diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2019-05-30 14:00:19 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-06-03 14:20:23 (GMT) |
commit | 808b8180632aef06e7a3644fb4d3957722abc3f3 (patch) | |
tree | 5379256750380540b9a09e62d5e6ae0070b9787b /Tests | |
parent | 9fd602bfd33479b1acecd40e5c1b76ce37d59798 (diff) | |
download | CMake-808b8180632aef06e7a3644fb4d3957722abc3f3.zip CMake-808b8180632aef06e7a3644fb4d3957722abc3f3.tar.gz CMake-808b8180632aef06e7a3644fb4d3957722abc3f3.tar.bz2 |
Genex: CompileLang and CompileLangAndId now match against a list of ids
This allows for expressions such as:
$<COMPILE_LANG_AND_ID, CXX, GNU, Clang>
Diffstat (limited to 'Tests')
7 files changed, 24 insertions, 4 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 ee187f5..a7055b1 100644 --- a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt @@ -9,6 +9,7 @@ add_executable(target_compile_options target_compile_options(target_compile_options 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> ) diff --git a/Tests/CMakeCommands/target_compile_options/consumer.cpp b/Tests/CMakeCommands/target_compile_options/consumer.cpp index 5cbe049..78928b4 100644 --- a/Tests/CMakeCommands/target_compile_options/consumer.cpp +++ b/Tests/CMakeCommands/target_compile_options/consumer.cpp @@ -17,6 +17,10 @@ # 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 @@ -29,6 +33,10 @@ # 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 edefdf2..7608400 100644 --- a/Tests/CMakeCommands/target_compile_options/main.cpp +++ b/Tests/CMakeCommands/target_compile_options/main.cpp @@ -9,6 +9,10 @@ # 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 @@ -25,6 +29,10 @@ # error Unexpected MY_PUBLIC_DEFINE # endif +# ifndef MY_MUTLI_COMP_PUBLIC_DEFINE +# error Expected MY_MUTLI_COMP_PUBLIC_DEFINE +# endif + #endif int main() 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\) |