summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-04-28 17:33:51 -0400
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-04-28 17:33:51 -0400
commit7c5745ae9560851baf383cdac731ccf4c5a65014 (patch)
tree4c4ca6ab11274e42e89002f763a2c76d511b8f6e /Source
parent3b81a4329420f0cb2ea0f3e7a4662c903e1b3aa0 (diff)
downloadcmake-7c5745ae9560851baf383cdac731ccf4c5a65014.tar.gz
ENH: Start working on command that will abstract generating of build command
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalGenerator.cxx54
-rw-r--r--Source/cmGlobalGenerator.h2
2 files changed, 33 insertions, 23 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 4e1934da76..17bfc01502 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))
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index bfaf4aaa35..a4bd0baba9 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -98,6 +98,8 @@ public:
std::string *output,
const char *makeProgram, const char *config,
bool clean);
+ virtual std::string GenerateBuildCommand(const char* makeProgram, const char *projectName, const char *targetName,
+ const char* config);
///! Set the CMake instance
void SetCMakeInstance(cmake *cm) {