summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmCPluginAPI.cxx6
-rw-r--r--Source/cmCommonTargetGenerator.cxx13
-rw-r--r--Source/cmCurl.cxx6
-rw-r--r--Source/cmCurl.h2
-rw-r--r--Source/cmFileCommand.cxx4
-rw-r--r--Source/cmGeneratorTarget.cxx2
-rw-r--r--Source/cmGetPropertyCommand.cxx15
-rw-r--r--Source/cmGlobalGenerator.cxx4
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmGlobalJOMMakefileGenerator.cxx5
-rw-r--r--Source/cmGlobalJOMMakefileGenerator.h2
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.cxx2
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.h2
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx34
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h2
-rw-r--r--Source/cmGlobalXCodeGenerator.h2
-rw-r--r--Source/cmLocalGenerator.cxx9
-rw-r--r--Source/cmMakefile.cxx4
-rw-r--r--Source/cmProperty.h8
-rw-r--r--Source/cmcmd.cxx2
21 files changed, 60 insertions, 68 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index e8faa7c..caa4806 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 21)
-set(CMake_VERSION_PATCH 20210919)
+set(CMake_VERSION_PATCH 20210921)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index e922ee5..e460031 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -140,7 +140,7 @@ const char* CCONV cmGetCurrentOutputDirectory(void* arg)
const char* CCONV cmGetDefinition(void* arg, const char* def)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
- return cmToCStr(mf->GetDefinition(def));
+ return mf->GetDefinition(def).GetCStr();
}
int CCONV cmIsOn(void* arg, const char* name)
@@ -592,12 +592,12 @@ const char* CCONV cmSourceFileGetProperty(void* arg, const char* prop)
{
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
if (cmSourceFile* rsf = sf->RealSourceFile) {
- return cmToCStr(rsf->GetProperty(prop));
+ return rsf->GetProperty(prop).GetCStr();
}
if (!strcmp(prop, "LOCATION")) {
return sf->FullPath.c_str();
}
- return cmToCStr(sf->Properties.GetPropertyValue(prop));
+ return sf->Properties.GetPropertyValue(prop).GetCStr();
}
int CCONV cmSourceFileGetPropertyAsBool(void* arg, const char* prop)
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 59e4141..4e7f50d 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -240,11 +240,16 @@ std::string cmCommonTargetGenerator::GetManifests(const std::string& config)
std::vector<std::string> manifests;
manifests.reserve(manifest_srcs.size());
+
+ std::string lang = this->GeneratorTarget->GetLinkerLanguage(config);
+ std::string const& manifestFlag =
+ this->Makefile->GetDefinition("CMAKE_" + lang + "_LINKER_MANIFEST_FLAG");
for (cmSourceFile const* manifest_src : manifest_srcs) {
- manifests.push_back(this->LocalCommonGenerator->ConvertToOutputFormat(
- this->LocalCommonGenerator->MaybeRelativeToWorkDir(
- manifest_src->GetFullPath()),
- cmOutputConverter::SHELL));
+ manifests.push_back(manifestFlag +
+ this->LocalCommonGenerator->ConvertToOutputFormat(
+ this->LocalCommonGenerator->MaybeRelativeToWorkDir(
+ manifest_src->GetFullPath()),
+ cmOutputConverter::SHELL));
}
return cmJoin(manifests, " ");
diff --git a/Source/cmCurl.cxx b/Source/cmCurl.cxx
index fa001d2..28ee24d 100644
--- a/Source/cmCurl.cxx
+++ b/Source/cmCurl.cxx
@@ -31,11 +31,11 @@
} \
} while (false)
-std::string cmCurlSetCAInfo(::CURL* curl, const char* cafile)
+std::string cmCurlSetCAInfo(::CURL* curl, const std::string& cafile)
{
std::string e;
- if (cafile && *cafile) {
- ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cafile);
+ if (!cafile.empty()) {
+ ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cafile.c_str());
check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: ");
}
#ifdef CMAKE_FIND_CAFILE
diff --git a/Source/cmCurl.h b/Source/cmCurl.h
index 9c1e337..b5134f4 100644
--- a/Source/cmCurl.h
+++ b/Source/cmCurl.h
@@ -8,7 +8,7 @@
#include <cm3p/curl/curl.h>
-std::string cmCurlSetCAInfo(::CURL* curl, const char* cafile = nullptr);
+std::string cmCurlSetCAInfo(::CURL* curl, const std::string& cafile = {});
std::string cmCurlSetNETRCOption(::CURL* curl, const std::string& netrc_level,
const std::string& netrc_file);
std::string cmCurlFixFileURL(std::string url);
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 1223d2a..bdfec02 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -1986,7 +1986,7 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
// check to see if a CAINFO file has been specified
// command arg comes first
- std::string const& cainfo_err = cmCurlSetCAInfo(curl, cmToCStr(cainfo));
+ std::string const& cainfo_err = cmCurlSetCAInfo(curl, cainfo);
if (!cainfo_err.empty()) {
status.SetError(cainfo_err);
return false;
@@ -2304,7 +2304,7 @@ bool HandleUploadCommand(std::vector<std::string> const& args,
// check to see if a CAINFO file has been specified
// command arg comes first
- std::string const& cainfo_err = cmCurlSetCAInfo(curl, cmToCStr(cainfo));
+ std::string const& cainfo_err = cmCurlSetCAInfo(curl, cainfo);
if (!cainfo_err.empty()) {
status.SetError(cainfo_err);
return false;
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 30c022f..f80b4d9 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -5742,7 +5742,7 @@ const char* getTypedProperty<const char*>(
cmProp value = tgt->GetProperty(prop);
if (genexInterpreter == nullptr) {
- return cmToCStr(value);
+ return value.GetCStr();
}
return genexInterpreter->Evaluate(value ? *value : "", prop).c_str();
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 4b380c0..5f20075 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGetPropertyCommand.h"
+#include <cstddef>
+
#include "cmExecutionStatus.h"
#include "cmGlobalGenerator.h"
#include "cmInstalledFile.h"
@@ -32,10 +34,6 @@ enum OutType
OutSet
};
-// Implementation of result storage.
-bool StoreResult(OutType infoType, cmMakefile& makefile,
- const std::string& variable, const char* value);
-
// Implementation of each property type.
bool HandleGlobalMode(cmExecutionStatus& status, const std::string& name,
OutType infoType, const std::string& variable,
@@ -253,8 +251,10 @@ bool cmGetPropertyCommand(std::vector<std::string> const& args,
namespace {
+// Implementation of result storage.
+template <typename ValueType>
bool StoreResult(OutType infoType, cmMakefile& makefile,
- const std::string& variable, const char* value)
+ const std::string& variable, ValueType value)
{
if (infoType == OutSet) {
makefile.AddDefinition(variable, value ? "1" : "0");
@@ -268,10 +268,11 @@ bool StoreResult(OutType infoType, cmMakefile& makefile,
}
return true;
}
+template <>
bool StoreResult(OutType infoType, cmMakefile& makefile,
- const std::string& variable, cmProp value)
+ const std::string& variable, std::nullptr_t value)
{
- return StoreResult(infoType, makefile, variable, value.GetCStr());
+ return StoreResult(infoType, makefile, variable, cmProp(value));
}
bool HandleGlobalMode(cmExecutionStatus& status, const std::string& name,
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index fd1a197..1c3d2c2 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -838,7 +838,7 @@ void cmGlobalGenerator::EnableLanguage(
cmSystemTools::RemoveFile(compilerLangFile);
if (!this->CMakeInstance->GetIsInTryCompile()) {
this->PrintCompilerAdvice(noCompiler, lang,
- cmToCStr(mf->GetDefinition(compilerEnv)));
+ mf->GetDefinition(compilerEnv));
mf->IssueMessage(MessageType::FATAL_ERROR, noCompiler.str());
fatalError = true;
}
@@ -922,7 +922,7 @@ void cmGlobalGenerator::EnableLanguage(
void cmGlobalGenerator::PrintCompilerAdvice(std::ostream& os,
std::string const& lang,
- const char* envVar) const
+ cmProp envVar) const
{
// Subclasses override this method if they do not support this advice.
os << "Tell CMake where to find the compiler by setting ";
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 34646d9..49a1a26 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -550,7 +550,7 @@ protected:
virtual bool CheckLanguages(std::vector<std::string> const& languages,
cmMakefile* mf) const;
virtual void PrintCompilerAdvice(std::ostream& os, std::string const& lang,
- const char* envVar) const;
+ cmProp envVar) const;
virtual bool ComputeTargetDepends();
diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx
index fc3123a..0d474e5 100644
--- a/Source/cmGlobalJOMMakefileGenerator.cxx
+++ b/Source/cmGlobalJOMMakefileGenerator.cxx
@@ -39,8 +39,9 @@ void cmGlobalJOMMakefileGenerator::GetDocumentation(
entry.Brief = "Generates JOM makefiles.";
}
-void cmGlobalJOMMakefileGenerator::PrintCompilerAdvice(
- std::ostream& os, std::string const& lang, const char* envVar) const
+void cmGlobalJOMMakefileGenerator::PrintCompilerAdvice(std::ostream& os,
+ std::string const& lang,
+ cmProp envVar) const
{
if (lang == "CXX" || lang == "C") {
/* clang-format off */
diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h
index 2d58f91..cc581df 100644
--- a/Source/cmGlobalJOMMakefileGenerator.h
+++ b/Source/cmGlobalJOMMakefileGenerator.h
@@ -50,5 +50,5 @@ protected:
private:
void PrintCompilerAdvice(std::ostream& os, std::string const& lang,
- const char* envVar) const override;
+ cmProp envVar) const override;
};
diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx
index 5ca8d52..2bc668c 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.cxx
+++ b/Source/cmGlobalNMakeMakefileGenerator.cxx
@@ -81,7 +81,7 @@ void cmGlobalNMakeMakefileGenerator::GetDocumentation(
}
void cmGlobalNMakeMakefileGenerator::PrintCompilerAdvice(
- std::ostream& os, std::string const& lang, const char* envVar) const
+ std::ostream& os, std::string const& lang, cmProp envVar) const
{
if (lang == "CXX" || lang == "C") {
/* clang-format off */
diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h
index 402b89f..a48a55e 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.h
+++ b/Source/cmGlobalNMakeMakefileGenerator.h
@@ -61,5 +61,5 @@ private:
void CheckNMakeFeatures();
void PrintCompilerAdvice(std::ostream& os, std::string const& lang,
- const char* envVar) const override;
+ cmProp envVar) const override;
};
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 6279d68..768c045 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -928,29 +928,21 @@ void cmGlobalNinjaGenerator::EnableLanguage(
continue;
}
this->ResolveLanguageCompiler(l, mf, optional);
- }
#ifdef _WIN32
- const bool clangGnuMode =
- ((mf->GetSafeDefinition("CMAKE_C_COMPILER_ID") == "Clang") &&
- (mf->GetSafeDefinition("CMAKE_C_COMPILER_FRONTEND_VARIANT") == "GNU")) ||
- ((mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID") == "Clang") &&
- (mf->GetSafeDefinition("CMAKE_CXX_COMPILER_FRONTEND_VARIANT") == "GNU"));
-
- if (clangGnuMode ||
- ((mf->GetSafeDefinition("CMAKE_C_SIMULATE_ID") != "MSVC") &&
- (mf->GetSafeDefinition("CMAKE_CXX_SIMULATE_ID") != "MSVC") &&
- (mf->IsOn("CMAKE_COMPILER_IS_MINGW") ||
- (mf->GetSafeDefinition("CMAKE_C_COMPILER_ID") == "GNU") ||
- (mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID") == "GNU") ||
- (mf->GetSafeDefinition("CMAKE_C_COMPILER_ID") == "Clang") ||
- (mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID") == "Clang") ||
- (mf->GetSafeDefinition("CMAKE_C_COMPILER_ID") == "ARMClang") ||
- (mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID") == "ARMClang") ||
- (mf->GetSafeDefinition("CMAKE_C_COMPILER_ID") == "QCC") ||
- (mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID") == "QCC")))) {
- this->UsingGCCOnWindows = true;
- }
+ std::string const& compilerId =
+ mf->GetSafeDefinition(cmStrCat("CMAKE_", l, "_COMPILER_ID"));
+ std::string const& simulateId =
+ mf->GetSafeDefinition(cmStrCat("CMAKE_", l, "_SIMULATE_ID"));
+ std::string const& compilerFrontendVariant = mf->GetSafeDefinition(
+ cmStrCat("CMAKE_", l, "_COMPILER_FRONTEND_VARIANT"));
+ if ((compilerId == "Clang" && compilerFrontendVariant == "GNU") ||
+ (simulateId != "MSVC" &&
+ (compilerId == "GNU" || compilerId == "QCC" ||
+ cmHasLiteralSuffix(compilerId, "Clang")))) {
+ this->UsingGCCOnWindows = true;
+ }
#endif
+ }
}
// Implemented by:
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 151f39f..57ada62 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -201,7 +201,7 @@ protected:
private:
virtual std::string GetVSMakeProgram() = 0;
void PrintCompilerAdvice(std::ostream&, std::string const&,
- const char*) const override
+ cmProp) const override
{
}
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 1e1b344..e54818e 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -327,7 +327,7 @@ private:
bool XcodeBuildCommandInitialized;
void PrintCompilerAdvice(std::ostream&, std::string const&,
- const char*) const override
+ cmProp) const override
{
}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 4c3e8ec..e2e0d8e 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -856,19 +856,18 @@ std::string cmLocalGenerator::GetIncludeFlags(
std::string const& includeFlag =
this->Makefile->GetSafeDefinition(cmStrCat("CMAKE_INCLUDE_FLAG_", lang));
- const char* sep = cmToCStr(
- this->Makefile->GetDefinition(cmStrCat("CMAKE_INCLUDE_FLAG_SEP_", lang)));
bool quotePaths = false;
if (this->Makefile->GetDefinition("CMAKE_QUOTE_INCLUDE_PATHS")) {
quotePaths = true;
}
+ std::string sep = " ";
bool repeatFlag = true;
// should the include flag be repeated like ie. -IA -IB
- if (!sep) {
- sep = " ";
- } else {
+ if (cmProp incSep = this->Makefile->GetDefinition(
+ cmStrCat("CMAKE_INCLUDE_FLAG_SEP_", lang))) {
// if there is a separator then the flag is not repeated but is only
// given once i.e. -classpath a:b:c
+ sep = incSep;
repeatFlag = false;
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index f9b2562..78c7246 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2453,7 +2453,7 @@ const char* cmMakefile::GetSONameFlag(const std::string& language) const
name += language;
}
name += "_FLAG";
- return cmToCStr(this->GetDefinition(name));
+ return this->GetDefinition(name).GetCStr();
}
bool cmMakefile::CanIWriteThisFile(std::string const& fileName) const
@@ -2531,7 +2531,7 @@ cmProp cmMakefile::GetDefinition(const std::string& name) const
vv->VariableAccessed(name,
def ? cmVariableWatch::VARIABLE_READ_ACCESS
: cmVariableWatch::UNKNOWN_VARIABLE_READ_ACCESS,
- cmToCStr(def), this);
+ def.GetCStr(), this);
if (watch_function_executed) {
// A callback was executed and may have caused re-allocation of the
diff --git a/Source/cmProperty.h b/Source/cmProperty.h
index 4179187..9d83df4 100644
--- a/Source/cmProperty.h
+++ b/Source/cmProperty.h
@@ -229,11 +229,3 @@ inline bool operator>=(cmProp l, std::nullptr_t) noexcept
{
return l.Compare(cmProp{}) >= 0;
}
-
-/**
- * Temporary wrapper
- */
-inline const char* cmToCStr(cmProp p)
-{
- return p.GetCStr();
-}
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 1e0f497..3e36f97 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -1068,6 +1068,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
} else if (!cmSystemTools::FileExists(arg)) {
cmSystemTools::Error(arg + ": no such file or directory (ignoring)");
return_value = 1;
+ } else if (cmSystemTools::FileLength(arg) == 0) {
+ // Ignore empty files, this is not an error
} else {
// Destroy console buffers to drop cout/cerr encoding transform.
consoleBuf.reset();