summaryrefslogtreecommitdiff
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2017-04-29 21:28:14 +0200
committerDaniel Pfeifer <daniel@pfeifer-mail.de>2017-05-08 22:29:44 +0200
commitc36d63cd48fbfda57cd8cf25c029a3a175e10299 (patch)
tree979c1f66e94ad7850b2db7e92c98a96cd0f34313 /Source/cmake.cxx
parent8986dec05dade19ee0f779c6c498dc0e04a8f8ee (diff)
downloadcmake-c36d63cd48fbfda57cd8cf25c029a3a175e10299.tar.gz
cmake: initialize with Role that controls which commands to register
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 737587d775..87b359783e 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -136,7 +136,7 @@ void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/,
cm->MarkCliAsUsed(variable);
}
-cmake::cmake()
+cmake::cmake(Role role)
{
this->Trace = false;
this->TraceExpand = false;
@@ -174,8 +174,12 @@ cmake::cmake()
this->AddDefaultGenerators();
this->AddDefaultExtraGenerators();
- this->AddScriptingCommands();
- this->AddProjectCommands();
+ if (role == RoleScript || role == RoleProject) {
+ this->AddScriptingCommands();
+ }
+ if (role == RoleProject) {
+ this->AddProjectCommands();
+ }
// Make sure we can capture the build tool output.
cmSystemTools::EnableVSConsoleOutput();
@@ -1888,7 +1892,7 @@ int cmake::CheckBuildSystem()
// Read the rerun check file and use it to decide whether to do the
// global generate.
- cmake cm;
+ cmake cm(RoleScript); // Actually, all we need is the `set` command.
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
@@ -2419,6 +2423,9 @@ int cmake::Build(const std::string& dir, const std::string& target,
std::string homeOutputOrig = this->GetHomeOutputDirectory();
this->SetDirectoriesFromFile(cachePath.c_str());
+ this->AddScriptingCommands();
+ this->AddProjectCommands();
+
int ret = this->Configure();
if (ret) {
cmSystemTools::Message("CMake Configure step failed. "