summaryrefslogtreecommitdiff
path: root/Tests/GeneratorExpression
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/GeneratorExpression')
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt54
-rw-r--r--Tests/GeneratorExpression/check-common.cmake5
-rw-r--r--Tests/GeneratorExpression/check-part1.cmake (renamed from Tests/GeneratorExpression/check.cmake)32
-rw-r--r--Tests/GeneratorExpression/check-part2.cmake36
-rw-r--r--Tests/GeneratorExpression/empty.cpp2
5 files changed, 99 insertions, 30 deletions
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index bb3147674..0008c1656 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -1,7 +1,7 @@
cmake_minimum_required (VERSION 2.8.8)
-project(GeneratorExpression NONE)
+project(GeneratorExpression CXX)
-add_custom_target(check ALL
+add_custom_target(check-part1 ALL
COMMAND ${CMAKE_COMMAND}
-Dtest_0=$<0:nothing>
-Dtest_0_with_comma=$<0:-Wl,--no-undefined>
@@ -14,6 +14,9 @@ add_custom_target(check ALL
-Dtest_and_1=$<AND:1>
-Dtest_and_1_0=$<AND:1,0>
-Dtest_and_1_1=$<AND:1,1>
+ # Ordinarily, the 'invalidcontent' would cause an error, but
+ # the '0' makes the AND abort early.
+ -Dtest_and_0_invalidcontent=$<AND:0,invalidcontent>
-Dtest_config_0=$<CONFIG:$<CONFIGURATION>x>
-Dtest_config_1=$<CONFIG:$<CONFIGURATION>>
-Dtest_config_debug=$<CONFIG:Debug>$<CONFIG:DEBUG>$<CONFIG:DeBuG>
@@ -28,6 +31,7 @@ add_custom_target(check ALL
-Dtest_or_1=$<OR:1>
-Dtest_or_1_0=$<OR:1,0>
-Dtest_or_1_1=$<OR:1,1>
+ -Dtest_or_1_invalidcontent=$<OR:1,invalidcontent>
-Dtest_bool_notfound=$<BOOL:NOTFOUND>
-Dtest_bool_foo_notfound=$<BOOL:Foo-NOTFOUND>
-Dtest_bool_true=$<BOOL:True>
@@ -43,16 +47,46 @@ add_custom_target(check ALL
-Dtest_strequal_no_yes=$<STREQUAL:No,Yes>
-Dtest_strequal_angle_r=$<STREQUAL:$<ANGLE-R>,$<ANGLE-R>>
-Dtest_strequal_comma=$<STREQUAL:$<COMMA>,$<COMMA>>
+ -Dtest_strequal_semicolon=$<STREQUAL:$<SEMICOLON>,$<SEMICOLON>>
-Dtest_strequal_angle_r_comma=$<STREQUAL:$<ANGLE-R>,$<COMMA>>
-Dtest_strequal_both_empty=$<STREQUAL:,>
-Dtest_strequal_one_empty=$<STREQUAL:something,>
-Dtest_angle_r=$<ANGLE-R>
-Dtest_comma=$<COMMA>
+ -Dtest_semicolon=$<SEMICOLON>
-Dtest_colons_1=$<1::>
-Dtest_colons_2=$<1:::>
-Dtest_colons_3=$<1:Qt5::Core>
-Dtest_colons_4=$<1:C:\\CMake>
-Dtest_colons_5=$<1:C:/CMake>
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/check-part1.cmake
+ COMMAND ${CMAKE_COMMAND} -E echo "check done (part 1 of 2)"
+ VERBATIM
+ )
+
+add_library(empty1 empty.cpp)
+target_include_directories(empty1 PUBLIC /empty1/public)
+target_include_directories(empty1 PRIVATE /empty1/private)
+
+add_library(empty2 empty.cpp)
+target_include_directories(empty2 PUBLIC /empty2/public)
+
+add_library(empty3 empty.cpp)
+target_include_directories(empty3 PUBLIC /empty3/public)
+target_include_directories(empty3 PRIVATE /empty3/private)
+
+add_library(empty4 empty.cpp)
+target_include_directories(empty4 PUBLIC /empty4/public)
+
+target_link_libraries(empty1 LINK_PUBLIC empty2)
+target_link_libraries(empty2 LINK_PUBLIC empty3 empty4)
+target_link_libraries(empty3 LINK_PUBLIC empty2 empty4)
+
+add_library(empty5 empty.cpp)
+target_include_directories(empty5 PRIVATE /empty5/private1 /empty5/private2)
+
+add_custom_target(check-part2 ALL
+ COMMAND ${CMAKE_COMMAND}
-Dtest_incomplete_1=$<
-Dtest_incomplete_2=$<something
-Dtest_incomplete_3=$<something:
@@ -74,7 +108,19 @@ add_custom_target(check ALL
-Dtest_incomplete_19=$<1:some,thing$<ANGLE-R>
-Dtest_incomplete_20=$<CONFIGURATION$<ANGLE-R>
-Dtest_incomplete_21=$<BOOL:something$<ANGLE-R>
- -P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake
- COMMAND ${CMAKE_COMMAND} -E echo "check done"
+ -Dtest_build_interface=$<BUILD_INTERFACE:build>
+ -Dtest_install_interface=$<INSTALL_INTERFACE:install>
+ -Dtest_target_name_1=$<TARGET_NAME:tgt,ok>
+ -Dtest_target_name_2=$<TARGET_NAME:tgt:ok>
+ -Dtest_target_includes1=$<TARGET_PROPERTY:empty1,INTERFACE_INCLUDE_DIRECTORIES>
+ -Dtest_target_includes2=$<TARGET_PROPERTY:empty2,INTERFACE_INCLUDE_DIRECTORIES>
+ -Dtest_target_includes3=$<TARGET_PROPERTY:empty3,INTERFACE_INCLUDE_DIRECTORIES>
+ -Dtest_target_includes4=$<TARGET_PROPERTY:empty1,INCLUDE_DIRECTORIES>
+ -Dtest_target_includes5=$<TARGET_PROPERTY:empty2,INCLUDE_DIRECTORIES>
+ -Dtest_target_includes6=$<TARGET_PROPERTY:empty3,INCLUDE_DIRECTORIES>
+ -Dtest_target_includes7=$<TARGET_PROPERTY:empty1,INTERFACE_INCLUDE_DIRECTORIES>
+ -Dtest_target_includes8=$<TARGET_PROPERTY:empty5,INCLUDE_DIRECTORIES>
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/check-part2.cmake
+ COMMAND ${CMAKE_COMMAND} -E echo "check done (part 2 of 2)"
VERBATIM
)
diff --git a/Tests/GeneratorExpression/check-common.cmake b/Tests/GeneratorExpression/check-common.cmake
new file mode 100644
index 000000000..8ffebd740
--- /dev/null
+++ b/Tests/GeneratorExpression/check-common.cmake
@@ -0,0 +1,5 @@
+macro(check var val)
+ if(NOT "${${var}}" STREQUAL "${val}")
+ message(SEND_ERROR "${var} is \"${${var}}\", not \"${val}\"")
+ endif()
+endmacro()
diff --git a/Tests/GeneratorExpression/check.cmake b/Tests/GeneratorExpression/check-part1.cmake
index 8745d57b6..9bef15904 100644
--- a/Tests/GeneratorExpression/check.cmake
+++ b/Tests/GeneratorExpression/check-part1.cmake
@@ -1,8 +1,5 @@
-macro(check var val)
- if(NOT "${${var}}" STREQUAL "${val}")
- message(SEND_ERROR "${var} is \"${${var}}\", not \"${val}\"")
- endif()
-endmacro()
+
+include(${CMAKE_CURRENT_LIST_DIR}/check-common.cmake)
message(STATUS "config=[${config}]")
check(test_0 "")
@@ -15,6 +12,7 @@ check(test_and_0_1 "0")
check(test_and_1 "1")
check(test_and_1_0 "0")
check(test_and_1_1 "1")
+check(test_and_0_invalidcontent "0")
check(test_config_0 "0")
check(test_config_1 "1")
foreach(c debug release relwithdebinfo minsizerel)
@@ -30,6 +28,7 @@ check(test_or_0_1 "1")
check(test_or_1 "1")
check(test_or_1_0 "1")
check(test_or_1_1 "1")
+check(test_or_1_invalidcontent "1")
check(test_bool_notfound "0")
check(test_bool_foo_notfound "0")
check(test_bool_true "1")
@@ -45,34 +44,15 @@ check(test_strequal_yes_no "0")
check(test_strequal_no_yes "0")
check(test_strequal_angle_r "1")
check(test_strequal_comma "1")
+check(test_strequal_semicolon "1")
check(test_strequal_angle_r_comma "0")
check(test_strequal_both_empty "1")
check(test_strequal_one_empty "0")
check(test_angle_r ">")
check(test_comma ",")
+check(test_semicolon ";")
check(test_colons_1 ":")
check(test_colons_2 "::")
check(test_colons_3 "Qt5::Core")
check(test_colons_4 "C:\\\\CMake")
check(test_colons_5 "C:/CMake")
-check(test_incomplete_1 "$<")
-check(test_incomplete_2 "$<something")
-check(test_incomplete_3 "$<something:")
-check(test_incomplete_4 "$<something:,")
-check(test_incomplete_5 "$something:,>")
-check(test_incomplete_6 "<something:,>")
-check(test_incomplete_7 "$<something::")
-check(test_incomplete_8 "$<something:,")
-check(test_incomplete_9 "$<something:,,")
-check(test_incomplete_10 "$<something:,:")
-check(test_incomplete_11 "$<something,,")
-check(test_incomplete_12 "$<,,")
-check(test_incomplete_13 "$<somespecialthing")
-check(test_incomplete_14 "$<>")
-check(test_incomplete_15 "$<some$<thing")
-check(test_incomplete_16 "$<BOOL:something")
-check(test_incomplete_17 "some$thing")
-check(test_incomplete_18 "$<1:some,thing")
-check(test_incomplete_19 "$<1:some,thing>")
-check(test_incomplete_20 "$<CONFIGURATION>")
-check(test_incomplete_21 "$<BOOL:something>")
diff --git a/Tests/GeneratorExpression/check-part2.cmake b/Tests/GeneratorExpression/check-part2.cmake
new file mode 100644
index 000000000..3f7187ca2
--- /dev/null
+++ b/Tests/GeneratorExpression/check-part2.cmake
@@ -0,0 +1,36 @@
+
+include(${CMAKE_CURRENT_LIST_DIR}/check-common.cmake)
+
+check(test_incomplete_1 "$<")
+check(test_incomplete_2 "$<something")
+check(test_incomplete_3 "$<something:")
+check(test_incomplete_4 "$<something:,")
+check(test_incomplete_5 "$something:,>")
+check(test_incomplete_6 "<something:,>")
+check(test_incomplete_7 "$<something::")
+check(test_incomplete_8 "$<something:,")
+check(test_incomplete_9 "$<something:,,")
+check(test_incomplete_10 "$<something:,:")
+check(test_incomplete_11 "$<something,,")
+check(test_incomplete_12 "$<,,")
+check(test_incomplete_13 "$<somespecialthing")
+check(test_incomplete_14 "$<>")
+check(test_incomplete_15 "$<some$<thing")
+check(test_incomplete_16 "$<BOOL:something")
+check(test_incomplete_17 "some$thing")
+check(test_incomplete_18 "$<1:some,thing")
+check(test_incomplete_19 "$<1:some,thing>")
+check(test_incomplete_20 "$<CONFIGURATION>")
+check(test_incomplete_21 "$<BOOL:something>")
+check(test_build_interface "build")
+check(test_install_interface "")
+check(test_target_name_1 "tgt,ok")
+check(test_target_name_2 "tgt:ok")
+check(test_target_includes1 "/empty1/public;/empty2/public;/empty3/public;/empty4/public")
+check(test_target_includes2 "/empty2/public;/empty3/public;/empty4/public")
+check(test_target_includes3 "/empty3/public;/empty2/public;/empty4/public")
+check(test_target_includes4 "/empty1/public;/empty1/private;/empty2/public;/empty3/public;/empty4/public")
+check(test_target_includes5 "/empty2/public;/empty3/public;/empty2/public;/empty4/public")
+check(test_target_includes6 "/empty3/public;/empty3/private;/empty2/public;/empty3/public;/empty4/public")
+check(test_target_includes7 "/empty1/public;/empty2/public;/empty3/public;/empty4/public")
+check(test_target_includes8 "/empty5/private1;/empty5/private2")
diff --git a/Tests/GeneratorExpression/empty.cpp b/Tests/GeneratorExpression/empty.cpp
new file mode 100644
index 000000000..c5399014f
--- /dev/null
+++ b/Tests/GeneratorExpression/empty.cpp
@@ -0,0 +1,2 @@
+
+// empty