summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CursesDialog/cmCursesColor.cxx59
-rw-r--r--Source/CursesDialog/cmCursesColor.h5
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.cxx4
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx12
-rw-r--r--Source/cmCommonTargetGenerator.cxx7
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx12
-rw-r--r--Source/cmGlobalNinjaGenerator.h7
-rw-r--r--Source/cmGlobalWatcomWMakeGenerator.cxx2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx7
-rw-r--r--Source/cmIncludeCommand.cxx35
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx2
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx2
-rw-r--r--Source/cmMakefileTargetGenerator.cxx5
-rw-r--r--Source/cmNinjaTargetGenerator.cxx2
-rw-r--r--Source/cmOutputConverter.cxx9
-rw-r--r--Source/cmOutputConverter.h1
-rw-r--r--Source/cmPolicies.h4
18 files changed, 134 insertions, 43 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 0024ab3..7384c59 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 17)
-set(CMake_VERSION_PATCH 20200422)
+set(CMake_VERSION_PATCH 20200429)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CursesDialog/cmCursesColor.cxx b/Source/CursesDialog/cmCursesColor.cxx
index 641d48c..c0b468b 100644
--- a/Source/CursesDialog/cmCursesColor.cxx
+++ b/Source/CursesDialog/cmCursesColor.cxx
@@ -2,6 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCursesColor.h"
+#include <cctype>
+#include <cstdlib>
+#include <cstring>
+#include <unordered_map>
+#include <utility>
+
#include "cmCursesStandardIncludes.h"
bool cmCursesColor::HasColors()
@@ -19,11 +25,54 @@ void cmCursesColor::InitColors()
if (HasColors()) {
start_color();
use_default_colors();
- init_pair(cmCursesColor::BoolOff, COLOR_RED, -1);
- init_pair(cmCursesColor::BoolOn, COLOR_GREEN, -1);
- init_pair(cmCursesColor::String, COLOR_BLUE, -1);
- init_pair(cmCursesColor::Path, COLOR_YELLOW, -1);
- init_pair(cmCursesColor::Options, COLOR_MAGENTA, -1);
+ init_pair(BoolOff, GetColor('N', COLOR_RED), -1);
+ init_pair(BoolOn, GetColor('Y', COLOR_GREEN), -1);
+ init_pair(String, GetColor('S', COLOR_CYAN), -1);
+ init_pair(Path, GetColor('P', COLOR_YELLOW), -1);
+ init_pair(Choice, GetColor('C', COLOR_MAGENTA), -1);
}
#endif
}
+
+short cmCursesColor::GetColor(char id, short fallback)
+{
+ static bool initialized = false;
+ static std::unordered_map<char, short> env;
+
+ if (!initialized) {
+ if (auto* v = getenv("CCMAKE_COLORS")) {
+ while (v[0] && v[1] && v[1] == '=') {
+ auto const n = std::toupper(*v);
+
+ char buffer[12];
+ memset(buffer, 0, sizeof(buffer));
+
+ if (auto* const e = strchr(v, ':')) {
+ if (static_cast<size_t>(e - v) > sizeof(buffer)) {
+ break;
+ }
+
+ strncpy(buffer, v + 2, static_cast<size_t>(e - v - 2));
+ v = e + 1;
+ } else {
+ auto const l = strlen(v);
+ if (l > sizeof(buffer)) {
+ break;
+ }
+
+ strncpy(buffer, v + 2, l - 2);
+ v += l;
+ }
+
+ auto const c = atoi(buffer);
+ if (c && c < COLORS) {
+ env.emplace(n, static_cast<short>(c));
+ }
+ }
+ }
+ initialized = true;
+ }
+
+ auto const iter = env.find(id);
+ return (iter == env.end() ? fallback : iter->second);
+}
diff --git a/Source/CursesDialog/cmCursesColor.h b/Source/CursesDialog/cmCursesColor.h
index 78ca52c..f83265f 100644
--- a/Source/CursesDialog/cmCursesColor.h
+++ b/Source/CursesDialog/cmCursesColor.h
@@ -13,12 +13,15 @@ public:
BoolOn,
String,
Path,
- Options
+ Choice
};
static bool HasColors();
static void InitColors();
+
+protected:
+ static short GetColor(char id, short fallback);
};
#endif // cmCursesColor_h
diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx
index a15241f..8df32e2 100644
--- a/Source/CursesDialog/cmCursesOptionsWidget.cxx
+++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx
@@ -17,8 +17,8 @@ cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left,
// the widget into a string widget at some point. BOOL is safe for
// now.
if (cmCursesColor::HasColors()) {
- set_field_fore(this->Field, COLOR_PAIR(cmCursesColor::Options));
- set_field_back(this->Field, COLOR_PAIR(cmCursesColor::Options));
+ set_field_fore(this->Field, COLOR_PAIR(cmCursesColor::Choice));
+ set_field_back(this->Field, COLOR_PAIR(cmCursesColor::Choice));
} else {
set_field_fore(this->Field, A_NORMAL);
set_field_back(this->Field, A_STANDOUT);
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 4daf726..930f300 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -808,11 +808,15 @@ bool CMakeSetupDialog::setupFirstConfigure()
m->insertProperty(QCMakeProperty::STRING, "CMAKE_SYSTEM_PROCESSOR",
tr("CMake System Processor"), systemProcessor, false);
QString cxxCompiler = dialog.getCXXCompiler();
- m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_CXX_COMPILER",
- tr("CXX compiler."), cxxCompiler, false);
+ if (!cxxCompiler.isEmpty()) {
+ m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_CXX_COMPILER",
+ tr("CXX compiler."), cxxCompiler, false);
+ }
QString cCompiler = dialog.getCCompiler();
- m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_C_COMPILER",
- tr("C compiler."), cCompiler, false);
+ if (!cCompiler.isEmpty()) {
+ m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_C_COMPILER",
+ tr("C compiler."), cCompiler, false);
+ }
} else if (dialog.crossCompilerToolChainFile()) {
QString toolchainFile = dialog.getCrossCompilerToolChainFile();
m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_TOOLCHAIN_FILE",
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 673936c..fbb9429 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -73,11 +73,12 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(
void cmCommonTargetGenerator::AppendFortranFormatFlags(
std::string& flags, cmSourceFile const& source)
{
- cmProp srcfmt = source.GetProperty("Fortran_FORMAT");
+ const std::string srcfmt = source.GetSafeProperty("Fortran_FORMAT");
cmOutputConverter::FortranFormat format =
- cmOutputConverter::GetFortranFormat(srcfmt ? srcfmt->c_str() : nullptr);
+ cmOutputConverter::GetFortranFormat(srcfmt);
if (format == cmOutputConverter::FortranFormatNone) {
- const char* tgtfmt = this->GeneratorTarget->GetProperty("Fortran_FORMAT");
+ const std::string tgtfmt =
+ this->GeneratorTarget->GetSafeProperty("Fortran_FORMAT");
format = cmOutputConverter::GetFortranFormat(tgtfmt);
}
const char* var = nullptr;
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 0cdbcc7..8ef19cc 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1054,10 +1054,9 @@ void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies()
}
std::string cmGlobalNinjaGenerator::OrderDependsTargetForTarget(
- cmGeneratorTarget const* target, const std::string& config)
+ cmGeneratorTarget const* target, const std::string& /*config*/) const
{
- return cmStrCat("cmake_object_order_depends_target_", target->GetName(), '_',
- cmSystemTools::UpperCase(config));
+ return cmStrCat("cmake_object_order_depends_target_", target->GetName());
}
void cmGlobalNinjaGenerator::AppendTargetOutputs(
@@ -2678,3 +2677,10 @@ bool cmGlobalNinjaMultiGenerator::ReadCacheEntriesForBuild(
return true;
}
+
+std::string cmGlobalNinjaMultiGenerator::OrderDependsTargetForTarget(
+ cmGeneratorTarget const* target, const std::string& config) const
+{
+ return cmStrCat("cmake_object_order_depends_target_", target->GetName(), '_',
+ cmSystemTools::UpperCase(config));
+}
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 5668dd1..b89fb8f 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -315,8 +315,8 @@ public:
ASD.insert(deps.begin(), deps.end());
}
- static std::string OrderDependsTargetForTarget(
- cmGeneratorTarget const* target, const std::string& config);
+ virtual std::string OrderDependsTargetForTarget(
+ cmGeneratorTarget const* target, const std::string& config) const;
void AppendTargetOutputs(
cmGeneratorTarget const* target, cmNinjaDeps& outputs,
@@ -644,6 +644,9 @@ public:
bool SupportsCrossConfigs() const override { return true; }
bool SupportsDefaultConfigs() const override { return true; }
+ std::string OrderDependsTargetForTarget(
+ cmGeneratorTarget const* target, const std::string& config) const override;
+
protected:
bool OpenBuildFileStreams() override;
void CloseBuildFileStreams() override;
diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx
index 308ddda..07e0793 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.cxx
+++ b/Source/cmGlobalWatcomWMakeGenerator.cxx
@@ -19,7 +19,7 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator(cmake* cm)
#endif
this->ToolSupportsColor = true;
this->NeedSymbolicMark = true;
- this->EmptyRuleHackCommand = "@cd .";
+ this->EmptyRuleHackCommand = "@%null";
#ifdef _WIN32
cm->GetState()->SetWindowsShell(true);
#endif
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 1a753e2..f305246 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -808,9 +808,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
// Add flags from target and source file properties.
std::string flags;
- cmProp srcfmt = sf->GetProperty("Fortran_FORMAT");
- switch (
- cmOutputConverter::GetFortranFormat(srcfmt ? srcfmt->c_str() : nullptr)) {
+ const std::string srcfmt = sf->GetSafeProperty("Fortran_FORMAT");
+ switch (cmOutputConverter::GetFortranFormat(srcfmt)) {
case cmOutputConverter::FortranFormatFixed:
flags = "-fixed " + flags;
break;
@@ -2290,7 +2289,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// Add Fortran source format attribute if property is set.
const char* format = nullptr;
- const char* tgtfmt = gtgt->GetProperty("Fortran_FORMAT");
+ const std::string tgtfmt = gtgt->GetSafeProperty("Fortran_FORMAT");
switch (cmOutputConverter::GetFortranFormat(tgtfmt)) {
case cmOutputConverter::FortranFormatFixed:
format = "fixed";
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index 14264f4..ae801bb 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -2,7 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmIncludeCommand.h"
+#include <map>
#include <sstream>
+#include <utility>
#include "cmExecutionStatus.h"
#include "cmGlobalGenerator.h"
@@ -16,6 +18,11 @@
bool cmIncludeCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
+ static std::map<std::string, cmPolicies::PolicyID> DeprecatedModules;
+ if (DeprecatedModules.empty()) {
+ DeprecatedModules["Documentation"] = cmPolicies::CMP0106;
+ }
+
if (args.empty() || args.size() > 4) {
status.SetError("called with wrong number of arguments. "
"include() only takes one file.");
@@ -65,9 +72,35 @@ bool cmIncludeCommand(std::vector<std::string> const& args,
}
if (!cmSystemTools::FileIsFullPath(fname)) {
+ bool system = false;
// Not a path. Maybe module.
std::string module = cmStrCat(fname, ".cmake");
- std::string mfile = status.GetMakefile().GetModulesFile(module);
+ std::string mfile = status.GetMakefile().GetModulesFile(module, system);
+
+ if (system) {
+ auto ModulePolicy = DeprecatedModules.find(fname);
+ if (ModulePolicy != DeprecatedModules.end()) {
+ cmPolicies::PolicyStatus PolicyStatus =
+ status.GetMakefile().GetPolicyStatus(ModulePolicy->second);
+ switch (PolicyStatus) {
+ case cmPolicies::WARN: {
+ status.GetMakefile().IssueMessage(
+ MessageType::AUTHOR_WARNING,
+ cmStrCat(cmPolicies::GetPolicyWarning(ModulePolicy->second),
+ "\n"));
+ CM_FALLTHROUGH;
+ }
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ mfile = "";
+ break;
+ }
+ }
+ }
+
if (!mfile.empty()) {
fname = mfile;
}
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index aa8912e..1401e29 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1442,7 +1442,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
// Create the scanner for this language
std::unique_ptr<cmDepends> scanner;
if (lang == "C" || lang == "CXX" || lang == "RC" || lang == "ASM" ||
- lang == "CUDA") {
+ lang == "OBJC" || lang == "OBJCXX" || lang == "CUDA") {
// TODO: Handle RC (resource files) dependencies correctly.
scanner = cm::make_unique<cmDependsC>(this, targetDir, lang, &validDeps);
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 95c798b..8daffa0 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -672,7 +672,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
if (this->FortranProject) {
switch (cmOutputConverter::GetFortranFormat(
- target->GetProperty("Fortran_FORMAT"))) {
+ target->GetSafeProperty("Fortran_FORMAT"))) {
case cmOutputConverter::FortranFormatFixed:
flags += " -fixed";
break;
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index b21946c..267d5e1 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -724,8 +724,9 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
// At the moment, it is assumed that C, C++, Fortran, and CUDA have both
// assembly and preprocessor capabilities. The same is true for the
// ability to export compile commands
- bool lang_has_preprocessor = ((lang == "C") || (lang == "CXX") ||
- (lang == "Fortran") || (lang == "CUDA"));
+ bool lang_has_preprocessor =
+ ((lang == "C") || (lang == "CXX") || (lang == "OBJC") ||
+ (lang == "OBJCXX") || (lang == "Fortran") || (lang == "CUDA"));
bool const lang_has_assembly = lang_has_preprocessor;
bool const lang_can_export_cmds = lang_has_preprocessor;
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index a70b6a0..701c44f 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -147,7 +147,7 @@ bool cmNinjaTargetGenerator::NeedDyndep(std::string const& lang) const
std::string cmNinjaTargetGenerator::OrderDependsTargetForTarget(
const std::string& config)
{
- return cmGlobalNinjaGenerator::OrderDependsTargetForTarget(
+ return this->GetGlobalGenerator()->OrderDependsTargetForTarget(
this->GeneratorTarget, config);
}
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index 68bf3af..dc324cc 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -170,15 +170,6 @@ cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat(
return format;
}
-cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat(
- const char* value)
-{
- if (!value) {
- return FortranFormatNone;
- }
- return GetFortranFormat(cm::string_view(value));
-}
-
void cmOutputConverter::SetLinkScriptShell(bool linkScriptShell)
{
this->LinkScriptShell = linkScriptShell;
diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h
index 6583ab5..28582df 100644
--- a/Source/cmOutputConverter.h
+++ b/Source/cmOutputConverter.h
@@ -94,7 +94,6 @@ public:
FortranFormatFree
};
static FortranFormat GetFortranFormat(cm::string_view value);
- static FortranFormat GetFortranFormat(const char* value);
private:
cmState* GetState() const;
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index cdf3f71..4abfa1f 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -314,7 +314,9 @@ class cmMakefile;
"CUDA_ARCHITECTURES not allowed.", \
3, 18, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0105, "Device link step uses the link options.", 3, 18, \
- 0, cmPolicies::WARN)
+ 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0106, "The Documentation module is removed.", 3, 18, 0, \
+ cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \