diff options
author | Marc Chevrier <marc.chevrier@sap.com> | 2017-12-15 11:31:53 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@sap.com> | 2018-01-23 09:24:56 (GMT) |
commit | 78b1c2e09ee5005d75e31c68c1c7b112e4b36d90 (patch) | |
tree | 3df5dc8f66711170a2cd8e0da75adeb7b79102b9 /Tests/GeneratorExpression/CMakeLists.txt | |
parent | 3f935e690a337a7a692c30d4d14082e08d1bed7c (diff) | |
download | CMake-78b1c2e09ee5005d75e31c68c1c7b112e4b36d90.zip CMake-78b1c2e09ee5005d75e31c68c1c7b112e4b36d90.tar.gz CMake-78b1c2e09ee5005d75e31c68c1c7b112e4b36d90.tar.bz2 |
sourceFile properties: add property COMPILE_OPTIONS
Add the support of per-source property COMPILE_OPTIONS,
including generator expressions support.
Related: #17507
Diffstat (limited to 'Tests/GeneratorExpression/CMakeLists.txt')
-rw-r--r-- | Tests/GeneratorExpression/CMakeLists.txt | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index 4586357..bc47be7 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -260,17 +260,33 @@ add_custom_target(check-part4 ALL #----------------------------------------------------------------------------- # Cover source file properties with generator expressions. -add_executable(srcgenex_flags srcgenex_flags.c) -set_property(SOURCE srcgenex_flags.c PROPERTY COMPILE_FLAGS "-DNAME=$<TARGET_PROPERTY:NAME>") - -add_executable(srcgenex_flags_COMPILE_LANGUAGE srcgenex_flags_COMPILE_LANGUAGE.c) -set_property(SOURCE srcgenex_flags_COMPILE_LANGUAGE.c PROPERTY COMPILE_FLAGS "$<$<COMPILE_LANGUAGE:C>:-DNAME=$<TARGET_PROPERTY:NAME>>") - -add_executable(srcgenex_defs srcgenex_defs.c) -set_property(SOURCE srcgenex_defs.c PROPERTY COMPILE_DEFINITIONS NAME=$<TARGET_PROPERTY:NAME>) - -add_executable(srcgenex_defs_COMPILE_LANGUAGE srcgenex_defs_COMPILE_LANGUAGE.c) -set_property(SOURCE srcgenex_defs_COMPILE_LANGUAGE.c PROPERTY COMPILE_DEFINITIONS $<$<COMPILE_LANGUAGE:C>:NAME=$<TARGET_PROPERTY:NAME>>) +## generate various source files +foreach (item IN ITEMS flags flags_COMPILE_LANGUAGE + options options_COMPILE_LANGUAGE + defs defs_COMPILE_LANGUAGE) + set(TARGET_NAME srcgenex_${item}) + configure_file(srcgenex.c.in ${TARGET_NAME}.c @ONLY) +endforeach() +add_executable(srcgenex_flags "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_flags.c") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_flags.c" + PROPERTY COMPILE_FLAGS "-DNAME=$<TARGET_PROPERTY:NAME>") +add_executable(srcgenex_flags_COMPILE_LANGUAGE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_flags_COMPILE_LANGUAGE.c") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_flags_COMPILE_LANGUAGE.c" + PROPERTY COMPILE_FLAGS "$<$<COMPILE_LANGUAGE:C>:-DNAME=$<TARGET_PROPERTY:NAME>>") + +add_executable(srcgenex_options "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_options.c") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_options.c" + PROPERTY COMPILE_OPTIONS -DUNUSED -DNAME=$<TARGET_PROPERTY:NAME>) +add_executable(srcgenex_options_COMPILE_LANGUAGE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_options_COMPILE_LANGUAGE.c") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_options_COMPILE_LANGUAGE.c" + PROPERTY COMPILE_OPTIONS $<$<COMPILE_LANGUAGE:C>:-DNAME=$<TARGET_PROPERTY:NAME>>) + +add_executable(srcgenex_defs "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_defs.c") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_defs.c" + PROPERTY COMPILE_DEFINITIONS NAME=$<TARGET_PROPERTY:NAME>) +add_executable(srcgenex_defs_COMPILE_LANGUAGE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_defs_COMPILE_LANGUAGE.c") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_defs_COMPILE_LANGUAGE.c" + PROPERTY COMPILE_DEFINITIONS $<$<COMPILE_LANGUAGE:C>:NAME=$<TARGET_PROPERTY:NAME>>) #----------------------------------------------------------------------------- # Cover test properties with generator expressions. |