0dfe395e3c
Allow setting build properties based on the features available for a target. The availability of features is determined at generate-time by evaluating the link implementation. Ensure that the <LANG>_STANDARD determined while evaluating COMPILE_FEATURES in the link implementation is not lower than that provided by the INTERFACE of the link implementation. This is similar to handling of transitive properties such as POSITION_INDEPENDENT_CODE.
18 lines
501 B
CMake
18 lines
501 B
CMake
|
|
set(genexvar $<COMPILE_FEATURES:cxx_final>)
|
|
|
|
if (HAVE_FINAL)
|
|
set(expected_result 1)
|
|
else()
|
|
set(expected_result 0)
|
|
endif()
|
|
|
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file${HAVE_FINAL}.cpp"
|
|
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file${genexvar}.cpp"
|
|
)
|
|
|
|
add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file${genexvar}.cpp")
|
|
if (HAVE_FINAL)
|
|
target_compile_features(empty PRIVATE cxx_final)
|
|
endif()
|