diff options
5 files changed, 28 insertions, 6 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c78b751..db5cee9 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1461,6 +1461,9 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent) // Imported targets. this->ImportedTargets = parent->ImportedTargets; + // Non-global Alias targets. + this->AliasTargets = parent->AliasTargets; + // Recursion depth. this->RecursionDepth = parent->RecursionDepth; } diff --git a/Tests/RunCMake/alias_targets/get_property-subdir/CMakeLists.txt b/Tests/RunCMake/alias_targets/get_property-subdir/CMakeLists.txt index bfd9840..b114b75 100644 --- a/Tests/RunCMake/alias_targets/get_property-subdir/CMakeLists.txt +++ b/Tests/RunCMake/alias_targets/get_property-subdir/CMakeLists.txt @@ -6,3 +6,10 @@ check_property (alias::import-local-subdir ALIASED_TARGET "import-local") check_property (alias::import-local-subdir IMPORTED "TRUE") check_property (alias::import-local-subdir ALIAS_GLOBAL "FALSE") check_property (alias::import-local-subdir IMPORT_LOCAL_PROPERTY "IMPORT_LOCAL") + + +# non-global alias defined in parent directory must be visible in sub-directory +check_property (alias::import-local ALIASED_TARGET "import-local") +check_property (alias::import-local IMPORTED "TRUE") +check_property (alias::import-local ALIAS_GLOBAL "FALSE") +check_property (alias::import-local IMPORT_LOCAL_PROPERTY "IMPORT_LOCAL") diff --git a/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake b/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake index 73f8a7d..316b74b 100644 --- a/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake +++ b/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake @@ -15,22 +15,25 @@ endif() add_library(import-local SHARED IMPORTED) set_property(TARGET import-local PROPERTY IMPORTED_LOCATION "${binary_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}func${CMAKE_SHARED_LIBRARY_SUFFIX}") set_property(TARGET import-local PROPERTY IMPORTED_IMPLIB "${binary_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}func${CMAKE_IMPORT_LIBRARY_SUFFIX}") -add_library(alias-local ALIAS import-local) +add_library(alias::local ALIAS import-local) add_library (lib-local SHARED lib.c) -target_link_libraries (lib-local PRIVATE import-local) +target_link_libraries (lib-local PRIVATE alias::local) add_executable (main-local main.c) -target_link_libraries (main-local PRIVATE import-local) +target_link_libraries (main-local PRIVATE alias::local) add_library(import-global SHARED IMPORTED GLOBAL) set_property(TARGET import-global PROPERTY IMPORTED_LOCATION "${binary_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}func${CMAKE_SHARED_LIBRARY_SUFFIX}") set_property(TARGET import-global PROPERTY IMPORTED_IMPLIB "${binary_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}func${CMAKE_IMPORT_LIBRARY_SUFFIX}") -add_library(alias-global ALIAS import-global) +add_library(alias::global ALIAS import-global) add_library (lib-global SHARED lib.c) -target_link_libraries (lib-global PRIVATE import-global) +target_link_libraries (lib-global PRIVATE alias::global) add_executable (main-global main.c) -target_link_libraries (main-global PRIVATE import-global) +target_link_libraries (main-global PRIVATE alias::global) + + +add_subdirectory(sub_dir) diff --git a/Tests/RunCMake/target_link_libraries-ALIAS/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries-ALIAS/RunCMakeTest.cmake index 4d24a6e..42ec47e 100644 --- a/Tests/RunCMake/target_link_libraries-ALIAS/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries-ALIAS/RunCMakeTest.cmake @@ -19,5 +19,7 @@ run_cmake_target(AliasTargets lib-local lib-local --config Release) run_cmake_target(AliasTargets main-local main-local --config Release) run_cmake_target(AliasTargets lib-global lib-global --config Release) run_cmake_target(AliasTargets main-global main-global --config Release) +run_cmake_target(AliasTargets lib-sub lib-sub --config Release) +run_cmake_target(AliasTargets main-sub main-sub --config Release) unset(RunCMake_TEST_OPTIONS) unset(RunCMake_TEST_OUTPUT_MERGE) diff --git a/Tests/RunCMake/target_link_libraries-ALIAS/sub_dir/CMakeLists.txt b/Tests/RunCMake/target_link_libraries-ALIAS/sub_dir/CMakeLists.txt new file mode 100644 index 0000000..326e964 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-ALIAS/sub_dir/CMakeLists.txt @@ -0,0 +1,7 @@ + + +add_library (lib-sub SHARED ../lib.c) +target_link_libraries (lib-sub PRIVATE alias::local) + +add_executable (main-sub ../main.c) +target_link_libraries (main-sub PRIVATE alias::local) |