ENH: Implemented generation of display for pre-build, pre-link, and post-build custom command comments during the build. This addresses issue #5353.
This commit is contained in:
parent
42bad89fe7
commit
872553de7e
|
@ -1144,11 +1144,6 @@ void cmGlobalXCodeGenerator
|
|||
{
|
||||
bool escapeOldStyle = cc.GetEscapeOldStyle();
|
||||
bool escapeAllowMakeVars = cc.GetEscapeAllowMakeVars();
|
||||
makefileStream << "\n#" << "Custom command rule: ";
|
||||
if(cc.GetComment())
|
||||
{
|
||||
makefileStream << cc.GetComment();
|
||||
}
|
||||
makefileStream << "\n";
|
||||
const std::vector<std::string>& outputs = cc.GetOutputs();
|
||||
if(!outputs.empty())
|
||||
|
@ -1175,6 +1170,14 @@ void cmGlobalXCodeGenerator
|
|||
}
|
||||
makefileStream << "\n";
|
||||
|
||||
if(const char* comment = cc.GetComment())
|
||||
{
|
||||
std::string echo_cmd = "echo ";
|
||||
echo_cmd += (this->CurrentLocalGenerator->
|
||||
EscapeForShell(comment, escapeAllowMakeVars));
|
||||
makefileStream << "\t" << echo_cmd.c_str() << "\n";
|
||||
}
|
||||
|
||||
// Add each command line to the set of commands.
|
||||
for(cmCustomCommandLines::const_iterator cl =
|
||||
cc.GetCommandLines().begin();
|
||||
|
|
|
@ -902,7 +902,7 @@ cmLocalUnixMakefileGenerator3
|
|||
for(std::vector<cmCustomCommand>::const_iterator i = ccs.begin();
|
||||
i != ccs.end(); ++i)
|
||||
{
|
||||
this->AppendCustomCommand(commands, *i);
|
||||
this->AppendCustomCommand(commands, *i, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -910,8 +910,22 @@ cmLocalUnixMakefileGenerator3
|
|||
void
|
||||
cmLocalUnixMakefileGenerator3
|
||||
::AppendCustomCommand(std::vector<std::string>& commands,
|
||||
const cmCustomCommand& cc)
|
||||
const cmCustomCommand& cc, bool echo_comment)
|
||||
{
|
||||
// Optionally create a command to display the custom command's
|
||||
// comment text. This is used for pre-build, pre-link, and
|
||||
// post-build command comments. Custom build step commands have
|
||||
// their comments generated elsewhere.
|
||||
if(echo_comment)
|
||||
{
|
||||
const char* comment = cc.GetComment();
|
||||
if(comment && *comment)
|
||||
{
|
||||
this->AppendEcho(commands, comment,
|
||||
cmLocalUnixMakefileGenerator3::EchoGenerate);
|
||||
}
|
||||
}
|
||||
|
||||
// if the command specified a working directory use it.
|
||||
const char* dir = this->Makefile->GetStartOutputDirectory();
|
||||
const char* workingDir = cc.GetWorkingDirectory();
|
||||
|
|
|
@ -313,7 +313,8 @@ protected:
|
|||
void AppendCustomCommands(std::vector<std::string>& commands,
|
||||
const std::vector<cmCustomCommand>& ccs);
|
||||
void AppendCustomCommand(std::vector<std::string>& commands,
|
||||
const cmCustomCommand& cc);
|
||||
const cmCustomCommand& cc,
|
||||
bool echo_comment=false);
|
||||
void AppendCleanCommand(std::vector<std::string>& commands,
|
||||
const std::vector<std::string>& files,
|
||||
cmTarget& target, const char* filename =0);
|
||||
|
|
|
@ -1355,6 +1355,12 @@ void cmLocalVisualStudio7Generator
|
|||
{
|
||||
if(!init)
|
||||
{
|
||||
const char* comment = cr->GetComment();
|
||||
if(comment && *comment)
|
||||
{
|
||||
fout << "\nDescription=\""
|
||||
<< this->EscapeForXML(comment) << "\"";
|
||||
}
|
||||
fout << "\nCommandLine=\"";
|
||||
init = true;
|
||||
}
|
||||
|
@ -1385,6 +1391,12 @@ void cmLocalVisualStudio7Generator
|
|||
{
|
||||
if(!init)
|
||||
{
|
||||
const char* comment = cr->GetComment();
|
||||
if(comment && *comment)
|
||||
{
|
||||
fout << "\nDescription=\""
|
||||
<< this->EscapeForXML(comment) << "\"";
|
||||
}
|
||||
fout << "\nCommandLine=\"";
|
||||
init = true;
|
||||
}
|
||||
|
@ -1415,6 +1427,12 @@ void cmLocalVisualStudio7Generator
|
|||
{
|
||||
if(!init)
|
||||
{
|
||||
const char* comment = cr->GetComment();
|
||||
if(comment && *comment)
|
||||
{
|
||||
fout << "\nDescription=\""
|
||||
<< this->EscapeForXML(comment) << "\"";
|
||||
}
|
||||
fout << "\nCommandLine=\"";
|
||||
init = true;
|
||||
}
|
||||
|
|
|
@ -95,12 +95,14 @@ ADD_CUSTOM_COMMAND(
|
|||
TARGET TDocument PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E echo " Writing doc1pre.txt."
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/doc1.tex ${PROJECT_BINARY_DIR}/doc1pre.txt
|
||||
COMMENT "Running TDocument pre-build commands"
|
||||
)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET TDocument POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E echo " Copying doc1pre.txt to doc2post.txt."
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1pre.txt
|
||||
${PROJECT_BINARY_DIR}/doc2post.txt
|
||||
COMMENT "Running TDocument post-build commands"
|
||||
)
|
||||
|
||||
################################################################
|
||||
|
|
Loading…
Reference in New Issue