Browse Source

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.
Ben Boeckel 7 years ago
parent
commit
4201a11c2b
36 changed files with 128 additions and 0 deletions
  1. 5 0
      Tests/RunCMake/CMakeLists.txt
  2. 5 0
      Tests/RunCMake/target_compile_definitions/CMakeLists.txt
  3. 3 0
      Tests/RunCMake/target_compile_definitions/RunCMakeTest.cmake
  4. 1 0
      Tests/RunCMake/target_compile_definitions/empty_keyword_args-result.txt
  5. 5 0
      Tests/RunCMake/target_compile_definitions/empty_keyword_args-stderr.txt
  6. 5 0
      Tests/RunCMake/target_compile_definitions/empty_keyword_args.cmake
  7. 1 0
      Tests/RunCMake/target_compile_features/RunCMakeTest.cmake
  8. 1 0
      Tests/RunCMake/target_compile_features/empty_keyword_args-result.txt
  9. 5 0
      Tests/RunCMake/target_compile_features/empty_keyword_args-stderr.txt
  10. 5 0
      Tests/RunCMake/target_compile_features/empty_keyword_args.cmake
  11. 5 0
      Tests/RunCMake/target_compile_options/CMakeLists.txt
  12. 3 0
      Tests/RunCMake/target_compile_options/RunCMakeTest.cmake
  13. 1 0
      Tests/RunCMake/target_compile_options/empty_keyword_args-result.txt
  14. 5 0
      Tests/RunCMake/target_compile_options/empty_keyword_args-stderr.txt
  15. 5 0
      Tests/RunCMake/target_compile_options/empty_keyword_args.cmake
  16. 5 0
      Tests/RunCMake/target_include_directories/CMakeLists.txt
  17. 3 0
      Tests/RunCMake/target_include_directories/RunCMakeTest.cmake
  18. 1 0
      Tests/RunCMake/target_include_directories/empty_keyword_args-result.txt
  19. 5 0
      Tests/RunCMake/target_include_directories/empty_keyword_args-stderr.txt
  20. 5 0
      Tests/RunCMake/target_include_directories/empty_keyword_args.cmake
  21. 5 0
      Tests/RunCMake/target_link_directories/CMakeLists.txt
  22. 3 0
      Tests/RunCMake/target_link_directories/RunCMakeTest.cmake
  23. 1 0
      Tests/RunCMake/target_link_directories/empty_keyword_args-result.txt
  24. 5 0
      Tests/RunCMake/target_link_directories/empty_keyword_args-stderr.txt
  25. 5 0
      Tests/RunCMake/target_link_directories/empty_keyword_args.cmake
  26. 1 0
      Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
  27. 4 0
      Tests/RunCMake/target_link_libraries/empty_keyword_args.cmake
  28. 2 0
      Tests/RunCMake/target_link_options/RunCMakeTest.cmake
  29. 1 0
      Tests/RunCMake/target_link_options/empty_keyword_args-result.txt
  30. 4 0
      Tests/RunCMake/target_link_options/empty_keyword_args-stderr.txt
  31. 5 0
      Tests/RunCMake/target_link_options/empty_keyword_args.cmake
  32. 5 0
      Tests/RunCMake/target_sources/CMakeLists.txt
  33. 3 0
      Tests/RunCMake/target_sources/RunCMakeTest.cmake
  34. 1 0
      Tests/RunCMake/target_sources/empty_keyword_args-result.txt
  35. 4 0
      Tests/RunCMake/target_sources/empty_keyword_args-stderr.txt
  36. 5 0
      Tests/RunCMake/target_sources/empty_keyword_args.cmake

+ 5 - 0
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})

+ 5 - 0
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)

+ 3 - 0
Tests/RunCMake/target_compile_definitions/RunCMakeTest.cmake

@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(empty_keyword_args)

+ 1 - 0
Tests/RunCMake/target_compile_definitions/empty_keyword_args-result.txt

@@ -0,0 +1 @@
+1

+ 5 - 0
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\)

+ 5 - 0
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)

+ 1 - 0
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)

+ 1 - 0
Tests/RunCMake/target_compile_features/empty_keyword_args-result.txt

@@ -0,0 +1 @@
+1

+ 5 - 0
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\)

+ 5 - 0
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)

+ 5 - 0
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)

+ 3 - 0
Tests/RunCMake/target_compile_options/RunCMakeTest.cmake

@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(empty_keyword_args)

+ 1 - 0
Tests/RunCMake/target_compile_options/empty_keyword_args-result.txt

@@ -0,0 +1 @@
+1

+ 5 - 0
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\)

+ 5 - 0
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)

+ 5 - 0
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)

+ 3 - 0
Tests/RunCMake/target_include_directories/RunCMakeTest.cmake

@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(empty_keyword_args)

+ 1 - 0
Tests/RunCMake/target_include_directories/empty_keyword_args-result.txt

@@ -0,0 +1 @@
+1

+ 5 - 0
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\)

+ 5 - 0
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)

+ 5 - 0
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)

+ 3 - 0
Tests/RunCMake/target_link_directories/RunCMakeTest.cmake

@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(empty_keyword_args)

+ 1 - 0
Tests/RunCMake/target_link_directories/empty_keyword_args-result.txt

@@ -0,0 +1 @@
+1

+ 5 - 0
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\)

+ 5 - 0
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)

+ 1 - 0
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)

+ 4 - 0
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)

+ 2 - 0
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)

+ 1 - 0
Tests/RunCMake/target_link_options/empty_keyword_args-result.txt

@@ -0,0 +1 @@
+1

+ 4 - 0
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\)

+ 5 - 0
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)

+ 5 - 0
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)

+ 3 - 0
Tests/RunCMake/target_sources/RunCMakeTest.cmake

@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(empty_keyword_args)

+ 1 - 0
Tests/RunCMake/target_sources/empty_keyword_args-result.txt

@@ -0,0 +1 @@
+1

+ 4 - 0
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\)

+ 5 - 0
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)