diff options
Diffstat (limited to 'Tests/RunCMake/GeneratorExpression')
333 files changed, 2533 insertions, 0 deletions
diff --git a/Tests/RunCMake/GeneratorExpression/BadAND-result.txt b/Tests/RunCMake/GeneratorExpression/BadAND-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadAND-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt new file mode 100644 index 0000000..86d3e04 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt @@ -0,0 +1,55 @@ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<AND> + + \$<AND> expression requires at least one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<AND:> + + Parameters to \$<AND> must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<AND:,> + + Parameters to \$<AND> must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<AND:01> + + Parameters to \$<AND> must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<AND:nothing> + + Parameters to \$<AND> must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<AND:1,nothing> + + Parameters to \$<AND> must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/GeneratorExpression/BadAND.cmake b/Tests/RunCMake/GeneratorExpression/BadAND.cmake new file mode 100644 index 0000000..8a7993f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadAND.cmake @@ -0,0 +1,8 @@ +add_custom_target(check ALL COMMAND check + $<AND> + $<AND:> + $<AND:,> + $<AND:01> + $<AND:nothing> + $<AND:1,nothing> + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG-result.txt b/Tests/RunCMake/GeneratorExpression/BadCONFIG-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt new file mode 100644 index 0000000..42dd0ce --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt @@ -0,0 +1,37 @@ +CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<CONFIG:.> + + Expression syntax not recognized. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<CONFIG:Foo,Bar> + + \$<CONFIG> expression requires one or zero parameters. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<CONFIG:Foo-Bar> + + Expression syntax not recognized. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<CONFIG:Foo-Nested> + + Expression syntax not recognized. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake new file mode 100644 index 0000000..5c22aaa --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake @@ -0,0 +1,6 @@ +add_custom_target(check ALL COMMAND check + $<CONFIG:.> + $<CONFIG:Foo,Bar> + $<CONFIG:Foo-Bar> + $<$<CONFIG:Foo-Nested>:foo> + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadIF-result.txt b/Tests/RunCMake/GeneratorExpression/BadIF-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadIF-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadIF-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadIF-stderr.txt new file mode 100644 index 0000000..7c7506c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadIF-stderr.txt @@ -0,0 +1,15 @@ +CMake Error at BadIF.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<IF:asdf,a,b> + + First parameter to \$<IF> must resolve to exactly one '0' or '1' value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadIF.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<IF:asdf,a> + + \$<IF> expression requires 3 comma separated parameters, but got 2 instead. diff --git a/Tests/RunCMake/GeneratorExpression/BadIF.cmake b/Tests/RunCMake/GeneratorExpression/BadIF.cmake new file mode 100644 index 0000000..583f68d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadIF.cmake @@ -0,0 +1,5 @@ + +add_custom_target(check ALL COMMAND check + $<IF:asdf,a,b> + $<IF:asdf,a> + ) diff --git a/Tests/RunCMake/GeneratorExpression/BadInstallPrefix-result.txt b/Tests/RunCMake/GeneratorExpression/BadInstallPrefix-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadInstallPrefix-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadInstallPrefix-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadInstallPrefix-stderr.txt new file mode 100644 index 0000000..271eb6e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadInstallPrefix-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at BadInstallPrefix.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<INSTALL_PREFIX> + + INSTALL_PREFIX is a marker for install\(EXPORT\) only. It should never be + evaluated. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/BadInstallPrefix.cmake b/Tests/RunCMake/GeneratorExpression/BadInstallPrefix.cmake new file mode 100644 index 0000000..fcfc3eb --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadInstallPrefix.cmake @@ -0,0 +1,3 @@ +add_custom_target(check ALL COMMAND check + $<INSTALL_PREFIX>/include + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadNOT-result.txt b/Tests/RunCMake/GeneratorExpression/BadNOT-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadNOT-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt new file mode 100644 index 0000000..627327c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt @@ -0,0 +1,54 @@ +CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<NOT> + + \$<NOT> expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<NOT:> + + \$<NOT> parameter must resolve to exactly one '0' or '1' value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<NOT:,> + + \$<NOT> expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<NOT:0,1> + + \$<NOT> expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<NOT:01> + + \$<NOT> parameter must resolve to exactly one '0' or '1' value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<NOT:nothing> + + \$<NOT> parameter must resolve to exactly one '0' or '1' value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/GeneratorExpression/BadNOT.cmake b/Tests/RunCMake/GeneratorExpression/BadNOT.cmake new file mode 100644 index 0000000..c2dada3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadNOT.cmake @@ -0,0 +1,8 @@ +add_custom_target(check ALL COMMAND check + $<NOT> + $<NOT:> + $<NOT:,> + $<NOT:0,1> + $<NOT:01> + $<NOT:nothing> + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadOR-result.txt b/Tests/RunCMake/GeneratorExpression/BadOR-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadOR-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt new file mode 100644 index 0000000..56e6af0 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt @@ -0,0 +1,55 @@ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<OR> + + \$<OR> expression requires at least one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<OR:> + + Parameters to \$<OR> must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<OR:,> + + Parameters to \$<OR> must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<OR:01> + + Parameters to \$<OR> must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<OR:nothing> + + Parameters to \$<OR> must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<OR:0,nothing> + + Parameters to \$<OR> must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/GeneratorExpression/BadOR.cmake b/Tests/RunCMake/GeneratorExpression/BadOR.cmake new file mode 100644 index 0000000..c0309da --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadOR.cmake @@ -0,0 +1,8 @@ +add_custom_target(check ALL COMMAND check + $<OR> + $<OR:> + $<OR:,> + $<OR:01> + $<OR:nothing> + $<OR:0,nothing> + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadSHELL_PATH-result.txt b/Tests/RunCMake/GeneratorExpression/BadSHELL_PATH-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadSHELL_PATH-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadSHELL_PATH-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadSHELL_PATH-stderr.txt new file mode 100644 index 0000000..a08e7b2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadSHELL_PATH-stderr.txt @@ -0,0 +1,26 @@ +CMake Error at BadSHELL_PATH.cmake:[0-9]+ \(add_custom_target\): + Error evaluating generator expression: + + \$<SHELL_PATH:> + + "" is not an absolute path. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadSHELL_PATH.cmake:[0-9]+ \(add_custom_target\): + Error evaluating generator expression: + + \$<SHELL_PATH:Relative/Path> + + "Relative/Path" is not an absolute path. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadSHELL_PATH.cmake:[0-9]+ \(add_custom_target\): + Error evaluating generator expression: + + \$<SHELL_PATH:;> + + "" is not an absolute path. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/BadSHELL_PATH.cmake b/Tests/RunCMake/GeneratorExpression/BadSHELL_PATH.cmake new file mode 100644 index 0000000..0e7c342 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadSHELL_PATH.cmake @@ -0,0 +1,5 @@ +add_custom_target(check ALL COMMAND check + $<SHELL_PATH:> + $<SHELL_PATH:Relative/Path> + "$<SHELL_PATH:;>" + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadStrEqual-result.txt b/Tests/RunCMake/GeneratorExpression/BadStrEqual-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadStrEqual-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadStrEqual-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadStrEqual-stderr.txt new file mode 100644 index 0000000..2f04c78 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadStrEqual-stderr.txt @@ -0,0 +1,40 @@ +CMake Error at BadStrEqual.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<STREQUAL> + + \$<STREQUAL> expression requires 2 comma separated parameters, but got 0 + instead. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++CMake Error at BadStrEqual.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<STREQUAL:> + + \$<STREQUAL> expression requires 2 comma separated parameters, but got 1 + instead. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadStrEqual.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<STREQUAL:,,> + + \$<STREQUAL> expression requires 2 comma separated parameters, but got 3 + instead. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadStrEqual.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<STREQUAL:something,,> + + \$<STREQUAL> expression requires 2 comma separated parameters, but got 3 + instead. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/GeneratorExpression/BadStrEqual.cmake b/Tests/RunCMake/GeneratorExpression/BadStrEqual.cmake new file mode 100644 index 0000000..56eb458 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadStrEqual.cmake @@ -0,0 +1,6 @@ +add_custom_target(check ALL COMMAND check + $<STREQUAL> + $<STREQUAL:> + $<STREQUAL:,,> + $<STREQUAL:something,,> + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetName-result.txt b/Tests/RunCMake/GeneratorExpression/BadTargetName-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadTargetName-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetName-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadTargetName-stderr.txt new file mode 100644 index 0000000..98eed1f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadTargetName-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at BadTargetName.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_NAME:\$<1:tgt>> + + \$<TARGET_NAME> expression requires literal input. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetName.cmake b/Tests/RunCMake/GeneratorExpression/BadTargetName.cmake new file mode 100644 index 0000000..e125cab --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadTargetName.cmake @@ -0,0 +1,3 @@ +add_custom_target(check ALL COMMAND check + $<TARGET_NAME:$<1:tgt>> + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetTypeInterface-result.txt b/Tests/RunCMake/GeneratorExpression/BadTargetTypeInterface-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadTargetTypeInterface-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetTypeInterface-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadTargetTypeInterface-stderr.txt new file mode 100644 index 0000000..3aa457e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadTargetTypeInterface-stderr.txt @@ -0,0 +1,26 @@ +CMake Error at BadTargetTypeInterface.cmake:[0-9]+ \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_FILE:iface> + + Target "iface" is not an executable or library. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at BadTargetTypeInterface.cmake:[0-9]+ \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_SONAME_FILE:iface> + + Target "iface" is not an executable or library. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at BadTargetTypeInterface.cmake:[0-9]+ \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_LINKER_FILE:iface> + + Target "iface" is not an executable or library. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetTypeInterface.cmake b/Tests/RunCMake/GeneratorExpression/BadTargetTypeInterface.cmake new file mode 100644 index 0000000..19566f4 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadTargetTypeInterface.cmake @@ -0,0 +1,6 @@ +add_library(iface INTERFACE) +add_custom_target(check ALL COMMAND echo + $<TARGET_FILE:iface> + $<TARGET_SONAME_FILE:iface> + $<TARGET_LINKER_FILE:iface> + ) diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-result.txt b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-stderr.txt new file mode 100644 index 0000000..a597d79 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-stderr.txt @@ -0,0 +1,26 @@ +CMake Error at BadTargetTypeObject.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_FILE:objlib> + + Target "objlib" is not an executable or library. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadTargetTypeObject.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_SONAME_FILE:objlib> + + Target "objlib" is not an executable or library. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadTargetTypeObject.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_LINKER_FILE:objlib> + + Target "objlib" is not an executable or library. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject.cmake b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject.cmake new file mode 100644 index 0000000..60e2c0d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject.cmake @@ -0,0 +1,6 @@ +add_library(objlib OBJECT) +add_custom_target(check ALL COMMAND echo + $<TARGET_FILE:objlib> + $<TARGET_SONAME_FILE:objlib> + $<TARGET_LINKER_FILE:objlib> + ) diff --git a/Tests/RunCMake/GeneratorExpression/BadZero-result.txt b/Tests/RunCMake/GeneratorExpression/BadZero-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadZero-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadZero-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadZero-stderr.txt new file mode 100644 index 0000000..40db4ae --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadZero-stderr.txt @@ -0,0 +1,17 @@ +CMake Error at BadZero.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<0> + + \$<0> expression requires a parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadZero.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<0,> + + Expression did not evaluate to a known generator expression +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/BadZero.cmake b/Tests/RunCMake/GeneratorExpression/BadZero.cmake new file mode 100644 index 0000000..559a9fa --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadZero.cmake @@ -0,0 +1,5 @@ + +add_custom_target(check ALL COMMAND check + $<0> + $<0,> + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt new file mode 100644 index 0000000..2079c12 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) at CMP0044-WARN.cmake:13 \(target_compile_definitions\): + Policy CMP0044 is not set: Case sensitive <LANG>_COMPILER_ID generator + expressions. Run "cmake --help-policy CMP0044" for policy details. Use + the cmake_policy command to set the policy and suppress this warning. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake new file mode 100644 index 0000000..dfa23e0 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake @@ -0,0 +1,17 @@ + +enable_language(C) + +string(TOLOWER ${CMAKE_C_COMPILER_ID} lc_test) +if (lc_test STREQUAL CMAKE_C_COMPILER_ID) + string(TOUPPER ${CMAKE_C_COMPILER_ID} lc_test) + if (lc_test STREQUAL CMAKE_C_COMPILER_ID) + message(SEND_ERROR "Try harder.") + endif() +endif() + +add_library(cmp0044-check empty.c) +target_compile_definitions(cmp0044-check + PRIVATE + Result=$<C_COMPILER_ID:${lc_test}> + Type_Is_${CMP0044_TYPE} +) diff --git a/Tests/RunCMake/GeneratorExpression/CMP0085-NEW-check.cmake b/Tests/RunCMake/GeneratorExpression/CMP0085-NEW-check.cmake new file mode 100644 index 0000000..520bf3d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0085-NEW-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/CMP0085-NEW-generated.txt" content) + +set(expected "101011") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/CMP0085-NEW.cmake b/Tests/RunCMake/GeneratorExpression/CMP0085-NEW.cmake new file mode 100644 index 0000000..ee85c0d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0085-NEW.cmake @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT CMP0085-NEW-generated.txt CONTENT + "$<IN_LIST:,>$<IN_LIST:,a>$<IN_LIST:,;a>$<IN_LIST:a,>$<IN_LIST:a,a>$<IN_LIST:a,;a>" + ) diff --git a/Tests/RunCMake/GeneratorExpression/CMP0085-OLD-check.cmake b/Tests/RunCMake/GeneratorExpression/CMP0085-OLD-check.cmake new file mode 100644 index 0000000..c387db7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0085-OLD-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/CMP0085-OLD-generated.txt" content) + +set(expected "000011") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/CMP0085-OLD.cmake b/Tests/RunCMake/GeneratorExpression/CMP0085-OLD.cmake new file mode 100644 index 0000000..31b6a51 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0085-OLD.cmake @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT CMP0085-OLD-generated.txt CONTENT + "$<IN_LIST:,>$<IN_LIST:,a>$<IN_LIST:,;a>$<IN_LIST:a,>$<IN_LIST:a,a>$<IN_LIST:a,;a>" + ) diff --git a/Tests/RunCMake/GeneratorExpression/CMP0085-WARN-check.cmake b/Tests/RunCMake/GeneratorExpression/CMP0085-WARN-check.cmake new file mode 100644 index 0000000..f7bcf0f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0085-WARN-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/CMP0085-WARN-generated.txt" content) + +set(expected "000011") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/CMP0085-WARN-stderr.txt b/Tests/RunCMake/GeneratorExpression/CMP0085-WARN-stderr.txt new file mode 100644 index 0000000..81bd450 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0085-WARN-stderr.txt @@ -0,0 +1,33 @@ +CMake Warning \(dev\) at CMP0085-WARN\.cmake:[0-9]+ \(file\): + Policy CMP0085 is not set: \$<IN_LIST:\.\.\.> handles empty list items\. Run + "cmake --help-policy CMP0085" for policy details\. Use the cmake_policy + command to set the policy and suppress this warning\. + + Search Item: + + "" + + List: + + "" + +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 CMP0085-WARN\.cmake:[0-9]+ \(file\): + Policy CMP0085 is not set: \$<IN_LIST:\.\.\.> handles empty list items\. Run + "cmake --help-policy CMP0085" for policy details\. Use the cmake_policy + command to set the policy and suppress this warning\. + + Search Item: + + "" + + List: + + ";a" + +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/GeneratorExpression/CMP0085-WARN.cmake b/Tests/RunCMake/GeneratorExpression/CMP0085-WARN.cmake new file mode 100644 index 0000000..59c7826 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0085-WARN.cmake @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT CMP0085-WARN-generated.txt CONTENT + "$<IN_LIST:,>$<IN_LIST:,a>$<IN_LIST:,;a>$<IN_LIST:a,>$<IN_LIST:a,a>$<IN_LIST:a,;a>" + ) diff --git a/Tests/RunCMake/GeneratorExpression/CMakeLists.txt b/Tests/RunCMake/GeneratorExpression/CMakeLists.txt new file mode 100644 index 0000000..12cd3c7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-stderr.txt new file mode 100644 index 0000000..c8f773a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_custom_command.cmake:2 \(add_custom_command\): + Error evaluating generator expression: + + \$<COMPILE_LANGUAGE> + + \$<COMPILE_LANGUAGE:...> may only be used to specify include directories, + compile definitions, compile options, and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command.cmake new file mode 100644 index 0000000..c3f051a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command.cmake @@ -0,0 +1,4 @@ +add_custom_target(drive) +add_custom_command(TARGET drive PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E echo $<COMPILE_LANGUAGE> +) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-stderr.txt new file mode 100644 index 0000000..7025838 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_custom_target.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<COMPILE_LANGUAGE> + + \$<COMPILE_LANGUAGE:...> may only be used to specify include directories, + compile definitions, compile options, and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target.cmake new file mode 100644 index 0000000..b826772 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target.cmake @@ -0,0 +1,3 @@ +add_custom_target(drive + COMMAND ${CMAKE_COMMAND} -E echo $<COMPILE_LANGUAGE> +) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-stderr.txt new file mode 100644 index 0000000..8d05e59 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_executable.cmake:1 \(add_executable\): + Error evaluating generator expression: + + \$<COMPILE_LANGUAGE> + + \$<COMPILE_LANGUAGE:...> may only be used to specify include directories, + compile definitions, compile options, and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable.cmake new file mode 100644 index 0000000..ff965a9 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable.cmake @@ -0,0 +1 @@ +add_executable(empty empty.$<COMPILE_LANGUAGE>) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-stderr.txt new file mode 100644 index 0000000..2ac9b76 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_library.cmake:1 \(add_library\): + Error evaluating generator expression: + + \$<COMPILE_LANGUAGE> + + \$<COMPILE_LANGUAGE:...> may only be used to specify include directories, + compile definitions, compile options, and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library.cmake new file mode 100644 index 0000000..dd1b5a2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library.cmake @@ -0,0 +1 @@ +add_library(empty empty.$<COMPILE_LANGUAGE>) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-stderr.txt new file mode 100644 index 0000000..fd8a731 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_test.cmake:5 \(add_test\): + Error evaluating generator expression: + + \$<COMPILE_LANGUAGE> + + \$<COMPILE_LANGUAGE:...> may only be used to specify include directories, + compile definitions, compile options, and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test.cmake new file mode 100644 index 0000000..deedf65 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test.cmake @@ -0,0 +1,5 @@ + +include(CTest) +enable_testing() + +add_test(NAME dummy COMMAND ${CMAKE_COMMAND} -E echo $<COMPILE_LANGUAGE>) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-stderr.txt new file mode 100644 index 0000000..bef7f63 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-stderr.txt @@ -0,0 +1,8 @@ +CMake Error: + Error evaluating generator expression: + + \$<COMPILE_LANGUAGE> + + \$<COMPILE_LANGUAGE:...> may only be used to specify include directories, + compile definitions, compile options, and to evaluate components of the + file\(GENERATE\) command. diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install.cmake new file mode 100644 index 0000000..92c20e3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install.cmake @@ -0,0 +1,5 @@ + +install(FILES + empty.$<COMPILE_LANGUAGE> + DESTINATION src +) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-stderr.txt new file mode 100644 index 0000000..8e7f881 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-target_sources.cmake:2 \(target_sources\): + Error evaluating generator expression: + + \$<COMPILE_LANGUAGE> + + \$<COMPILE_LANGUAGE:...> may only be used to specify include directories, + compile definitions, compile options, and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources.cmake new file mode 100644 index 0000000..a4a5abb --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources.cmake @@ -0,0 +1,2 @@ +add_library(empty) +target_sources(empty PRIVATE empty.$<COMPILE_LANGUAGE>) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake new file mode 100644 index 0000000..00dd290 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_compile_options(empty PRIVATE $<$<COMPILE_LANGUAGE:CXX>:$<TARGET_EXISTS:too,many,parameters>>) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-stderr.txt new file mode 100644 index 0000000..2ee96ed --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at COMPILE_LANG_AND_ID-add_custom_command.cmake:2 \(add_custom_command\): + Error evaluating generator expression: + + \$<COMPILE_LANG_AND_ID> + + \$<COMPILE_LANG_AND_ID> expression requires at least two parameters. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command.cmake new file mode 100644 index 0000000..9bd5e8e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command.cmake @@ -0,0 +1,4 @@ +add_custom_target(drive) +add_custom_command(TARGET drive PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E echo $<COMPILE_LANG_AND_ID> +) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target-stderr.txt new file mode 100644 index 0000000..589e64b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at COMPILE_LANG_AND_ID-add_custom_target.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<COMPILE_LANG_AND_ID:LANG,ID> + + \$<COMPILE_LANG_AND_ID:lang,id> may only be used with binary targets to + specify include directories, compile definitions, and compile options. It + may not be used with the add_custom_command, add_custom_target, or + file\(GENERATE\) commands. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target.cmake new file mode 100644 index 0000000..398db19 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_target.cmake @@ -0,0 +1,4 @@ + +add_custom_target(drive + COMMAND ${CMAKE_COMMAND} -E echo $<COMPILE_LANG_AND_ID:LANG,ID> +) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable-stderr.txt new file mode 100644 index 0000000..3b3f38d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at COMPILE_LANG_AND_ID-add_executable.cmake:1 \(add_executable\): + Error evaluating generator expression: + + \$<COMPILE_LANG_AND_ID:C,MSVC> + + \$<COMPILE_LANG_AND_ID:lang,id> may only be used with binary targets to + specify include directories, compile definitions, and compile options. It + may not be used with the add_custom_command, add_custom_target, or + file\(GENERATE\) commands. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable.cmake new file mode 100644 index 0000000..2245f50 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_executable.cmake @@ -0,0 +1,5 @@ +add_executable(empty main.c + $<$<COMPILE_LANG_AND_ID:C,MSVC>:empty.c> + $<$<COMPILE_LANG_AND_ID:C,GNU>:empty2.c> + $<$<COMPILE_LANG_AND_ID:C,Clang>:empty3.c> + ) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library-stderr.txt new file mode 100644 index 0000000..4cbf000 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at COMPILE_LANG_AND_ID-add_library.cmake:2 \(add_library\): + Error evaluating generator expression: + + \$<COMPILE_LANG_AND_ID:C,MSVC> + + \$<COMPILE_LANG_AND_ID:lang,id> may only be used with binary targets to + specify include directories, compile definitions, and compile options. It + may not be used with the add_custom_command, add_custom_target, or + file\(GENERATE\) commands. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library.cmake new file mode 100644 index 0000000..044962a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_library.cmake @@ -0,0 +1,2 @@ + +add_library(empty empty.$<COMPILE_LANG_AND_ID:C,MSVC>) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test-stderr.txt new file mode 100644 index 0000000..26a5940 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at COMPILE_LANG_AND_ID-add_test.cmake:5 \(add_test\): + Error evaluating generator expression: + + \$<COMPILE_LANG_AND_ID:CXX,GNU> + + \$<COMPILE_LANG_AND_ID:lang,id> may only be used with binary targets to + specify include directories, compile definitions, and compile options. It + may not be used with the add_custom_command, add_custom_target, or + file\(GENERATE\) commands. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test.cmake new file mode 100644 index 0000000..b5b6c2b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_test.cmake @@ -0,0 +1,5 @@ + +include(CTest) +enable_testing() + +add_test(NAME dummy COMMAND ${CMAKE_COMMAND} -E echo $<COMPILE_LANG_AND_ID:CXX,GNU>) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install-stderr.txt new file mode 100644 index 0000000..0c4ecd0 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install-stderr.txt @@ -0,0 +1,9 @@ +CMake Error: + Error evaluating generator expression: + + \$<COMPILE_LANG_AND_ID:C,MSVC> + + \$<COMPILE_LANG_AND_ID:lang,id> may only be used with binary targets to + specify include directories, compile definitions, and compile options. It + may not be used with the add_custom_command, add_custom_target, or + file\(GENERATE\) commands. diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install.cmake new file mode 100644 index 0000000..c13eda6 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-install.cmake @@ -0,0 +1,5 @@ + +install(FILES + empty.$<COMPILE_LANG_AND_ID:C,MSVC> + DESTINATION src +) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-stderr.txt new file mode 100644 index 0000000..3ecbdc3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at COMPILE_LANG_AND_ID-target_sources.cmake:2 \(target_sources\): + Error evaluating generator expression: + + \$<COMPILE_LANG_AND_ID> + + \$<COMPILE_LANG_AND_ID> expression requires at least two parameters. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources.cmake new file mode 100644 index 0000000..a2c9b03 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources.cmake @@ -0,0 +1,2 @@ +add_library(empty) +target_sources(empty PRIVATE empty.$<COMPILE_LANG_AND_ID>) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-unknown-lang.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-unknown-lang.cmake new file mode 100644 index 0000000..b9e840b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-unknown-lang.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_compile_options(empty PRIVATE $<$<COMPILE_LANG_AND_ID:CXX,GNU>:$<TARGET_EXISTS:too,many,parameters>>) diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-Exclude-check.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-Exclude-check.cmake new file mode 100644 index 0000000..605ae4d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-Exclude-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/FILTER-generated.txt" content) + +set(expected "DO_NOT_FILTER_THIS;thisisanitem") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-Exclude.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-Exclude.cmake new file mode 100644 index 0000000..b879be2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-Exclude.cmake @@ -0,0 +1,4 @@ +cmake_policy(VERSION 3.11) + +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +file(GENERATE OUTPUT "FILTER-generated.txt" CONTENT "$<FILTER:${mylist},EXCLUDE,^FILTER_THIS_.+>") diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-Include-check.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-Include-check.cmake new file mode 100644 index 0000000..9d48d98 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-Include-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/FILTER-generated.txt" content) + +set(expected "FILTER_THIS_BIT;FILTER_THIS_THING") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-Include.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-Include.cmake new file mode 100644 index 0000000..5e0260a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-Include.cmake @@ -0,0 +1,4 @@ +cmake_policy(VERSION 3.11) + +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +file(GENERATE OUTPUT "FILTER-generated.txt" CONTENT "$<FILTER:${mylist},INCLUDE,^FILTER_THIS_.+>") diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-result.txt b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-stderr.txt b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-stderr.txt new file mode 100644 index 0000000..dd10925 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at FILTER-InvalidOperator.cmake:3 \(file\): + Error evaluating generator expression: + + \$<FILTER:,RM,> + + \$<FILTER:...> second parameter must be either INCLUDE or EXCLUDE +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator.cmake new file mode 100644 index 0000000..26f3917 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator.cmake @@ -0,0 +1,3 @@ +cmake_policy(VERSION 3.11) + +file(GENERATE OUTPUT "FILTER-generated.txt" CONTENT "$<FILTER:,RM,>") diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-empty-check.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-empty-check.cmake new file mode 100644 index 0000000..2844484 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-empty-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/FILTER-generated.txt" content) + +set(expected "") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-empty.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-empty.cmake new file mode 100644 index 0000000..e0fc671 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-empty.cmake @@ -0,0 +1,3 @@ +cmake_policy(VERSION 3.11) + +file(GENERATE OUTPUT "FILTER-generated.txt" CONTENT "$<FILTER:,INCLUDE,>") diff --git a/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-check.cmake b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-check.cmake new file mode 100644 index 0000000..df76740 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/GENEX_EVAL-generated.txt" content) + +set(expected "BEFORE_PROPERTY1_AFTER") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion1-result.txt b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion1-stderr.txt b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion1-stderr.txt new file mode 100644 index 0000000..012dff6 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion1-stderr.txt @@ -0,0 +1,26 @@ +^CMake Error at GENEX_EVAL-recursion1.cmake:7 \(add_custom_target\): + Error evaluating generator expression: + + \$<GENEX_EVAL:\$<TARGET_PROPERTY:CUSTOM_PROPERTY>> + + Dependency loop found. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at GENEX_EVAL-recursion1.cmake:7 \(add_custom_target\): + Loop step 1 + + \$<GENEX_EVAL:\$<TARGET_PROPERTY:CUSTOM_PROPERTY>> + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at GENEX_EVAL-recursion1.cmake:7 \(add_custom_target\): + Loop step 2 + + \$<TARGET_GENEX_EVAL:recursion,\$<TARGET_PROPERTY:recursion,CUSTOM_PROPERTY>> + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion1.cmake b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion1.cmake new file mode 100644 index 0000000..6596a81 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion1.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library (recursion SHARED empty.c) +set_property (TARGET recursion PROPERTY CUSTOM_PROPERTY "$<GENEX_EVAL:$<TARGET_PROPERTY:CUSTOM_PROPERTY>>") + +add_custom_target (drive + COMMAND echo "$<TARGET_GENEX_EVAL:recursion,$<TARGET_PROPERTY:recursion,CUSTOM_PROPERTY>>" + DEPENDS recursion) diff --git a/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2-result.txt b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2-stderr.txt b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2-stderr.txt new file mode 100644 index 0000000..ed68400 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2-stderr.txt @@ -0,0 +1,26 @@ +^CMake Error at GENEX_EVAL-recursion2.cmake:8 \(add_custom_target\): + Error evaluating generator expression: + + \$<GENEX_EVAL:\$<TARGET_PROPERTY:CUSTOM_PROPERTY2>> + + Dependency loop found. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at GENEX_EVAL-recursion2.cmake:8 \(add_custom_target\): + Loop step 1 + + \$<GENEX_EVAL:\$<TARGET_PROPERTY:CUSTOM_PROPERTY1>> + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at GENEX_EVAL-recursion2.cmake:8 \(add_custom_target\): + Loop step 2 + + \$<GENEX_EVAL:\$<TARGET_PROPERTY:CUSTOM_PROPERTY2>> + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2.cmake b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2.cmake new file mode 100644 index 0000000..773749f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL-recursion2.cmake @@ -0,0 +1,10 @@ + +enable_language(C) + +add_library(recursion SHARED empty.c) +set_property (TARGET recursion PROPERTY CUSTOM_PROPERTY1 "$<GENEX_EVAL:$<TARGET_PROPERTY:CUSTOM_PROPERTY2>>") +set_property (TARGET recursion PROPERTY CUSTOM_PROPERTY2 "$<GENEX_EVAL:$<TARGET_PROPERTY:CUSTOM_PROPERTY1>>") + +add_custom_target (drive + COMMAND echo "$<TARGET_GENEX_EVAL:recursion,$<TARGET_PROPERTY:recursion,CUSTOM_PROPERTY1>>" + DEPENDS recursion) diff --git a/Tests/RunCMake/GeneratorExpression/GENEX_EVAL.cmake b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL.cmake new file mode 100644 index 0000000..153cd17 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/GENEX_EVAL.cmake @@ -0,0 +1,12 @@ + +cmake_policy(VERSION 3.11) + +enable_language(C) + +add_library (example SHARED empty.c) +set_property (TARGET example PROPERTY CUSTOM_PROPERTY1 "PROPERTY1") +set_property (TARGET example PROPERTY CUSTOM_PROPERTY2 "$<TARGET_PROPERTY:CUSTOM_PROPERTY1>") +set_property (TARGET example PROPERTY CUSTOM_PROPERTY3 "$<GENEX_EVAL:BEFORE_$<TARGET_PROPERTY:CUSTOM_PROPERTY2>_AFTER>") +set_property (TARGET example PROPERTY CUSTOM_PROPERTY4 "$<GENEX_EVAL:$<TARGET_PROPERTY:CUSTOM_PROPERTY3>>") + +file(GENERATE OUTPUT "GENEX_EVAL-generated.txt" CONTENT "$<TARGET_GENEX_EVAL:example,$<TARGET_PROPERTY:example,CUSTOM_PROPERTY4>>") diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt new file mode 100644 index 0000000..854447f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at ImportedTarget-TARGET_BUNDLE_CONTENT_DIR.cmake:[0-9]* \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_BUNDLE_CONTENT_DIR:empty> + + TARGET_BUNDLE_CONTENT_DIR not allowed for IMPORTED targets. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]* \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR.cmake b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR.cmake new file mode 100644 index 0000000..ac2d3ce --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR.cmake @@ -0,0 +1,2 @@ +add_library(empty UNKNOWN IMPORTED) +add_custom_target(custom COMMAND echo $<TARGET_BUNDLE_CONTENT_DIR:empty>) diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR-result.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR-stderr.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR-stderr.txt new file mode 100644 index 0000000..9b97df1 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at ImportedTarget-TARGET_BUNDLE_DIR.cmake:[0-9]* \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_BUNDLE_DIR:empty> + + TARGET_BUNDLE_DIR not allowed for IMPORTED targets. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]* \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR.cmake b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR.cmake new file mode 100644 index 0000000..17c8128 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR.cmake @@ -0,0 +1,2 @@ +add_library(empty UNKNOWN IMPORTED) +add_custom_target(custom COMMAND echo $<TARGET_BUNDLE_DIR:empty>) diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE-stderr.txt new file mode 100644 index 0000000..d915ecb --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at ImportedTarget-TARGET_PDB_FILE.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_PDB_FILE:empty> + + TARGET_PDB_FILE not allowed for IMPORTED targets. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..c55c5d5 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE.cmake @@ -0,0 +1,2 @@ +add_library(empty UNKNOWN IMPORTED) +add_custom_target(custom COMMAND echo $<TARGET_PDB_FILE:empty>) diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt new file mode 100644 index 0000000..3b2a814 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at ImportedTarget-TARGET_PDB_FILE_BASE_NAME.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_PDB_FILE_BASE_NAME:empty> + + TARGET_PDB_FILE_BASE_NAME not allowed for IMPORTED targets. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME.cmake b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME.cmake new file mode 100644 index 0000000..489d8e6 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME.cmake @@ -0,0 +1,2 @@ +add_library(empty UNKNOWN IMPORTED) +add_custom_target(custom COMMAND echo $<TARGET_PDB_FILE_BASE_NAME:empty>) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_custom_command-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_custom_command-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_custom_command-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_custom_command-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_custom_command-stderr.txt new file mode 100644 index 0000000..0b0d458 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_custom_command-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at LINK_LANGUAGE-add_custom_command.cmake:2 \(add_custom_command\): + Error evaluating generator expression: + + \$<LINK_LANGUAGE> + + \$<LINK_LANGUAGE:...> may only be used with binary targets to specify link + libraries, link directories, link options and link depends. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_custom_command.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_custom_command.cmake new file mode 100644 index 0000000..a378c1c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-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_LANGUAGE> +) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_custom_target-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_custom_target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_custom_target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_custom_target-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_custom_target-stderr.txt new file mode 100644 index 0000000..92da634 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_custom_target-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at LINK_LANGUAGE-add_custom_target.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<LINK_LANGUAGE> + + \$<LINK_LANGUAGE:...> may only be used with binary targets to specify link + libraries, link directories, link options and link depends. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_custom_target.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_custom_target.cmake new file mode 100644 index 0000000..60b6c75 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_custom_target.cmake @@ -0,0 +1,3 @@ +add_custom_target(drive + COMMAND ${CMAKE_COMMAND} -E echo $<LINK_LANGUAGE> +) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_executable-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_executable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_executable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_executable-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_executable-stderr.txt new file mode 100644 index 0000000..3bdc8e4 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_executable-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at LINK_LANGUAGE-add_executable.cmake:1 \(add_executable\): + Error evaluating generator expression: + + \$<LINK_LANGUAGE> + + \$<LINK_LANGUAGE:...> may only be used with binary targets to specify link + libraries, link directories, link options and link depends. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_executable.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_executable.cmake new file mode 100644 index 0000000..2176b39 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_executable.cmake @@ -0,0 +1 @@ +add_executable(empty empty.$<LINK_LANGUAGE>) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_library-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_library-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_library-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_library-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_library-stderr.txt new file mode 100644 index 0000000..1bacdeb --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_library-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at LINK_LANGUAGE-add_library.cmake:1 \(add_library\): + Error evaluating generator expression: + + \$<LINK_LANGUAGE> + + \$<LINK_LANGUAGE:...> may only be used with binary targets to specify link + libraries, link directories, link options and link depends. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_library.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_library.cmake new file mode 100644 index 0000000..253f82a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_library.cmake @@ -0,0 +1 @@ +add_library(empty empty.$<LINK_LANGUAGE>) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_test-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_test-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_test-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_test-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_test-stderr.txt new file mode 100644 index 0000000..f22efde --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_test-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at LINK_LANGUAGE-add_test.cmake:5 \(add_test\): + Error evaluating generator expression: + + \$<LINK_LANGUAGE> + + \$<LINK_LANGUAGE:...> may only be used with binary targets to specify link + libraries, link directories, link options and link depends. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_test.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_test.cmake new file mode 100644 index 0000000..4fd547d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-add_test.cmake @@ -0,0 +1,5 @@ + +include(CTest) +enable_testing() + +add_test(NAME dummy COMMAND ${CMAKE_COMMAND} -E echo $<LINK_LANGUAGE>) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-file_generate-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-file_generate-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-file_generate-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-file_generate-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-file_generate-stderr.txt new file mode 100644 index 0000000..21d26de --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-file_generate-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at LINK_LANGUAGE-file_generate.cmake:3 \(file\): + Error evaluating generator expression: + + \$<LINK_LANGUAGE> + + \$<LINK_LANGUAGE:...> may only be used with binary targets to specify link + libraries, link directories, link options and link depends. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-file_generate.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-file_generate.cmake new file mode 100644 index 0000000..519b883 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-file_generate.cmake @@ -0,0 +1,6 @@ +enable_language(CXX C) + +file(GENERATE + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/output.txt + CONTENT "LANG_IS_$<LINK_LANGUAGE>\n" +) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-install-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-install-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-install-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-install-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-install-stderr.txt new file mode 100644 index 0000000..73afc33 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-install-stderr.txt @@ -0,0 +1,10 @@ +CMake Error: + Error evaluating generator expression: + + \$<LINK_LANGUAGE> + + \$<LINK_LANGUAGE:...> may only be used with binary targets to specify link + libraries, link directories, link options and link depends. + + +CMake Generate step failed. Build files cannot be regenerated correctly. diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-install.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-install.cmake new file mode 100644 index 0000000..533c0b4 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-install.cmake @@ -0,0 +1,5 @@ + +install(FILES + empty.$<LINK_LANGUAGE> + DESTINATION src +) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-target_sources-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-target_sources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-target_sources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-target_sources-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-target_sources-stderr.txt new file mode 100644 index 0000000..d8121cc --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-target_sources-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at LINK_LANGUAGE-target_sources.cmake:2 \(target_sources\): + Error evaluating generator expression: + + \$<LINK_LANGUAGE> + + \$<LINK_LANGUAGE:...> may only be used with binary targets to specify link + libraries, link directories, link options and link depends. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-target_sources.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-target_sources.cmake new file mode 100644 index 0000000..c134c01 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-target_sources.cmake @@ -0,0 +1,2 @@ +add_library(empty) +target_sources(empty PRIVATE empty.$<LINK_LANGUAGE>) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-unknown-lang.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-unknown-lang.cmake new file mode 100644 index 0000000..0ba472d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-unknown-lang.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_link_options(empty PRIVATE $<$<LINK_LANGUAGE:CXX>:$<TARGET_EXISTS:too,many,parameters>>) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage1-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage1-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage1-stderr.txt new file mode 100644 index 0000000..1e3a83b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage1-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at LINK_LANGUAGE-wrong-usage1.cmake:4 \(target_compile_definitions\): + Error evaluating generator expression: + + \$<LINK_LANGUAGE:C> + + \$<LINK_LANGUAGE:...> may only be used with binary targets to specify link + libraries, link directories, link options and link depends. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage1.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage1.cmake new file mode 100644 index 0000000..90b7ce0 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage1.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_compile_definitions(empty PRIVATE $<$<LINK_LANGUAGE:C>:DEF>) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage2-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage2-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage2-stderr.txt new file mode 100644 index 0000000..7fe4310 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage2-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at LINK_LANGUAGE-wrong-usage2.cmake:4 \(target_compile_options\): + Error evaluating generator expression: + + \$<LINK_LANGUAGE:C> + + \$<LINK_LANGUAGE:...> may only be used with binary targets to specify link + libraries, link directories, link options and link depends. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage2.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage2.cmake new file mode 100644 index 0000000..e761897 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage2.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_compile_options(empty PRIVATE $<$<LINK_LANGUAGE:C>:-OPT>) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage3-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage3-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage3-stderr.txt new file mode 100644 index 0000000..cb20e99 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage3-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at LINK_LANGUAGE-wrong-usage3.cmake:4 \(target_include_directories\): + Error evaluating generator expression: + + \$<LINK_LANGUAGE:C> + + \$<LINK_LANGUAGE:...> may only be used with binary targets to specify link + libraries, link directories, link options and link depends. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage3.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage3.cmake new file mode 100644 index 0000000..96a72a1 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage3.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_include_directories(empty PRIVATE $<$<LINK_LANGUAGE:C>:/DIR>) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage4-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage4-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage4-stderr.txt new file mode 100644 index 0000000..ee36912 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage4-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at LINK_LANGUAGE-wrong-usage4.cmake:7 \(target_link_libraries\): + Error evaluating generator expression: + + \$<LINK_LANGUAGE> + + \$<LINK_LANGUAGE> is not supported in link libraries expression. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage4.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage4.cmake new file mode 100644 index 0000000..3ecaabb --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANGUAGE-wrong-usage4.cmake @@ -0,0 +1,7 @@ + +enable_language(C) + +add_library(libC empty.c) + +add_executable(empty empty.c) +target_link_libraries(empty PRIVATE lib$<LINK_LANGUAGE>) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_custom_command-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_custom_command-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_custom_command-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_custom_command-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_custom_command-stderr.txt new file mode 100644 index 0000000..2ff62bc --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_custom_command-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at LINK_LANG_AND_ID-add_custom_command.cmake:2 \(add_custom_command\): + Error evaluating generator expression: + + \$<LINK_LANG_AND_ID:LANG,ID> + + \$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify + link libraries, link directories, link options, and link depends. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_custom_command.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_custom_command.cmake new file mode 100644 index 0000000..9df9232 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-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_LANG_AND_ID:LANG,ID> +) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_custom_target-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_custom_target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_custom_target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_custom_target-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_custom_target-stderr.txt new file mode 100644 index 0000000..0749c44 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_custom_target-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at LINK_LANG_AND_ID-add_custom_target.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<LINK_LANG_AND_ID:LANG,ID> + + \$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify + link libraries, link directories, link options, and link depends. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_custom_target.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_custom_target.cmake new file mode 100644 index 0000000..e5f76bc --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_custom_target.cmake @@ -0,0 +1,4 @@ + +add_custom_target(drive + COMMAND ${CMAKE_COMMAND} -E echo $<LINK_LANG_AND_ID:LANG,ID> +) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_executable-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_executable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_executable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_executable-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_executable-stderr.txt new file mode 100644 index 0000000..595312a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_executable-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at LINK_LANG_AND_ID-add_executable.cmake:1 \(add_executable\): + Error evaluating generator expression: + + \$<LINK_LANG_AND_ID:C,MSVC> + + \$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify + link libraries, link directories, link options, and link depends. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_executable.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_executable.cmake new file mode 100644 index 0000000..4d6c674 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_executable.cmake @@ -0,0 +1,5 @@ +add_executable(empty main.c + $<$<LINK_LANG_AND_ID:C,MSVC>:empty.c> + $<$<LINK_LANG_AND_ID:C,GNU>:empty2.c> + $<$<LINK_LANG_AND_ID:C,Clang>:empty3.c> + ) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_library-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_library-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_library-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_library-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_library-stderr.txt new file mode 100644 index 0000000..be46e28 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_library-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at LINK_LANG_AND_ID-add_library.cmake:2 \(add_library\): + Error evaluating generator expression: + + \$<LINK_LANG_AND_ID:C,MSVC> + + \$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify + link libraries, link directories, link options, and link depends. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_library.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_library.cmake new file mode 100644 index 0000000..a8199cf --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_library.cmake @@ -0,0 +1,2 @@ + +add_library(empty empty.$<LINK_LANG_AND_ID:C,MSVC>) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_test-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_test-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_test-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_test-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_test-stderr.txt new file mode 100644 index 0000000..2a29492 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_test-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at LINK_LANG_AND_ID-add_test.cmake:5 \(add_test\): + Error evaluating generator expression: + + \$<LINK_LANG_AND_ID:CXX,GNU> + + \$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify + link libraries, link directories, link options, and link depends. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_test.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_test.cmake new file mode 100644 index 0000000..fd700d7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-add_test.cmake @@ -0,0 +1,5 @@ + +include(CTest) +enable_testing() + +add_test(NAME dummy COMMAND ${CMAKE_COMMAND} -E echo $<LINK_LANG_AND_ID:CXX,GNU>) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-file_generate-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-file_generate-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-file_generate-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-file_generate-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-file_generate-stderr.txt new file mode 100644 index 0000000..e57b55c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-file_generate-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at LINK_LANG_AND_ID-file_generate.cmake:3 \(file\): + Error evaluating generator expression: + + \$<LINK_LANG_AND_ID:C,GNU> + + \$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify + link libraries, link directories, link options, and link depends. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-file_generate.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-file_generate.cmake new file mode 100644 index 0000000..67c1bda --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-file_generate.cmake @@ -0,0 +1,6 @@ +enable_language(CXX C) + +file(GENERATE + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/output.txt + CONTENT "LANG_IS_$<$<LINK_LANG_AND_ID:C,GNU>:C>\n" +) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-install-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-install-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-install-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-install-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-install-stderr.txt new file mode 100644 index 0000000..965f974 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-install-stderr.txt @@ -0,0 +1,10 @@ +CMake Error: + Error evaluating generator expression: + + \$<LINK_LANG_AND_ID:C,MSVC> + + \$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify + link libraries, link directories, link options, and link depends. + + +CMake Generate step failed. Build files cannot be regenerated correctly. diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-install.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-install.cmake new file mode 100644 index 0000000..b8f9323 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-install.cmake @@ -0,0 +1,5 @@ + +install(FILES + empty.$<LINK_LANG_AND_ID:C,MSVC> + DESTINATION src +) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-target_sources-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-target_sources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-target_sources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-target_sources-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-target_sources-stderr.txt new file mode 100644 index 0000000..e86602a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-target_sources-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at LINK_LANG_AND_ID-target_sources.cmake:2 \(target_sources\): + Error evaluating generator expression: + + \$<LINK_LANG_AND_ID> + + \$<LINK_LANG_AND_ID> expression requires at least two parameters. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-target_sources.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-target_sources.cmake new file mode 100644 index 0000000..da5faf4 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-target_sources.cmake @@ -0,0 +1,2 @@ +add_library(empty) +target_sources(empty PRIVATE empty.$<LINK_LANG_AND_ID>) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-unknown-lang.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-unknown-lang.cmake new file mode 100644 index 0000000..99dd337 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-unknown-lang.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_link_options(empty PRIVATE $<$<LINK_LANG_AND_ID:CXX,GNU>:$<TARGET_EXISTS:too,many,parameters>>) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage1-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage1-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage1-stderr.txt new file mode 100644 index 0000000..95611c3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage1-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at LINK_LANG_AND_ID-wrong-usage1.cmake:4 \(target_compile_definitions\): + Error evaluating generator expression: + + \$<LINK_LANG_AND_ID:C,GNU> + + \$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify + link libraries, link directories, link options, and link depends. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage1.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage1.cmake new file mode 100644 index 0000000..e58e3b44 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage1.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_compile_definitions(empty PRIVATE $<$<LINK_LANG_AND_ID:C,GNU>:DEF>) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage2-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage2-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage2-stderr.txt new file mode 100644 index 0000000..53bdcb2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage2-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at LINK_LANG_AND_ID-wrong-usage2.cmake:4 \(target_compile_options\): + Error evaluating generator expression: + + \$<LINK_LANG_AND_ID:C,GNU> + + \$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify + link libraries, link directories, link options, and link depends. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage2.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage2.cmake new file mode 100644 index 0000000..998daa9 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage2.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_compile_options(empty PRIVATE $<$<LINK_LANG_AND_ID:C,GNU>:-OPT>) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage3-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage3-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage3-stderr.txt new file mode 100644 index 0000000..a34a2ea --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage3-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at LINK_LANG_AND_ID-wrong-usage3.cmake:4 \(target_include_directories\): + Error evaluating generator expression: + + \$<LINK_LANG_AND_ID:C,GNU> + + \$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify + link libraries, link directories, link options, and link depends. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage3.cmake b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage3.cmake new file mode 100644 index 0000000..0543056 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_LANG_AND_ID-wrong-usage3.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_include_directories(empty PRIVATE $<$<LINK_LANG_AND_ID:C,GNU>:/DIR>) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking-stderr.txt new file mode 100644 index 0000000..cded130 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at LINK_ONLY-not-linking.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<LINK_ONLY:something> + + \$<LINK_ONLY:...> may only be used for linking +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking.cmake b/Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking.cmake new file mode 100644 index 0000000..16db0a2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking.cmake @@ -0,0 +1 @@ +add_custom_target(Custom ALL COMMAND ${CMAKE_COMMAND} -E echo $<LINK_ONLY:something>) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt new file mode 100644 index 0000000..831edad --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidCompiler-TARGET_PDB_FILE.cmake:6 \(file\): + Error evaluating generator expression: + + \$<TARGET_PDB_FILE:empty> + + TARGET_PDB_FILE is not supported by the target linker. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..84a2b2e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_PDB_FILE:empty>]" +) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-stderr.txt new file mode 100644 index 0000000..b061ce3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake:6 \(file\): + Error evaluating generator expression: + + \$<TARGET_PDB_FILE_BASE_NAME:empty> + + TARGET_PDB_FILE_BASE_NAME is not supported by the target linker. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake new file mode 100644 index 0000000..811c3f7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_PDB_FILE_BASE_NAME:empty>]" +) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID-stderr.txt new file mode 100644 index 0000000..0c21aa6 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget-CXX_COMPILER_ID.cmake:1 \(add_custom_command\): + Error evaluating generator expression: + + \$<CXX_COMPILER_ID> + + \$<CXX_COMPILER_ID> may only be used with binary targets. It may not be + used with add_custom_command or add_custom_target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID.cmake new file mode 100644 index 0000000..a9fb092 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID.cmake @@ -0,0 +1,4 @@ +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<CXX_COMPILER_ID>.cpp" +) +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION-stderr.txt new file mode 100644 index 0000000..fae1bd2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget-CXX_COMPILER_VERSION.cmake:1 \(add_custom_command\): + Error evaluating generator expression: + + \$<CXX_COMPILER_VERSION> + + \$<CXX_COMPILER_VERSION> may only be used with binary targets. It may not + be used with add_custom_command or add_custom_target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION.cmake new file mode 100644 index 0000000..41610c4 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION.cmake @@ -0,0 +1,4 @@ +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<CXX_COMPILER_VERSION>.cpp" +) +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID-stderr.txt new file mode 100644 index 0000000..337b299 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget-C_COMPILER_ID.cmake:1 \(add_custom_command\): + Error evaluating generator expression: + + \$<C_COMPILER_ID> + + \$<C_COMPILER_ID> may only be used with binary targets. It may not be used + with add_custom_command or add_custom_target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID.cmake new file mode 100644 index 0000000..1b02431 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID.cmake @@ -0,0 +1,4 @@ +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.c" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<C_COMPILER_ID>.c" +) +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c") diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION-stderr.txt new file mode 100644 index 0000000..d8548b5 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget-C_COMPILER_VERSION.cmake:1 \(add_custom_command\): + Error evaluating generator expression: + + \$<C_COMPILER_VERSION> + + \$<C_COMPILER_VERSION> may only be used with binary targets. It may not be + used with add_custom_command or add_custom_target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION.cmake new file mode 100644 index 0000000..bc1ffe0 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION.cmake @@ -0,0 +1,4 @@ +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.c" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<C_COMPILER_VERSION>.c" +) +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c") diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID-stderr.txt new file mode 100644 index 0000000..fc13248 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget-Fortran_COMPILER_ID.cmake:1 \(add_custom_command\): + Error evaluating generator expression: + + \$<Fortran_COMPILER_ID> + + \$<Fortran_COMPILER_ID> may only be used with binary targets. It may not be + used with add_custom_command or add_custom_target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID.cmake new file mode 100644 index 0000000..88a0bfb --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID.cmake @@ -0,0 +1,4 @@ +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.c" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<Fortran_COMPILER_ID>.c" +) +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c") diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION-stderr.txt new file mode 100644 index 0000000..f8a4120 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget-Fortran_COMPILER_VERSION.cmake:1 \(add_custom_command\): + Error evaluating generator expression: + + \$<Fortran_COMPILER_VERSION> + + \$<Fortran_COMPILER_VERSION> may only be used with binary targets. It may + not be used with add_custom_command or add_custom_target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION.cmake new file mode 100644 index 0000000..34a4884 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION.cmake @@ -0,0 +1,4 @@ +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.c" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<Fortran_COMPILER_VERSION>.c" +) +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c") diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt new file mode 100644 index 0000000..03c02d9 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidTarget-TARGET_BUNDLE_CONTENT_DIR.cmake:[0-9]* \(file\): + Error evaluating generator expression: + + \$<TARGET_BUNDLE_CONTENT_DIR:empty> + + TARGET_BUNDLE_CONTENT_DIR is allowed only for Bundle targets. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]* \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR.cmake new file mode 100644 index 0000000..63b3b1b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_BUNDLE_CONTENT_DIR:empty>]" +) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR-stderr.txt new file mode 100644 index 0000000..f895c88 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidTarget-TARGET_BUNDLE_DIR.cmake:[0-9]* \(file\): + Error evaluating generator expression: + + \$<TARGET_BUNDLE_DIR:empty> + + TARGET_BUNDLE_DIR is allowed only for Bundle targets. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]* \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR.cmake new file mode 100644 index 0000000..19f333a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_BUNDLE_DIR:empty>]" +) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt new file mode 100644 index 0000000..e5f21e2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidTarget-TARGET_PDB_FILE.cmake:6 \(file\): + Error evaluating generator expression: + + \$<TARGET_PDB_FILE:empty> + + TARGET_PDB_FILE is allowed only for targets with linker created artifacts. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..84a2b2e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_PDB_FILE:empty>]" +) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt new file mode 100644 index 0000000..c7d245c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake:6 \(file\): + Error evaluating generator expression: + + \$<TARGET_PDB_FILE_BASE_NAME:empty> + + TARGET_PDB_FILE_BASE_NAME is allowed only for targets with linker created + artifacts. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake new file mode 100644 index 0000000..811c3f7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_PDB_FILE_BASE_NAME:empty>]" +) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY-stderr.txt new file mode 100644 index 0000000..4babf43 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget-TARGET_POLICY.cmake:1 \(add_custom_command\): + Error evaluating generator expression: + + \$<TARGET_POLICY:CMP0004> + + \$<TARGET_POLICY:prop> may only be used with binary targets. It may not be + used with add_custom_command or add_custom_target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY.cmake new file mode 100644 index 0000000..55d8a99 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY.cmake @@ -0,0 +1,4 @@ +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<TARGET_POLICY:CMP0004>.cpp" +) +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY-stderr.txt new file mode 100644 index 0000000..c414947 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at NonValidTarget-TARGET_PROPERTY.cmake:1 \(add_custom_command\): + Error evaluating generator expression: + + \$<TARGET_PROPERTY:NotAProperty> + + \$<TARGET_PROPERTY:prop> may only be used with binary targets. It may not + be used with add_custom_command or add_custom_target. Specify the target + to read a property from using the \$<TARGET_PROPERTY:tgt,prop> signature + instead. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY.cmake new file mode 100644 index 0000000..9e246b2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY.cmake @@ -0,0 +1,4 @@ +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<TARGET_PROPERTY:NotAProperty>.cpp" +) +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") diff --git a/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-result.txt b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-stderr.txt b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-stderr.txt new file mode 100644 index 0000000..013c4f2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at OUTPUT_NAME-recursion.cmake:[0-9]+ \(add_executable\): + Target 'empty2' OUTPUT_NAME depends on itself. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at OUTPUT_NAME-recursion.cmake:[0-9]+ \(add_executable\): + Target 'empty2' OUTPUT_NAME depends on itself. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake new file mode 100644 index 0000000..006b0da --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake @@ -0,0 +1,6 @@ +enable_language(C) +add_executable(empty1 empty.c) +set_property(TARGET empty1 PROPERTY OUTPUT_NAME $<TARGET_FILE_NAME:empty1>) + +add_executable(empty2 empty.c) +set_property(TARGET empty2 PROPERTY OUTPUT_NAME $<TARGET_FILE_BASE_NAME:empty2>) diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-1-check.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-1-check.cmake new file mode 100644 index 0000000..e127711 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-1-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/REMOVE_DUPLICATES-generated.txt" content) + +set(expected "1") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-1.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-1.cmake new file mode 100644 index 0000000..53934af --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-1.cmake @@ -0,0 +1,3 @@ +cmake_policy(VERSION 3.11) + +file(GENERATE OUTPUT "REMOVE_DUPLICATES-generated.txt" CONTENT "$<REMOVE_DUPLICATES:1>") diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-2-check.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-2-check.cmake new file mode 100644 index 0000000..e127711 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-2-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/REMOVE_DUPLICATES-generated.txt" content) + +set(expected "1") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-2.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-2.cmake new file mode 100644 index 0000000..a8aca6e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-2.cmake @@ -0,0 +1,3 @@ +cmake_policy(VERSION 3.11) + +file(GENERATE OUTPUT "REMOVE_DUPLICATES-generated.txt" CONTENT "$<REMOVE_DUPLICATES:1$<SEMICOLON>1>") diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-3-check.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-3-check.cmake new file mode 100644 index 0000000..e3055ce --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-3-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/REMOVE_DUPLICATES-generated.txt" content) + +set(expected "2;1") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-3.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-3.cmake new file mode 100644 index 0000000..ee2dd3e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-3.cmake @@ -0,0 +1,3 @@ +cmake_policy(VERSION 3.11) + +file(GENERATE OUTPUT "REMOVE_DUPLICATES-generated.txt" CONTENT "$<REMOVE_DUPLICATES:2$<SEMICOLON>1>") diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-4-check.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-4-check.cmake new file mode 100644 index 0000000..e3055ce --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-4-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/REMOVE_DUPLICATES-generated.txt" content) + +set(expected "2;1") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-4.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-4.cmake new file mode 100644 index 0000000..557bc28 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-4.cmake @@ -0,0 +1,3 @@ +cmake_policy(VERSION 3.11) + +file(GENERATE OUTPUT "REMOVE_DUPLICATES-generated.txt" CONTENT "$<REMOVE_DUPLICATES:2$<SEMICOLON>1$<SEMICOLON>2>") diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-check.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-check.cmake new file mode 100644 index 0000000..f779d48 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/REMOVE_DUPLICATES-generated.txt" content) + +set(expected "") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty.cmake new file mode 100644 index 0000000..3b9d674 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty.cmake @@ -0,0 +1,3 @@ +cmake_policy(VERSION 3.11) + +file(GENERATE OUTPUT "REMOVE_DUPLICATES-generated.txt" CONTENT "$<REMOVE_DUPLICATES:>") diff --git a/Tests/RunCMake/GeneratorExpression/ResultValidator.cmake b/Tests/RunCMake/GeneratorExpression/ResultValidator.cmake new file mode 100644 index 0000000..722ae05 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ResultValidator.cmake @@ -0,0 +1,6 @@ + +function (CHECK_VALUE test_msg value expected) + if (NOT value STREQUAL expected) + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [[${value}]]\nbut expected:\n [[${expected}]]\n") + endif() +endfunction() diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake new file mode 100644 index 0000000..6550f84 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -0,0 +1,134 @@ +include(RunCMake) + +run_cmake(BadIF) +run_cmake(BadCONFIG) +run_cmake(BadOR) +run_cmake(BadAND) +run_cmake(BadNOT) +run_cmake(BadStrEqual) +run_cmake(BadZero) +run_cmake(BadTargetName) +run_cmake(BadTargetTypeInterface) +run_cmake(BadTargetTypeObject) +run_cmake(BadInstallPrefix) +run_cmake(BadSHELL_PATH) +run_cmake(CMP0044-WARN) +run_cmake(NonValidTarget-C_COMPILER_ID) +run_cmake(NonValidTarget-CXX_COMPILER_ID) +run_cmake(NonValidTarget-Fortran_COMPILER_ID) +run_cmake(NonValidTarget-C_COMPILER_VERSION) +run_cmake(NonValidTarget-CXX_COMPILER_VERSION) +run_cmake(NonValidTarget-Fortran_COMPILER_VERSION) +run_cmake(NonValidTarget-TARGET_BUNDLE_DIR) +run_cmake(NonValidTarget-TARGET_BUNDLE_CONTENT_DIR) +run_cmake(NonValidTarget-TARGET_PROPERTY) +run_cmake(NonValidTarget-TARGET_POLICY) +run_cmake(COMPILE_LANGUAGE-add_custom_target) +run_cmake(COMPILE_LANGUAGE-add_custom_command) +run_cmake(COMPILE_LANGUAGE-install) +run_cmake(COMPILE_LANGUAGE-target_sources) +run_cmake(COMPILE_LANGUAGE-add_executable) +run_cmake(COMPILE_LANGUAGE-add_library) +run_cmake(COMPILE_LANGUAGE-add_test) +run_cmake(COMPILE_LANGUAGE-unknown-lang) +run_cmake(COMPILE_LANG_AND_ID-add_custom_target) +run_cmake(COMPILE_LANG_AND_ID-add_custom_command) +run_cmake(COMPILE_LANG_AND_ID-install) +run_cmake(COMPILE_LANG_AND_ID-target_sources) +run_cmake(COMPILE_LANG_AND_ID-add_executable) +run_cmake(COMPILE_LANG_AND_ID-add_library) +run_cmake(COMPILE_LANG_AND_ID-add_test) +run_cmake(COMPILE_LANG_AND_ID-unknown-lang) +run_cmake(LINK_LANGUAGE-add_custom_target) +run_cmake(LINK_LANGUAGE-add_custom_command) +run_cmake(LINK_LANGUAGE-install) +run_cmake(LINK_LANGUAGE-target_sources) +run_cmake(LINK_LANGUAGE-add_executable) +run_cmake(LINK_LANGUAGE-add_library) +run_cmake(LINK_LANGUAGE-add_test) +run_cmake(LINK_LANGUAGE-unknown-lang) +run_cmake(LINK_LANGUAGE-wrong-usage1) +run_cmake(LINK_LANGUAGE-wrong-usage2) +run_cmake(LINK_LANGUAGE-wrong-usage3) +run_cmake(LINK_LANGUAGE-wrong-usage4) +run_cmake(LINK_LANGUAGE-file_generate) +run_cmake(LINK_LANG_AND_ID-add_custom_target) +run_cmake(LINK_LANG_AND_ID-add_custom_command) +run_cmake(LINK_LANG_AND_ID-install) +run_cmake(LINK_LANG_AND_ID-target_sources) +run_cmake(LINK_LANG_AND_ID-add_executable) +run_cmake(LINK_LANG_AND_ID-add_library) +run_cmake(LINK_LANG_AND_ID-add_test) +run_cmake(LINK_LANG_AND_ID-unknown-lang) +run_cmake(LINK_LANG_AND_ID-wrong-usage1) +run_cmake(LINK_LANG_AND_ID-wrong-usage2) +run_cmake(LINK_LANG_AND_ID-wrong-usage3) +run_cmake(LINK_LANG_AND_ID-file_generate) +run_cmake(TARGET_FILE-recursion) +run_cmake(OUTPUT_NAME-recursion) +run_cmake(TARGET_FILE_PREFIX) +run_cmake(TARGET_FILE_PREFIX-imported-target) +run_cmake(TARGET_FILE_PREFIX-non-valid-target) +run_cmake(TARGET_LINKER_FILE_PREFIX-non-valid-target) +run_cmake(TARGET_FILE_SUFFIX) +run_cmake(TARGET_FILE_SUFFIX-imported-target) +run_cmake(TARGET_FILE_SUFFIX-non-valid-target) +run_cmake(TARGET_LINKER_FILE_SUFFIX-non-valid-target) +run_cmake_with_options(TARGET_FILE_BASE_NAME -DCMAKE_BUILD_TYPE:STRING=Debug) +run_cmake_with_options(TARGET_FILE_BASE_NAME-imported-target -DCMAKE_BUILD_TYPE:STRING=Debug) +run_cmake(TARGET_FILE_BASE_NAME-non-valid-target) +run_cmake(TARGET_LINKER_FILE_BASE_NAME-non-valid-target) +run_cmake(TARGET_PROPERTY-INCLUDE_DIRECTORIES) +run_cmake(TARGET_PROPERTY-LOCATION) +run_cmake(TARGET_PROPERTY-SOURCES) +run_cmake(LINK_ONLY-not-linking) +run_cmake(TARGET_EXISTS-no-arg) +run_cmake(TARGET_EXISTS-empty-arg) +run_cmake(TARGET_EXISTS) +run_cmake(TARGET_EXISTS-not-a-target) +run_cmake(TARGET_NAME_IF_EXISTS-no-arg) +run_cmake(TARGET_NAME_IF_EXISTS-empty-arg) +run_cmake(TARGET_NAME_IF_EXISTS) +run_cmake(TARGET_NAME_IF_EXISTS-not-a-target) +run_cmake(TARGET_GENEX_EVAL-no-arg) +run_cmake(TARGET_GENEX_EVAL-no-target) +run_cmake(TARGET_GENEX_EVAL-non-valid-target) +run_cmake(TARGET_GENEX_EVAL-recursion1) +run_cmake(TARGET_GENEX_EVAL-recursion2) +run_cmake(TARGET_GENEX_EVAL) +run_cmake(GENEX_EVAL-recursion1) +run_cmake(GENEX_EVAL-recursion2) +run_cmake(GENEX_EVAL) +run_cmake(REMOVE_DUPLICATES-empty) +run_cmake(REMOVE_DUPLICATES-1) +run_cmake(REMOVE_DUPLICATES-2) +run_cmake(REMOVE_DUPLICATES-3) +run_cmake(REMOVE_DUPLICATES-4) +run_cmake(FILTER-empty) +run_cmake(FILTER-InvalidOperator) +run_cmake(FILTER-Exclude) +run_cmake(FILTER-Include) + +run_cmake(ImportedTarget-TARGET_BUNDLE_DIR) +run_cmake(ImportedTarget-TARGET_BUNDLE_CONTENT_DIR) +run_cmake(ImportedTarget-TARGET_PDB_FILE) +run_cmake(ImportedTarget-TARGET_PDB_FILE_BASE_NAME) +if(LINKER_SUPPORTS_PDB) + run_cmake(NonValidTarget-TARGET_PDB_FILE) + run_cmake(ValidTarget-TARGET_PDB_FILE) + run_cmake(NonValidTarget-TARGET_PDB_FILE_BASE_NAME) + run_cmake(ValidTarget-TARGET_PDB_FILE_BASE_NAME) +else() + run_cmake(NonValidCompiler-TARGET_PDB_FILE) + run_cmake(NonValidCompiler-TARGET_PDB_FILE_BASE_NAME) +endif() + +set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0085:STRING=OLD) +run_cmake(CMP0085-OLD) +unset(RunCMake_TEST_OPTIONS) + +run_cmake(CMP0085-WARN) + +set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0085:STRING=NEW) +run_cmake(CMP0085-NEW) +unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-check.cmake new file mode 100644 index 0000000..c4c3a51 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_EXISTS-generated.txt" content) + +set(expected "1") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg-stderr.txt new file mode 100644 index 0000000..1df6e28 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TARGET_EXISTS-empty-arg.cmake:2 \(file\): + Error evaluating generator expression: + + \$<TARGET_EXISTS:> + + \$<TARGET_EXISTS:tgt> expression requires a non-empty valid target name. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg.cmake new file mode 100644 index 0000000..e387abc --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_EXISTS-generated.txt CONTENT "$<TARGET_EXISTS:${empty}>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg-stderr.txt new file mode 100644 index 0000000..69e6130 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TARGET_EXISTS-no-arg.cmake:2 \(file\): + Error evaluating generator expression: + + \$<TARGET_EXISTS> + + \$<TARGET_EXISTS> expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg.cmake new file mode 100644 index 0000000..0a5ce32 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_EXISTS-generated.txt CONTENT "$<TARGET_EXISTS>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target-check.cmake new file mode 100644 index 0000000..35ba267 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_EXISTS-not-a-target-generated.txt" content) + +set(expected "0") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target.cmake new file mode 100644 index 0000000..d8a8d3e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_EXISTS-not-a-target-generated.txt CONTENT "$<TARGET_EXISTS:just-random-string>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS.cmake new file mode 100644 index 0000000..9a83b34 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0070 NEW) +add_custom_target(foo) +file(GENERATE OUTPUT TARGET_EXISTS-generated.txt CONTENT "$<TARGET_EXISTS:foo>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE-recursion-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_FILE-recursion-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE-recursion-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE-recursion-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_FILE-recursion-stderr.txt new file mode 100644 index 0000000..5b15526 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE-recursion-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at TARGET_FILE-recursion.cmake:[0-9]+ \(add_executable\): + Target 'empty1' OUTPUT_DIRECTORY depends on itself. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE-recursion.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE-recursion.cmake new file mode 100644 index 0000000..e780103 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE-recursion.cmake @@ -0,0 +1,4 @@ +enable_language(C) +add_executable(empty1 empty.c) +set_property(TARGET empty1 PROPERTY OUTPUT_NAME $<TARGET_FILE_NAME:empty1>) +set_property(TARGET empty1 PROPERTY RUNTIME_OUTPUT_DIRECTORY $<TARGET_FILE_DIR:empty1>) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-check.cmake new file mode 100644 index 0000000..793edb1 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_FILE_BASE_NAME-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target-check.cmake new file mode 100644 index 0000000..793edb1 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_FILE_BASE_NAME-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake new file mode 100644 index 0000000..40f7c66 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake @@ -0,0 +1,106 @@ + +cmake_minimum_required(VERSION 3.14) + +enable_language (C) + +set (GENERATE_CONTENT [[ +macro (CHECK_VALUE test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() +]]) + +add_executable(exec1 IMPORTED) +add_library (shared1 SHARED IMPORTED) +add_library (static1 STATIC IMPORTED) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable default" "$<TARGET_FILE_BASE_NAME:exec1>" "exec1") +check_value ("TARGET_FILE_BASE_NAME shared default" "$<TARGET_FILE_BASE_NAME:shared1>" "shared1") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker default" "$<TARGET_LINKER_FILE_BASE_NAME:shared1>" "shared1") +check_value ("TARGET_FILE_BASE_NAME static default" "$<TARGET_FILE_BASE_NAME:static1>" "static1") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker default" "$<TARGET_LINKER_FILE_BASE_NAME:static1>" "static1") +]]) + + +add_executable (exec2 IMPORTED) +set_property (TARGET exec2 PROPERTY OUTPUT_NAME exec2_custom) +add_library (shared2 SHARED IMPORTED) +set_property (TARGET shared2 PROPERTY OUTPUT_NAME shared2_custom) +add_library (static2 STATIC IMPORTED) +set_property (TARGET static2 PROPERTY OUTPUT_NAME static2_custom) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable custom" "$<TARGET_FILE_BASE_NAME:exec2>" "exec2_custom") +check_value ("TARGET_FILE_BASE_NAME shared custom" "$<TARGET_FILE_BASE_NAME:shared2>" "shared2_custom") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker custom" "$<TARGET_LINKER_FILE_BASE_NAME:shared2>" "shared2_custom") +check_value ("TARGET_FILE_BASE_NAME static custom" "$<TARGET_FILE_BASE_NAME:static2>" "static2_custom") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker custom" "$<TARGET_LINKER_FILE_BASE_NAME:static2>" "static2_custom") +]]) + + +add_executable (exec3 IMPORTED) +set_property (TARGET exec3 PROPERTY RUNTIME_OUTPUT_NAME exec3_runtime) +set_property (TARGET exec3 PROPERTY LIBRARY_OUTPUT_NAME exec3_library) +set_property (TARGET exec3 PROPERTY ARCHIVE_OUTPUT_NAME exec3_archive) +add_library (shared3 SHARED IMPORTED) +set_property (TARGET shared3 PROPERTY RUNTIME_OUTPUT_NAME shared3_runtime) +set_property (TARGET shared3 PROPERTY LIBRARY_OUTPUT_NAME shared3_library) +set_property (TARGET shared3 PROPERTY ARCHIVE_OUTPUT_NAME shared3_archive) +add_library (static3 STATIC IMPORTED) +set_property (TARGET static3 PROPERTY RUNTIME_OUTPUT_NAME static3_runtime) +set_property (TARGET static3 PROPERTY LIBRARY_OUTPUT_NAME static3_library) +set_property (TARGET static3 PROPERTY ARCHIVE_OUTPUT_NAME static3_archive) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable all properties" "$<TARGET_FILE_BASE_NAME:exec3>" "exec3_runtime") +check_value ("TARGET_FILE_BASE_NAME shared all properties" "$<TARGET_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_runtime,shared3_library>") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_archive,shared3_library>") +check_value ("TARGET_FILE_BASE_NAME static all properties" "$<TARGET_FILE_BASE_NAME:static3>" "static3_archive") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:static3>" "static3_archive") +]]) + + +unset(GENERATE_CONDITION) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) + list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) + set(GENERATE_CONDITION CONDITION $<CONFIG:${FIRST_CONFIG}>) +else() + set (FIRST_CONFIG ${CMAKE_BUILD_TYPE}) +endif() +string (TOUPPER "${FIRST_CONFIG}" FIRST_CONFIG) + + +add_executable (exec4 IMPORTED) +set_property (TARGET exec4 PROPERTY RUNTIME_OUTPUT_NAME exec4_runtime) +set_property (TARGET exec4 PROPERTY LIBRARY_OUTPUT_NAME exec4_library) +set_property (TARGET exec4 PROPERTY ARCHIVE_OUTPUT_NAME exec4_archive) +set_property (TARGET exec4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) +add_library (shared4 SHARED IMPORTED) +set_property (TARGET shared4 PROPERTY RUNTIME_OUTPUT_NAME shared4_runtime) +set_property (TARGET shared4 PROPERTY LIBRARY_OUTPUT_NAME shared4_library) +set_property (TARGET shared4 PROPERTY ARCHIVE_OUTPUT_NAME shared4_archive) +set_property (TARGET shared4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) +add_library (static4 STATIC IMPORTED) +set_property (TARGET static4 PROPERTY RUNTIME_OUTPUT_NAME static4_runtime) +set_property (TARGET static4 PROPERTY LIBRARY_OUTPUT_NAME static4_library) +set_property (TARGET static4 PROPERTY ARCHIVE_OUTPUT_NAME static4_archive) +set_property (TARGET static4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable all properties + postfix" "$<TARGET_FILE_BASE_NAME:exec4>" "exec4_runtime_postfix") +check_value ("TARGET_FILE_BASE_NAME shared all properties + postfix" "$<TARGET_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_runtime,shared4_library>_postfix") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_archive,shared4_library>_postfix") +check_value ("TARGET_FILE_BASE_NAME static all properties + postfix" "$<TARGET_FILE_BASE_NAME:static4>" "static4_archive_postfix") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:static4>" "static4_archive_postfix") +]]) + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_BASE_NAME-generated.cmake" + CONTENT "${GENERATE_CONTENT}" ${GENERATE_CONDITION}) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-stderr.txt new file mode 100644 index 0000000..ecb9e5d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_FILE_BASE_NAME-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<TARGET_FILE_BASE_NAME:empty> + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target.cmake new file mode 100644 index 0000000..8622b7d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target.cmake @@ -0,0 +1,7 @@ + +add_custom_target(empty) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_FILE_BASE_NAME:empty>]" +) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake new file mode 100644 index 0000000..f88d710 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake @@ -0,0 +1,135 @@ + +cmake_minimum_required(VERSION 3.14) + +enable_language (C) + +set (GENERATE_CONTENT [[ +macro (CHECK_VALUE test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() +]]) + +add_executable (exec1 empty.c) +add_library (shared1 SHARED empty.c) +add_library (static1 STATIC empty.c) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable default" "$<TARGET_FILE_BASE_NAME:exec1>" "exec1") +check_value ("TARGET_FILE_BASE_NAME shared default" "$<TARGET_FILE_BASE_NAME:shared1>" "shared1") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker default" "$<TARGET_LINKER_FILE_BASE_NAME:shared1>" "shared1") +check_value ("TARGET_FILE_BASE_NAME static default" "$<TARGET_FILE_BASE_NAME:static1>" "static1") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker default" "$<TARGET_LINKER_FILE_BASE_NAME:static1>" "static1") +]]) +if (CMAKE_C_LINKER_SUPPORTS_PDB) + string(APPEND GENERATE_CONTENT [[ +check_value ("TARGET_PDB_FILE_BASE_NAME executable PDB default" "$<TARGET_PDB_FILE_BASE_NAME:exec1>" "exec1") +check_value ("TARGET_PDB_FILE_BASE_NAME shared PDB default" "$<TARGET_PDB_FILE_BASE_NAME:shared1>" "shared1") +]]) +endif() + + +add_executable (exec2 empty.c) +set_property (TARGET exec2 PROPERTY OUTPUT_NAME exec2_custom) +add_library (shared2 SHARED empty.c) +set_property (TARGET shared2 PROPERTY OUTPUT_NAME shared2_custom) +add_library (static2 STATIC empty.c) +set_property (TARGET static2 PROPERTY OUTPUT_NAME static2_custom) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable custom" "$<TARGET_FILE_BASE_NAME:exec2>" "exec2_custom") +check_value ("TARGET_FILE_BASE_NAME shared custom" "$<TARGET_FILE_BASE_NAME:shared2>" "shared2_custom") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker custom" "$<TARGET_LINKER_FILE_BASE_NAME:shared2>" "shared2_custom") +check_value ("TARGET_FILE_BASE_NAME static custom" "$<TARGET_FILE_BASE_NAME:static2>" "static2_custom") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker custom" "$<TARGET_LINKER_FILE_BASE_NAME:static2>" "static2_custom") +]]) +if (CMAKE_C_LINKER_SUPPORTS_PDB) + string (APPEND GENERATE_CONTENT [[ +check_value ("TARGET_PDB_FILE_BASE_NAME executable PDB custom" "$<TARGET_PDB_FILE_BASE_NAME:exec2>" "exec2_custom") +check_value ("TARGET_PDB_FILE_BASE_NAME shared PDB custom" "$<TARGET_PDB_FILE_BASE_NAME:shared2>" "shared2_custom") + ]]) +endif() + +add_executable (exec3 empty.c) +set_property (TARGET exec3 PROPERTY RUNTIME_OUTPUT_NAME exec3_runtime) +set_property (TARGET exec3 PROPERTY LIBRARY_OUTPUT_NAME exec3_library) +set_property (TARGET exec3 PROPERTY ARCHIVE_OUTPUT_NAME exec3_archive) +set_property (TARGET exec3 PROPERTY PDB_NAME exec3_pdb) +add_library (shared3 SHARED empty.c) +set_property (TARGET shared3 PROPERTY RUNTIME_OUTPUT_NAME shared3_runtime) +set_property (TARGET shared3 PROPERTY LIBRARY_OUTPUT_NAME shared3_library) +set_property (TARGET shared3 PROPERTY ARCHIVE_OUTPUT_NAME shared3_archive) +set_property (TARGET shared3 PROPERTY PDB_NAME shared3_pdb) +add_library (static3 STATIC empty.c) +set_property (TARGET static3 PROPERTY RUNTIME_OUTPUT_NAME static3_runtime) +set_property (TARGET static3 PROPERTY LIBRARY_OUTPUT_NAME static3_library) +set_property (TARGET static3 PROPERTY ARCHIVE_OUTPUT_NAME static3_archive) +set_property (TARGET static3 PROPERTY PDB_NAME static3_pdb) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable all properties" "$<TARGET_FILE_BASE_NAME:exec3>" "exec3_runtime") +check_value ("TARGET_FILE_BASE_NAME shared all properties" "$<TARGET_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_runtime,shared3_library>") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_archive,shared3_library>") +check_value ("TARGET_FILE_BASE_NAME static all properties" "$<TARGET_FILE_BASE_NAME:static3>" "static3_archive") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:static3>" "static3_archive") +]]) +if (CMAKE_C_LINKER_SUPPORTS_PDB) + string (APPEND GENERATE_CONTENT [[ +check_value ("TARGET_PDB_FILE_BASE_NAME executable PDB all properties" "$<TARGET_PDB_FILE_BASE_NAME:exec3>" "exec3_pdb") +check_value ("TARGET_PDB_FILE_BASE_NAME shared PDB all properties" "$<TARGET_PDB_FILE_BASE_NAME:shared3>" "shared3_pdb") +]]) +endif() + + +unset(GENERATE_CONDITION) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) + list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) + set(GENERATE_CONDITION CONDITION $<CONFIG:${FIRST_CONFIG}>) +else() + set (FIRST_CONFIG ${CMAKE_BUILD_TYPE}) +endif() +string (TOUPPER "${FIRST_CONFIG}" FIRST_CONFIG) + + +add_executable (exec4 empty.c) +set_property (TARGET exec4 PROPERTY RUNTIME_OUTPUT_NAME exec4_runtime) +set_property (TARGET exec4 PROPERTY LIBRARY_OUTPUT_NAME exec4_library) +set_property (TARGET exec4 PROPERTY ARCHIVE_OUTPUT_NAME exec4_archive) +set_property (TARGET exec4 PROPERTY PDB_NAME exec4_pdb) +set_property (TARGET exec4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) +add_library (shared4 SHARED empty.c) +set_property (TARGET shared4 PROPERTY RUNTIME_OUTPUT_NAME shared4_runtime) +set_property (TARGET shared4 PROPERTY LIBRARY_OUTPUT_NAME shared4_library) +set_property (TARGET shared4 PROPERTY ARCHIVE_OUTPUT_NAME shared4_archive) +set_property (TARGET shared4 PROPERTY PDB_NAME shared4_pdb) +set_property (TARGET shared4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) +add_library (static4 STATIC empty.c) +set_property (TARGET static4 PROPERTY RUNTIME_OUTPUT_NAME static4_runtime) +set_property (TARGET static4 PROPERTY LIBRARY_OUTPUT_NAME static4_library) +set_property (TARGET static4 PROPERTY ARCHIVE_OUTPUT_NAME static4_archive) +set_property (TARGET static4 PROPERTY PDB_NAME static4_pdb) +set_property (TARGET static4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable all properties + postfix" "$<TARGET_FILE_BASE_NAME:exec4>" "exec4_runtime_postfix") +check_value ("TARGET_FILE_BASE_NAME shared all properties + postfix" "$<TARGET_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_runtime,shared4_library>_postfix") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_archive,shared4_library>_postfix") +check_value ("TARGET_FILE_BASE_NAME static all properties + postfix" "$<TARGET_FILE_BASE_NAME:static4>" "static4_archive_postfix") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:static4>" "static4_archive_postfix") +]]) +if (CMAKE_C_LINKER_SUPPORTS_PDB) + string (APPEND GENERATE_CONTENT [[ +check_value ("TARGET_PDB_FILE_BASE_NAME executable PDB all properties + postfix" "$<TARGET_PDB_FILE_BASE_NAME:exec4>" "exec4_pdb_postfix") +check_value ("TARGET_PDB_FILE_BASE_NAME shared PDB all properties + postfix" "$<TARGET_PDB_FILE_BASE_NAME:shared4>" "shared4_pdb_postfix") +]]) +endif() + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_BASE_NAME-generated.cmake" + CONTENT "${GENERATE_CONTENT}" ${GENERATE_CONDITION}) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-check.cmake new file mode 100644 index 0000000..676ad4b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_FILE_PREFIX-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-imported-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-imported-target-check.cmake new file mode 100644 index 0000000..676ad4b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-imported-target-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_FILE_PREFIX-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-imported-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-imported-target.cmake new file mode 100644 index 0000000..f52776e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-imported-target.cmake @@ -0,0 +1,49 @@ + +cmake_minimum_required(VERSION 3.14) + +enable_language (C) + +set (win_platforms Windows CYGWIN) + +set (GENERATE_CONTENT [[ +macro (CHECK_VALUE test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() +]]) + +add_executable(exec1 IMPORTED) +add_library (shared1 SHARED IMPORTED) +add_library (static1 STATIC IMPORTED) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_PREFIX executable default\" \"$<TARGET_FILE_PREFIX:exec1>\" \"\") +check_value (\"TARGET_FILE_PREFIX shared default\" \"$<TARGET_FILE_PREFIX:shared1>\" \"${CMAKE_SHARED_LIBRARY_PREFIX}\") +check_value (\"TARGET_LINKER_FILE_PREFIX shared linker default\" \"$<TARGET_LINKER_FILE_PREFIX:shared1>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms}>,${CMAKE_IMPORT_LIBRARY_PREFIX},${CMAKE_SHARED_LIBRARY_PREFIX}>\") +check_value (\"TARGET_FILE_PREFIX static default\" \"$<TARGET_FILE_PREFIX:static1>\" \"${CMAKE_STATIC_LIBRARY_PREFIX}\") +check_value (\"TARGET_LINKER_FILE_PREFIX static linker default\" \"$<TARGET_LINKER_FILE_PREFIX:static1>\" \"${CMAKE_STATIC_LIBRARY_PREFIX}\")\n") + + +add_executable (exec2 IMPORTED) +set_property (TARGET exec2 PROPERTY PREFIX exec2_prefix) +set_property (TARGET exec2 PROPERTY ENABLE_EXPORTS TRUE) +set_property (TARGET exec2 PROPERTY IMPORT_PREFIX exec2_import_prefix) +add_library (shared2 SHARED IMPORTED) +set_property (TARGET shared2 PROPERTY PREFIX shared2_prefix) +set_property (TARGET shared2 PROPERTY IMPORT_PREFIX shared2_import_prefix) +add_library (static2 STATIC IMPORTED) +set_property (TARGET static2 PROPERTY PREFIX static2_prefix) +set_property (TARGET static2 PROPERTY IMPORT_PREFIX static2_import_prefix) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_PREFIX executable custom\" \"$<TARGET_FILE_PREFIX:exec2>\" \"exec2_prefix\") +check_value (\"TARGET_LINKER_FILE_PREFIX executable linker custom\" \"$<TARGET_LINKER_FILE_PREFIX:exec2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms};AIX>,exec2_import_prefix,exec2_prefix>\") +check_value (\"TARGET_FILE_PREFIX shared custom\" \"$<TARGET_FILE_PREFIX:shared2>\" \"shared2_prefix\") +check_value (\"TARGET_LINKER_FILE_PREFIX shared linker custom\" \"$<TARGET_LINKER_FILE_PREFIX:shared2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms}>,shared2_import_prefix,shared2_prefix>\") +check_value (\"TARGET_FILE_PREFIX static custom\" \"$<TARGET_FILE_PREFIX:static2>\" \"static2_prefix\") +check_value (\"TARGET_LINKER_FILE_PREFIX static linker custom\" \"$<TARGET_LINKER_FILE_PREFIX:static2>\" \"static2_prefix\")\n") + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_PREFIX-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target-stderr.txt new file mode 100644 index 0000000..81362ef --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_FILE_PREFIX-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<TARGET_FILE_PREFIX:empty> + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target.cmake new file mode 100644 index 0000000..d1095fa --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX-non-valid-target.cmake @@ -0,0 +1,7 @@ + +add_custom_target(empty) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_FILE_PREFIX:empty>]" +) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX.cmake new file mode 100644 index 0000000..bef7bbf --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_PREFIX.cmake @@ -0,0 +1,49 @@ + +cmake_minimum_required(VERSION 3.14) + +enable_language (C) + +set (win_platforms Windows CYGWIN) + +set (GENERATE_CONTENT [[ +macro (CHECK_VALUE test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() +]]) + +add_executable (exec1 empty.c) +add_library (shared1 SHARED empty.c) +add_library (static1 STATIC empty.c) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_PREFIX executable default\" \"$<TARGET_FILE_PREFIX:exec1>\" \"\") +check_value (\"TARGET_FILE_PREFIX shared default\" \"$<TARGET_FILE_PREFIX:shared1>\" \"${CMAKE_SHARED_LIBRARY_PREFIX}\") +check_value (\"TARGET_LINKER_FILE_PREFIX shared linker default\" \"$<TARGET_LINKER_FILE_PREFIX:shared1>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms}>,${CMAKE_IMPORT_LIBRARY_PREFIX},${CMAKE_SHARED_LIBRARY_PREFIX}>\") +check_value (\"TARGET_FILE_PREFIX static default\" \"$<TARGET_FILE_PREFIX:static1>\" \"${CMAKE_STATIC_LIBRARY_PREFIX}\") +check_value (\"TARGET_LINKER_FILE_PREFIX static linker default\" \"$<TARGET_LINKER_FILE_PREFIX:static1>\" \"${CMAKE_STATIC_LIBRARY_PREFIX}\")\n") + + +add_executable (exec2 empty.c) +set_property (TARGET exec2 PROPERTY PREFIX exec2_prefix) +set_property (TARGET exec2 PROPERTY ENABLE_EXPORTS TRUE) +set_property (TARGET exec2 PROPERTY IMPORT_PREFIX exec2_import_prefix) +add_library (shared2 SHARED empty.c) +set_property (TARGET shared2 PROPERTY PREFIX shared2_prefix) +set_property (TARGET shared2 PROPERTY IMPORT_PREFIX shared2_import_prefix) +add_library (static2 STATIC empty.c) +set_property (TARGET static2 PROPERTY PREFIX static2_prefix) +set_property (TARGET static2 PROPERTY IMPORT_PREFIX static2_import_prefix) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_PREFIX executable custom\" \"$<TARGET_FILE_PREFIX:exec2>\" \"exec2_prefix\") +check_value (\"TARGET_LINKER_FILE_PREFIX executable linker custom\" \"$<TARGET_LINKER_FILE_PREFIX:exec2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms};AIX>,exec2_import_prefix,exec2_prefix>\") +check_value (\"TARGET_FILE_PREFIX shared custom\" \"$<TARGET_FILE_PREFIX:shared2>\" \"shared2_prefix\") +check_value (\"TARGET_LINKER_FILE_PREFIX shared linker custom\" \"$<TARGET_LINKER_FILE_PREFIX:shared2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms}>,shared2_import_prefix,shared2_prefix>\") +check_value (\"TARGET_FILE_PREFIX static custom\" \"$<TARGET_FILE_PREFIX:static2>\" \"static2_prefix\") +check_value (\"TARGET_LINKER_FILE_PREFIX static linker custom\" \"$<TARGET_LINKER_FILE_PREFIX:static2>\" \"static2_prefix\")\n") + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_PREFIX-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-check.cmake new file mode 100644 index 0000000..f159370 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_FILE_SUFFIX-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-imported-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-imported-target-check.cmake new file mode 100644 index 0000000..f159370 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-imported-target-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_FILE_SUFFIX-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-imported-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-imported-target.cmake new file mode 100644 index 0000000..cefeb86 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-imported-target.cmake @@ -0,0 +1,49 @@ + +cmake_minimum_required(VERSION 3.14) + +enable_language (C) + +set (win_platforms Windows CYGWIN) + +set (GENERATE_CONTENT [[ +macro (CHECK_VALUE test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() +]]) + +add_executable (exec1 IMPORTED) +add_library (shared1 SHARED IMPORTED) +add_library (static1 STATIC IMPORTED) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_SUFFIX executable default\" \"$<TARGET_FILE_SUFFIX:exec1>\" \"${CMAKE_EXECUTABLE_SUFFIX}\") +check_value (\"TARGET_FILE_SUFFIX shared default\" \"$<TARGET_FILE_SUFFIX:shared1>\" \"${CMAKE_SHARED_LIBRARY_SUFFIX}\") +check_value (\"TARGET_LINKER_FILE_SUFFIX shared linker default\" \"$<TARGET_LINKER_FILE_SUFFIX:shared1>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms}>,${CMAKE_IMPORT_LIBRARY_SUFFIX},${CMAKE_SHARED_LIBRARY_SUFFIX}>\") +check_value (\"TARGET_FILE_SUFFIX static default\" \"$<TARGET_FILE_SUFFIX:static1>\" \"${CMAKE_STATIC_LIBRARY_SUFFIX}\") +check_value (\"TARGET_LINKER_FILE_SUFFIX static linker default\" \"$<TARGET_LINKER_FILE_SUFFIX:static1>\" \"${CMAKE_STATIC_LIBRARY_SUFFIX}\")\n") + + +add_executable (exec2 IMPORTED) +set_property (TARGET exec2 PROPERTY SUFFIX exec2_suffix) +set_property (TARGET exec2 PROPERTY ENABLE_EXPORTS TRUE) +set_property (TARGET exec2 PROPERTY IMPORT_SUFFIX exec2_import_suffix) +add_library (shared2 SHARED IMPORTED) +set_property (TARGET shared2 PROPERTY SUFFIX shared2_suffix) +set_property (TARGET shared2 PROPERTY IMPORT_SUFFIX shared2_import_suffix) +add_library (static2 STATIC IMPORTED) +set_property (TARGET static2 PROPERTY SUFFIX static2_suffix) +set_property (TARGET static2 PROPERTY IMPORT_SUFFIX static2_import_suffix) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_SUFFIX executable custom\" \"$<TARGET_FILE_SUFFIX:exec2>\" \"exec2_suffix\") +check_value (\"TARGET_LINKER_FILE_SUFFIX executable linker custom\" \"$<TARGET_LINKER_FILE_SUFFIX:exec2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms};AIX>,exec2_import_suffix,exec2_suffix>\") +check_value (\"TARGET_FILE_SUFFIX shared custom\" \"$<TARGET_FILE_SUFFIX:shared2>\" \"shared2_suffix\") +check_value (\"TARGET_LINKER_FILE_SUFFIX shared linker custom\" \"$<TARGET_LINKER_FILE_SUFFIX:shared2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms}>,shared2_import_suffix,shared2_suffix>\") +check_value (\"TARGET_FILE_SUFFIX static custom\" \"$<TARGET_FILE_SUFFIX:static2>\" \"static2_suffix\") +check_value (\"TARGET_LINKER_FILE_SUFFIX static linker custom\" \"$<TARGET_LINKER_FILE_SUFFIX:static2>\" \"static2_suffix\")\n") + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_SUFFIX-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target-stderr.txt new file mode 100644 index 0000000..9ea09d1 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_FILE_SUFFIX-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<TARGET_FILE_SUFFIX:empty> + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target.cmake new file mode 100644 index 0000000..f7089f9 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX-non-valid-target.cmake @@ -0,0 +1,7 @@ + +add_custom_target(empty) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_FILE_SUFFIX:empty>]" +) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX.cmake new file mode 100644 index 0000000..39e39fd --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_SUFFIX.cmake @@ -0,0 +1,49 @@ + +cmake_minimum_required(VERSION 3.14) + +enable_language (C) + +set (win_platforms Windows CYGWIN) + +set (GENERATE_CONTENT [[ +macro (CHECK_VALUE test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() +]]) + +add_executable (exec1 empty.c) +add_library (shared1 SHARED empty.c) +add_library (static1 STATIC empty.c) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_SUFFIX executable default\" \"$<TARGET_FILE_SUFFIX:exec1>\" \"${CMAKE_EXECUTABLE_SUFFIX}\") +check_value (\"TARGET_FILE_SUFFIX shared default\" \"$<TARGET_FILE_SUFFIX:shared1>\" \"${CMAKE_SHARED_LIBRARY_SUFFIX}\") +check_value (\"TARGET_LINKER_FILE_SUFFIX shared linker default\" \"$<TARGET_LINKER_FILE_SUFFIX:shared1>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms}>,${CMAKE_IMPORT_LIBRARY_SUFFIX},${CMAKE_SHARED_LIBRARY_SUFFIX}>\") +check_value (\"TARGET_FILE_SUFFIX static default\" \"$<TARGET_FILE_SUFFIX:static1>\" \"${CMAKE_STATIC_LIBRARY_SUFFIX}\") +check_value (\"TARGET_LINKER_FILE_SUFFIX static linker default\" \"$<TARGET_LINKER_FILE_SUFFIX:static1>\" \"${CMAKE_STATIC_LIBRARY_SUFFIX}\")\n") + + +add_executable (exec2 empty.c) +set_property (TARGET exec2 PROPERTY SUFFIX exec2_suffix) +set_property (TARGET exec2 PROPERTY ENABLE_EXPORTS TRUE) +set_property (TARGET exec2 PROPERTY IMPORT_SUFFIX exec2_import_suffix) +add_library (shared2 SHARED empty.c) +set_property (TARGET shared2 PROPERTY SUFFIX shared2_suffix) +set_property (TARGET shared2 PROPERTY IMPORT_SUFFIX shared2_import_suffix) +add_library (static2 STATIC empty.c) +set_property (TARGET static2 PROPERTY SUFFIX static2_suffix) +set_property (TARGET static2 PROPERTY IMPORT_SUFFIX static2_import_suffix) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_SUFFIX executable custom\" \"$<TARGET_FILE_SUFFIX:exec2>\" \"exec2_suffix\") +check_value (\"TARGET_LINKER_FILE_SUFFIX executable linker custom\" \"$<TARGET_LINKER_FILE_SUFFIX:exec2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms};AIX>,exec2_import_suffix,exec2_suffix>\") +check_value (\"TARGET_FILE_SUFFIX shared custom\" \"$<TARGET_FILE_SUFFIX:shared2>\" \"shared2_suffix\") +check_value (\"TARGET_LINKER_FILE_SUFFIX shared linker custom\" \"$<TARGET_LINKER_FILE_SUFFIX:shared2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms}>,shared2_import_suffix,shared2_suffix>\") +check_value (\"TARGET_FILE_SUFFIX static custom\" \"$<TARGET_FILE_SUFFIX:static2>\" \"static2_suffix\") +check_value (\"TARGET_LINKER_FILE_SUFFIX static linker custom\" \"$<TARGET_LINKER_FILE_SUFFIX:static2>\" \"static2_suffix\")\n") + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_SUFFIX-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-check.cmake new file mode 100644 index 0000000..124a583 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_GENEX_EVAL-generated.txt" content) + +set(expected "BEFORE_PROPERTY1_AFTER") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-arg-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-arg-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-arg-stderr.txt new file mode 100644 index 0000000..9b0844f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-arg-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at TARGET_GENEX_EVAL-no-arg.cmake:4 \(add_custom_command\): + Error evaluating generator expression: + + \$<TARGET_GENEX_EVAL:> + + \$<TARGET_GENEX_EVAL> expression requires 2 comma separated parameters, but + got 1 instead. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-arg.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-arg.cmake new file mode 100644 index 0000000..2dc13ea --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-arg.cmake @@ -0,0 +1,7 @@ + +cmake_policy(VERSION 3.11) + +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.c" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<TARGET_GENEX_EVAL:>.c" +) +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-target-stderr.txt new file mode 100644 index 0000000..647fd85 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-target-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at TARGET_GENEX_EVAL-no-target.cmake:2 \(add_custom_command\): + Error evaluating generator expression: + + \$<TARGET_GENEX_EVAL:,> + + \$<TARGET_GENEX_EVAL:tgt, ...> expression requires a non-empty valid target + name. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-target.cmake new file mode 100644 index 0000000..df4f0ea --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-no-target.cmake @@ -0,0 +1,5 @@ + +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.c" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<TARGET_GENEX_EVAL:,>.c" +) +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-non-valid-target-stderr.txt new file mode 100644 index 0000000..cc44d4b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-non-valid-target-stderr.txt @@ -0,0 +1,8 @@ +^CMake Error at TARGET_GENEX_EVAL-non-valid-target.cmake:2 \(add_custom_command\): + Error evaluating generator expression: + + \$<TARGET_GENEX_EVAL:bad-target,> + + \$<TARGET_GENEX_EVAL:tgt, ...> target "bad-target" not found. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-non-valid-target.cmake new file mode 100644 index 0000000..8db7375 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-non-valid-target.cmake @@ -0,0 +1,5 @@ + +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.c" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<TARGET_GENEX_EVAL:bad-target,>.c" +) +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion1-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion1-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion1-stderr.txt new file mode 100644 index 0000000..bba2234 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion1-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at TARGET_GENEX_EVAL-recursion1.cmake:7 \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_GENEX_EVAL:recursion,\$<TARGET_PROPERTY:CUSTOM_PROPERTY>> + + Self reference on target "recursion". + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion1.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion1.cmake new file mode 100644 index 0000000..b75d211 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion1.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library (recursion SHARED empty.c) +set_property (TARGET recursion PROPERTY CUSTOM_PROPERTY "$<TARGET_GENEX_EVAL:recursion,$<TARGET_PROPERTY:CUSTOM_PROPERTY>>") + +add_custom_target (drive + COMMAND echo "$<TARGET_GENEX_EVAL:recursion,$<TARGET_PROPERTY:recursion,CUSTOM_PROPERTY>>" + DEPENDS recursion) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion2-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion2-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion2-stderr.txt new file mode 100644 index 0000000..73f6b77 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion2-stderr.txt @@ -0,0 +1,26 @@ +^CMake Error at TARGET_GENEX_EVAL-recursion2.cmake:10 \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_GENEX_EVAL:recursion1,\$<TARGET_PROPERTY:recursion1,CUSTOM_PROPERTY1>> + + Dependency loop found. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at TARGET_GENEX_EVAL-recursion2.cmake:10 \(add_custom_target\): + Loop step 1 + + \$<TARGET_GENEX_EVAL:recursion2,\$<TARGET_PROPERTY:recursion2,CUSTOM_PROPERTY2>> + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at TARGET_GENEX_EVAL-recursion2.cmake:10 \(add_custom_target\): + Loop step 2 + + \$<TARGET_GENEX_EVAL:recursion1,\$<TARGET_PROPERTY:recursion1,CUSTOM_PROPERTY1>> + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion2.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion2.cmake new file mode 100644 index 0000000..a28dfc3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL-recursion2.cmake @@ -0,0 +1,12 @@ + +enable_language(C) + +add_library (recursion1 SHARED empty.c) +set_property (TARGET recursion1 PROPERTY CUSTOM_PROPERTY1 "$<TARGET_GENEX_EVAL:recursion2,$<TARGET_PROPERTY:recursion2,CUSTOM_PROPERTY2>>") + +add_library (recursion2 SHARED empty.c) +set_property (TARGET recursion2 PROPERTY CUSTOM_PROPERTY2 "$<TARGET_GENEX_EVAL:recursion1,$<TARGET_PROPERTY:recursion1,CUSTOM_PROPERTY1>>") + +add_custom_target (drive + COMMAND echo "$<TARGET_GENEX_EVAL:recursion1,$<TARGET_PROPERTY:recursion1,CUSTOM_PROPERTY1>>" + DEPENDS recursion) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL.cmake new file mode 100644 index 0000000..68b3712 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_GENEX_EVAL.cmake @@ -0,0 +1,10 @@ + +cmake_policy(VERSION 3.11) + +enable_language(C) + +add_library (example SHARED empty.c) +set_property (TARGET example PROPERTY CUSTOM_PROPERTY1 "PROPERTY1") +set_property (TARGET example PROPERTY CUSTOM_PROPERTY2 "BEFORE_$<TARGET_PROPERTY:CUSTOM_PROPERTY1>_AFTER") + +file(GENERATE OUTPUT "TARGET_GENEX_EVAL-generated.txt" CONTENT "$<TARGET_GENEX_EVAL:example,$<TARGET_PROPERTY:example,CUSTOM_PROPERTY2>>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-stderr.txt new file mode 100644 index 0000000..1ae2f2c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_LINKER_FILE_BASE_NAME-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<TARGET_LINKER_FILE_BASE_NAME:empty> + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target.cmake new file mode 100644 index 0000000..776fb4b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target.cmake @@ -0,0 +1,7 @@ + +add_custom_target(empty) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_LINKER_FILE_BASE_NAME:empty>]" +) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target-stderr.txt new file mode 100644 index 0000000..7a36cef --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_LINKER_FILE_PREFIX-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<TARGET_LINKER_FILE_PREFIX:empty> + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target.cmake new file mode 100644 index 0000000..8dad4da --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_PREFIX-non-valid-target.cmake @@ -0,0 +1,7 @@ + +add_custom_target(empty) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_LINKER_FILE_PREFIX:empty>]" +) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target-stderr.txt new file mode 100644 index 0000000..cc5217a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_LINKER_FILE_SUFFIX-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<TARGET_LINKER_FILE_SUFFIX:empty> + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target.cmake new file mode 100644 index 0000000..82c2f3a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_SUFFIX-non-valid-target.cmake @@ -0,0 +1,7 @@ + +add_custom_target(empty) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_LINKER_FILE_SUFFIX:empty>]" +) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-check.cmake new file mode 100644 index 0000000..2f57430 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_NAME_IF_EXISTS-generated.txt" content) + +set(expected "foo") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-stderr.txt new file mode 100644 index 0000000..5ee13b7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TARGET_NAME_IF_EXISTS-empty-arg.cmake:2 \(file\): + Error evaluating generator expression: + + \$<TARGET_NAME_IF_EXISTS:> + + \$<TARGET_NAME_IF_EXISTS:tgt> expression requires a non-empty valid target + name. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg.cmake new file mode 100644 index 0000000..f5034f4 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated.txt CONTENT "$<TARGET_NAME_IF_EXISTS:${empty}>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-stderr.txt new file mode 100644 index 0000000..4122425 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TARGET_NAME_IF_EXISTS-no-arg.cmake:2 \(file\): + Error evaluating generator expression: + + \$<TARGET_NAME_IF_EXISTS> + + \$<TARGET_NAME_IF_EXISTS> expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg.cmake new file mode 100644 index 0000000..3293094 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated.txt CONTENT "$<TARGET_NAME_IF_EXISTS>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target-check.cmake new file mode 100644 index 0000000..2085c16 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target-check.cmake @@ -0,0 +1,5 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_NAME_IF_EXISTS-not-a-target-generated.txt" content) + +if(content) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected an empty string") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target.cmake new file mode 100644 index 0000000..a054e6c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-not-a-target-generated.txt CONTENT "$<TARGET_NAME_IF_EXISTS:just-random-string>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS.cmake new file mode 100644 index 0000000..0ce3b1d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0070 NEW) +add_custom_target(foo) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated.txt CONTENT "$<TARGET_NAME_IF_EXISTS:foo>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES.cmake new file mode 100644 index 0000000..cb6f4d8 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES.cmake @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.14) +enable_language(C) + +add_library(foo1 STATIC empty.c) +target_include_directories(foo1 PUBLIC include) +target_link_libraries(foo1 PRIVATE foo2 foo3 foo4) + +add_library(foo2 STATIC empty.c) +target_include_directories(foo2 PUBLIC $<TARGET_PROPERTY:foo1,INCLUDE_DIRECTORIES>) + +add_library(foo3 STATIC empty.c) +target_include_directories(foo3 PUBLIC $<TARGET_PROPERTY:foo2,INCLUDE_DIRECTORIES>) + +add_library(foo4 STATIC empty.c) +target_include_directories(foo4 PUBLIC $<TARGET_PROPERTY:foo3,INCLUDE_DIRECTORIES>) + +# Evaluate a genex that looks up INCLUDE_DIRECTORIES on multiple targets. +file(GENERATE OUTPUT out.txt CONTENT "$<TARGET_PROPERTY:foo4,INCLUDE_DIRECTORIES>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt new file mode 100644 index 0000000..d4e5b29 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt @@ -0,0 +1,12 @@ +CMake Warning \(dev\) at TARGET_PROPERTY-LOCATION.cmake:2 \(add_library\): + Policy CMP0026 is not set: Disallow use of the LOCATION target property. + Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + The LOCATION property should not be read from target "foo". Use the target + name directly with add_custom_command, or use the generator expression + \$<TARGET_FILE>, as appropriate. + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION.cmake new file mode 100644 index 0000000..8929cdb --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION.cmake @@ -0,0 +1,3 @@ +enable_language(C) +add_library(foo empty.c) +add_custom_target(drive COMMAND ${CMAKE_COMMAND} -E echo $<TARGET_PROPERTY:foo,LOCATION>) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake new file mode 100644 index 0000000..c1a0f5b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake @@ -0,0 +1,6 @@ +file(READ ${RunCMake_TEST_BINARY_DIR}/foo.txt foo_sources) + +set(foo_expected "empty.c;empty2.c;empty3.c") +if(NOT foo_sources STREQUAL foo_expected) + set(RunCMake_TEST_FAILED "foo SOURCES was:\n [[${foo_sources}]]\nbut expected:\n [[${foo_expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES.cmake new file mode 100644 index 0000000..dee7ead --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES.cmake @@ -0,0 +1,5 @@ +cmake_policy(SET CMP0070 NEW) +enable_language(C) +add_library(foo empty.c empty2.c) +target_sources(foo PRIVATE empty3.c) +file(GENERATE OUTPUT foo.txt CONTENT "$<TARGET_PROPERTY:foo,SOURCES>") diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake new file mode 100644 index 0000000..2a588bc --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake @@ -0,0 +1,17 @@ +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/test.txt TEST_TXT ENCODING UTF-8) + +list(GET TEST_TXT 0 PDB_PATH) +list(GET TEST_TXT 1 PDB_NAME) +list(GET TEST_TXT 2 PDB_DIR) + +if(NOT PDB_PATH MATCHES "empty\\.pdb") + message(FATAL_ERROR "unexpected PDB_PATH [${PDB_PATH}]") +endif() + +if(NOT PDB_NAME STREQUAL "empty.pdb") + message(FATAL_ERROR "unexpected PDB_NAME [${PDB_NAME}]") +endif() + +if(PDB_DIR MATCHES "empty\\.pdb") + message(FATAL_ERROR "unexpected PDB_DIR [${PDB_DIR}]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..a66394b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake @@ -0,0 +1,20 @@ + +enable_language(C) + +add_library(empty SHARED empty.c) + +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) + list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) + set(GENERATE_CONDITION CONDITION $<CONFIG:${FIRST_CONFIG}>) +endif() + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT +[[$<TARGET_PDB_FILE:empty> +$<TARGET_PDB_FILE_NAME:empty> +$<TARGET_PDB_FILE_DIR:empty> +]] + ${GENERATE_CONDITION} +) diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME-check.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME-check.cmake new file mode 100644 index 0000000..996d2d4 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME-check.cmake @@ -0,0 +1,7 @@ +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/test.txt TEST_TXT ENCODING UTF-8) + +list(GET TEST_TXT 0 PDB_FILE_BASE_NAME) + +if(NOT PDB_FILE_BASE_NAME MATCHES "empty") + set(RunCMake_TEST_FAILED "unexpected PDB_FILE_BASE_NAME [${PDB_FILE_BASE_NAME}]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake new file mode 100644 index 0000000..cc53bdf --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake @@ -0,0 +1,16 @@ + +enable_language(C) + +add_library(empty SHARED empty.c) + +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) + list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) + set(GENERATE_CONDITION CONDITION $<CONFIG:${FIRST_CONFIG}>) +endif() + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "$<TARGET_PDB_FILE_BASE_NAME:empty>" + ${GENERATE_CONDITION} +) diff --git a/Tests/RunCMake/GeneratorExpression/empty.c b/Tests/RunCMake/GeneratorExpression/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/empty.c diff --git a/Tests/RunCMake/GeneratorExpression/empty2.c b/Tests/RunCMake/GeneratorExpression/empty2.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/empty2.c diff --git a/Tests/RunCMake/GeneratorExpression/empty3.c b/Tests/RunCMake/GeneratorExpression/empty3.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/empty3.c |