summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-06-04 12:32:11 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-06-04 12:32:19 (GMT)
commit4b68baa776bf8ccc2911057fc79b558515438900 (patch)
treef82f327d1e6e06e2e3cc7241aef4d783cb7b5299 /Tests
parentd4108f5585ae4e0ab79c9b192f9d6a0614f868cd (diff)
parent162555d7ecd510a84fb26a2ebc90f0a3e9eabc1a (diff)
downloadCMake-4b68baa776bf8ccc2911057fc79b558515438900.zip
CMake-4b68baa776bf8ccc2911057fc79b558515438900.tar.gz
CMake-4b68baa776bf8ccc2911057fc79b558515438900.tar.bz2
Merge topic 'compiler_id_gen_exp_supports_multiple_ids'
162555d7ec Help: Add release notes for updated generator expressions 808b818063 Genex: CompileLang and CompileLangAndId now match against a list of ids 9fd602bfd3 Genex: PlatformId now can match against a list of ids. ec66af2026 Genex: CompilerId now can match against a list of ids. 2d4787fc4d Genex: Add more extensive support for an unbounded number of parameters Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3405
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt1
-rw-r--r--Tests/CMakeCommands/target_compile_definitions/consumer.c4
-rw-r--r--Tests/CMakeCommands/target_compile_options/CMakeLists.txt16
-rw-r--r--Tests/CMakeCommands/target_compile_options/consumer.cpp24
-rw-r--r--Tests/CMakeCommands/target_compile_options/main.cpp20
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt1
-rw-r--r--Tests/GeneratorExpression/check-part3.cmake5
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-stderr.txt3
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-stderr.txt3
-rw-r--r--Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt2
10 files changed, 72 insertions, 7 deletions
diff --git a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt
index 7dc7995..a5bc1e1 100644
--- a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt
@@ -34,6 +34,7 @@ target_compile_definitions(consumer
CONSUMER_LANG_$<COMPILE_LANGUAGE>
LANG_IS_CXX=$<COMPILE_LANGUAGE:CXX>
LANG_IS_C=$<COMPILE_LANGUAGE:C>
+ LANG_IS_C_OR_CXX=$<COMPILE_LANGUAGE:C,CXX>
)
if(CMAKE_GENERATOR MATCHES "Visual Studio|Xcode")
target_compile_definitions(consumer
diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.c b/Tests/CMakeCommands/target_compile_definitions/consumer.c
index bacd4c4..bb65e01 100644
--- a/Tests/CMakeCommands/target_compile_definitions/consumer.c
+++ b/Tests/CMakeCommands/target_compile_definitions/consumer.c
@@ -35,6 +35,10 @@
# endif
#endif
+#if !LANG_IS_C_OR_CXX
+# error Expected LANG_IS_C_OR_CXX
+#endif
+
void consumer_c()
{
}
diff --git a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt
index a24cd53..a7055b1 100644
--- a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt
@@ -7,9 +7,11 @@ add_executable(target_compile_options
"${CMAKE_CURRENT_SOURCE_DIR}/main.cpp"
)
target_compile_options(target_compile_options
- PRIVATE $<$<CXX_COMPILER_ID:GNU>:-DMY_PRIVATE_DEFINE>
+ PRIVATE $<$<CXX_COMPILER_ID:AppleClang,Clang,GNU>:-DMY_PRIVATE_DEFINE>
PUBLIC $<$<COMPILE_LANG_AND_ID:CXX,GNU>:-DMY_PUBLIC_DEFINE>
+ PUBLIC $<$<COMPILE_LANG_AND_ID:CXX,GNU,Clang,AppleClang>:-DMY_MUTLI_COMP_PUBLIC_DEFINE>
INTERFACE $<$<CXX_COMPILER_ID:GNU>:-DMY_INTERFACE_DEFINE>
+ INTERFACE $<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-DMY_MULTI_COMP_INTERFACE_DEFINE>
)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
@@ -17,6 +19,11 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
PRIVATE
"DO_GNU_TESTS"
)
+elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ target_compile_definitions(target_compile_options
+ PRIVATE
+ "DO_CLANG_TESTS"
+ )
endif()
add_executable(consumer
@@ -40,7 +47,7 @@ if(CMAKE_GENERATOR MATCHES "Visual Studio")
endif()
target_compile_options(consumer
- PRIVATE $<$<CXX_COMPILER_ID:GNU>:$<TARGET_PROPERTY:target_compile_options,INTERFACE_COMPILE_OPTIONS>>
+ PRIVATE $<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:$<TARGET_PROPERTY:target_compile_options,INTERFACE_COMPILE_OPTIONS>>
)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
@@ -48,6 +55,11 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
PRIVATE
"DO_GNU_TESTS"
)
+elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ target_compile_definitions(consumer
+ PRIVATE
+ "DO_CLANG_TESTS"
+ )
endif()
# Test no items
diff --git a/Tests/CMakeCommands/target_compile_options/consumer.cpp b/Tests/CMakeCommands/target_compile_options/consumer.cpp
index fe79eb5..78928b4 100644
--- a/Tests/CMakeCommands/target_compile_options/consumer.cpp
+++ b/Tests/CMakeCommands/target_compile_options/consumer.cpp
@@ -13,6 +13,30 @@
# error Expected MY_INTERFACE_DEFINE
# endif
+# ifndef MY_MULTI_COMP_INTERFACE_DEFINE
+# error Expected MY_MULTI_COMP_INTERFACE_DEFINE
+# endif
+
+# ifndef MY_MUTLI_COMP_PUBLIC_DEFINE
+# error Expected MY_MUTLI_COMP_PUBLIC_DEFINE
+# endif
+
+#endif
+
+#ifdef DO_CLANG_TESTS
+
+# ifdef MY_PRIVATE_DEFINE
+# error Unexpected MY_PRIVATE_DEFINE
+# endif
+
+# ifndef MY_MULTI_COMP_INTERFACE_DEFINE
+# error Expected MY_MULTI_COMP_INTERFACE_DEFINE
+# endif
+
+# ifndef MY_MUTLI_COMP_PUBLIC_DEFINE
+# error Expected MY_MUTLI_COMP_PUBLIC_DEFINE
+# endif
+
#endif
#ifndef CONSUMER_LANG_CXX
diff --git a/Tests/CMakeCommands/target_compile_options/main.cpp b/Tests/CMakeCommands/target_compile_options/main.cpp
index 829a25e..7608400 100644
--- a/Tests/CMakeCommands/target_compile_options/main.cpp
+++ b/Tests/CMakeCommands/target_compile_options/main.cpp
@@ -9,12 +9,32 @@
# error Expected MY_PUBLIC_DEFINE
# endif
+# ifndef MY_MUTLI_COMP_PUBLIC_DEFINE
+# error Expected MY_MUTLI_COMP_PUBLIC_DEFINE
+# endif
+
# ifdef MY_INTERFACE_DEFINE
# error Unexpected MY_INTERFACE_DEFINE
# endif
#endif
+#ifdef DO_CLANG_TESTS
+
+# ifndef MY_PRIVATE_DEFINE
+# error Expected MY_PRIVATE_DEFINE
+# endif
+
+# ifdef MY_PUBLIC_DEFINE
+# error Unexpected MY_PUBLIC_DEFINE
+# endif
+
+# ifndef MY_MUTLI_COMP_PUBLIC_DEFINE
+# error Expected MY_MUTLI_COMP_PUBLIC_DEFINE
+# endif
+
+#endif
+
int main()
{
return 0;
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index 5ba0dc0..3ff2b85 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -220,6 +220,7 @@ add_custom_target(check-part3 ALL
-Dtest_early_termination_2=$<$<1:>:,
-Dsystem_name=${CMAKE_HOST_SYSTEM_NAME}
-Dtest_platform_id=$<PLATFORM_ID>
+ -Dtest_platform_id_supported=$<PLATFORM_ID:Linux,Windows,Darwin>
-Dtest_platform_id_Linux=$<PLATFORM_ID:Linux>
-Dtest_platform_id_Windows=$<PLATFORM_ID:Windows>
-Dtest_platform_id_Darwin=$<PLATFORM_ID:Darwin>
diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake
index 9014406..4fb7308 100644
--- a/Tests/GeneratorExpression/check-part3.cmake
+++ b/Tests/GeneratorExpression/check-part3.cmake
@@ -28,11 +28,16 @@ check(test_early_termination_2 "$<:,")
check(test_platform_id "${system_name}")
foreach(system Linux Windows Darwin)
if(system_name STREQUAL system)
+ check(test_platform_id_supported 1)
check(test_platform_id_${system} 1)
+ set(platform_supported 1)
else()
check(test_platform_id_${system} 0)
endif()
endforeach()
+if(NOT platform_supported)
+ check(test_platform_id_supported 0)
+endif()
check(lower_case "mi,xed")
check(upper_case "MIX,ED")
check(make_c_identifier "_4f_oo__bar__")
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-stderr.txt
index fc3c3de..2ee96ed 100644
--- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-stderr.txt
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-stderr.txt
@@ -3,7 +3,6 @@ CMake Error at COMPILE_LANG_AND_ID-add_custom_command.cmake:2 \(add_custom_comma
\$<COMPILE_LANG_AND_ID>
- \$<COMPILE_LANG_AND_ID> expression requires 2 comma separated parameters,
- but got 0 instead.
+ \$<COMPILE_LANG_AND_ID> expression requires at least two parameters.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-stderr.txt
index 44d8684..3ecbdc3 100644
--- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-stderr.txt
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-stderr.txt
@@ -3,7 +3,6 @@ CMake Error at COMPILE_LANG_AND_ID-target_sources.cmake:2 \(target_sources\):
\$<COMPILE_LANG_AND_ID>
- \$<COMPILE_LANG_AND_ID> expression requires 2 comma separated parameters,
- but got 0 instead.
+ \$<COMPILE_LANG_AND_ID> expression requires at least two parameters.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt b/Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt
index 16bcb36..66ff016 100644
--- a/Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt
+++ b/Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt
@@ -2,4 +2,4 @@
add_library(foo STATIC foo.cpp)
string(TOLOWER ${CMAKE_CXX_COMPILER_ID} compiler_id)
-target_compile_definitions(foo PRIVATE Foo=$<CXX_COMPILER_ID:${compiler_id}>)
+target_compile_definitions(foo PRIVATE Foo=$<CXX_COMPILER_ID:invalid,${compiler_id}>)