diff options
author | Brad King <brad.king@kitware.com> | 2020-10-27 11:09:13 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-10-27 11:09:20 (GMT) |
commit | 80e2163f826a76134e34874e953979ee70f8b972 (patch) | |
tree | 769fdba23603c7978cfd536687e59b8bb7e1b84e /Tests | |
parent | 5da313e55e9c15f7efca9e85ed5355457ca364aa (diff) | |
parent | c75d68a2afd55237b8956d90aca6ff3b8fbbae0f (diff) | |
download | CMake-80e2163f826a76134e34874e953979ee70f8b972.zip CMake-80e2163f826a76134e34874e953979ee70f8b972.tar.gz CMake-80e2163f826a76134e34874e953979ee70f8b972.tar.bz2 |
Merge topic 'issue-19696'
c75d68a2af genex: improve unit testing for $<TARGET_NAME_IF_EXISTS:...>
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5420
Diffstat (limited to 'Tests')
7 files changed, 34 insertions, 0 deletions
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 6349112..edeb6bd 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -35,6 +35,9 @@ 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_NAME_IF_EXISTS-alias-target) +run_cmake(TARGET_NAME_IF_EXISTS-imported-target) +run_cmake(TARGET_NAME_IF_EXISTS-imported-global-target) run_cmake(REMOVE_DUPLICATES-empty) run_cmake(REMOVE_DUPLICATES-1) run_cmake(REMOVE_DUPLICATES-2) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-alias-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-alias-target-check.cmake new file mode 100644 index 0000000..8ae2ecc --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-alias-target-check.cmake @@ -0,0 +1,5 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_NAME_IF_EXISTS-generated-alias.txt" content) + +if(NOT content STREQUAL aliasTarget) + set(RunCMake_TEST_FAILED "actual content:\n ${content}\nbut expected [[aliasTarget]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-alias-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-alias-target.cmake new file mode 100644 index 0000000..d3ef0f8 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-alias-target.cmake @@ -0,0 +1,8 @@ +enable_language(CXX) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy_executable.cpp" "int main(int,char**) { return 0; }\n") +add_executable(executableTarget "${CMAKE_CURRENT_BINARY_DIR}/dummy_executable.cpp") +add_executable(aliasTarget ALIAS executableTarget) + +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated-alias.txt CONTENT "$<TARGET_NAME_IF_EXISTS:aliasTarget>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-global-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-global-target-check.cmake new file mode 100644 index 0000000..b14c9e1 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-global-target-check.cmake @@ -0,0 +1,5 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_NAME_IF_EXISTS-generated-imported-global.txt" content) + +if(NOT content STREQUAL importedGlobalTarget) + set(RunCMake_TEST_FAILED "actual content:\n ${content}\nbut expected [[importedGlobalTarget]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-global-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-global-target.cmake new file mode 100644 index 0000000..b685558 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-global-target.cmake @@ -0,0 +1,4 @@ +add_executable(importedGlobalTarget IMPORTED GLOBAL) + +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated-imported-global.txt CONTENT "$<TARGET_NAME_IF_EXISTS:importedGlobalTarget>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-target-check.cmake new file mode 100644 index 0000000..9615893 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-target-check.cmake @@ -0,0 +1,5 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_NAME_IF_EXISTS-generated-imported.txt" content) + +if(NOT content STREQUAL importedTarget) + set(RunCMake_TEST_FAILED "actual content:\n ${content}\nbut expected [[importedTarget]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-target.cmake new file mode 100644 index 0000000..2008907 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-target.cmake @@ -0,0 +1,4 @@ +add_executable(importedTarget IMPORTED) + +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated-imported.txt CONTENT "$<TARGET_NAME_IF_EXISTS:importedTarget>") |