An install(CODE that calls execute_process to run a cmake file that in turn does a execute_process does not happen on windows with 3.29.0. It works with windows 3.28.4, and on mac (and ubunut) for 3.29.0 as well.
install(
CODE "execute_process(
COMMAND ${CMAKE_COMMAND}
-DFILE_TO_COPY_PATH=${FILE_TO_COPY_PATH}
-DEXECUTABLE_PATH=\${CMAKE_INSTALL_PREFIX}/energyplus${CMAKE_EXECUTABLE_SUFFIX}
-P ${PROJECT_SOURCE_DIR}/cmake/PythonGetLibAndLinkUp.cmake
)")
You can find a MCVE at https://github.com/jmarrec/debug-python-gha/tree/mcve_issue
On mac with 3.29, you see the messages being printed: https://github.com/jmarrec/debug-python-gha/actions/runs/8473162581/job/23216873513#step:5:15
On Windows, with 3.28 same: https://github.com/jmarrec/debug-python-gha/actions/runs/8473162579/job/23216873874#step:7:17
But on Windows with 3.29.0, you do not: https://github.com/jmarrec/debug-python-gha/actions/runs/8473162579/job/23216873620#step:7:16
I think it would be great to have an equivalent to CheckCXXXCompilerFlag in a generator expression.
Example:
-W-enum-constexpr-conversion
is supported on clang 16+. AppleClang version numbering does not follow the upstream LLVM clang version. In order to properly silence the warning without adding another warning for unknown warning option
, we need to add this only for versions that support this flag.
cmake_policy(PUSH)
cmake_policy(SET CMP0025 NEW) # This is needed to have <CXX_COMPILER_ID> differentiate between Clang and AppleClang
set(clang_16_or_greater "$<AND:$<CXX_COMPILER_ID:Clang>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,16>>")
set(apple_clang_15_or_greater "$<AND:$<CXX_COMPILER_ID:AppleClang>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,15>>")
set(has_enum_constexpr_option "$<OR:${clang_16_or_greater},${apple_clang_15_or_greater}>")
target_compile_options(MyLib INTERFACE
$<${has_enum_constexpr_option}:-Wno-enum-constexpr-conversion>
cmake_policy(POP)
Alternatively,
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-Wenum-constexpr-conversion has_enum_constexpr_option)
target_compile_options(MyLib INTERFACE
$<${has_enum_constexpr_option}:-Wno-enum-constexpr-conversion>
Ideally one could do something like this directly:
target_compile_options(MyLib INTERFACE $<CXX_COMPILER_FLAG_SUPPORTED:-Wno-enum-constexpr-conversion>)