summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmGeneratorTarget.h1
-rw-r--r--Source/cmGeneratorTarget_Link.cxx5
-rw-r--r--Source/cmGeneratorTarget_TransitiveProperty.cxx3
-rw-r--r--Source/cmLinkItem.h1
-rw-r--r--Tests/ExportImport/Export/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/install/EXPORT-InterfaceLinkNoexist.cmake4
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake1
7 files changed, 18 insertions, 3 deletions
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 4521fd4..dd5f047 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -264,6 +264,7 @@ public:
{
Compile, // Usage requirements for compiling. Excludes $<LINK_ONLY>.
Link, // Usage requirements for linking. Includes $<LINK_ONLY>.
+ LinkInterfaceEval,
};
cmLinkInterfaceLibraries const* GetLinkInterfaceLibraries(
diff --git a/Source/cmGeneratorTarget_Link.cxx b/Source/cmGeneratorTarget_Link.cxx
index 0799429..3ed77a8 100644
--- a/Source/cmGeneratorTarget_Link.cxx
+++ b/Source/cmGeneratorTarget_Link.cxx
@@ -392,7 +392,7 @@ void cmGeneratorTarget::CheckLinkLibraries() const
// should be a subset of LinkInterfaceMap (with LINK_ONLY left out).
for (auto const& hmp : this->LinkInterfaceMap) {
for (auto const& hmi : hmp.second) {
- if (!hmi.second.LibrariesDone) {
+ if (!hmi.second.LibrariesDone || hmi.second.LinkOnlyEval) {
continue;
}
for (cmLinkItem const& item : hmi.second.Libraries) {
@@ -642,6 +642,7 @@ cmLinkInterface const* cmGeneratorTarget::GetLinkInterface(
if (secondPass) {
iface = cmOptionalLinkInterface();
}
+ iface.LinkOnlyEval = false;
if (!iface.LibrariesDone) {
iface.LibrariesDone = true;
this->ComputeLinkInterfaceLibraries(config, iface, head, UseTo::Link);
@@ -765,6 +766,7 @@ const cmLinkInterfaceLibraries* cmGeneratorTarget::GetLinkInterfaceLibraries(
}
cmOptionalLinkInterface& iface = hm[head];
+ iface.LinkOnlyEval = (usage == UseTo::LinkInterfaceEval);
if (!iface.LibrariesDone) {
iface.LibrariesDone = true;
this->ComputeLinkInterfaceLibraries(config, iface, head, usage);
@@ -1034,6 +1036,7 @@ const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface(
if (secondPass) {
iface = cmOptionalLinkInterface();
}
+ iface.LinkOnlyEval = (usage == UseTo::LinkInterfaceEval);
if (!iface.AllDone) {
iface.AllDone = true;
iface.LibrariesDone = true;
diff --git a/Source/cmGeneratorTarget_TransitiveProperty.cxx b/Source/cmGeneratorTarget_TransitiveProperty.cxx
index ac929eb..107f6d9 100644
--- a/Source/cmGeneratorTarget_TransitiveProperty.cxx
+++ b/Source/cmGeneratorTarget_TransitiveProperty.cxx
@@ -286,7 +286,8 @@ cmGeneratorTarget::GetCustomTransitiveProperties(std::string const& config,
}
}
};
- addTransitiveProperties("TRANSITIVE_LINK_PROPERTIES", UseTo::Link);
+ addTransitiveProperties("TRANSITIVE_LINK_PROPERTIES",
+ UseTo::LinkInterfaceEval);
addTransitiveProperties("TRANSITIVE_COMPILE_PROPERTIES", UseTo::Compile);
i = ctpm.emplace(config, std::move(ctp)).first;
}
diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h
index 1946c9b..bd1531b 100644
--- a/Source/cmLinkItem.h
+++ b/Source/cmLinkItem.h
@@ -120,6 +120,7 @@ struct cmLinkInterface : public cmLinkInterfaceLibraries
struct cmOptionalLinkInterface : public cmLinkInterface
{
+ bool LinkOnlyEval = false;
bool LibrariesDone = false;
bool AllDone = false;
bool Exists = false;
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index 8f83587..28118ba 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -29,6 +29,9 @@ add_library(compileOnly INTERFACE)
target_compile_definitions(compileOnly INTERFACE FROM_compileOnly)
target_link_options(compileOnly INTERFACE -fthis-flag-does-not-exist)
+add_library(noUses INTERFACE)
+target_link_libraries(noUses INTERFACE this::target_does_not_exist)
+
add_library(testLib1 STATIC testLib1.c)
add_library(testLib2 STATIC testLib2.c)
target_link_libraries(testLib2 testLib1)
@@ -601,6 +604,7 @@ install(FILES
install(
TARGETS
compileOnly
+ noUses
testExe1 testLib1 testLib2 testExe2 testLib3 testLib4 testExe3 testExe4
testExe2lib testLib4lib testLib4libdbg testLib4libopt
testLib6 testLib7 testLib8
@@ -676,7 +680,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3
testSharedLibDepends renamed_on_export
cmp0022NEW cmp0022OLD
TopDirLib SubDirLinkA
- systemlib
+ systemlib noUses
testInterfaceIncludeUser
testInterfaceIncludeUser2
NAMESPACE bld_
diff --git a/Tests/RunCMake/install/EXPORT-InterfaceLinkNoexist.cmake b/Tests/RunCMake/install/EXPORT-InterfaceLinkNoexist.cmake
new file mode 100644
index 0000000..14442bc
--- /dev/null
+++ b/Tests/RunCMake/install/EXPORT-InterfaceLinkNoexist.cmake
@@ -0,0 +1,4 @@
+add_library(foo INTERFACE)
+target_link_libraries(foo INTERFACE nonexistent::bar)
+install(TARGETS foo DESTINATION lib EXPORT foo-targets)
+install(EXPORT foo-targets FILE foo-targets.cmake DESTINATION lib)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index 7b0aa85..295922c 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -85,6 +85,7 @@ run_cmake(EXPORT-UnknownExport)
run_cmake(EXPORT-NamelinkOnly)
run_cmake(EXPORT-SeparateNamelink)
run_cmake(EXPORT-TargetTwice)
+run_cmake(EXPORT-InterfaceLinkNoexist)
run_cmake(CMP0062-OLD)
run_cmake(CMP0062-NEW)
run_cmake(CMP0062-WARN)