diff options
author | Brad King <brad.king@kitware.com> | 2019-03-07 13:52:18 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-03-07 14:00:56 (GMT) |
commit | 47389c5641b821813f3f236bfbc179f52a2c95d7 (patch) | |
tree | 0c5d54b310509435badeb287b7b1e1bcb328d595 /Tests | |
parent | 20a41aa589d4418f9ac46fc8c0402162d1d82873 (diff) | |
download | CMake-47389c5641b821813f3f236bfbc179f52a2c95d7.zip CMake-47389c5641b821813f3f236bfbc179f52a2c95d7.tar.gz CMake-47389c5641b821813f3f236bfbc179f52a2c95d7.tar.bz2 |
install: Do not crash on imported global target
Since commit e89ad0f94e (install: Allow installing targets created in
another directory, 2018-06-18, v3.13.0-rc1~407^2) the `install(TARGETS)`
command may find a global-scoped target outside the calling directory.
Ignore an `IMPORTED GLOBAL` target if it is found in this way. Imported
targets cannot be installed, and trying to do so violates internal
invariants.
Fixes: #19022
Diffstat (limited to 'Tests')
4 files changed, 9 insertions, 0 deletions
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 28e8ec4..c637db1 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -66,6 +66,7 @@ run_cmake(CMP0062-WARN) run_cmake(CMP0087-OLD) run_cmake(CMP0087-NEW) run_cmake(CMP0087-WARN) +run_cmake(TARGETS-ImportedGlobal) run_cmake(TARGETS-NAMELINK_COMPONENT-bad-all) run_cmake(TARGETS-NAMELINK_COMPONENT-bad-exc) run_cmake(FILES-DESTINATION-TYPE) diff --git a/Tests/RunCMake/install/TARGETS-ImportedGlobal-result.txt b/Tests/RunCMake/install/TARGETS-ImportedGlobal-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-ImportedGlobal-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/TARGETS-ImportedGlobal-stderr.txt b/Tests/RunCMake/install/TARGETS-ImportedGlobal-stderr.txt new file mode 100644 index 0000000..d67802b --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-ImportedGlobal-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TARGETS-ImportedGlobal.cmake:[0-9]+ \(install\): + install TARGETS given target "imported_global" which does not exist. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/install/TARGETS-ImportedGlobal.cmake b/Tests/RunCMake/install/TARGETS-ImportedGlobal.cmake new file mode 100644 index 0000000..08c20bd --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-ImportedGlobal.cmake @@ -0,0 +1,3 @@ +add_library(imported_global STATIC IMPORTED GLOBAL) +set_property(TARGET imported_global PROPERTY IMPORTED_LOCATION /does_not_exist) +install(TARGETS imported_global DESTINATION bin) |