summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-12-18 14:50:08 (GMT)
committerBrad King <brad.king@kitware.com>2007-12-18 14:50:08 (GMT)
commit872553de7e729788242da37124f41e40228c6f13 (patch)
tree1bb9aaa4a3fa205c260f09b8eaa80efba79ec7ac
parent42bad89fe7ba61bed1f0ba293e8497970df2cef0 (diff)
downloadCMake-872553de7e729788242da37124f41e40228c6f13.zip
CMake-872553de7e729788242da37124f41e40228c6f13.tar.gz
CMake-872553de7e729788242da37124f41e40228c6f13.tar.bz2
ENH: Implemented generation of display for pre-build, pre-link, and post-build custom command comments during the build. This addresses issue #5353.
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx13
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx18
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h3
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx18
-rw-r--r--Tests/CustomCommand/CMakeLists.txt2
5 files changed, 46 insertions, 8 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 0ecd9aa..f08c36e 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -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();
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 6fa4dd9..f6c091a 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -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();
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index dfb3641..671d768 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -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);
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index a912931..1c144e2 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -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;
}
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index 669fbb8..71ded6d 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -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"
)
################################################################