summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-11-13 20:59:32 (GMT)
committerBrad King <brad.king@kitware.com>2013-11-14 21:25:31 (GMT)
commit05923172f94d804dfba33957aa08ac88cc5cd0bd (patch)
tree5f394cf0dba177cad5905a01dfaee476d00278af /Source/cmGlobalGenerator.cxx
parent1befbfad3d9971335ab0e7deb1a93acfdccf0fb6 (diff)
downloadCMake-05923172f94d804dfba33957aa08ac88cc5cd0bd.zip
CMake-05923172f94d804dfba33957aa08ac88cc5cd0bd.tar.gz
CMake-05923172f94d804dfba33957aa08ac88cc5cd0bd.tar.bz2
cmGlobalGenerator: Add method to compute "cmake --build" command line
Create a GenerateCMakeBuildCommand method to generate a command-line string invoking "cmake --build" for a given target and configuration. Optionally allow the "-i" make flag and additional native options.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx40
1 files changed, 40 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 335bf5a..531e1ca 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1707,6 +1707,46 @@ int cmGlobalGenerator::Build(
return retVal;
}
+//----------------------------------------------------------------------------
+std::string cmGlobalGenerator::GenerateCMakeBuildCommand(
+ const char* target, const char* config, const char* native,
+ bool ignoreErrors)
+{
+ std::string makeCommand = cmSystemTools::GetCMakeCommand();
+ makeCommand = cmSystemTools::ConvertToOutputPath(makeCommand.c_str());
+ makeCommand += " --build .";
+ if(config && *config)
+ {
+ makeCommand += " --config \"";
+ makeCommand += config;
+ makeCommand += "\"";
+ }
+ if(target && *target)
+ {
+ makeCommand += " --target \"";
+ makeCommand += target;
+ makeCommand += "\"";
+ }
+ const char* sep = " -- ";
+ if(ignoreErrors)
+ {
+ const char* iflag = this->GetBuildIgnoreErrorsFlag();
+ if(iflag && *iflag)
+ {
+ makeCommand += sep;
+ makeCommand += iflag;
+ sep = " ";
+ }
+ }
+ if(native && *native)
+ {
+ makeCommand += sep;
+ makeCommand += native;
+ }
+ return makeCommand;
+}
+
+//----------------------------------------------------------------------------
void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg)
{
this->LocalGenerators.push_back(lg);