diff options
author | Brad King <brad.king@kitware.com> | 2014-03-10 19:04:38 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-03-12 14:44:00 (GMT) |
commit | 9a5c55441418ef79415b9a1b99c35192d2b8c1b0 (patch) | |
tree | 93930fd77e9dc70520420e194f0973728ec0940b /Source/cmGlobalXCodeGenerator.cxx | |
parent | d45e7f34611cd678bdda29d7d2b2ff4ce1abbce7 (diff) | |
download | CMake-9a5c55441418ef79415b9a1b99c35192d2b8c1b0.zip CMake-9a5c55441418ef79415b9a1b99c35192d2b8c1b0.tar.gz CMake-9a5c55441418ef79415b9a1b99c35192d2b8c1b0.tar.bz2 |
cmGlobalXCodeGenerator: Simplify handling of multiple outputs
Make the multiple output pair map more local. Generate it where we
have the current configuration available.
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 49 |
1 files changed, 18 insertions, 31 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 16c74b9..2dd31f3 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1470,32 +1470,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, const & commands, const char* name) { - - // collect multiple outputs of custom commands into a set - // which will be used for every configuration - std::map<std::string, std::string> multipleOutputPairs; - for(std::vector<cmCustomCommand>::const_iterator i = commands.begin(); - i != commands.end(); ++i) - { - cmCustomCommand const& cc = *i; - if(!cc.GetCommandLines().empty()) - { - const std::vector<std::string>& outputs = cc.GetOutputs(); - if(!outputs.empty()) - { - // If there are more than one outputs treat the - // first as the primary output and make the rest depend on it. - std::vector<std::string>::const_iterator o = outputs.begin(); - std::string primaryOutput = this->ConvertToRelativeForMake(o->c_str()); - for(++o; o != outputs.end(); ++o) - { - std::string currentOutput=this->ConvertToRelativeForMake(o->c_str()); - multipleOutputPairs[currentOutput] = primaryOutput; - } - } - } - } - + bool haveMultipleOutputPairs = false; std::string dir = this->CurrentMakefile->GetCurrentOutputDirectory(); dir += "/CMakeScripts"; cmSystemTools::MakeDirectory(dir.c_str()); @@ -1515,7 +1490,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, target, commands, currentConfig->c_str(), - multipleOutputPairs); + haveMultipleOutputPairs); } std::string cdir = this->CurrentMakefile->GetCurrentOutputDirectory(); @@ -1525,7 +1500,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, makecmd += " -f "; makecmd += this->ConvertToRelativeForMake( (makefile+"$CONFIGURATION").c_str()); - if(!multipleOutputPairs.empty()) + if(haveMultipleOutputPairs) { makecmd += " cmake_check_multiple_outputs"; } @@ -1544,9 +1519,7 @@ void cmGlobalXCodeGenerator std::vector<cmCustomCommand> const & commands, const std::string& configName, - const std::map<std::string, - std::string>& multipleOutputPairs - ) + bool& haveMultipleOutputPairs) { std::string makefileName=makefileBasename; if(this->XcodeVersion > 20) @@ -1569,6 +1542,7 @@ void cmGlobalXCodeGenerator makefileStream << "all: "; std::map<const cmCustomCommand*, std::string> tname; int count = 0; + std::map<std::string, std::string> multipleOutputPairs; for(std::vector<cmCustomCommand>::const_iterator i = commands.begin(); i != commands.end(); ++i) { @@ -1584,6 +1558,16 @@ void cmGlobalXCodeGenerator makefileStream << "\\\n\t" << this->ConvertToRelativeForMake(o->c_str()); } + + // If there is more than one output treat the first as the + // primary output and make the rest depend on it. + std::vector<std::string>::const_iterator o = outputs.begin(); + std::string primaryOutput = this->ConvertToRelativeForMake(o->c_str()); + for(++o; o != outputs.end(); ++o) + { + std::string currentOutput=this->ConvertToRelativeForMake(o->c_str()); + multipleOutputPairs[currentOutput] = primaryOutput; + } } else { @@ -1683,6 +1667,9 @@ void cmGlobalXCodeGenerator << o->second << "; fi\n"; } } + + haveMultipleOutputPairs = + haveMultipleOutputPairs || !multipleOutputPairs.empty(); } //---------------------------------------------------------------------------- |