summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileLibraryTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-03-12 14:54:37 (GMT)
committerBrad King <brad.king@kitware.com>2012-03-13 18:38:02 (GMT)
commit3aa741acb6b47d83a0892ddf027ddb0abdc33e78 (patch)
treed3416968375e99e3e99dce6611440535085b0cb7 /Source/cmMakefileLibraryTargetGenerator.cxx
parentb87d7a60a0ed146b79c49baedb666db228d5a70f (diff)
downloadCMake-3aa741acb6b47d83a0892ddf027ddb0abdc33e78.zip
CMake-3aa741acb6b47d83a0892ddf027ddb0abdc33e78.tar.gz
CMake-3aa741acb6b47d83a0892ddf027ddb0abdc33e78.tar.bz2
Build object library targets in Makefiles
Treat OBJECT libraries as STATIC libraries but leave out the archive step. The object files will be left behind for reference by other targets later.
Diffstat (limited to 'Source/cmMakefileLibraryTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index b4174cc..38aa59d 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -101,6 +101,9 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
this->WriteModuleLibraryRules(true);
}
break;
+ case cmTarget::OBJECT_LIBRARY:
+ this->WriteObjectLibraryRules();
+ break;
default:
// If language is not known, this is an error.
cmSystemTools::Error("Unknown Library Type");
@@ -122,6 +125,29 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
}
//----------------------------------------------------------------------------
+void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules()
+{
+ std::vector<std::string> commands;
+ std::vector<std::string> depends;
+
+ // Add post-build rules.
+ this->LocalGenerator->
+ AppendCustomCommands(commands, this->Target->GetPostBuildCommands(),
+ this->Target);
+
+ // Depend on the object files.
+ this->AppendObjectDepends(depends);
+
+ // Write the rule.
+ this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
+ this->Target->GetName(),
+ depends, commands, true);
+
+ // Write the main driver rule to build everything in this target.
+ this->WriteTargetDriverRule(this->Target->GetName(), false);
+}
+
+//----------------------------------------------------------------------------
void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
{
const char* linkLanguage =