summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-02-08 10:46:42 -0500
committerBrad King <brad.king@kitware.com>2016-02-08 10:46:42 -0500
commit656bf0da2c0b9a2fa6e79970df968d5e9c4e4e1a (patch)
tree92372b68cedf092fedb04593a406faacf7d180e9
parent2a768f84e3dda1ce26342b9922b7f57e5110e887 (diff)
parenta1ad098dc8fc5204fc797b92faed517337816b82 (diff)
downloadcmake-656bf0da2c0b9a2fa6e79970df968d5e9c4e4e1a.tar.gz
Merge branch 'fix-install-EXPORT-crash' into release
-rw-r--r--Source/cmInstallCommand.cxx8
-rw-r--r--Tests/RunCMake/install/CMP0062-NEW.cmake2
-rw-r--r--Tests/RunCMake/install/CMP0062-OLD.cmake2
-rw-r--r--Tests/RunCMake/install/CMP0062-WARN.cmake1
-rw-r--r--Tests/RunCMake/install/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/install/EXPORT-OldIFace.cmake7
-rw-r--r--Tests/RunCMake/install/EXPORT-OldIFace/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake1
8 files changed, 19 insertions, 6 deletions
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 15a83ee017..2d78a4101f 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/CMP0062-NEW.cmake b/Tests/RunCMake/install/CMP0062-NEW.cmake
index a696f56fc5..9e7a5fb82f 100644
--- a/Tests/RunCMake/install/CMP0062-NEW.cmake
+++ b/Tests/RunCMake/install/CMP0062-NEW.cmake
@@ -1,4 +1,4 @@
-
+cmake_policy(VERSION 3.2)
cmake_policy(SET CMP0062 NEW)
add_library(iface INTERFACE)
diff --git a/Tests/RunCMake/install/CMP0062-OLD.cmake b/Tests/RunCMake/install/CMP0062-OLD.cmake
index 94b809a981..8874923b4c 100644
--- a/Tests/RunCMake/install/CMP0062-OLD.cmake
+++ b/Tests/RunCMake/install/CMP0062-OLD.cmake
@@ -1,4 +1,4 @@
-
+cmake_policy(VERSION 3.2)
cmake_policy(SET CMP0062 OLD)
add_library(iface INTERFACE)
diff --git a/Tests/RunCMake/install/CMP0062-WARN.cmake b/Tests/RunCMake/install/CMP0062-WARN.cmake
index 0435a640ef..018f82275a 100644
--- a/Tests/RunCMake/install/CMP0062-WARN.cmake
+++ b/Tests/RunCMake/install/CMP0062-WARN.cmake
@@ -1,3 +1,4 @@
+cmake_policy(VERSION 3.2)
add_library(iface INTERFACE)
export(TARGETS iface FILE "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake")
diff --git a/Tests/RunCMake/install/CMakeLists.txt b/Tests/RunCMake/install/CMakeLists.txt
index 4b3de84d94..6dd8cdf551 100644
--- a/Tests/RunCMake/install/CMakeLists.txt
+++ b/Tests/RunCMake/install/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.4)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/install/EXPORT-OldIFace.cmake b/Tests/RunCMake/install/EXPORT-OldIFace.cmake
new file mode 100644
index 0000000000..033f68446e
--- /dev/null
+++ b/Tests/RunCMake/install/EXPORT-OldIFace.cmake
@@ -0,0 +1,7 @@
+enable_language(C)
+set(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
+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 0000000000..32292e2f65
--- /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 2c1b29d9c7..c2347d89dd 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)