summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Jasny <gjasny@googlemail.com>2017-02-18 20:12:27 +0100
committerGregor Jasny <gjasny@googlemail.com>2017-02-22 17:05:17 +0100
commit33a1d727d5aafeaa0d9e729119d7d43ea9fcb370 (patch)
tree547d8658c95029be6ece913237cfbe17703f3406
parent96b6afdc4289a3f04983ee5f5af82c83b422c583 (diff)
downloadcmake-33a1d727d5aafeaa0d9e729119d7d43ea9fcb370.tar.gz
Makefile: Allow adding post-build rules to object libraries
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx3
-rw-r--r--Source/cmMakefile.cxx6
-rw-r--r--Source/cmMakefile.h10
3 files changed, 15 insertions, 4 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 8627cf2820..5029a947a4 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -489,7 +489,8 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
std::vector<std::string> no_byproducts;
lg->GetMakefile()->AddCustomCommandToTarget(
target->GetName(), no_byproducts, no_depends, commandLines,
- cmTarget::POST_BUILD, "Depend check for xcode", dir.c_str());
+ cmTarget::POST_BUILD, "Depend check for xcode", dir.c_str(), true,
+ false, "", false, cmMakefile::AcceptObjectLibraryCommands);
}
if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index bdaca9713a..7f9e6ef18a 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -684,7 +684,8 @@ void cmMakefile::AddCustomCommandToTarget(
const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines, cmTarget::CustomCommandType type,
const char* comment, const char* workingDir, bool escapeOldStyle,
- bool uses_terminal, const std::string& depfile, bool command_expand_lists)
+ bool uses_terminal, const std::string& depfile, bool command_expand_lists,
+ ObjectLibraryCommands objLibraryCommands)
{
// Find the target to which to add the custom command.
cmTargets::iterator ti = this->Targets.find(target);
@@ -724,7 +725,8 @@ void cmMakefile::AddCustomCommandToTarget(
return;
}
- if (ti->second.GetType() == cmStateEnums::OBJECT_LIBRARY) {
+ if (objLibraryCommands == RejectObjectLibraryCommands &&
+ ti->second.GetType() == cmStateEnums::OBJECT_LIBRARY) {
std::ostringstream e;
e << "Target \"" << target
<< "\" is an OBJECT library "
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 9d9e90a76f..4d5ce98842 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -119,6 +119,13 @@ public:
*/
void FinalPass();
+ /** How to handle custom commands for object libraries */
+ enum ObjectLibraryCommands
+ {
+ RejectObjectLibraryCommands,
+ AcceptObjectLibraryCommands
+ };
+
/** Add a custom command to the build. */
void AddCustomCommandToTarget(
const std::string& target, const std::vector<std::string>& byproducts,
@@ -126,7 +133,8 @@ public:
const cmCustomCommandLines& commandLines, cmTarget::CustomCommandType type,
const char* comment, const char* workingDir, bool escapeOldStyle = true,
bool uses_terminal = false, const std::string& depfile = "",
- bool command_expand_lists = false);
+ bool command_expand_lists = false,
+ ObjectLibraryCommands objLibraryCommands = RejectObjectLibraryCommands);
cmSourceFile* AddCustomCommandToOutput(
const std::vector<std::string>& outputs,
const std::vector<std::string>& byproducts,