summaryrefslogtreecommitdiff
path: root/Source/cmAddLibraryCommand.cxx
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2017-03-23 09:32:08 -0400
committerBrad King <brad.king@kitware.com>2017-04-18 11:36:10 -0400
commiteec93bceec5411e4409b5e3ee5dc301fca6fcbfd (patch)
tree58758ce2d61173c52559f55c0979236cafa7f969 /Source/cmAddLibraryCommand.cxx
parent93c89bc75ceee599ba7c08b8fe1ac5104942054f (diff)
downloadcmake-eec93bceec5411e4409b5e3ee5dc301fca6fcbfd.tar.gz
Allow OBJECT libraries to be installed, exported, and imported
Teach install() and export() to handle the actual object files. Disallow this on Xcode with multiple architectures because it still cannot be cleanly supported there. Co-Author: Brad King <brad.king@kitware.com>
Diffstat (limited to 'Source/cmAddLibraryCommand.cxx')
-rw-r--r--Source/cmAddLibraryCommand.cxx13
1 files changed, 9 insertions, 4 deletions
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index 9ae4ace4a6..0bdf9636ed 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -297,10 +297,15 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
return false;
}
if (type == cmStateEnums::OBJECT_LIBRARY) {
- this->Makefile->IssueMessage(
- cmake::FATAL_ERROR,
- "The OBJECT library type may not be used for IMPORTED libraries.");
- return true;
+ std::string reason;
+ if (!this->Makefile->GetGlobalGenerator()->HasKnownObjectFileLocation(
+ &reason)) {
+ this->Makefile->IssueMessage(
+ cmake::FATAL_ERROR,
+ "The OBJECT library type may not be used for IMPORTED libraries" +
+ reason + ".");
+ return true;
+ }
}
if (type == cmStateEnums::INTERFACE_LIBRARY) {
if (!cmGeneratorExpression::IsValidTargetName(libName)) {