summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx91
1 files changed, 47 insertions, 44 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 5175aae..2ee56f1 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -24,10 +24,6 @@
#include "cmsys/FStream.hxx"
#include "cmsys/RegularExpression.hxx"
-#if defined(_WIN32) && !defined(__CYGWIN__)
-# include <windows.h>
-#endif
-
#include "cmAlgorithms.h"
#include "cmCPackPropertiesGenerator.h"
#include "cmComputeTargetDepends.h"
@@ -142,6 +138,10 @@ cmGlobalGenerator::~cmGlobalGenerator()
{
this->ClearGeneratorMembers();
}
+codecvt_Encoding cmGlobalGenerator::GetMakefileEncoding() const
+{
+ return codecvt_Encoding::None;
+}
#if !defined(CMAKE_BOOTSTRAP)
Json::Value cmGlobalGenerator::GetJson() const
@@ -239,7 +239,8 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string& lang,
if (!mf->GetDefinition(langComp)) {
if (!optional) {
- cmSystemTools::Error(langComp + " not set, after EnableLanguage");
+ cmSystemTools::Error(
+ cmStrCat(langComp, " not set, after EnableLanguage"));
}
return;
}
@@ -636,11 +637,10 @@ void cmGlobalGenerator::EnableLanguage(
#if defined(_WIN32) && !defined(__CYGWIN__)
cmSystemTools::WindowsVersion windowsVersion =
cmSystemTools::GetWindowsVersion();
- std::ostringstream windowsVersionString;
- windowsVersionString << windowsVersion.dwMajorVersion << "."
- << windowsVersion.dwMinorVersion << "."
- << windowsVersion.dwBuildNumber;
- mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION", windowsVersionString.str());
+ auto windowsVersionString = cmStrCat(windowsVersion.dwMajorVersion, '.',
+ windowsVersion.dwMinorVersion, '.',
+ windowsVersion.dwBuildNumber);
+ mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION", windowsVersionString);
#endif
// Read the DetermineSystem file
std::string systemFile = mf->GetModulesFile("CMakeDetermineSystem.cmake");
@@ -695,22 +695,22 @@ void cmGlobalGenerator::EnableLanguage(
setupFile, mf->GetCurrentSourceDirectory());
if (!cmSystemTools::FileExists(absSetupFile)) {
cmSystemTools::Error(
- "CMAKE_PROJECT_TOP_LEVEL_INCLUDES file does not exist: " +
- setupFile);
+ cmStrCat("CMAKE_PROJECT_TOP_LEVEL_INCLUDES file does not exist: ",
+ setupFile));
mf->GetState()->SetInTopLevelIncludes(false);
return;
}
if (cmSystemTools::FileIsDirectory(absSetupFile)) {
cmSystemTools::Error(
- "CMAKE_PROJECT_TOP_LEVEL_INCLUDES file is a directory: " +
- setupFile);
+ cmStrCat("CMAKE_PROJECT_TOP_LEVEL_INCLUDES file is a directory: ",
+ setupFile));
mf->GetState()->SetInTopLevelIncludes(false);
return;
}
if (!mf->ReadListFile(absSetupFile)) {
cmSystemTools::Error(
- "Failed reading CMAKE_PROJECT_TOP_LEVEL_INCLUDES file: " +
- setupFile);
+ cmStrCat("Failed reading CMAKE_PROJECT_TOP_LEVEL_INCLUDES file: ",
+ setupFile));
mf->GetState()->SetInTopLevelIncludes(false);
return;
}
@@ -754,7 +754,8 @@ void cmGlobalGenerator::EnableLanguage(
// to avoid duplicate compiler tests.
if (cmSystemTools::FileExists(fpath)) {
if (!mf->ReadListFile(fpath)) {
- cmSystemTools::Error("Could not find cmake module file: " + fpath);
+ cmSystemTools::Error(
+ cmStrCat("Could not find cmake module file: ", fpath));
}
// if this file was found then the language was already determined
// to be working
@@ -778,8 +779,8 @@ void cmGlobalGenerator::EnableLanguage(
cmStrCat("CMakeDetermine", lang, "Compiler.cmake");
std::string determineFile = mf->GetModulesFile(determineCompiler);
if (!mf->ReadListFile(determineFile)) {
- cmSystemTools::Error("Could not find cmake module file: " +
- determineCompiler);
+ cmSystemTools::Error(
+ cmStrCat("Could not find cmake module file: ", determineCompiler));
}
if (cmSystemTools::GetFatalErrorOccurred()) {
return;
@@ -807,7 +808,8 @@ void cmGlobalGenerator::EnableLanguage(
// configures CMake(LANG)Compiler.cmake
fpath = cmStrCat(rootBin, "/CMake", lang, "Compiler.cmake");
if (!mf->ReadListFile(fpath)) {
- cmSystemTools::Error("Could not find cmake module file: " + fpath);
+ cmSystemTools::Error(
+ cmStrCat("Could not find cmake module file: ", fpath));
}
this->SetLanguageEnabledFlag(lang, mf);
needSetLanguageEnabledMaps[lang] = true;
@@ -890,10 +892,11 @@ void cmGlobalGenerator::EnableLanguage(
fpath = cmStrCat("CMake", lang, "Information.cmake");
std::string informationFile = mf->GetModulesFile(fpath);
if (informationFile.empty()) {
- cmSystemTools::Error("Could not find cmake module file: " + fpath);
+ cmSystemTools::Error(
+ cmStrCat("Could not find cmake module file: ", fpath));
} else if (!mf->ReadListFile(informationFile)) {
- cmSystemTools::Error("Could not process cmake module file: " +
- informationFile);
+ cmSystemTools::Error(
+ cmStrCat("Could not process cmake module file: ", informationFile));
}
}
if (needSetLanguageEnabledMaps[lang]) {
@@ -911,8 +914,8 @@ void cmGlobalGenerator::EnableLanguage(
std::string testLang = cmStrCat("CMakeTest", lang, "Compiler.cmake");
std::string ifpath = mf->GetModulesFile(testLang);
if (!mf->ReadListFile(ifpath)) {
- cmSystemTools::Error("Could not find cmake module file: " +
- testLang);
+ cmSystemTools::Error(
+ cmStrCat("Could not find cmake module file: ", testLang));
}
std::string compilerWorks =
cmStrCat("CMAKE_", lang, "_COMPILER_WORKS");
@@ -977,7 +980,7 @@ void cmGlobalGenerator::PrintCompilerAdvice(std::ostream& os,
void cmGlobalGenerator::CheckCompilerIdCompatibility(
cmMakefile* mf, std::string const& lang) const
{
- std::string compilerIdVar = "CMAKE_" + lang + "_COMPILER_ID";
+ std::string compilerIdVar = cmStrCat("CMAKE_", lang, "_COMPILER_ID");
std::string const compilerId = mf->GetSafeDefinition(compilerIdVar);
if (compilerId == "AppleClang") {
@@ -1105,9 +1108,9 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(
}
{
// Fix compiler versions.
- std::string version = "CMAKE_" + lang + "_COMPILER_VERSION";
- std::string emulated = "CMAKE_" + lang + "_SIMULATE_VERSION";
- std::string emulatedId = "CMAKE_" + lang + "_SIMULATE_ID";
+ std::string version = cmStrCat("CMAKE_", lang, "_COMPILER_VERSION");
+ std::string emulated = cmStrCat("CMAKE_", lang, "_SIMULATE_VERSION");
+ std::string emulatedId = cmStrCat("CMAKE_", lang, "_SIMULATE_ID");
std::string const& actual = mf->GetRequiredDefinition(emulated);
mf->AddDefinition(version, actual);
mf->RemoveDefinition(emulatedId);
@@ -1208,7 +1211,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l,
return;
}
- std::string linkerPrefVar = "CMAKE_" + l + "_LINKER_PREFERENCE";
+ std::string linkerPrefVar = cmStrCat("CMAKE_", l, "_LINKER_PREFERENCE");
cmValue linkerPref = mf->GetDefinition(linkerPrefVar);
int preference = 0;
if (cmNonempty(linkerPref)) {
@@ -1234,7 +1237,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l,
this->LanguageToLinkerPreference[l] = preference;
- std::string outputExtensionVar = "CMAKE_" + l + "_OUTPUT_EXTENSION";
+ std::string outputExtensionVar = cmStrCat("CMAKE_", l, "_OUTPUT_EXTENSION");
if (cmValue p = mf->GetDefinition(outputExtensionVar)) {
std::string outputExtension = *p;
this->LanguageToOutputExtension[l] = outputExtension;
@@ -1251,7 +1254,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l,
this->FillExtensionToLanguageMap(l, mf);
std::string ignoreExtensionsVar =
- std::string("CMAKE_") + std::string(l) + std::string("_IGNORE_EXTENSIONS");
+ cmStrCat("CMAKE_", l, "_IGNORE_EXTENSIONS");
std::string ignoreExts = mf->GetSafeDefinition(ignoreExtensionsVar);
cmList extensionList{ ignoreExts };
for (std::string const& i : extensionList) {
@@ -1262,8 +1265,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l,
void cmGlobalGenerator::FillExtensionToLanguageMap(const std::string& l,
cmMakefile* mf)
{
- std::string extensionsVar = std::string("CMAKE_") + std::string(l) +
- std::string("_SOURCE_FILE_EXTENSIONS");
+ std::string extensionsVar = cmStrCat("CMAKE_", l, "_SOURCE_FILE_EXTENSIONS");
const std::string& exts = mf->GetSafeDefinition(extensionsVar);
cmList extensionList{ exts };
for (std::string const& i : extensionList) {
@@ -1886,7 +1888,7 @@ void cmGlobalGenerator::FinalizeTargetConfiguration()
std::set<std::string> standardIncludesSet;
for (std::string const& li : langs) {
std::string const standardIncludesVar =
- "CMAKE_" + li + "_STANDARD_INCLUDE_DIRECTORIES";
+ cmStrCat("CMAKE_", li, "_STANDARD_INCLUDE_DIRECTORIES");
std::string const& standardIncludesStr =
mf->GetSafeDefinition(standardIncludesVar);
cmList standardIncludesList{ standardIncludesStr };
@@ -2017,13 +2019,14 @@ void cmGlobalGenerator::CheckTargetProperties()
for (auto const& notFound : notFoundMap) {
notFoundVars += notFound.first;
notFoundVars += notFound.second;
- notFoundVars += "\n";
+ notFoundVars += '\n';
}
- cmSystemTools::Error("The following variables are used in this project, "
- "but they are set to NOTFOUND.\n"
- "Please set them or make sure they are set and "
- "tested correctly in the CMake files:\n" +
- notFoundVars);
+ cmSystemTools::Error(
+ cmStrCat("The following variables are used in this project, "
+ "but they are set to NOTFOUND.\n"
+ "Please set them or make sure they are set and "
+ "tested correctly in the CMake files:\n",
+ notFoundVars));
}
}
@@ -2181,8 +2184,8 @@ int cmGlobalGenerator::Build(
outputflag, timeout)) {
cmSystemTools::SetRunCommandHideConsole(hideconsole);
cmSystemTools::Error(
- "Generator: execution of make failed. Make command was: " +
- makeCommandStr);
+ cmStrCat("Generator: execution of make failed. Make command was: ",
+ makeCommandStr));
ostr << *outputPtr
<< "\nGenerator: execution of make failed. Make command was: "
<< outputMakeCommandStr << std::endl;
@@ -3342,7 +3345,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
// Place the labels file in a per-target support directory.
std::string dir = target->GetSupportDirectory();
std::string file = cmStrCat(dir, "/Labels.txt");
- std::string json_file = dir + "/Labels.json";
+ std::string json_file = cmStrCat(dir, "/Labels.json");
#ifndef CMAKE_BOOTSTRAP
// Check whether labels are enabled for this target.