diff options
author | Marc Chevrier <marc.chevrier@sap.com> | 2017-12-21 16:03:18 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@sap.com> | 2018-01-24 14:10:10 (GMT) |
commit | 044831117955dfa33ed4e0c7799ea3f37258b149 (patch) | |
tree | a443e5f1695bc9290ac7a8c27e4d0df019146a8d /Tests/GeneratorExpression | |
parent | 3073bd1f3deecaaf090202075382e372a3b3656a (diff) | |
download | CMake-044831117955dfa33ed4e0c7799ea3f37258b149.zip CMake-044831117955dfa33ed4e0c7799ea3f37258b149.tar.gz CMake-044831117955dfa33ed4e0c7799ea3f37258b149.tar.bz2 |
sourceFile properties: add property INCLUDE_DIRECTORIES
Diffstat (limited to 'Tests/GeneratorExpression')
-rw-r--r-- | Tests/GeneratorExpression/CMakeLists.txt | 20 | ||||
-rw-r--r-- | Tests/GeneratorExpression/srcgenex_includes.c.in | 12 | ||||
-rw-r--r-- | Tests/GeneratorExpression/srcgenex_includes.h.in | 7 |
3 files changed, 37 insertions, 2 deletions
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index bc47be7..19d12e5 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -283,10 +283,26 @@ set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_options_COMPILE_LANGUA 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>) + PROPERTY COMPILE_DEFINITIONS UNUSED 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>>) + PROPERTY COMPILE_DEFINITIONS $<$<COMPILE_LANGUAGE:C>:NAME=$<TARGET_PROPERTY:NAME>>) + +foreach (item IN ITEMS basic COMPILE_LANGUAGE) + set(TARGET_NAME srcgenex_includes_${item}) + configure_file(srcgenex_includes.h.in "sf_includes_${item}/${TARGET_NAME}.h" @ONLY) + configure_file(srcgenex_includes.c.in ${TARGET_NAME}.c @ONLY) +endforeach() +add_executable(srcgenex_includes_basic "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_includes_basic.c") +# first include directory is useless but ensure list aspect is tested +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_includes_basic.c" + PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/sf_includes_basic") +if (CMAKE_GENERATOR MATCHES "Makefiles|Ninja|Watcom WMake") + add_executable(srcgenex_includes_COMPILE_LANGUAGE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_includes_COMPILE_LANGUAGE.c") + # first include directory is useless but ensure list aspect is tested + set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_includes_COMPILE_LANGUAGE.c" + PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}" $<$<COMPILE_LANGUAGE:C>:${CMAKE_CURRENT_BINARY_DIR}/sf_includes_COMPILE_LANGUAGE>) +endif() #----------------------------------------------------------------------------- # Cover test properties with generator expressions. diff --git a/Tests/GeneratorExpression/srcgenex_includes.c.in b/Tests/GeneratorExpression/srcgenex_includes.c.in new file mode 100644 index 0000000..b48d7df --- /dev/null +++ b/Tests/GeneratorExpression/srcgenex_includes.c.in @@ -0,0 +1,12 @@ + +#include "@TARGET_NAME@.h" + +int @TARGET_NAME@(void) +{ + return 0; +} + +int main(int argc, char* argv[]) +{ + return @TARGET_NAME@(); +} diff --git a/Tests/GeneratorExpression/srcgenex_includes.h.in b/Tests/GeneratorExpression/srcgenex_includes.h.in new file mode 100644 index 0000000..2259ca6 --- /dev/null +++ b/Tests/GeneratorExpression/srcgenex_includes.h.in @@ -0,0 +1,7 @@ + +#if !defined @TARGET_NAME@_H +#define @TARGET_NAME@_H + +int @TARGET_NAME@(void); + +#endif |