diff options
author | Brad King <brad.king@kitware.com> | 2012-03-12 10:47:40 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-03-13 14:37:32 -0400 |
commit | b87d7a60a0ed146b79c49baedb666db228d5a70f (patch) | |
tree | 4ff0a6246e4c7b78edc7c77e481fa8c0aaec9844 /Source/cmAddLibraryCommand.cxx | |
parent | d5aedf15a4a6d7023a7ba73dcf92b24607af4606 (diff) | |
download | cmake-b87d7a60a0ed146b79c49baedb666db228d5a70f.tar.gz |
Add OBJECT_LIBRARY target type
This library type can compile sources to object files but does not link
or archive them. It will be useful to reference from executable and
normal library targets for direct inclusion of object files in them.
Diagnose and reject the following as errors:
* An OBJECT library may not be referenced in target_link_libraries.
* An OBJECT library may contain only compiling sources and supporting
headers and custom commands. Other source types that are not normally
ignored are not allowed.
* An OBJECT library may not have PRE_BUILD, PRE_LINK, or POST_BUILD
commands.
* An OBJECT library may not be installed, exported, or imported.
Some of these cases may be supported in the future but are not for now.
Teach the VS generator that OBJECT_LIBRARY targets are "linkable" just
like STATIC_LIBRARY targets for the LinkLibraryDependencies behavior.
Diffstat (limited to 'Source/cmAddLibraryCommand.cxx')
-rw-r--r-- | Source/cmAddLibraryCommand.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index 9a776fbdea..c1d0e9d6d9 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -64,6 +64,12 @@ bool cmAddLibraryCommand type = cmTarget::MODULE_LIBRARY; haveSpecifiedType = true; } + else if(libType == "OBJECT") + { + ++s; + type = cmTarget::OBJECT_LIBRARY; + haveSpecifiedType = true; + } else if(libType == "UNKNOWN") { ++s; @@ -118,6 +124,14 @@ bool cmAddLibraryCommand this->SetError("called with IMPORTED argument but no library type."); return false; } + if(type == cmTarget::OBJECT_LIBRARY) + { + this->Makefile->IssueMessage( + cmake::FATAL_ERROR, + "The OBJECT library type may not be used for IMPORTED libraries." + ); + return true; + } // Make sure the target does not already exist. if(this->Makefile->FindTargetToUse(libName.c_str())) |