summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-11-13 21:01:20 (GMT)
committerBrad King <brad.king@kitware.com>2013-11-15 19:38:18 (GMT)
commitbca67c710f21cdea70c9b23fe927c87135ee81d9 (patch)
treea661bbd7b31601f890ffbc7110bb242c92e1d8b5 /Source
parent05923172f94d804dfba33957aa08ac88cc5cd0bd (diff)
downloadCMake-bca67c710f21cdea70c9b23fe927c87135ee81d9.zip
CMake-bca67c710f21cdea70c9b23fe927c87135ee81d9.tar.gz
CMake-bca67c710f21cdea70c9b23fe927c87135ee81d9.tar.bz2
build_command: Return a "cmake --build" command-line
Re-implement the build_command() command to use "cmake --build" instead of generating a native build tool invocation directly. This command will internally invoke the proper native build tool. This avoids requiring cmGlobalGenerator::GenerateBuildCommand to produce a string so that it can be later refactored to produce a vector with no quoting or escaping. It will also allow us to later teach CMake to delay the decision about which build tool to invoke until after the project build system is generated to disk. For example, on Visual Studio 10 and above the preferred command-line tool is MSBuild, but we need to fall back to devenv if the .sln has Intel Fortran .vfproj files.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmBuildCommand.cxx33
1 files changed, 8 insertions, 25 deletions
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index b6e2569..c06b8ad 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -85,18 +85,7 @@ bool cmBuildCommand
}
}
- const char* makeprogram
- = this->Makefile->GetDefinition("CMAKE_MAKE_PROGRAM");
- if(!makeprogram)
- {
- this->Makefile->IssueMessage(
- cmake::FATAL_ERROR,
- "build_command() requires CMAKE_MAKE_PROGRAM to be defined. "
- "Call project() or enable_language() first.");
- return true;
- }
-
- // If null/empty CONFIGURATION argument, GenerateBuildCommand uses 'Debug'
+ // If null/empty CONFIGURATION argument, cmake --build uses 'Debug'
// in the currently implemented multi-configuration global generators...
// so we put this code here to end up with the same default configuration
// as the original 2-arg build_command signature:
@@ -110,19 +99,15 @@ bool cmBuildCommand
configuration = "Release";
}
- // If null/empty PROJECT_NAME argument, use the Makefile's project name:
- //
- if(!project_name || !*project_name)
+ if(project_name && *project_name)
{
- project_name = this->Makefile->GetProjectName();
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,
+ "Ignoring PROJECT_NAME option because it has no effect.");
}
- // If null/empty TARGET argument, GenerateBuildCommand omits any mention
- // of a target name on the build command line...
- //
std::string makecommand = this->Makefile->GetLocalGenerator()
- ->GetGlobalGenerator()->GenerateBuildCommand
- (makeprogram, project_name, 0, 0, target, configuration, true, false);
+ ->GetGlobalGenerator()->GenerateCMakeBuildCommand(target, configuration,
+ 0, true);
this->Makefile->AddDefinition(variable, makecommand.c_str());
@@ -142,7 +127,6 @@ bool cmBuildCommand
const char* define = args[0].c_str();
const char* cacheValue
= this->Makefile->GetDefinition(define);
- std::string makeprogram = args[1];
std::string configType = "Release";
const char* cfg = getenv("CMAKE_CONFIG_TYPE");
@@ -152,9 +136,8 @@ bool cmBuildCommand
}
std::string makecommand = this->Makefile->GetLocalGenerator()
- ->GetGlobalGenerator()->GenerateBuildCommand
- (makeprogram.c_str(), this->Makefile->GetProjectName(), 0, 0,
- 0, configType.c_str(), true, false);
+ ->GetGlobalGenerator()->GenerateCMakeBuildCommand(0, configType.c_str(),
+ 0, true);
if(cacheValue)
{