diff options
author | Deniz Bahadir <dbahadir@benocs.com> | 2017-09-14 11:15:08 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-10-26 13:11:04 (GMT) |
commit | 494906a8a21f44e9233632d9be7f93ee3990aaaf (patch) | |
tree | 027746c20b4cc38e33f4ec9e30e295c2d89da23a /Tests/RunCMake/alias_targets/imported-global-target.cmake | |
parent | fe4b25ec2fa09a50b6ffbfcf29e118afdfba0659 (diff) | |
download | CMake-494906a8a21f44e9233632d9be7f93ee3990aaaf.zip CMake-494906a8a21f44e9233632d9be7f93ee3990aaaf.tar.gz CMake-494906a8a21f44e9233632d9be7f93ee3990aaaf.tar.bz2 |
Add support for IMPORTED GLOBAL targets to be aliased
Issue: #15569
Issue: #17197
Diffstat (limited to 'Tests/RunCMake/alias_targets/imported-global-target.cmake')
-rw-r--r-- | Tests/RunCMake/alias_targets/imported-global-target.cmake | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Tests/RunCMake/alias_targets/imported-global-target.cmake b/Tests/RunCMake/alias_targets/imported-global-target.cmake new file mode 100644 index 0000000..12c4e0a --- /dev/null +++ b/Tests/RunCMake/alias_targets/imported-global-target.cmake @@ -0,0 +1,46 @@ + +enable_language(CXX) + + +add_executable(test-exe IMPORTED GLOBAL) +add_executable(alias-test-exe ALIAS test-exe) + +if(TARGET alias-test-exe) + get_target_property(aliased-target alias-test-exe ALIASED_TARGET) + if("${aliased-target}" STREQUAL "test-exe") + get_target_property(aliased-name alias-test-exe NAME) + if("${aliased-name}" STREQUAL "test-exe") + message("'alias-test-exe' is an alias for '${aliased-target}'" + " and its name-property contains '${aliased-name}'.") + else() + message("'alias-test-exe' is an alias for '${aliased-target}'" + " but its name-property contains '${aliased-name}'!?") + endif() + else() + message("'alias-test-exe' is something but not a real target!?") + endif() +else() + message("'alias-test-exe' does not exist!?") +endif() + + +add_library(test-lib SHARED IMPORTED GLOBAL) +add_library(alias-test-lib ALIAS test-lib) + +if(TARGET alias-test-lib) + get_target_property(aliased-target alias-test-lib ALIASED_TARGET) + if("${aliased-target}" STREQUAL "test-lib") + get_target_property(aliased-name alias-test-lib NAME) + if("${aliased-name}" STREQUAL "test-lib") + message("'alias-test-lib' is an alias for '${aliased-target}'" + " and its name-property contains '${aliased-name}'.") + else() + message("'alias-test-lib' is an alias for '${aliased-target}'" + " but its name-property contains '${aliased-name}'!?") + endif() + else() + message("'alias-test-lib' is something but not a real target!?") + endif() +else() + message("'alias-test-lib' does not exist!?") +endif() |