diff options
-rw-r--r-- | Source/cmInstallCommand.cxx | 8 | ||||
-rw-r--r-- | Tests/RunCMake/install/EXPORT-OldIFace.cmake | 6 | ||||
-rw-r--r-- | Tests/RunCMake/install/EXPORT-OldIFace/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/install/RunCMakeTest.cmake | 1 |
4 files changed, 14 insertions, 3 deletions
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 15a83ee..2d78a41 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -1374,10 +1374,12 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) tei != exportSet->GetTargetExports()->end(); ++tei) { cmTargetExport const* te = *tei; - cmTarget* tgt = this->Makefile->FindTarget(te->TargetName); + cmTarget* tgt = + this->Makefile->GetGlobalGenerator()->FindTarget(te->TargetName); const bool newCMP0022Behavior = - tgt->GetPolicyStatusCMP0022() != cmPolicies::WARN - && tgt->GetPolicyStatusCMP0022() != cmPolicies::OLD; + (tgt && + tgt->GetPolicyStatusCMP0022() != cmPolicies::WARN && + tgt->GetPolicyStatusCMP0022() != cmPolicies::OLD); if(!newCMP0022Behavior) { diff --git a/Tests/RunCMake/install/EXPORT-OldIFace.cmake b/Tests/RunCMake/install/EXPORT-OldIFace.cmake new file mode 100644 index 0000000..8dfb46b --- /dev/null +++ b/Tests/RunCMake/install/EXPORT-OldIFace.cmake @@ -0,0 +1,6 @@ +enable_language(C) +add_subdirectory(EXPORT-OldIFace) +add_library(foo SHARED empty.c) +target_link_libraries(foo bar) +install(TARGETS foo DESTINATION lib EXPORT fooExport) +install(EXPORT fooExport DESTINATION lib/cmake/foo EXPORT_LINK_INTERFACE_LIBRARIES) diff --git a/Tests/RunCMake/install/EXPORT-OldIFace/CMakeLists.txt b/Tests/RunCMake/install/EXPORT-OldIFace/CMakeLists.txt new file mode 100644 index 0000000..32292e2 --- /dev/null +++ b/Tests/RunCMake/install/EXPORT-OldIFace/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(bar SHARED ../empty.c) +install(TARGETS bar DESTINATION lib EXPORT fooExport) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 2c1b29d..c2347d8 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -10,6 +10,7 @@ run_cmake(DIRECTORY-DIRECTORY-bad) run_cmake(DIRECTORY-DESTINATION-bad) run_cmake(FILES-DESTINATION-bad) run_cmake(TARGETS-DESTINATION-bad) +run_cmake(EXPORT-OldIFace) run_cmake(CMP0062-OLD) run_cmake(CMP0062-NEW) run_cmake(CMP0062-WARN) |