diff options
author | Deniz Bahadir <dbahadir@benocs.com> | 2017-09-18 15:50:11 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-10-26 13:11:04 (GMT) |
commit | fe4b25ec2fa09a50b6ffbfcf29e118afdfba0659 (patch) | |
tree | ad60a1043e9ec894f76171b686d1d7e83808e1fc /Tests | |
parent | e40fd9fd19923c84be725da41c233100f400bd93 (diff) | |
download | CMake-fe4b25ec2fa09a50b6ffbfcf29e118afdfba0659.zip CMake-fe4b25ec2fa09a50b6ffbfcf29e118afdfba0659.tar.gz CMake-fe4b25ec2fa09a50b6ffbfcf29e118afdfba0659.tar.bz2 |
Teach target_* commands to set INTERFACE properties of IMPORTED targets
Now, several `INTERFACE_*` properties can be set on `IMPORTED` targets,
not only via `set_property` and `set_target_properties` but also via
`target_compile_definitions`, `target_compile_features`,
`target_compile_options`, `target_include_directories`, `target_sources`
and `target_link_libraries`.
Fixes: #15689
Issue: #17197
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-stderr.txt | 5 | ||||
-rw-r--r-- | Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/target_compile_features/imported_target-stderr.txt | 7 | ||||
-rw-r--r-- | Tests/RunCMake/target_compile_features/imported_target.cmake | 10 | ||||
-rw-r--r-- | Tests/RunCMake/target_link_libraries/ImportedTarget.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/target_link_libraries/ImportedTargetFailure-result.txt (renamed from Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-result.txt) | 0 | ||||
-rw-r--r-- | Tests/RunCMake/target_link_libraries/ImportedTargetFailure-stderr.txt | 5 | ||||
-rw-r--r-- | Tests/RunCMake/target_link_libraries/ImportedTargetFailure.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake | 2 |
9 files changed, 24 insertions, 11 deletions
diff --git a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-stderr.txt deleted file mode 100644 index adcd3a2..0000000 --- a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -^CMake Error at UNKNOWNwithNoSourcesButLinkObjects.cmake:[0-9]+ \(target_link_libraries\): - Cannot specify link libraries for target \"TestUnknownLibWithoutSources\" - which is not built by this project. -Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake b/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake index 8e014c2..a977d42 100644 --- a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake +++ b/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake @@ -2,4 +2,4 @@ enable_language(CXX) add_library(ObjectLibDependency OBJECT test.cpp) add_library(TestUnknownLibWithoutSources UNKNOWN IMPORTED) -target_link_libraries(TestUnknownLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) +target_link_libraries(TestUnknownLibWithoutSources INTERFACE $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/target_compile_features/imported_target-stderr.txt b/Tests/RunCMake/target_compile_features/imported_target-stderr.txt index 7a07427..afad537 100644 --- a/Tests/RunCMake/target_compile_features/imported_target-stderr.txt +++ b/Tests/RunCMake/target_compile_features/imported_target-stderr.txt @@ -1,4 +1,5 @@ -CMake Error at imported_target.cmake:[0-9]+ \(target_compile_features\): - Cannot specify compile features for imported target "main". +^CMake Error at imported_target.cmake:[0-9]+ \(target_compile_features\): + target_compile_features may only set INTERFACE properties on INTERFACE + targets Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/target_compile_features/imported_target.cmake b/Tests/RunCMake/target_compile_features/imported_target.cmake index e886ce9..e410ace 100644 --- a/Tests/RunCMake/target_compile_features/imported_target.cmake +++ b/Tests/RunCMake/target_compile_features/imported_target.cmake @@ -1,4 +1,10 @@ enable_language(CXX) -add_library(main INTERFACE IMPORTED) -target_compile_features(main INTERFACE cxx_delegating_constructors) +add_library(lib1-interface INTERFACE IMPORTED) +target_compile_features(lib1-interface INTERFACE cxx_delegating_constructors) + +add_library(lib2-interface INTERFACE IMPORTED) +target_compile_features(lib2-interface PUBLIC cxx_delegating_constructors) + +add_library(lib-shared SHARED IMPORTED) +target_compile_features(lib-shared INTERFACE cxx_delegating_constructors) diff --git a/Tests/RunCMake/target_link_libraries/ImportedTarget.cmake b/Tests/RunCMake/target_link_libraries/ImportedTarget.cmake new file mode 100644 index 0000000..e5ec3f6 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/ImportedTarget.cmake @@ -0,0 +1,2 @@ +add_library(UnknownImportedGlobal UNKNOWN IMPORTED GLOBAL) +target_link_libraries(UnknownImportedGlobal INTERFACE z) diff --git a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-result.txt b/Tests/RunCMake/target_link_libraries/ImportedTargetFailure-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-result.txt +++ b/Tests/RunCMake/target_link_libraries/ImportedTargetFailure-result.txt diff --git a/Tests/RunCMake/target_link_libraries/ImportedTargetFailure-stderr.txt b/Tests/RunCMake/target_link_libraries/ImportedTargetFailure-stderr.txt new file mode 100644 index 0000000..1cafa5b --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/ImportedTargetFailure-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at ImportedTargetFailure.cmake:[0-9]+ \(target_link_libraries\): + IMPORTED library can only be used with the INTERFACE keyword of + target_link_libraries +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_link_libraries/ImportedTargetFailure.cmake b/Tests/RunCMake/target_link_libraries/ImportedTargetFailure.cmake new file mode 100644 index 0000000..3ac0aa9 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/ImportedTargetFailure.cmake @@ -0,0 +1,2 @@ +add_library(UnknownImportedGlobal UNKNOWN IMPORTED GLOBAL) +target_link_libraries(UnknownImportedGlobal PRIVATE z) diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake index b1c9435..97b0888 100644 --- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake @@ -4,6 +4,8 @@ run_cmake(CMP0023-WARN) run_cmake(CMP0023-NEW) run_cmake(CMP0023-WARN-2) run_cmake(CMP0023-NEW-2) +run_cmake(ImportedTarget) +run_cmake(ImportedTargetFailure) run_cmake(MixedSignature) run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses) run_cmake(SubDirTarget) |