From c40229968cec39590ccdf54402625c83b44581a0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 10 Jan 2020 10:44:59 -0500 Subject: target_link_libraries: Add FIXME comment for out-of-dir genex list Issue: #20204 --- Source/cmTargetLinkLibrariesCommand.cxx | 4 ++++ Tests/CMakeCommands/target_link_libraries/SubDirB/CMakeLists.txt | 3 +++ 2 files changed, 7 insertions(+) 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..10f926a 100644 --- a/Tests/CMakeCommands/target_link_libraries/SubDirB/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/SubDirB/CMakeLists.txt @@ -4,6 +4,9 @@ add_executable(SubDirB SubDirB.c) # be visible to the directory in which TopDir is defined. target_link_libraries(TopDir PUBLIC 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 # compiling SubDirA that it sees our target and its own. -- cgit v0.12