AddCustomCommand: Handle multiple IMPLICIT_DEPENDS files (#10048)
The code handling IMPLICIT_DEPENDS was only able to track a single file, the latest file replaced earlier files in the list. The documentation now mentions that the language has to be prefixed to every file and the test now uses two implicit dependencies, where only the second is modified to trigger re-running of the custom command. Alex Inspired-by: Michael Wild <themiwi@users.sourceforge.net>
This commit is contained in:
parent
c66f03adf9
commit
05f162ce95
|
@ -68,7 +68,8 @@ public:
|
||||||
" [COMMAND command2 [ARGS] [args2...] ...]\n"
|
" [COMMAND command2 [ARGS] [args2...] ...]\n"
|
||||||
" [MAIN_DEPENDENCY depend]\n"
|
" [MAIN_DEPENDENCY depend]\n"
|
||||||
" [DEPENDS [depends...]]\n"
|
" [DEPENDS [depends...]]\n"
|
||||||
" [IMPLICIT_DEPENDS <lang1> depend1 ...]\n"
|
" [IMPLICIT_DEPENDS <lang1> depend1\n"
|
||||||
|
" [<lang2> depend2] ...]\n"
|
||||||
" [WORKING_DIRECTORY dir]\n"
|
" [WORKING_DIRECTORY dir]\n"
|
||||||
" [COMMENT comment] [VERBATIM] [APPEND])\n"
|
" [COMMENT comment] [VERBATIM] [APPEND])\n"
|
||||||
"This defines a command to generate specified OUTPUT file(s). "
|
"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 "
|
"dependencies of an input file. The language given specifies the "
|
||||||
"programming language whose corresponding dependency scanner should "
|
"programming language whose corresponding dependency scanner should "
|
||||||
"be used. Currently only C and CXX language scanners are supported. "
|
"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 "
|
"Dependencies discovered from the scanning are added to those of "
|
||||||
"the custom command at build time. Note that the IMPLICIT_DEPENDS "
|
"the custom command at build time. Note that the IMPLICIT_DEPENDS "
|
||||||
"option is currently supported only for Makefile generators and "
|
"option is currently supported only for Makefile generators and "
|
||||||
|
|
|
@ -1939,9 +1939,13 @@ void cmLocalUnixMakefileGenerator3
|
||||||
for(ImplicitDependFileMap::const_iterator pi = implicitPairs.begin();
|
for(ImplicitDependFileMap::const_iterator pi = implicitPairs.begin();
|
||||||
pi != implicitPairs.end(); ++pi)
|
pi != implicitPairs.end(); ++pi)
|
||||||
{
|
{
|
||||||
cmakefileStream << " \"" << pi->second << "\" ";
|
for(cmDepends::DependencyVector::const_iterator di = pi->second.begin();
|
||||||
|
di != pi->second.end(); ++ di)
|
||||||
|
{
|
||||||
|
cmakefileStream << " \"" << *di << "\" ";
|
||||||
cmakefileStream << "\"" << pi->first << "\"\n";
|
cmakefileStream << "\"" << pi->first << "\"\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
cmakefileStream << " )\n";
|
cmakefileStream << " )\n";
|
||||||
|
|
||||||
// Tell the dependency scanner what compiler is used.
|
// Tell the dependency scanner what compiler is used.
|
||||||
|
@ -2204,7 +2208,7 @@ cmLocalUnixMakefileGenerator3::AddImplicitDepends(cmTarget const& tgt,
|
||||||
const char* obj,
|
const char* obj,
|
||||||
const char* src)
|
const char* src)
|
||||||
{
|
{
|
||||||
this->ImplicitDepends[tgt.GetName()][lang][obj] = src;
|
this->ImplicitDepends[tgt.GetName()][lang][obj].push_back(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -209,7 +209,8 @@ public:
|
||||||
|
|
||||||
// File pairs for implicit dependency scanning. The key of the map
|
// File pairs for implicit dependency scanning. The key of the map
|
||||||
// is the depender and the value is the explicit dependee.
|
// is the depender and the value is the explicit dependee.
|
||||||
struct ImplicitDependFileMap: public std::map<cmStdString, cmStdString> {};
|
struct ImplicitDependFileMap:
|
||||||
|
public std::map<cmStdString, cmDepends::DependencyVector> {};
|
||||||
struct ImplicitDependLanguageMap:
|
struct ImplicitDependLanguageMap:
|
||||||
public std::map<cmStdString, ImplicitDependFileMap> {};
|
public std::map<cmStdString, ImplicitDependFileMap> {};
|
||||||
struct ImplicitDependTargetMap:
|
struct ImplicitDependTargetMap:
|
||||||
|
|
|
@ -64,7 +64,8 @@ if("${CMAKE_GENERATOR}" MATCHES "Make")
|
||||||
# Test the IMPLICIT_DEPENDS feature.
|
# Test the IMPLICIT_DEPENDS feature.
|
||||||
set(ZOT_DEPENDS IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/dep.cxx)
|
set(ZOT_DEPENDS IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/dep.cxx)
|
||||||
set(ZOT_CUSTOM_DEP
|
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()
|
else()
|
||||||
# No IMPLICIT_DEPENDS...just depend directly.
|
# No IMPLICIT_DEPENDS...just depend directly.
|
||||||
set(ZOT_DEPENDS DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/zot.hxx.in)
|
set(ZOT_DEPENDS DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/zot.hxx.in)
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
#include <zot_custom.hxx.in>
|
||||||
|
// some comment
|
Loading…
Reference in New Issue