summaryrefslogtreecommitdiff
path: root/Source/cmInstallTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-01-31 15:50:31 +0000
committerKitware Robot <kwrobot@kitware.com>2019-01-31 10:50:38 -0500
commit5107a84d46ad245221843adbef092118649e6dc7 (patch)
tree843c7124775ceeba50ceff95b81990c6f7c230e2 /Source/cmInstallTargetGenerator.cxx
parent9329e1e30ef4de637d0e71950933f1725f28b475 (diff)
parentf64099cf5e5a659340cf221dd32a6cfa8bfe47d3 (diff)
downloadcmake-5107a84d46ad245221843adbef092118649e6dc7.tar.gz
Merge topic 'restore-install-late-framework'
f64099cf5e Merge branch 'backport-restore-install-late-framework' 95210d027a macOS: Restore compatibility for setting FRAMEWORK after install() d9dd68cb60 macOS: Restore compatibility for setting FRAMEWORK after install() Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Kyle Edwards <kyle.edwards@kitware.com> Merge-request: !2878
Diffstat (limited to 'Source/cmInstallTargetGenerator.cxx')
-rw-r--r--Source/cmInstallTargetGenerator.cxx31
1 files changed, 29 insertions, 2 deletions
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 10df70badb..26cebf08e4 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -19,6 +19,7 @@
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
+#include "cmake.h"
cmInstallTargetGenerator::cmInstallTargetGenerator(
std::string targetName, const char* dest, bool implib,
@@ -209,8 +210,34 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(
// An import library looks like a static library.
type = cmInstallType_STATIC_LIBRARY;
} else if (this->Target->IsFrameworkOnApple()) {
- // There is a bug in cmInstallCommand if this fails.
- assert(this->NamelinkMode == NamelinkModeNone);
+ // FIXME: In principle we should be able to
+ // assert(this->NamelinkMode == NamelinkModeNone);
+ // but since the current install() command implementation checks
+ // the FRAMEWORK property immediately instead of delaying until
+ // generate time, it is possible for project code to set the
+ // property after calling install(). In such a case, the install()
+ // command will use the LIBRARY code path and create two install
+ // generators, one for the namelink component (NamelinkModeOnly)
+ // and one for the primary artifact component (NamelinkModeSkip).
+ // Historically this was not diagnosed and resulted in silent
+ // installation of a framework to the LIBRARY destination.
+ // Retain that behavior and warn about the case.
+ switch (this->NamelinkMode) {
+ case NamelinkModeNone:
+ // Normal case.
+ break;
+ case NamelinkModeOnly:
+ // Assume the NamelinkModeSkip instance will warn and install.
+ return;
+ case NamelinkModeSkip: {
+ std::string e = "Target '" + this->Target->GetName() +
+ "' was changed to a FRAMEWORK sometime after install(). "
+ "This may result in the wrong install DESTINATION. "
+ "Set the FRAMEWORK property earlier.";
+ this->Target->GetGlobalGenerator()->GetCMakeInstance()->IssueMessage(
+ MessageType::AUTHOR_WARNING, e, this->GetBacktrace());
+ } break;
+ }
// Install the whole framework directory.
type = cmInstallType_DIRECTORY;