summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2018-10-26 13:11:42 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2018-10-26 16:08:05 (GMT)
commit4201a11c2b5a5bdb442f99f88a5f17d6ae7c4a4c (patch)
treeecf5018aede6ad380f97b640300d607ce9878b29 /Tests
parent9e78be8065f6c9c9f363b3e495017715abf9303b (diff)
downloadCMake-4201a11c2b5a5bdb442f99f88a5f17d6ae7c4a4c.zip
CMake-4201a11c2b5a5bdb442f99f88a5f17d6ae7c4a4c.tar.gz
CMake-4201a11c2b5a5bdb442f99f88a5f17d6ae7c4a4c.tar.bz2
Tests: add tests for empty-value keyword arguments in target_*
Not all of these commands accept non-compilable (i.e., IMPORTED) targets, so those calls are currently just commented out. If they ever do start to accept them, the tests should be enabled.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/target_compile_definitions/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/target_compile_definitions/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/target_compile_definitions/empty_keyword_args-result.txt1
-rw-r--r--Tests/RunCMake/target_compile_definitions/empty_keyword_args-stderr.txt5
-rw-r--r--Tests/RunCMake/target_compile_definitions/empty_keyword_args.cmake5
-rw-r--r--Tests/RunCMake/target_compile_features/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/target_compile_features/empty_keyword_args-result.txt1
-rw-r--r--Tests/RunCMake/target_compile_features/empty_keyword_args-stderr.txt5
-rw-r--r--Tests/RunCMake/target_compile_features/empty_keyword_args.cmake5
-rw-r--r--Tests/RunCMake/target_compile_options/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/target_compile_options/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/target_compile_options/empty_keyword_args-result.txt1
-rw-r--r--Tests/RunCMake/target_compile_options/empty_keyword_args-stderr.txt5
-rw-r--r--Tests/RunCMake/target_compile_options/empty_keyword_args.cmake5
-rw-r--r--Tests/RunCMake/target_include_directories/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/target_include_directories/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/target_include_directories/empty_keyword_args-result.txt1
-rw-r--r--Tests/RunCMake/target_include_directories/empty_keyword_args-stderr.txt5
-rw-r--r--Tests/RunCMake/target_include_directories/empty_keyword_args.cmake5
-rw-r--r--Tests/RunCMake/target_link_directories/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/target_link_directories/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/target_link_directories/empty_keyword_args-result.txt1
-rw-r--r--Tests/RunCMake/target_link_directories/empty_keyword_args-stderr.txt5
-rw-r--r--Tests/RunCMake/target_link_directories/empty_keyword_args.cmake5
-rw-r--r--Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/target_link_libraries/empty_keyword_args.cmake4
-rw-r--r--Tests/RunCMake/target_link_options/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/target_link_options/empty_keyword_args-result.txt1
-rw-r--r--Tests/RunCMake/target_link_options/empty_keyword_args-stderr.txt4
-rw-r--r--Tests/RunCMake/target_link_options/empty_keyword_args.cmake5
-rw-r--r--Tests/RunCMake/target_sources/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/target_sources/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/target_sources/empty_keyword_args-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/empty_keyword_args-stderr.txt4
-rw-r--r--Tests/RunCMake/target_sources/empty_keyword_args.cmake5
36 files changed, 128 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 90681b9..b2880b6 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -342,11 +342,16 @@ endif()
add_RunCMake_test(File_Generate)
add_RunCMake_test(ExportWithoutLanguage)
+add_RunCMake_test(target_link_directories)
add_RunCMake_test(target_link_libraries)
add_RunCMake_test(add_link_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID})
add_RunCMake_test(target_link_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID})
+add_RunCMake_test(target_compile_definitions)
add_RunCMake_test(target_compile_features)
+add_RunCMake_test(target_compile_options)
+add_RunCMake_test(target_include_directories)
+add_RunCMake_test(target_sources)
add_RunCMake_test(CheckModules)
add_RunCMake_test(CheckIPOSupported)
add_RunCMake_test(CommandLine -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
diff --git a/Tests/RunCMake/target_compile_definitions/CMakeLists.txt b/Tests/RunCMake/target_compile_definitions/CMakeLists.txt
new file mode 100644
index 0000000..14ef56e
--- /dev/null
+++ b/Tests/RunCMake/target_compile_definitions/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.11)
+
+project(${RunCMake_TEST} LANGUAGES NONE)
+
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/target_compile_definitions/RunCMakeTest.cmake b/Tests/RunCMake/target_compile_definitions/RunCMakeTest.cmake
new file mode 100644
index 0000000..b67c598
--- /dev/null
+++ b/Tests/RunCMake/target_compile_definitions/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(empty_keyword_args)
diff --git a/Tests/RunCMake/target_compile_definitions/empty_keyword_args-result.txt b/Tests/RunCMake/target_compile_definitions/empty_keyword_args-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_compile_definitions/empty_keyword_args-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_compile_definitions/empty_keyword_args-stderr.txt b/Tests/RunCMake/target_compile_definitions/empty_keyword_args-stderr.txt
new file mode 100644
index 0000000..d8fb3ba
--- /dev/null
+++ b/Tests/RunCMake/target_compile_definitions/empty_keyword_args-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at empty_keyword_args.cmake:2 \(target_compile_definitions\):
+ target_compile_definitions may only set INTERFACE properties on INTERFACE
+ targets
+Call Stack \(most recent call first\):
+ CMakeLists.txt:5 \(include\)
diff --git a/Tests/RunCMake/target_compile_definitions/empty_keyword_args.cmake b/Tests/RunCMake/target_compile_definitions/empty_keyword_args.cmake
new file mode 100644
index 0000000..cb94e87
--- /dev/null
+++ b/Tests/RunCMake/target_compile_definitions/empty_keyword_args.cmake
@@ -0,0 +1,5 @@
+add_library(iface INTERFACE)
+target_compile_definitions(iface PUBLIC PRIVATE INTERFACE)
+# Cannot be called with non-compilable targets.
+#add_library(imported UNKNOWN IMPORTED)
+#target_compile_definitions(imported PUBLIC PRIVATE INTERFACE)
diff --git a/Tests/RunCMake/target_compile_features/RunCMakeTest.cmake b/Tests/RunCMake/target_compile_features/RunCMakeTest.cmake
index 1f67f11..f8b0809 100644
--- a/Tests/RunCMake/target_compile_features/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_compile_features/RunCMakeTest.cmake
@@ -12,3 +12,4 @@ run_cmake(no_matching_cxx_feature)
run_cmake(not_a_c_feature)
run_cmake(no_matching_c_feature)
run_cmake(cxx_not_enabled)
+run_cmake(empty_keyword_args)
diff --git a/Tests/RunCMake/target_compile_features/empty_keyword_args-result.txt b/Tests/RunCMake/target_compile_features/empty_keyword_args-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/empty_keyword_args-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_compile_features/empty_keyword_args-stderr.txt b/Tests/RunCMake/target_compile_features/empty_keyword_args-stderr.txt
new file mode 100644
index 0000000..eecd3cf
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/empty_keyword_args-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at empty_keyword_args.cmake:2 \(target_compile_features\):
+ target_compile_features may only set INTERFACE properties on INTERFACE
+ targets
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/target_compile_features/empty_keyword_args.cmake b/Tests/RunCMake/target_compile_features/empty_keyword_args.cmake
new file mode 100644
index 0000000..8d57c1c
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/empty_keyword_args.cmake
@@ -0,0 +1,5 @@
+add_library(iface INTERFACE)
+target_compile_features(iface PUBLIC PRIVATE INTERFACE)
+# Cannot be called with non-compilable targets.
+#add_library(imported UNKNOWN IMPORTED)
+#target_compile_features(imported PUBLIC PRIVATE INTERFACE)
diff --git a/Tests/RunCMake/target_compile_options/CMakeLists.txt b/Tests/RunCMake/target_compile_options/CMakeLists.txt
new file mode 100644
index 0000000..14ef56e
--- /dev/null
+++ b/Tests/RunCMake/target_compile_options/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.11)
+
+project(${RunCMake_TEST} LANGUAGES NONE)
+
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/target_compile_options/RunCMakeTest.cmake b/Tests/RunCMake/target_compile_options/RunCMakeTest.cmake
new file mode 100644
index 0000000..b67c598
--- /dev/null
+++ b/Tests/RunCMake/target_compile_options/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(empty_keyword_args)
diff --git a/Tests/RunCMake/target_compile_options/empty_keyword_args-result.txt b/Tests/RunCMake/target_compile_options/empty_keyword_args-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_compile_options/empty_keyword_args-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_compile_options/empty_keyword_args-stderr.txt b/Tests/RunCMake/target_compile_options/empty_keyword_args-stderr.txt
new file mode 100644
index 0000000..381ff48
--- /dev/null
+++ b/Tests/RunCMake/target_compile_options/empty_keyword_args-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at empty_keyword_args.cmake:2 \(target_compile_options\):
+ target_compile_options may only set INTERFACE properties on INTERFACE
+ targets
+Call Stack \(most recent call first\):
+ CMakeLists.txt:5 \(include\)
diff --git a/Tests/RunCMake/target_compile_options/empty_keyword_args.cmake b/Tests/RunCMake/target_compile_options/empty_keyword_args.cmake
new file mode 100644
index 0000000..8b92fcf
--- /dev/null
+++ b/Tests/RunCMake/target_compile_options/empty_keyword_args.cmake
@@ -0,0 +1,5 @@
+add_library(iface INTERFACE)
+target_compile_options(iface PUBLIC PRIVATE INTERFACE)
+# Cannot be called with non-compilable targets.
+#add_library(imported UNKNOWN IMPORTED)
+#target_compile_options(imported PUBLIC PRIVATE INTERFACE)
diff --git a/Tests/RunCMake/target_include_directories/CMakeLists.txt b/Tests/RunCMake/target_include_directories/CMakeLists.txt
new file mode 100644
index 0000000..14ef56e
--- /dev/null
+++ b/Tests/RunCMake/target_include_directories/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.11)
+
+project(${RunCMake_TEST} LANGUAGES NONE)
+
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/target_include_directories/RunCMakeTest.cmake b/Tests/RunCMake/target_include_directories/RunCMakeTest.cmake
new file mode 100644
index 0000000..b67c598
--- /dev/null
+++ b/Tests/RunCMake/target_include_directories/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(empty_keyword_args)
diff --git a/Tests/RunCMake/target_include_directories/empty_keyword_args-result.txt b/Tests/RunCMake/target_include_directories/empty_keyword_args-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_include_directories/empty_keyword_args-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_include_directories/empty_keyword_args-stderr.txt b/Tests/RunCMake/target_include_directories/empty_keyword_args-stderr.txt
new file mode 100644
index 0000000..6200703
--- /dev/null
+++ b/Tests/RunCMake/target_include_directories/empty_keyword_args-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at empty_keyword_args.cmake:2 \(target_include_directories\):
+ target_include_directories may only set INTERFACE properties on INTERFACE
+ targets
+Call Stack \(most recent call first\):
+ CMakeLists.txt:5 \(include\)
diff --git a/Tests/RunCMake/target_include_directories/empty_keyword_args.cmake b/Tests/RunCMake/target_include_directories/empty_keyword_args.cmake
new file mode 100644
index 0000000..08eaf91
--- /dev/null
+++ b/Tests/RunCMake/target_include_directories/empty_keyword_args.cmake
@@ -0,0 +1,5 @@
+add_library(iface INTERFACE)
+target_include_directories(iface PUBLIC PRIVATE INTERFACE)
+# Cannot be called with non-compilable targets.
+#add_library(imported UNKNOWN IMPORTED)
+#target_include_directories(imported PUBLIC PRIVATE INTERFACE)
diff --git a/Tests/RunCMake/target_link_directories/CMakeLists.txt b/Tests/RunCMake/target_link_directories/CMakeLists.txt
new file mode 100644
index 0000000..14ef56e
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.11)
+
+project(${RunCMake_TEST} LANGUAGES NONE)
+
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/target_link_directories/RunCMakeTest.cmake b/Tests/RunCMake/target_link_directories/RunCMakeTest.cmake
new file mode 100644
index 0000000..b67c598
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(empty_keyword_args)
diff --git a/Tests/RunCMake/target_link_directories/empty_keyword_args-result.txt b/Tests/RunCMake/target_link_directories/empty_keyword_args-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/empty_keyword_args-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_link_directories/empty_keyword_args-stderr.txt b/Tests/RunCMake/target_link_directories/empty_keyword_args-stderr.txt
new file mode 100644
index 0000000..26ee9a1
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/empty_keyword_args-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at empty_keyword_args.cmake:2 \(target_link_directories\):
+ target_link_directories may only set INTERFACE properties on INTERFACE
+ targets
+Call Stack \(most recent call first\):
+ CMakeLists.txt:5 \(include\)
diff --git a/Tests/RunCMake/target_link_directories/empty_keyword_args.cmake b/Tests/RunCMake/target_link_directories/empty_keyword_args.cmake
new file mode 100644
index 0000000..aadf80a
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/empty_keyword_args.cmake
@@ -0,0 +1,5 @@
+add_library(iface INTERFACE)
+target_link_directories(iface PUBLIC PRIVATE INTERFACE)
+# Cannot be called with non-compilable targets.
+#add_library(imported UNKNOWN IMPORTED)
+#target_link_directories(imported PUBLIC PRIVATE INTERFACE)
diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
index a041d6d..0152d4c 100644
--- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
@@ -19,3 +19,4 @@ run_cmake(SharedDepNotTarget)
run_cmake(StaticPrivateDepNotExported)
run_cmake(StaticPrivateDepNotTarget)
run_cmake(UNKNOWN-IMPORTED-GLOBAL)
+run_cmake(empty_keyword_args)
diff --git a/Tests/RunCMake/target_link_libraries/empty_keyword_args.cmake b/Tests/RunCMake/target_link_libraries/empty_keyword_args.cmake
new file mode 100644
index 0000000..440fa06
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/empty_keyword_args.cmake
@@ -0,0 +1,4 @@
+add_library(iface INTERFACE)
+target_link_libraries(iface PUBLIC PRIVATE INTERFACE)
+add_library(imported UNKNOWN IMPORTED)
+target_link_libraries(imported PUBLIC PRIVATE INTERFACE)
diff --git a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake
index 1eaa5d2..1d9ef8b 100644
--- a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake
@@ -39,3 +39,5 @@ if(RunCMake_GENERATOR MATCHES "(Ninja|Makefile)")
run_cmake_target(LINKER_expansion LINKER linker)
run_cmake_target(LINKER_expansion LINKER_SHELL linker_shell)
endif()
+
+run_cmake(empty_keyword_args)
diff --git a/Tests/RunCMake/target_link_options/empty_keyword_args-result.txt b/Tests/RunCMake/target_link_options/empty_keyword_args-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/empty_keyword_args-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_link_options/empty_keyword_args-stderr.txt b/Tests/RunCMake/target_link_options/empty_keyword_args-stderr.txt
new file mode 100644
index 0000000..0103d00
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/empty_keyword_args-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at empty_keyword_args.cmake:2 \(target_link_options\):
+ target_link_options may only set INTERFACE properties on INTERFACE targets
+Call Stack \(most recent call first\):
+ CMakeLists.txt:5 \(include\)
diff --git a/Tests/RunCMake/target_link_options/empty_keyword_args.cmake b/Tests/RunCMake/target_link_options/empty_keyword_args.cmake
new file mode 100644
index 0000000..a1a297e
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/empty_keyword_args.cmake
@@ -0,0 +1,5 @@
+add_library(iface INTERFACE)
+target_link_options(iface PUBLIC PRIVATE INTERFACE)
+# Cannot be called with non-compilable targets.
+#add_library(imported UNKNOWN IMPORTED)
+#target_link_options(imported PUBLIC PRIVATE INTERFACE)
diff --git a/Tests/RunCMake/target_sources/CMakeLists.txt b/Tests/RunCMake/target_sources/CMakeLists.txt
new file mode 100644
index 0000000..14ef56e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.11)
+
+project(${RunCMake_TEST} LANGUAGES NONE)
+
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/target_sources/RunCMakeTest.cmake b/Tests/RunCMake/target_sources/RunCMakeTest.cmake
new file mode 100644
index 0000000..b67c598
--- /dev/null
+++ b/Tests/RunCMake/target_sources/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(empty_keyword_args)
diff --git a/Tests/RunCMake/target_sources/empty_keyword_args-result.txt b/Tests/RunCMake/target_sources/empty_keyword_args-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_sources/empty_keyword_args-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_sources/empty_keyword_args-stderr.txt b/Tests/RunCMake/target_sources/empty_keyword_args-stderr.txt
new file mode 100644
index 0000000..9ff5bb0
--- /dev/null
+++ b/Tests/RunCMake/target_sources/empty_keyword_args-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at empty_keyword_args.cmake:2 \(target_sources\):
+ target_sources may only set INTERFACE properties on INTERFACE targets
+Call Stack \(most recent call first\):
+ CMakeLists.txt:5 \(include\)
diff --git a/Tests/RunCMake/target_sources/empty_keyword_args.cmake b/Tests/RunCMake/target_sources/empty_keyword_args.cmake
new file mode 100644
index 0000000..5cee451
--- /dev/null
+++ b/Tests/RunCMake/target_sources/empty_keyword_args.cmake
@@ -0,0 +1,5 @@
+add_library(iface INTERFACE)
+target_sources(iface PUBLIC PRIVATE INTERFACE)
+# Cannot be called with non-compilable targets.
+#add_library(imported UNKNOWN IMPORTED)
+#target_sources(imported PUBLIC PRIVATE INTERFACE)