diff options
Diffstat (limited to 'Tests/RunCMake/GenEx-LINK_LIBRARY')
67 files changed, 414 insertions, 0 deletions
diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/CMakeLists.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/CMakeLists.txt new file mode 100644 index 0000000..612169c --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.18...3.22) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/RunCMakeTest.cmake new file mode 100644 index 0000000..ab1ac37 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/RunCMakeTest.cmake @@ -0,0 +1,25 @@ +include(RunCMake) + +run_cmake(add_custom_target) +run_cmake(add_custom_command) +run_cmake(add_link_options) +run_cmake(link_directories) +run_cmake(target_link_options) +run_cmake(target_link_directories) +run_cmake(no-arguments) +run_cmake(empty-arguments) +run_cmake(forbidden-arguments) +run_cmake(bad-feature1) +run_cmake(bad-feature2) +run_cmake(bad-feature3) +run_cmake(bad-feature4) +run_cmake(bad-feature5) +run_cmake(bad-feature6) +run_cmake(bad-feature7) +run_cmake(feature-not-supported) +run_cmake(library-ignored) +run_cmake(compatible-features) +run_cmake(incompatible-features) +run_cmake(nested-compatible-features) +run_cmake(nested-incompatible-features) +run_cmake(only-targets) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command-stderr.txt new file mode 100644 index 0000000..d8ff0eb --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at add_custom_command.cmake:[0-9]+ \(add_custom_command\): + Error evaluating generator expression: + + \$<LINK_LIBRARY:feat> + + \$<LINK_LIBRARY:...> may only be used with binary targets to specify link + libraries. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command.cmake new file mode 100644 index 0000000..3583a67 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_command.cmake @@ -0,0 +1,4 @@ +add_custom_target(drive) +add_custom_command(TARGET drive PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "$<LINK_LIBRARY:feat>" +) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target-stderr.txt new file mode 100644 index 0000000..8ca384d --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at add_custom_target.cmake:[0-9]+ \(add_custom_target\): + Error evaluating generator expression: + + \$<LINK_LIBRARY:feat> + + \$<LINK_LIBRARY:...> may only be used with binary targets to specify link + libraries. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target.cmake new file mode 100644 index 0000000..ef00965 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_custom_target.cmake @@ -0,0 +1,3 @@ +add_custom_target(drive + COMMAND ${CMAKE_COMMAND} -E echo "$<LINK_LIBRARY:feat>" +) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options-stderr.txt new file mode 100644 index 0000000..399a413 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at add_link_options.cmake:[0-9]+ \(add_link_options\): + Error evaluating generator expression: + + \$<LINK_LIBRARY:feat> + + \$<LINK_LIBRARY:...> may only be used with binary targets to specify link + libraries. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options.cmake new file mode 100644 index 0000000..fdccf95 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/add_link_options.cmake @@ -0,0 +1,5 @@ +enable_language(C) + +add_link_options("$<LINK_LIBRARY:feat>") + +add_library(empty SHARED empty.c) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature1-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature1-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature1-stderr.txt new file mode 100644 index 0000000..0ff8aca --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature1-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at bad-feature1.cmake:[0-9]+ \(add_library\): + Feature 'bad_feat', specified through generator-expression + '\$<LINK_LIBRARY>' to link target 'lib', is not supported for the 'C' link + language. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature1.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature1.cmake new file mode 100644 index 0000000..5e540cf --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature1.cmake @@ -0,0 +1,6 @@ +enable_language(C) + +add_library(dep SHARED empty.c) + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE "$<LINK_LIBRARY:bad_feat,dep>") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature2-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature2-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature2-stderr.txt new file mode 100644 index 0000000..9e878cc --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature2-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at bad-feature2.cmake:[0-9]+ \(add_library\): + Feature 'feat', specified through generator-expression '\$<LINK_LIBRARY>' to + link target 'lib', is not defined for the 'C' link language. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature2.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature2.cmake new file mode 100644 index 0000000..15b5ca0 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature2.cmake @@ -0,0 +1,8 @@ +enable_language(C) + +set(CMAKE_C_LINK_USING_feat_SUPPORTED TRUE) + +add_library(dep SHARED empty.c) + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE "$<LINK_LIBRARY:feat,dep>") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature3-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature3-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature3-stderr.txt new file mode 100644 index 0000000..69963fe --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature3-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at bad-feature3.cmake:[0-9]+ \(add_library\): + Feature 'feat', specified by variable 'CMAKE_C_LINK_USING_feat', is + malformed \("<LIBRARY>", "<LIB_ITEM>", or "<LINK_ITEM>" patterns are + missing\) and cannot be used to link target 'lib'. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature3.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature3.cmake new file mode 100644 index 0000000..7960465 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature3.cmake @@ -0,0 +1,9 @@ +enable_language(C) + +set(CMAKE_C_LINK_USING_feat_SUPPORTED TRUE) +set(CMAKE_C_LINK_USING_feat "") + +add_library(dep SHARED empty.c) + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE "$<LINK_LIBRARY:feat,dep>") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature4-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature4-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature4-stderr.txt new file mode 100644 index 0000000..7385115 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature4-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at bad-feature4.cmake:[0-9]+ \(add_library\): + Feature 'feat', specified by variable 'CMAKE_C_LINK_USING_feat', is + malformed \("<LIBRARY>", "<LIB_ITEM>", or "<LINK_ITEM>" patterns are + missing\) and cannot be used to link target 'lib'. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature4.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature4.cmake new file mode 100644 index 0000000..b40cfaf --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature4.cmake @@ -0,0 +1,9 @@ +enable_language(C) + +set(CMAKE_C_LINK_USING_feat_SUPPORTED TRUE) +set(CMAKE_C_LINK_USING_feat "-opt") + +add_library(dep SHARED empty.c) + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE "$<LINK_LIBRARY:feat,dep>") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature5-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature5-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature5-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature5-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature5-stderr.txt new file mode 100644 index 0000000..9894577 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature5-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at bad-feature5.cmake:[0-9]+ \(add_library\): + Feature 'feat', specified by variable 'CMAKE_C_LINK_USING_feat', is + malformed \(wrong number of elements\) and cannot be used to link target + 'lib'. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature5.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature5.cmake new file mode 100644 index 0000000..8ce1ecf --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature5.cmake @@ -0,0 +1,9 @@ +enable_language(C) + +set(CMAKE_C_LINK_USING_feat_SUPPORTED TRUE) +set(CMAKE_C_LINK_USING_feat "-prefix" "<LIBRARY>") + +add_library(dep SHARED empty.c) + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE "$<LINK_LIBRARY:feat,dep>") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature6-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature6-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature6-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature6-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature6-stderr.txt new file mode 100644 index 0000000..d8d0e19 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature6-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at bad-feature6.cmake:[0-9]+ \(add_library\): + Feature 'feat', specified by variable 'CMAKE_C_LINK_USING_feat', is + malformed \("<LIBRARY>", "<LIB_ITEM>", or "<LINK_ITEM>" patterns are missing + for "PATH{}" alternative\) and cannot be used to link target 'lib'. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature6.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature6.cmake new file mode 100644 index 0000000..7b72ad5 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature6.cmake @@ -0,0 +1,9 @@ +enable_language(C) + +set(CMAKE_C_LINK_USING_feat_SUPPORTED TRUE) +set(CMAKE_C_LINK_USING_feat "PATH{}NAME{<LIBRARY>}") + +add_library(dep SHARED empty.c) + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE "$<LINK_LIBRARY:feat,dep>") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature7-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature7-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature7-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature7-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature7-stderr.txt new file mode 100644 index 0000000..2a498cd --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature7-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at bad-feature7.cmake:[0-9]+ \(add_library\): + Feature 'feat', specified by variable 'CMAKE_C_LINK_USING_feat', is + malformed \("<LIBRARY>", "<LIB_ITEM>", or "<LINK_ITEM>" patterns are missing + for "NAME{}" alternative\) and cannot be used to link target 'lib'. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature7.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature7.cmake new file mode 100644 index 0000000..173f86c --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/bad-feature7.cmake @@ -0,0 +1,9 @@ +enable_language(C) + +set(CMAKE_C_LINK_USING_feat_SUPPORTED TRUE) +set(CMAKE_C_LINK_USING_feat "NAME{}PATH{<LIBRARY>}") + +add_library(dep SHARED empty.c) + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE "$<LINK_LIBRARY:feat,dep>") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/compatible-features.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/compatible-features.cmake new file mode 100644 index 0000000..e79764c --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/compatible-features.cmake @@ -0,0 +1,15 @@ +enable_language(C) + +set(CMAKE_C_LINK_USING_feat1_SUPPORTED TRUE) +set(CMAKE_C_LINK_USING_feat1 "<LIBRARY>") + +set(CMAKE_C_LINK_USING_feat2_SUPPORTED TRUE) +set(CMAKE_C_LINK_USING_feat2 "<LIBRARY>") + +add_library(dep1 SHARED empty.c) + +add_library(dep2 SHARED empty.c) +target_link_libraries(dep2 PRIVATE "$<LINK_LIBRARY:feat1,dep1>") + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE "$<LINK_LIBRARY:feat2,dep1,dep2>") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/empty-arguments-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/empty-arguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/empty-arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/empty-arguments-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/empty-arguments-stderr.txt new file mode 100644 index 0000000..1530f61 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/empty-arguments-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at empty-arguments.cmake:[0-9]+ \(target_link_libraries\): + Error evaluating generator expression: + + \$<LINK_LIBRARY:,> + + \$<LINK_LIBRARY:...> expects a feature name as first argument. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/empty-arguments.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/empty-arguments.cmake new file mode 100644 index 0000000..c6e2260 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/empty-arguments.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE "$<LINK_LIBRARY:,>") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/empty.c b/Tests/RunCMake/GenEx-LINK_LIBRARY/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/empty.c diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/feature-not-supported-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/feature-not-supported-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/feature-not-supported-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/feature-not-supported-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/feature-not-supported-stderr.txt new file mode 100644 index 0000000..6067bce --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/feature-not-supported-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at feature-not-supported.cmake:[0-9]+ \(add_library\): + Feature 'feat', specified through generator-expression '\$<LINK_LIBRARY>' to + link target 'lib', is not supported for the 'C' link language. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/feature-not-supported.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/feature-not-supported.cmake new file mode 100644 index 0000000..0666227 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/feature-not-supported.cmake @@ -0,0 +1,9 @@ +enable_language(C) + +set(CMAKE_C_LINK_USING_feat_SUPPORTED FALSE) +set(CMAKE_C_LINK_USING_feat "<LIBRARY>") + +add_library(dep SHARED empty.c) + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE "$<LINK_LIBRARY:feat,dep>") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments-stderr.txt new file mode 100644 index 0000000..5245dd8 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments-stderr.txt @@ -0,0 +1,16 @@ +CMake Error at forbidden-arguments.cmake:[0-9]+ \(link_libraries\): + Property LINK_LIBRARIES contains the invalid item "<LINK_LIBRARY:feat>". + The LINK_LIBRARIES property may contain the generator-expression + "\$<LINK_LIBRARY:...>" which may be used to specify how the libraries are + linked. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at forbidden-arguments.cmake:[0-9]+ \(target_link_libraries\): + Property LINK_LIBRARIES contains the invalid item "<LINK_LIBRARY:feat>". + The LINK_LIBRARIES property may contain the generator-expression + "\$<LINK_LIBRARY:...>" which may be used to specify how the libraries are + linked. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments.cmake new file mode 100644 index 0000000..1c51c44 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/forbidden-arguments.cmake @@ -0,0 +1,6 @@ +enable_language(C) + +link_libraries(<LINK_LIBRARY:feat> foo </LINK_LIBRARY:feat>) + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE <LINK_LIBRARY:feat> foo </LINK_LIBRARY:feat>) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features-stderr.txt new file mode 100644 index 0000000..22219a2 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at incompatible-features.cmake:[0-9]+ \(add_library\): + Impossible to link target 'lib' because the link item 'dep1', specified + with the feature 'feat1', has already occurred with the feature 'feat2', + which is not allowed. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features.cmake new file mode 100644 index 0000000..d96b214 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/incompatible-features.cmake @@ -0,0 +1,15 @@ +enable_language(C) + +set(CMAKE_C_LINK_USING_feat1_SUPPORTED TRUE) +set(CMAKE_C_LINK_USING_feat1 "<LIBRARY>") + +set(CMAKE_C_LINK_USING_feat2_SUPPORTED TRUE) +set(CMAKE_C_LINK_USING_feat2 "<LIBRARY>") + +add_library(dep1 SHARED empty.c) + +add_library(dep2 SHARED empty.c) +target_link_libraries(dep2 PUBLIC "$<LINK_LIBRARY:feat1,dep1>") + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE "$<LINK_LIBRARY:feat2,dep1,dep2>") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/library-ignored-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/library-ignored-stderr.txt new file mode 100644 index 0000000..f9a99af --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/library-ignored-stderr.txt @@ -0,0 +1,14 @@ +CMake Warning \(dev\) at library-ignored.cmake:[0-9]+ \(add_library\): + The feature 'feat', specified as part of a generator-expression + '\$<LINK_LIBRARY:feat>', will not be applied to the INTERFACE library + 'front'. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at library-ignored.cmake:[0-9]+ \(add_library\): + The feature 'feat', specified as part of a generator-expression + '\$<LINK_LIBRARY:feat>', will not be applied to the OBJECT library 'dep'. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/library-ignored.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/library-ignored.cmake new file mode 100644 index 0000000..e000b97 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/library-ignored.cmake @@ -0,0 +1,15 @@ +enable_language(C) + +set(CMAKE_C_LINK_USING_feat_SUPPORTED TRUE) +set(CMAKE_C_LINK_USING_feat "<LIBRARY>") + +add_library(dep OBJECT empty.c) + +add_library(lib SHARED empty.c) + +add_library(front INTERFACE) +target_link_libraries(front INTERFACE lib) + + +add_library(lib2 SHARED empty.c) +target_link_libraries(lib2 PRIVATE "$<LINK_LIBRARY:feat,front,dep>") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories-stderr.txt new file mode 100644 index 0000000..aeb32f2 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at link_directories.cmake:[0-9]+ \(link_directories\): + Error evaluating generator expression: + + \$<LINK_LIBRARY:feat> + + \$<LINK_LIBRARY:...> may only be used with binary targets to specify link + libraries. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories.cmake new file mode 100644 index 0000000..b6d9a36 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/link_directories.cmake @@ -0,0 +1,5 @@ +enable_language(C) + +link_directories("$<LINK_LIBRARY:feat>") + +add_library(empty SHARED empty.c) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-compatible-features.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-compatible-features.cmake new file mode 100644 index 0000000..d3b04e8 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-compatible-features.cmake @@ -0,0 +1,11 @@ +enable_language(C) + +set(CMAKE_C_LINK_USING_feat1_SUPPORTED TRUE) +set(CMAKE_C_LINK_USING_feat1 "<LIBRARY>") + +add_library(dep1 SHARED empty.c) + +add_library(dep2 SHARED empty.c) + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE "$<LINK_LIBRARY:feat1,dep1,$<LINK_LIBRARY:feat1,dep2>>") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-incompatible-features-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-incompatible-features-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-incompatible-features-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-incompatible-features-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-incompatible-features-stderr.txt new file mode 100644 index 0000000..3f6c504 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-incompatible-features-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at nested-incompatible-features.cmake:[0-9]+ \(target_link_libraries\): + Error evaluating generator expression: + + \$<LINK_LIBRARY:feat2,dep1,\$<LINK_LIBRARY:feat1,dep2>> + + \$<LINK_LIBRARY:...> with different features cannot be nested. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-incompatible-features.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-incompatible-features.cmake new file mode 100644 index 0000000..8565fa9 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/nested-incompatible-features.cmake @@ -0,0 +1,14 @@ +enable_language(C) + +set(CMAKE_C_LINK_USING_feat1_SUPPORTED TRUE) +set(CMAKE_C_LINK_USING_feat1 "<LIBRARY>") + +set(CMAKE_C_LINK_USING_feat2_SUPPORTED TRUE) +set(CMAKE_C_LINK_USING_feat2 "<LIBRARY>") + +add_library(dep1 SHARED empty.c) + +add_library(dep2 SHARED empty.c) + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE "$<LINK_LIBRARY:feat2,dep1,$<LINK_LIBRARY:feat1,dep2>>") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/no-arguments-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/no-arguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/no-arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/no-arguments-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/no-arguments-stderr.txt new file mode 100644 index 0000000..af58fa0 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/no-arguments-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at no-arguments.cmake:[0-9]+ \(target_link_libraries\): + Error evaluating generator expression: + + \$<LINK_LIBRARY> + + \$<LINK_LIBRARY> expression requires at least one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/no-arguments.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/no-arguments.cmake new file mode 100644 index 0000000..0645dc7 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/no-arguments.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_library(lib SHARED empty.c) +target_link_libraries(lib PRIVATE "$<LINK_LIBRARY>") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/only-targets-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/only-targets-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/only-targets-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/only-targets-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/only-targets-stderr.txt new file mode 100644 index 0000000..6b770f0 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/only-targets-stderr.txt @@ -0,0 +1,13 @@ +CMake Error at only-targets.cmake:[0-9]+ \(target_link_libraries\): + Target "lib2" has LINK_LIBRARIES_ONLY_TARGETS enabled, but it links to: + + external + + which is not a target. Possible reasons include: + + \* There is a typo in the target name. + \* A find_package call is missing for an IMPORTED target. + \* An ALIAS target is missing. + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/only-targets.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/only-targets.cmake new file mode 100644 index 0000000..e29ad6c --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/only-targets.cmake @@ -0,0 +1,16 @@ +enable_language(C) + +set(CMAKE_C_LINK_USING_feat1_SUPPORTED TRUE) +set(CMAKE_C_LINK_USING_feat1 "<LIBRARY>") + +set(CMAKE_LINK_LIBRARIES_ONLY_TARGETS 1) + +add_library(dep1 SHARED empty.c) + +add_library(lib1 SHARED empty.c) +# accepted +target_link_libraries(lib1 PRIVATE "$<LINK_LIBRARY:feat1,dep1>") + +add_library(lib2 SHARED empty.c) +# invalid +target_link_libraries(lib2 PRIVATE "$<LINK_LIBRARY:feat1,external>") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories-stderr.txt new file mode 100644 index 0000000..e0c60c4 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at target_link_directories.cmake:[0-9]+ \(target_link_directories\): + Error evaluating generator expression: + + \$<LINK_LIBRARY:feat> + + \$<LINK_LIBRARY:...> may only be used with binary targets to specify link + libraries. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories.cmake new file mode 100644 index 0000000..e8cc670 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_directories.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_library(empty SHARED empty.c) +target_link_directories(empty PRIVATE "$<LINK_LIBRARY:feat>") diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options-result.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options-stderr.txt b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options-stderr.txt new file mode 100644 index 0000000..6c9aab1 --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at target_link_options.cmake:[0-9]+ \(target_link_options\): + Error evaluating generator expression: + + \$<LINK_LIBRARY:FEAT> + + \$<LINK_LIBRARY:...> may only be used with binary targets to specify link + libraries. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options.cmake b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options.cmake new file mode 100644 index 0000000..800124c --- /dev/null +++ b/Tests/RunCMake/GenEx-LINK_LIBRARY/target_link_options.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_library(empty SHARED empty.c) +target_link_options(empty PRIVATE $<LINK_LIBRARY:FEAT>) |