summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-12-01 16:41:00 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-12-01 16:41:00 (GMT)
commit782bef73746cce51a000effd72f16b2fbb3d3d8a (patch)
treea529545cc540245b811534b506c762d4e18b15fe /Source
parente95224b2e747c8eacba178c37a9ad5c5c055cbf4 (diff)
downloadCMake-782bef73746cce51a000effd72f16b2fbb3d3d8a.zip
CMake-782bef73746cce51a000effd72f16b2fbb3d3d8a.tar.gz
CMake-782bef73746cce51a000effd72f16b2fbb3d3d8a.tar.bz2
ENH: Add a way for the generated command to include extra flags. This is useful for CTest (or try compile) to add -j2
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestBuildCommand.cxx3
-rw-r--r--Source/cmBuildCommand.cxx37
-rw-r--r--Source/cmGlobalGenerator.cxx15
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx8
-rw-r--r--Source/cmGlobalVisualStudio6Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx8
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx9
-rw-r--r--Source/cmGlobalXCodeGenerator.h4
10 files changed, 42 insertions, 48 deletions
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx
index fcfdf2f..e5d20ed 100644
--- a/Source/CTest/cmCTestBuildCommand.cxx
+++ b/Source/CTest/cmCTestBuildCommand.cxx
@@ -108,6 +108,7 @@ bool cmCTestBuildCommand::InitialPass(
const char* cmakeGeneratorName = m_Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
const char* cmakeProjectName = m_Makefile->GetDefinition("CTEST_PROJECT_NAME");
const char* cmakeBuildConfiguration = m_Makefile->GetDefinition("CTEST_BUILD_CONFIGURATION");
+ const char* cmakeBuildAdditionalFlags = m_Makefile->GetDefinition("CTEST_BUILD_FLAGS");
if ( cmakeGeneratorName && *cmakeGeneratorName &&
cmakeProjectName && *cmakeProjectName )
{
@@ -132,7 +133,7 @@ bool cmCTestBuildCommand::InitialPass(
const char* cmakeMakeProgram = m_Makefile->GetDefinition("CMAKE_MAKE_PROGRAM");
std::string buildCommand
= m_GlobalGenerator->GenerateBuildCommand(cmakeMakeProgram, cmakeProjectName,
- 0, cmakeBuildConfiguration, true);
+ cmakeBuildAdditionalFlags, 0, cmakeBuildConfiguration, true);
m_CTest->SetCTestConfiguration("MakeCommand", buildCommand.c_str());
}
else
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index 6c7d7bd..382ba6b 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -33,40 +33,9 @@ bool cmBuildCommand::InitialPass(std::vector<std::string> const& args)
std::string makeprogram = args[1];
std::string makecommand
= m_Makefile->GetLocalGenerator()->GetGlobalGenerator()->GenerateBuildCommand(
- makeprogram.c_str(), m_Makefile->GetProjectName(), 0, "Release", true);
-#if 0
- std::string makecommand;
- if(makeprogram.find("msdev") != std::string::npos ||
- makeprogram.find("MSDEV") != std::string::npos )
- {
- makecommand = "\"";
- makecommand += makeprogram;
- makecommand += "\"";
- makecommand += " ";
- makecommand += m_Makefile->GetProjectName();
- makecommand += ".dsw /MAKE \"ALL_BUILD - Release\" ";
- }
- else if (makeprogram.find("devenv") != std::string::npos ||
- makeprogram.find("DEVENV") != std::string::npos )
- {
- makecommand = "\"";
- makecommand += makeprogram;
- makecommand += "\"";
- makecommand += " ";
- makecommand += m_Makefile->GetProjectName();
- makecommand += ".sln /build Release /project ALL_BUILD";
- }
- else if (makeprogram.find("xcodebuild") != std::string::npos)
- {
- makecommand += makeprogram;
- }
- else
- {
- makecommand = makeprogram;
- makecommand += " -i";
- }
- std::cerr << "-- Compare: " << makecommand.c_str() << " and " << makecmd.c_str() << ": " << (makecmd == makecommand) << std::endl;
-#endif
+ makeprogram.c_str(), m_Makefile->GetProjectName(), 0,
+ 0, "Release", true);
+
if(cacheValue)
{
return true;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index bf80555..8a976ab 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -719,8 +719,8 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
}
std::string cmGlobalGenerator::GenerateBuildCommand(const char* makeProgram,
- const char *projectName, const char *targetName, const char* config,
- bool ignoreErrors)
+ const char *projectName, const char* additionalOptions, const char *targetName,
+ const char* config, bool ignoreErrors)
{
// Project name and config are not used yet.
(void)projectName;
@@ -738,6 +738,11 @@ std::string cmGlobalGenerator::GenerateBuildCommand(const char* makeProgram,
{
makeCommand += " -i";
}
+ if ( additionalOptions )
+ {
+ makeCommand += " ";
+ makeCommand += additionalOptions;
+ }
if ( targetName )
{
makeCommand += " ";
@@ -770,7 +775,8 @@ int cmGlobalGenerator::Build(
// should we do a clean first?
if (clean)
{
- std::string cleanCommand = this->GenerateBuildCommand(makeCommandCSTR, projectName, "clean", config, false);
+ std::string cleanCommand = this->GenerateBuildCommand(makeCommandCSTR, projectName,
+ 0, "clean", config, false);
if (!cmSystemTools::RunSingleCommand(cleanCommand.c_str(), output,
&retVal, 0, false, timeout))
{
@@ -788,7 +794,8 @@ int cmGlobalGenerator::Build(
}
// now build
- std::string makeCommand = this->GenerateBuildCommand(makeCommandCSTR, projectName, target, config, false);
+ std::string makeCommand = this->GenerateBuildCommand(makeCommandCSTR, projectName,
+ 0, target, config, false);
if (!cmSystemTools::RunSingleCommand(makeCommand.c_str(), output,
&retVal, 0, false, timeout))
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 5552b50..f5ef449 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -99,7 +99,7 @@ public:
const char *makeProgram, const char *config,
bool clean);
virtual std::string GenerateBuildCommand(const char* makeProgram,
- const char *projectName, const char *targetName,
+ const char *projectName, const char* additionalOptions, const char *targetName,
const char* config, bool ignoreErrors);
///! Set the CMake instance
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index eed2e09..07f171d 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -68,7 +68,8 @@ void cmGlobalVisualStudio6Generator::GenerateConfigurations(cmMakefile* mf)
}
std::string cmGlobalVisualStudio6Generator::GenerateBuildCommand(const char* makeProgram,
- const char *projectName, const char *targetName, const char* config, bool ignoreErrors)
+ const char *projectName, const char* additionalOptions, const char *targetName,
+ const char* config, bool ignoreErrors)
{
// Ingoring errors is not implemented in visual studio 6
(void) ignoreErrors;
@@ -134,6 +135,11 @@ std::string cmGlobalVisualStudio6Generator::GenerateBuildCommand(const char* mak
{
makeCommand += "\" /BUILD";
}
+ if ( additionalOptions )
+ {
+ makeCommand += " ";
+ makeCommand += additionalOptions;
+ }
return makeCommand;
}
diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h
index 0af3ae6..1d9b56d 100644
--- a/Source/cmGlobalVisualStudio6Generator.h
+++ b/Source/cmGlobalVisualStudio6Generator.h
@@ -55,7 +55,7 @@ public:
* loaded commands, not as part of the usual build process.
*/
virtual std::string GenerateBuildCommand(const char* makeProgram,
- const char *projectName, const char *targetName, const char* config,
+ const char *projectName, const char* additionalOptions, const char *targetName, const char* config,
bool ignoreErrors);
/**
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index c44a782..8a9888b 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -44,7 +44,8 @@ void cmGlobalVisualStudio7Generator::EnableLanguage(std::vector<std::string>cons
}
std::string cmGlobalVisualStudio7Generator::GenerateBuildCommand(const char* makeProgram,
- const char *projectName, const char *targetName, const char* config, bool ignoreErrors)
+ const char *projectName, const char* additionalOptions, const char *targetName,
+ const char* config, bool ignoreErrors)
{
// Ingoring errors is not implemented in visual studio 6
(void) ignoreErrors;
@@ -100,6 +101,11 @@ std::string cmGlobalVisualStudio7Generator::GenerateBuildCommand(const char* mak
{
makeCommand += "ALL_BUILD";
}
+ if ( additionalOptions )
+ {
+ makeCommand += " ";
+ makeCommand += additionalOptions;
+ }
return makeCommand;
}
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index e5c7ff4..39f554c 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -54,7 +54,7 @@ public:
* loaded commands, not as part of the usual build process.
*/
virtual std::string GenerateBuildCommand(const char* makeProgram,
- const char *projectName, const char *targetName, const char* config,
+ const char *projectName, const char* additionalOptions, const char *targetName, const char* config,
bool ignoreErrors);
/**
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 93afdc2..06d3f1b 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -132,8 +132,8 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const&
//----------------------------------------------------------------------------
std::string cmGlobalXCodeGenerator::GenerateBuildCommand(const char* makeProgram,
- const char *projectName, const char *targetName, const char* config,
- bool ignoreErrors)
+ const char *projectName, const char* additionalOptions, const char *targetName,
+ const char* config, bool ignoreErrors)
{
// Config is not used yet
(void) config;
@@ -190,6 +190,11 @@ std::string cmGlobalXCodeGenerator::GenerateBuildCommand(const char* makeProgram
{
makeCommand += " -configuration Debug";
}
+ if ( additionalOptions )
+ {
+ makeCommand += " ";
+ makeCommand += additionalOptions;
+ }
makeCommand += " OBJROOT=.";
return makeCommand;
}
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index f9d7602..94f2ea2 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -59,8 +59,8 @@ public:
* loaded commands, not as part of the usual build process.
*/
virtual std::string GenerateBuildCommand(const char* makeProgram,
- const char *projectName, const char *targetName, const char* config,
- bool ignoreErrors);
+ const char *projectName, const char* additionalOptions, const char *targetName,
+ const char* config, bool ignoreErrors);
/**
* Generate the all required files for building this project/tree. This