diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-04-28 21:33:51 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-04-28 21:33:51 (GMT) |
commit | 7c5745ae9560851baf383cdac731ccf4c5a65014 (patch) | |
tree | 4c4ca6ab11274e42e89002f763a2c76d511b8f6e /Source/cmGlobalGenerator.cxx | |
parent | 3b81a4329420f0cb2ea0f3e7a4662c903e1b3aa0 (diff) | |
download | CMake-7c5745ae9560851baf383cdac731ccf4c5a65014.zip CMake-7c5745ae9560851baf383cdac731ccf4c5a65014.tar.gz CMake-7c5745ae9560851baf383cdac731ccf4c5a65014.tar.bz2 |
ENH: Start working on command that will abstract generating of build command
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 54 |
1 files changed, 31 insertions, 23 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4e1934d..17bfc01 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -649,34 +649,50 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, newTarget.c_str(), output,makeCommand.c_str(),config,false); } + +std::string cmGlobalGenerator::GenerateBuildCommand(const char* makeProgram, + const char *projectName, const char *targetName, const char* config) +{ + // Project name and config are not used yet. + (void)projectName; + (void)config; + + std::string makeCommand = makeProgram; + makeCommand = cmSystemTools::ConvertToOutputPath(makeCommand.c_str()); + makeCommand += " "; + // Since we have full control over the invocation of nmake, let us + // make it quiet. + if ( strcmp(this->GetName(), "NMake Makefiles") == 0 ) + { + makeCommand += "/NOLOGO "; + } + if ( targetName ) + { + makeCommand += targetName; + } + else + { + makeCommand += "all"; + } + return makeCommand; +} int cmGlobalGenerator::Build( const char *, const char *bindir, - const char *, const char *target, + const char *projectName, const char *target, std::string *output, const char *makeCommandCSTR, - const char * /* config */, + const char *config, bool clean) { *output += "\nTesting TryCompileWithoutMakefile\n"; - // now build the test - std::string makeCommand = makeCommandCSTR; - makeCommand = cmSystemTools::ConvertToOutputPath(makeCommand.c_str()); - /** * Run an executable command and put the stdout in output. */ std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); cmSystemTools::ChangeDirectory(bindir); - // Since we have full control over the invocation of nmake, let us - // make it quiet. - if ( strcmp(this->GetName(), "NMake Makefiles") == 0 ) - { - makeCommand += " /NOLOGO "; - } - int retVal; int timeout = cmGlobalGenerator::s_TryCompileTimeout; bool hideconsole = cmSystemTools::GetRunCommandHideConsole(); @@ -685,7 +701,7 @@ int cmGlobalGenerator::Build( // should we do a clean first? if (clean) { - std::string cleanCommand = makeCommand + " clean"; + std::string cleanCommand = this->GenerateBuildCommand(makeCommandCSTR, projectName, "clean", config); if (!cmSystemTools::RunSingleCommand(cleanCommand.c_str(), output, &retVal, 0, false, timeout)) { @@ -703,15 +719,7 @@ int cmGlobalGenerator::Build( } // now build - if (target && strlen(target)) - { - makeCommand += " "; - makeCommand += target; - } - else - { - makeCommand += " all"; - } + std::string makeCommand = this->GenerateBuildCommand(makeCommandCSTR, projectName, target, config); if (!cmSystemTools::RunSingleCommand(makeCommand.c_str(), output, &retVal, 0, false, timeout)) |