diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2022-07-06 13:06:53 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2022-07-06 14:15:43 (GMT) |
commit | 913ea78d7a22302fcaecb284096239bdb05b6206 (patch) | |
tree | 109938d99efb12ab3be17643e6897c9176c26085 /Tests | |
parent | 4a8db1783ccc48bfdb9060dfff5775ba42cd94cb (diff) | |
download | CMake-913ea78d7a22302fcaecb284096239bdb05b6206.zip CMake-913ea78d7a22302fcaecb284096239bdb05b6206.tar.gz CMake-913ea78d7a22302fcaecb284096239bdb05b6206.tar.bz2 |
Genex LINK_LIBRARY and LINK_GROUP: check supported properties
Refines check for properties supporting these genex.
Enhance error message.
Fixes: #23699
Diffstat (limited to 'Tests')
20 files changed, 68 insertions, 12 deletions
diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-LINK_GROUP/RunCMakeTest.cmake index f20d225..f1023d1 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenEx-LINK_GROUP/RunCMakeTest.cmake @@ -6,6 +6,7 @@ run_cmake(add_link_options) run_cmake(link_directories) run_cmake(target_link_options) run_cmake(target_link_directories) +run_cmake(invalid-property) run_cmake(no-arguments) run_cmake(empty-arguments) run_cmake(forbidden-arguments) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_command-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_command-stderr.txt index a80a11b..c3eb103 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_command-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_command-stderr.txt @@ -4,6 +4,7 @@ CMake Error at add_custom_command.cmake:[0-9]+ \(add_custom_command\): \$<LINK_GROUP:feat> \$<LINK_GROUP:...> may only be used with binary targets to specify group of - link libraries. + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_target-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_target-stderr.txt index deb246a..8bd07fe 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_target-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/add_custom_target-stderr.txt @@ -4,6 +4,7 @@ CMake Error at add_custom_target.cmake:[0-9]+ \(add_custom_target\): \$<LINK_GROUP:feat> \$<LINK_GROUP:...> may only be used with binary targets to specify group of - link libraries. + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/add_link_options-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/add_link_options-stderr.txt index 17c348c..8314461 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/add_link_options-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/add_link_options-stderr.txt @@ -4,6 +4,7 @@ CMake Error at add_link_options.cmake:[0-9]+ \(add_link_options\): \$<LINK_GROUP:feat> \$<LINK_GROUP:...> may only be used with binary targets to specify group of - link libraries. + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property-result.txt b/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property-stderr.txt new file mode 100644 index 0000000..f39d275 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at invalid-property.cmake:[0-9]+ \(set_property\): + Error evaluating generator expression: + + \$<LINK_GROUP:feat,dep> + + \$<LINK_GROUP:...> may only be used with binary targets to specify group of + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property.cmake b/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property.cmake new file mode 100644 index 0000000..549f4c1 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_GROUP/invalid-property.cmake @@ -0,0 +1,10 @@ +enable_language(C) + +set (CMAKE_LINK_GROUP_USING_feat "--prefix" "--suffix") +set (CMAKE_LINK_GROUP_USING_feat_SUPPORTED TRUE) + +add_library(dep SHARED empty.c) +set_property(TARGET dep PROPERTY INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE "$<LINK_GROUP:feat,dep>") + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE dep) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/link_directories-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/link_directories-stderr.txt index 51194a4..1ee01f3 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/link_directories-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/link_directories-stderr.txt @@ -4,6 +4,7 @@ CMake Error at link_directories.cmake:[0-9]+ \(link_directories\): \$<LINK_GROUP:feat> \$<LINK_GROUP:...> may only be used with binary targets to specify group of - link libraries. + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/target_link_directories-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/target_link_directories-stderr.txt index 042dd0b..58a8fc4 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/target_link_directories-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/target_link_directories-stderr.txt @@ -4,6 +4,7 @@ CMake Error at target_link_directories.cmake:[0-9]+ \(target_link_directories\): \$<LINK_GROUP:feat> \$<LINK_GROUP:...> may only be used with binary targets to specify group of - link libraries. + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_GROUP/target_link_options-stderr.txt b/Tests/RunCMake/GenEx-LINK_GROUP/target_link_options-stderr.txt index 7030b9c..910106c 100644 --- a/Tests/RunCMake/GenEx-LINK_GROUP/target_link_options-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_GROUP/target_link_options-stderr.txt @@ -4,6 +4,7 @@ CMake Error at target_link_options.cmake:[0-9]+ \(target_link_options\): \$<LINK_GROUP:FEAT> \$<LINK_GROUP:...> may only be used with binary targets to specify group of - link libraries. + link libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/RunCMakeTest.cmake index 3fb68d6..7df0e80 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/RunCMakeTest.cmake @@ -6,6 +6,7 @@ run_cmake(add_link_options) run_cmake(link_directories) run_cmake(target_link_options) run_cmake(target_link_directories) +run_cmake(invalid-property) run_cmake(no-arguments) run_cmake(empty-arguments) run_cmake(forbidden-arguments) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command-stderr.txt index d8ff0eb..a9c3842 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command-stderr.txt @@ -4,6 +4,7 @@ CMake Error at add_custom_command.cmake:[0-9]+ \(add_custom_command\): \$<LINK_LIBRARY:feat> \$<LINK_LIBRARY:...> may only be used with binary targets to specify link - libraries. + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target-stderr.txt index 8ca384d..95104a5 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target-stderr.txt @@ -4,6 +4,7 @@ CMake Error at add_custom_target.cmake:[0-9]+ \(add_custom_target\): \$<LINK_LIBRARY:feat> \$<LINK_LIBRARY:...> may only be used with binary targets to specify link - libraries. + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options-stderr.txt index 399a413..f8669ad 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options-stderr.txt @@ -4,6 +4,7 @@ CMake Error at add_link_options.cmake:[0-9]+ \(add_link_options\): \$<LINK_LIBRARY:feat> \$<LINK_LIBRARY:...> may only be used with binary targets to specify link - libraries. + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property-stderr.txt new file mode 100644 index 0000000..7410e48 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at invalid-property.cmake:[0-9]+ \(set_property\): + Error evaluating generator expression: + + \$<LINK_LIBRARY:feat,dep> + + \$<LINK_LIBRARY:...> may only be used with binary targets to specify link + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property.cmake new file mode 100644 index 0000000..a8e3a57 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/invalid-property.cmake @@ -0,0 +1,10 @@ +enable_language(C) + +set (CMAKE_LINK_LIBRARY_USING_feat "<LIBRARY>") +set (CMAKE_LINK_LIBRARY_USING_feat_SUPPORTED TRUE) + +add_library(dep SHARED empty.c) +set_property(TARGET dep PROPERTY INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE "$<LINK_LIBRARY:feat,dep>") + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE dep) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories-stderr.txt index aeb32f2..e47bf04 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories-stderr.txt @@ -4,6 +4,7 @@ CMake Error at link_directories.cmake:[0-9]+ \(link_directories\): \$<LINK_LIBRARY:feat> \$<LINK_LIBRARY:...> may only be used with binary targets to specify link - libraries. + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories-stderr.txt index e0c60c4..7c467fd 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories-stderr.txt @@ -4,6 +4,7 @@ CMake Error at target_link_directories.cmake:[0-9]+ \(target_link_directories\): \$<LINK_LIBRARY:feat> \$<LINK_LIBRARY:...> may only be used with binary targets to specify link - libraries. + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options-stderr.txt index 6c9aab1..02805b7 100644 --- a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options-stderr.txt +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options-stderr.txt @@ -4,6 +4,7 @@ CMake Error at target_link_options.cmake:[0-9]+ \(target_link_options\): \$<LINK_LIBRARY:FEAT> \$<LINK_LIBRARY:...> may only be used with binary targets to specify link - libraries. + libraries through 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', and + 'INTERFACE_LINK_LIBRARIES_DIRECT' properties. Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) |