diff options
8 files changed, 15 insertions, 8 deletions
diff --git a/Help/prop_tgt/LINK_LIBRARIES_INDIRECTION.txt b/Help/prop_tgt/LINK_LIBRARIES_INDIRECTION.txt index 1fdb6ad..fab4418 100644 --- a/Help/prop_tgt/LINK_LIBRARIES_INDIRECTION.txt +++ b/Help/prop_tgt/LINK_LIBRARIES_INDIRECTION.txt @@ -2,8 +2,8 @@ A call to :command:`target_link_libraries(<target> ...)` may update this property on ``<target>``. If ``<target>`` was not created in the same directory as the call then :command:`target_link_libraries` will add a - suffix of the form ``::@<directory-id>`` to each entry, where the - ``::@`` is a separator and the ``<directory-id>`` is unspecified. + suffix of the form ``::@(directory-id)`` to each entry, where the + ``::@`` is a separator and the ``(directory-id)`` is unspecified. This tells the generators that the named libraries must be looked up in the scope of the caller rather than in the scope in which the ``<target>`` was created. Valid directory ids are stripped on export diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index fa7bce1..79cf5a1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -139,7 +139,7 @@ cmDirectoryId cmMakefile::GetDirectoryId() const // If we ever need to expose this to CMake language code we should // add a read-only property in cmMakefile::GetProperty. char buf[32]; - sprintf(buf, "<%p>", + sprintf(buf, "(%p)", static_cast<void const*>(this)); // cast avoids format warning return std::string(buf); } diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index e1ac6a8..ad59748 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -406,6 +406,10 @@ static bool HandleLibrary(cmMakefile& mf, cmTarget* target, // the name to tell ResolveLinkItem to look up the name in the // caller's directory. cmDirectoryId const dirId = mf.GetDirectoryId(); + // FIXME: The "lib" may be a genex with a list inside it. + // After expansion this id will only attach to the last entry, + // or may attach to an empty string! We will need another way + // to encode this that can apply to a whole list. See issue #20204. libRef = lib + CMAKE_DIRECTORY_ID_SEP + dirId.String; } else { // This is an absolute path or a library name added by a caller diff --git a/Tests/CMakeCommands/target_link_libraries/SubDirB/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/SubDirB/CMakeLists.txt index 7c918e6..b430834 100644 --- a/Tests/CMakeCommands/target_link_libraries/SubDirB/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/SubDirB/CMakeLists.txt @@ -2,7 +2,10 @@ add_executable(SubDirB SubDirB.c) # Link to a target imported in this directory that would not normally # be visible to the directory in which TopDir is defined. -target_link_libraries(TopDir PUBLIC SameNameImported) +target_link_libraries(TopDir PUBLIC debug SameNameImported optimized SameNameImported) + +#FIXME: Demonstrate known issue #20204. +#target_link_libraries(TopDir PUBLIC "$<1:SameNameImported;SameNameImported>") # Link SubDirA to a target imported in this directory that has the same # name as a target imported in SubDirA's directory. We verify when diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW-stdout.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW-stdout.txt index 89cd806..90a5f37 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW-stdout.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW-stdout.txt @@ -1 +1 @@ --- INTERFACE_LINK_LIBRARIES='foo::@<[Xx0-9A-Fa-f]+>' +-- INTERFACE_LINK_LIBRARIES='foo::@\([Xx0-9A-Fa-f]+\)' diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-stderr.txt index 8ef35c1..8670403 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-stderr.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-stderr.txt @@ -1,5 +1,5 @@ ^CMake Error at CMP0079-link-NEW-bogus.cmake:[0-9]+ \(add_executable\): - Target "top" links to target "foo::@<0xdeadbeef>" but the target was not + Target "top" links to target "foo::@\(0xdeadbeef\)" but the target was not found. Perhaps a find_package\(\) call is missing for an IMPORTED target, or an ALIAS target is missing\? Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake index 8622f14..ea9e071 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake @@ -3,4 +3,4 @@ cmake_policy(SET CMP0079 NEW) enable_language(C) add_executable(top empty.c) -set_property(TARGET top APPEND PROPERTY LINK_LIBRARIES "foo::@<0xdeadbeef>") +set_property(TARGET top APPEND PROPERTY LINK_LIBRARIES "foo::@(0xdeadbeef)") diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-stdout.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-stdout.txt index 84b30bd..3e8c7c6 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-stdout.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-stdout.txt @@ -1 +1 @@ --- LINK_LIBRARIES='foo::@<[Xx0-9A-Fa-f]+>' +-- LINK_LIBRARIES='foo::@\([Xx0-9A-Fa-f]+\)' |