Modernise FindReadline.cmake, and fix on Solaris#813
Conversation
7301200 to
5c1df9f
Compare
5c1df9f to
bc57c70
Compare
|
This change, the commit 0ee6302, breaks the build on Ubuntu 20 with ninja 1.10.0 and cmake 4.2.3. This is because the global compile definitions has such entries below: |
@sergio-nsk: assuming you meant Ubuntu 20.04, I hadn't been able to reproduce your problem: judging by the error message, I would expect the bug (if any) to be in |
|
@carenas Please try this CMakeLists.txt in the parent directory: cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
project(issue-813)
add_compile_definitions($<$<CONFIG:Debug>:DEBUG>)
add_subdirectory(pcre2)Run it on Ubuntu 20: |
|
Very odd. I can reproduce with that testcase. However, I don't understand it. The mkostemp check is failing with that very unexpected message. Somehow, the act of pushing and popping the feature check state is causing the compile definition to be set as a literal rather than a generator expression? I don't understand, I'll need to trace the CMake to see what's happening. I do apologise for this regression. If you have any suggestions on how to fix it, I'd be grateful. |
|
Oh oh! I'm a dummy, I see what I've done. There's a line where I propagate compile definitions... which is fine, except that I hadn't realised a) that it propagates customer definitions from the parent; and b) that you can't propagate generator expressions. So, it was much more brittle than I realised. I have put out a PR with the fix: #883 |
I don't have a fix, I have a work around in the parent cmake file: get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(is_multi_config)
add_compile_definitions($<$<CONFIG:Debug>:DEBUG>)
elseif(CMAKE_BUILD_TYPE STREQUAL Debug)
add_compile_definitions(DEBUG)
endif()
I believe it may depend on the cmake version or its scripts. There is no such issue on Ubuntu 22 or newer. For some reasons, generator expressions are not expanded if the generator is not multi-configuration. |
The CMake build fails on Solaris out of the box, because our Autoconf has clever logic to add
-ltermcapas required by libreadline, but the CMake scripts just don't. And worse, CMake defaults to search for and link to all the third-party libraries, whereas Autoconf is set to not link them unless requested.