diff options
author | Ken Martin <ken.martin@kitware.com> | 2005-06-21 13:34:47 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2005-06-21 13:34:47 (GMT) |
commit | b25dea9f11b0f625d9a6e00567a3ff58b38b0c4a (patch) | |
tree | 6af6ae34b74fe4bc42f103df96266b70cde594e6 | |
parent | 43e1e82fc64906f53b635e6d66f52bf72a6781be (diff) | |
download | CMake-b25dea9f11b0f625d9a6e00567a3ff58b38b0c4a.zip CMake-b25dea9f11b0f625d9a6e00567a3ff58b38b0c4a.tar.gz CMake-b25dea9f11b0f625d9a6e00567a3ff58b38b0c4a.tar.bz2 |
ENH: add test to make sure custom commands are used
-rw-r--r-- | Source/cmCustomCommand.cxx | 3 | ||||
-rw-r--r-- | Source/cmCustomCommand.h | 5 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 19 |
3 files changed, 26 insertions, 1 deletions
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index d677798..8d794f7 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -19,6 +19,7 @@ //---------------------------------------------------------------------------- cmCustomCommand::cmCustomCommand() { + m_Used = false; } //---------------------------------------------------------------------------- @@ -28,6 +29,7 @@ cmCustomCommand::cmCustomCommand(const cmCustomCommand& r): m_CommandLines(r.m_CommandLines), m_Comment(r.m_Comment) { + m_Used = false; } //---------------------------------------------------------------------------- @@ -40,6 +42,7 @@ cmCustomCommand::cmCustomCommand(const char* output, m_CommandLines(commandLines), m_Comment(comment?comment:"") { + m_Used = false; } //---------------------------------------------------------------------------- diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index 0a87949..e6d696a 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -49,11 +49,16 @@ public: /** Get the comment string for the command. */ const char* GetComment() const; + /** set get the used status of the command */ + void Used() { m_Used = true;}; + bool IsUsed() { return m_Used;}; + private: std::string m_Output; std::vector<std::string> m_Depends; cmCustomCommandLines m_CommandLines; std::string m_Comment; + bool m_Used; }; #endif diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 3c0f808..fd1ea48 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -92,6 +92,22 @@ void cmLocalUnixMakefileGenerator3::Generate() // Write the cmake file with information for this directory. this->WriteDirectoryInformationFile(); + + // all custom commands used? + const std::vector<cmSourceFile*> &srcs = m_Makefile->GetSourceFiles(); + std::vector<cmSourceFile*>::const_iterator sit = srcs.begin(); + for (;sit != srcs.end(); ++sit) + { + if ((*sit)->GetCustomCommand() && !(*sit)->GetCustomCommand()->IsUsed()) + { + cmOStringStream err; + err << "Warning: Custom command for source file " + << (*sit)->GetSourceName().c_str() << "." + << (*sit)->GetSourceExtension().c_str() + << " was not used."; + cmSystemTools::Message(err.str().c_str(), "Warning"); + } + } } @@ -162,8 +178,9 @@ void cmLocalUnixMakefileGenerator3 for(std::vector<cmSourceFile*>::const_iterator i = classes.begin(); i != classes.end(); i++) { - if(const cmCustomCommand* cc = (*i)->GetCustomCommand()) + if(cmCustomCommand* cc = (*i)->GetCustomCommand()) { + cc->Used(); objTarget = this->GenerateCustomRuleFile(*cc,tgtDir.c_str()); if (clean) { |