summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx37
1 files changed, 25 insertions, 12 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index f63a264..fdb3687 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -8,6 +8,8 @@
# include <cm/iterator>
#endif
+#include <cmext/algorithm>
+
#include "cm_sys_stat.h"
#include "cmAlgorithms.h"
@@ -330,9 +332,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
}
} else {
- std::cerr << "Parse error in command line argument: " << arg << "\n"
- << "Should be: VAR:type=value\n";
- cmSystemTools::Error("No cmake script provided.");
+ cmSystemTools::Error("Parse error in command line argument: " + arg +
+ "\n" + "Should be: VAR:type=value\n");
return false;
}
} else if (cmHasLiteralPrefix(arg, "-W")) {
@@ -422,7 +423,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
return false;
}
}
- std::cout << "loading initial cache file " << path << "\n";
+ cmSystemTools::Stdout("loading initial cache file " + path + "\n");
// Resolve script path specified on command line relative to $PWD.
path = cmSystemTools::CollapseFullPath(path);
this->ReadListFile(args, path);
@@ -539,7 +540,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
std::vector<std::string> includeDirs = cmExpandedList(includes);
gg->CreateGenerationObjects();
- cmLocalGenerator* lg = gg->LocalGenerators[0];
+ const auto& lg = gg->LocalGenerators[0];
std::string includeFlags =
lg->GetIncludeFlags(includeDirs, nullptr, language);
@@ -549,7 +550,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
const char* targetName = "dummy";
std::vector<std::string> srcs;
cmTarget* tgt = mf->AddExecutable(targetName, srcs, true);
- tgt->SetProperty("LINKER_LANGUAGE", language.c_str());
+ tgt->SetProperty("LINKER_LANGUAGE", language);
std::string libs = mf->GetSafeDefinition("PACKAGE_LIBRARIES");
std::vector<std::string> libList = cmExpandedList(libs);
@@ -735,6 +736,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
return;
}
this->SetLogLevel(logLevel);
+ this->LogLevelWasSetViaCLI = true;
} else if (arg.find("--loglevel=", 0) == 0) {
// This is supported for backward compatibility. This option only
// appeared in the 3.15.x release series and was renamed to
@@ -746,6 +748,9 @@ void cmake::SetArgs(const std::vector<std::string>& args)
return;
}
this->SetLogLevel(logLevel);
+ this->LogLevelWasSetViaCLI = true;
+ } else if (arg == "--log-context") {
+ this->SetShowLogContext(true);
} else if (arg.find("--trace-expand", 0) == 0) {
std::cout << "Running with expanded trace output on.\n";
this->SetTrace(true);
@@ -1046,7 +1051,7 @@ void cmake::GetRegisteredGenerators(std::vector<GeneratorInfo>& generators,
std::vector<std::string> names = gen->GetGeneratorNames();
if (includeNamesWithPlatform) {
- cmAppend(names, gen->GetGeneratorNamesWithPlatform());
+ cm::append(names, gen->GetGeneratorNamesWithPlatform());
}
for (std::string const& name : names) {
@@ -1916,6 +1921,7 @@ void cmake::AddDefaultGenerators()
this->Generators.push_back(cmGlobalGhsMultiGenerator::NewFactory());
# endif
this->Generators.push_back(cmGlobalNinjaGenerator::NewFactory());
+ this->Generators.push_back(cmGlobalNinjaMultiGenerator::NewFactory());
#endif
#if defined(CMAKE_USE_WMAKE)
this->Generators.push_back(cmGlobalWatcomWMakeGenerator::NewFactory());
@@ -2166,7 +2172,7 @@ int cmake::CheckBuildSystem()
if (ggd) {
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmMakefile mfd(ggd.get(), cm.GetCurrentSnapshot());
- std::unique_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator(&mfd));
+ auto lgd = ggd->CreateLocalGenerator(&mfd);
lgd->ClearDependencies(&mfd, verbose);
}
}
@@ -2287,7 +2293,7 @@ void cmake::MarkCliAsUsed(const std::string& variable)
void cmake::GenerateGraphViz(const std::string& fileName) const
{
#ifndef CMAKE_BOOTSTRAP
- cmGraphVizWriter gvWriter(this->GetGlobalGenerator());
+ cmGraphVizWriter gvWriter(fileName, this->GetGlobalGenerator());
std::string settingsFile =
cmStrCat(this->GetHomeOutputDirectory(), "/CMakeGraphVizOptions.cmake");
@@ -2295,9 +2301,8 @@ void cmake::GenerateGraphViz(const std::string& fileName) const
cmStrCat(this->GetHomeDirectory(), "/CMakeGraphVizOptions.cmake");
gvWriter.ReadSettings(settingsFile, fallbackSettingsFile);
- gvWriter.WritePerTargetFiles(fileName);
- gvWriter.WriteTargetDependersFiles(fileName);
- gvWriter.WriteGlobalFile(fileName);
+
+ gvWriter.Write();
#endif
}
@@ -2616,6 +2621,14 @@ int cmake::Build(int jobs, const std::string& dir,
return 1;
}
}
+ const char* cachedGeneratorToolset =
+ this->State->GetCacheEntryValue("CMAKE_GENERATOR_TOOLSET");
+ if (cachedGeneratorToolset) {
+ cmMakefile mf(gen, this->GetCurrentSnapshot());
+ if (!gen->SetGeneratorToolset(cachedGeneratorToolset, true, &mf)) {
+ return 1;
+ }
+ }
std::string output;
std::string projName;
const char* cachedProjectName =