summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/GeneratorExpression
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-05-17 13:26:38 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-05-17 13:27:12 (GMT)
commitacc2f022bb538cbd61621f66d64d13b751d23f39 (patch)
tree5cc39f9ca4de99f0efacb822af647074eb3911f4 /Tests/RunCMake/GeneratorExpression
parent3020354f7c86f959d707aed2b833692204dd7778 (diff)
parente214abdaab4f8097095a601067b4071194ad01a5 (diff)
downloadCMake-acc2f022bb538cbd61621f66d64d13b751d23f39.zip
CMake-acc2f022bb538cbd61621f66d64d13b751d23f39.tar.gz
CMake-acc2f022bb538cbd61621f66d64d13b751d23f39.tar.bz2
Merge topic 'offer_compiler_lang_generator_expression'
e214abdaab Genex: Add COMPILE_LANG_AND_ID generator expression f84ed796a2 Docs: Generator-expressions remove usage of `CMake-id` Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3300
Diffstat (limited to 'Tests/RunCMake/GeneratorExpression')
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-stderr.txt9
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command.cmake4
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target-stderr.txt11
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target.cmake4
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable-stderr.txt11
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable.cmake5
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library-stderr.txt11
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library.cmake2
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test-stderr.txt11
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test.cmake5
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install-stderr.txt9
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install.cmake5
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-stderr.txt9
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources.cmake2
-rw-r--r--Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-unknown-lang.cmake4
-rw-r--r--Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake8
23 files changed, 117 insertions, 0 deletions
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-result.txt
@@ -0,0 +1 @@
+1
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
new file mode 100644
index 0000000..fc3c3de
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-stderr.txt
@@ -0,0 +1,9 @@
+CMake Error at COMPILE_LANG_AND_ID-add_custom_command.cmake:2 \(add_custom_command\):
+ Error evaluating generator expression:
+
+ \$<COMPILE_LANG_AND_ID>
+
+ \$<COMPILE_LANG_AND_ID> expression requires 2 comma separated parameters,
+ but got 0 instead.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command.cmake
new file mode 100644
index 0000000..9bd5e8e
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command.cmake
@@ -0,0 +1,4 @@
+add_custom_target(drive)
+add_custom_command(TARGET drive PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E echo $<COMPILE_LANG_AND_ID>
+)
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target-stderr.txt
new file mode 100644
index 0000000..589e64b
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target-stderr.txt
@@ -0,0 +1,11 @@
+CMake Error at COMPILE_LANG_AND_ID-add_custom_target.cmake:2 \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<COMPILE_LANG_AND_ID:LANG,ID>
+
+ \$<COMPILE_LANG_AND_ID:lang,id> may only be used with binary targets to
+ specify include directories, compile definitions, and compile options. It
+ may not be used with the add_custom_command, add_custom_target, or
+ file\(GENERATE\) commands.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target.cmake
new file mode 100644
index 0000000..398db19
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target.cmake
@@ -0,0 +1,4 @@
+
+add_custom_target(drive
+ COMMAND ${CMAKE_COMMAND} -E echo $<COMPILE_LANG_AND_ID:LANG,ID>
+)
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable-stderr.txt
new file mode 100644
index 0000000..3b3f38d
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable-stderr.txt
@@ -0,0 +1,11 @@
+CMake Error at COMPILE_LANG_AND_ID-add_executable.cmake:1 \(add_executable\):
+ Error evaluating generator expression:
+
+ \$<COMPILE_LANG_AND_ID:C,MSVC>
+
+ \$<COMPILE_LANG_AND_ID:lang,id> may only be used with binary targets to
+ specify include directories, compile definitions, and compile options. It
+ may not be used with the add_custom_command, add_custom_target, or
+ file\(GENERATE\) commands.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable.cmake
new file mode 100644
index 0000000..2245f50
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable.cmake
@@ -0,0 +1,5 @@
+add_executable(empty main.c
+ $<$<COMPILE_LANG_AND_ID:C,MSVC>:empty.c>
+ $<$<COMPILE_LANG_AND_ID:C,GNU>:empty2.c>
+ $<$<COMPILE_LANG_AND_ID:C,Clang>:empty3.c>
+ )
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library-stderr.txt
new file mode 100644
index 0000000..4cbf000
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library-stderr.txt
@@ -0,0 +1,11 @@
+CMake Error at COMPILE_LANG_AND_ID-add_library.cmake:2 \(add_library\):
+ Error evaluating generator expression:
+
+ \$<COMPILE_LANG_AND_ID:C,MSVC>
+
+ \$<COMPILE_LANG_AND_ID:lang,id> may only be used with binary targets to
+ specify include directories, compile definitions, and compile options. It
+ may not be used with the add_custom_command, add_custom_target, or
+ file\(GENERATE\) commands.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library.cmake
new file mode 100644
index 0000000..044962a
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library.cmake
@@ -0,0 +1,2 @@
+
+add_library(empty empty.$<COMPILE_LANG_AND_ID:C,MSVC>)
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test-stderr.txt
new file mode 100644
index 0000000..26a5940
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test-stderr.txt
@@ -0,0 +1,11 @@
+CMake Error at COMPILE_LANG_AND_ID-add_test.cmake:5 \(add_test\):
+ Error evaluating generator expression:
+
+ \$<COMPILE_LANG_AND_ID:CXX,GNU>
+
+ \$<COMPILE_LANG_AND_ID:lang,id> may only be used with binary targets to
+ specify include directories, compile definitions, and compile options. It
+ may not be used with the add_custom_command, add_custom_target, or
+ file\(GENERATE\) commands.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test.cmake
new file mode 100644
index 0000000..b5b6c2b
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test.cmake
@@ -0,0 +1,5 @@
+
+include(CTest)
+enable_testing()
+
+add_test(NAME dummy COMMAND ${CMAKE_COMMAND} -E echo $<COMPILE_LANG_AND_ID:CXX,GNU>)
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install-stderr.txt
new file mode 100644
index 0000000..0c4ecd0
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install-stderr.txt
@@ -0,0 +1,9 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<COMPILE_LANG_AND_ID:C,MSVC>
+
+ \$<COMPILE_LANG_AND_ID:lang,id> may only be used with binary targets to
+ specify include directories, compile definitions, and compile options. It
+ may not be used with the add_custom_command, add_custom_target, or
+ file\(GENERATE\) commands.
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install.cmake
new file mode 100644
index 0000000..c13eda6
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install.cmake
@@ -0,0 +1,5 @@
+
+install(FILES
+ empty.$<COMPILE_LANG_AND_ID:C,MSVC>
+ DESTINATION src
+)
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-result.txt
@@ -0,0 +1 @@
+1
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
new file mode 100644
index 0000000..44d8684
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-stderr.txt
@@ -0,0 +1,9 @@
+CMake Error at COMPILE_LANG_AND_ID-target_sources.cmake:2 \(target_sources\):
+ Error evaluating generator expression:
+
+ \$<COMPILE_LANG_AND_ID>
+
+ \$<COMPILE_LANG_AND_ID> expression requires 2 comma separated parameters,
+ but got 0 instead.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources.cmake
new file mode 100644
index 0000000..a2c9b03
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources.cmake
@@ -0,0 +1,2 @@
+add_library(empty)
+target_sources(empty PRIVATE empty.$<COMPILE_LANG_AND_ID>)
diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-unknown-lang.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-unknown-lang.cmake
new file mode 100644
index 0000000..b9e840b
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-unknown-lang.cmake
@@ -0,0 +1,4 @@
+
+enable_language(C)
+add_executable(empty empty.c)
+target_compile_options(empty PRIVATE $<$<COMPILE_LANG_AND_ID:CXX,GNU>:$<TARGET_EXISTS:too,many,parameters>>)
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index a491e99..8abf70d 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -31,6 +31,14 @@ run_cmake(COMPILE_LANGUAGE-add_executable)
run_cmake(COMPILE_LANGUAGE-add_library)
run_cmake(COMPILE_LANGUAGE-add_test)
run_cmake(COMPILE_LANGUAGE-unknown-lang)
+run_cmake(COMPILE_LANG_AND_ID-add_custom_target)
+run_cmake(COMPILE_LANG_AND_ID-add_custom_command)
+run_cmake(COMPILE_LANG_AND_ID-install)
+run_cmake(COMPILE_LANG_AND_ID-target_sources)
+run_cmake(COMPILE_LANG_AND_ID-add_executable)
+run_cmake(COMPILE_LANG_AND_ID-add_library)
+run_cmake(COMPILE_LANG_AND_ID-add_test)
+run_cmake(COMPILE_LANG_AND_ID-unknown-lang)
run_cmake(TARGET_FILE-recursion)
run_cmake(OUTPUT_NAME-recursion)
run_cmake(TARGET_FILE_PREFIX)