diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h index c5252b794..1cc1e3a75 100644 --- a/Source/cmAddCustomCommandCommand.h +++ b/Source/cmAddCustomCommandCommand.h @@ -68,7 +68,8 @@ public: " [COMMAND command2 [ARGS] [args2...] ...]\n" " [MAIN_DEPENDENCY depend]\n" " [DEPENDS [depends...]]\n" - " [IMPLICIT_DEPENDS depend1 ...]\n" + " [IMPLICIT_DEPENDS depend1\n" + " [ depend2] ...]\n" " [WORKING_DIRECTORY dir]\n" " [COMMENT comment] [VERBATIM] [APPEND])\n" "This defines a command to generate specified OUTPUT file(s). " @@ -142,6 +143,8 @@ public: "dependencies of an input file. The language given specifies the " "programming language whose corresponding dependency scanner should " "be used. Currently only C and CXX language scanners are supported. " + "The language has to be specified for every file in the " + "IMPLICIT_DEPENDS list. " "Dependencies discovered from the scanning are added to those of " "the custom command at build time. Note that the IMPLICIT_DEPENDS " "option is currently supported only for Makefile generators and " diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index db93529dd..820d25a9d 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1939,8 +1939,12 @@ void cmLocalUnixMakefileGenerator3 for(ImplicitDependFileMap::const_iterator pi = implicitPairs.begin(); pi != implicitPairs.end(); ++pi) { - cmakefileStream << " \"" << pi->second << "\" "; - cmakefileStream << "\"" << pi->first << "\"\n"; + for(cmDepends::DependencyVector::const_iterator di = pi->second.begin(); + di != pi->second.end(); ++ di) + { + cmakefileStream << " \"" << *di << "\" "; + cmakefileStream << "\"" << pi->first << "\"\n"; + } } cmakefileStream << " )\n"; @@ -2204,7 +2208,7 @@ cmLocalUnixMakefileGenerator3::AddImplicitDepends(cmTarget const& tgt, const char* obj, const char* src) { - this->ImplicitDepends[tgt.GetName()][lang][obj] = src; + this->ImplicitDepends[tgt.GetName()][lang][obj].push_back(src); } //---------------------------------------------------------------------------- diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index e3749590b..703369e1c 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -209,7 +209,8 @@ public: // File pairs for implicit dependency scanning. The key of the map // is the depender and the value is the explicit dependee. - struct ImplicitDependFileMap: public std::map {}; + struct ImplicitDependFileMap: + public std::map {}; struct ImplicitDependLanguageMap: public std::map {}; struct ImplicitDependTargetMap: diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt index 01f5f6267..542c716b4 100644 --- a/Tests/BuildDepends/Project/CMakeLists.txt +++ b/Tests/BuildDepends/Project/CMakeLists.txt @@ -64,7 +64,8 @@ if("${CMAKE_GENERATOR}" MATCHES "Make") # Test the IMPLICIT_DEPENDS feature. set(ZOT_DEPENDS IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/dep.cxx) set(ZOT_CUSTOM_DEP - IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/dep_custom.cxx) + IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/dep_custom.cxx + CXX ${CMAKE_CURRENT_SOURCE_DIR}/dep_custom2.cxx ) else() # No IMPLICIT_DEPENDS...just depend directly. set(ZOT_DEPENDS DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/zot.hxx.in) diff --git a/Tests/BuildDepends/Project/dep_custom2.cxx b/Tests/BuildDepends/Project/dep_custom2.cxx new file mode 100644 index 000000000..ac9dee120 --- /dev/null +++ b/Tests/BuildDepends/Project/dep_custom2.cxx @@ -0,0 +1,2 @@ +#include +// some comment