mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 08:20:18 -06:00
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.
This commit is contained in:
@@ -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
Tests/RunCMake/target_compile_definitions/CMakeLists.txt
Normal file
5
Tests/RunCMake/target_compile_definitions/CMakeLists.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
|
||||
project(${RunCMake_TEST} LANGUAGES NONE)
|
||||
|
||||
include(${RunCMake_TEST}.cmake)
|
||||
@@ -0,0 +1,3 @@
|
||||
include(RunCMake)
|
||||
|
||||
run_cmake(empty_keyword_args)
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -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\)
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -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\)
|
||||
@@ -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
Tests/RunCMake/target_compile_options/CMakeLists.txt
Normal file
5
Tests/RunCMake/target_compile_options/CMakeLists.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
|
||||
project(${RunCMake_TEST} LANGUAGES NONE)
|
||||
|
||||
include(${RunCMake_TEST}.cmake)
|
||||
3
Tests/RunCMake/target_compile_options/RunCMakeTest.cmake
Normal file
3
Tests/RunCMake/target_compile_options/RunCMakeTest.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
include(RunCMake)
|
||||
|
||||
run_cmake(empty_keyword_args)
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -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\)
|
||||
@@ -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
Tests/RunCMake/target_include_directories/CMakeLists.txt
Normal file
5
Tests/RunCMake/target_include_directories/CMakeLists.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
|
||||
project(${RunCMake_TEST} LANGUAGES NONE)
|
||||
|
||||
include(${RunCMake_TEST}.cmake)
|
||||
@@ -0,0 +1,3 @@
|
||||
include(RunCMake)
|
||||
|
||||
run_cmake(empty_keyword_args)
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -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\)
|
||||
@@ -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
Tests/RunCMake/target_link_directories/CMakeLists.txt
Normal file
5
Tests/RunCMake/target_link_directories/CMakeLists.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
|
||||
project(${RunCMake_TEST} LANGUAGES NONE)
|
||||
|
||||
include(${RunCMake_TEST}.cmake)
|
||||
@@ -0,0 +1,3 @@
|
||||
include(RunCMake)
|
||||
|
||||
run_cmake(empty_keyword_args)
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -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\)
|
||||
@@ -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)
|
||||
@@ -19,3 +19,4 @@ run_cmake(SharedDepNotTarget)
|
||||
run_cmake(StaticPrivateDepNotExported)
|
||||
run_cmake(StaticPrivateDepNotTarget)
|
||||
run_cmake(UNKNOWN-IMPORTED-GLOBAL)
|
||||
run_cmake(empty_keyword_args)
|
||||
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -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\)
|
||||
@@ -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
Tests/RunCMake/target_sources/CMakeLists.txt
Normal file
5
Tests/RunCMake/target_sources/CMakeLists.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
|
||||
project(${RunCMake_TEST} LANGUAGES NONE)
|
||||
|
||||
include(${RunCMake_TEST}.cmake)
|
||||
3
Tests/RunCMake/target_sources/RunCMakeTest.cmake
Normal file
3
Tests/RunCMake/target_sources/RunCMakeTest.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
include(RunCMake)
|
||||
|
||||
run_cmake(empty_keyword_args)
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -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
Tests/RunCMake/target_sources/empty_keyword_args.cmake
Normal file
5
Tests/RunCMake/target_sources/empty_keyword_args.cmake
Normal file
@@ -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)
|
||||
Reference in New Issue
Block a user