summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-01-29 16:54:46 (GMT)
committerBrad King <brad.king@kitware.com>2019-01-30 13:00:06 (GMT)
commit95210d027a03192532fcf2c71c98c79fd4cc0fd1 (patch)
treebc44de663aba125b071d57b73cbab0ccdc0cc4e6 /Tests
parent62c0b1aebb827fc8a133cedfa343322d28714501 (diff)
downloadCMake-95210d027a03192532fcf2c71c98c79fd4cc0fd1.zip
CMake-95210d027a03192532fcf2c71c98c79fd4cc0fd1.tar.gz
CMake-95210d027a03192532fcf2c71c98c79fd4cc0fd1.tar.bz2
macOS: Restore compatibility for setting FRAMEWORK after install()
The `FRAMEWORK` target property affects the way the `install()` command treats the target and so should be set first. Our implementation assumed that this was always the case and led to an assertion failure. Prior to CMake 3.12 this was visible only when using an explicit `LIBRARY ... NAMELINK_ONLY` option, but commit 0212d7c762 (install: add NAMELINK_COMPONENT argument, 2018-04-18, v3.12.0-rc1~139^2~3) made it possible with a simple `LIBRARY DESTINATION`. Fully supporting out-of-order specification will require non-trivial refactoring to defer install generator creation to generate time. For now simply restore the old behavior of installing the framework to the library destination and warn about the case. Fixes: #18848
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/Framework/InstallBeforeFramework-stderr.txt7
-rw-r--r--Tests/RunCMake/Framework/InstallBeforeFramework.cmake5
-rw-r--r--Tests/RunCMake/Framework/RunCMakeTest.cmake2
3 files changed, 14 insertions, 0 deletions
diff --git a/Tests/RunCMake/Framework/InstallBeforeFramework-stderr.txt b/Tests/RunCMake/Framework/InstallBeforeFramework-stderr.txt
new file mode 100644
index 0000000..a3a7c6c
--- /dev/null
+++ b/Tests/RunCMake/Framework/InstallBeforeFramework-stderr.txt
@@ -0,0 +1,7 @@
+^CMake Warning \(dev\) at InstallBeforeFramework.cmake:4 \(install\):
+ Target 'foo' was changed to a FRAMEWORK sometime after install\(\). This may
+ result in the wrong install DESTINATION. Set the FRAMEWORK property
+ earlier.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/Framework/InstallBeforeFramework.cmake b/Tests/RunCMake/Framework/InstallBeforeFramework.cmake
new file mode 100644
index 0000000..3791dac
--- /dev/null
+++ b/Tests/RunCMake/Framework/InstallBeforeFramework.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+
+add_library(foo SHARED foo.c)
+install(TARGETS foo LIBRARY DESTINATION lib)
+set_property(TARGET foo PROPERTY FRAMEWORK TRUE)
diff --git a/Tests/RunCMake/Framework/RunCMakeTest.cmake b/Tests/RunCMake/Framework/RunCMakeTest.cmake
index 4fc83f8..e705a31 100644
--- a/Tests/RunCMake/Framework/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Framework/RunCMakeTest.cmake
@@ -1,5 +1,7 @@
include(RunCMake)
+run_cmake(InstallBeforeFramework)
+
function(framework_layout_test Name Toolchain Type)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${Toolchain}${Type}FrameworkLayout-build)
set(RunCMake_TEST_NO_CLEAN 1)