ENH: Return utility target after creation

After creating a utility target with AddUtilityCommand, return a pointer
to the cmTarget instance so the caller may further modify the target as
needed.
This commit is contained in:
Brad King 2008-10-09 11:00:54 -04:00
parent 802b76a7c4
commit 0ad5eb177b
2 changed files with 14 additions and 12 deletions

View File

@ -982,12 +982,13 @@ void cmMakefile::AddUtilityCommand(const char* utilityName,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmMakefile::AddUtilityCommand(const char* utilityName, cmTarget*
bool excludeFromAll, cmMakefile::AddUtilityCommand(const char* utilityName,
const char* workingDirectory, bool excludeFromAll,
const std::vector<std::string>& depends, const char* workingDirectory,
const cmCustomCommandLines& commandLines, const std::vector<std::string>& depends,
bool escapeOldStyle, const char* comment) const cmCustomCommandLines& commandLines,
bool escapeOldStyle, const char* comment)
{ {
// Create a target instance for this utility. // Create a target instance for this utility.
cmTarget* target = this->AddNewTarget(cmTarget::UTILITY, utilityName); cmTarget* target = this->AddNewTarget(cmTarget::UTILITY, utilityName);
@ -1025,6 +1026,7 @@ void cmMakefile::AddUtilityCommand(const char* utilityName,
cmSystemTools::Error("Could not get source file entry for ", cmSystemTools::Error("Could not get source file entry for ",
force.c_str()); force.c_str());
} }
return target;
} }
void cmMakefile::AddDefineFlag(const char* flag) void cmMakefile::AddDefineFlag(const char* flag)

View File

@ -200,12 +200,12 @@ public:
const char* arg2=0, const char* arg2=0,
const char* arg3=0, const char* arg3=0,
const char* arg4=0); const char* arg4=0);
void AddUtilityCommand(const char* utilityName, bool excludeFromAll, cmTarget* AddUtilityCommand(const char* utilityName, bool excludeFromAll,
const char* workingDirectory, const char* workingDirectory,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines, const cmCustomCommandLines& commandLines,
bool escapeOldStyle = true, bool escapeOldStyle = true,
const char* comment = 0); const char* comment = 0);
/** /**
* Add a link library to the build. * Add a link library to the build.