summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/install.rst5
-rw-r--r--Help/manual/cmake.1.rst4
-rw-r--r--Help/variable/CMAKE_FIND_DEBUG_MODE.rst1
-rw-r--r--Modules/ExternalProject.cmake2
-rw-r--r--Modules/FindPython/Support.cmake2
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/Checks/cm_cxx_features.cmake2
-rw-r--r--Source/cmCommonTargetGenerator.cxx13
-rw-r--r--Source/cmCommonTargetGenerator.h3
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx4
-rw-r--r--Source/cmFileAPICodemodel.cxx25
-rw-r--r--Source/cmGeneratorTarget.cxx68
-rw-r--r--Source/cmGeneratorTarget.h20
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx8
-rw-r--r--Source/cmGetDirectoryPropertyCommand.cxx4
-rw-r--r--Source/cmGetPropertyCommand.cxx3
-rw-r--r--Source/cmGlobalGenerator.cxx8
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx4
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx6
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx2
-rw-r--r--Source/cmLocalGenerator.cxx330
-rw-r--r--Source/cmLocalGenerator.h13
-rw-r--r--Source/cmLocalNinjaGenerator.cxx11
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx8
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx5
-rw-r--r--Source/cmMakefile.cxx74
-rw-r--r--Source/cmMakefile.h9
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx3
-rw-r--r--Source/cmMakefileTargetGenerator.cxx75
-rw-r--r--Source/cmNinjaTargetGenerator.cxx70
-rw-r--r--Source/cmQtAutoGenInitializer.cxx17
-rw-r--r--Source/cmSourceFile.cxx4
-rw-r--r--Source/cmTest.cxx4
-rw-r--r--Source/cmVariableWatchCommand.cxx2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx5
-rw-r--r--Source/kwsys/testSystemTools.cxx9
-rw-r--r--Tests/ExternalProject/CMakeLists.txt9
-rw-r--r--Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake9
-rw-r--r--Utilities/Release/linux/x86_64/Dockerfile4
-rw-r--r--Utilities/Release/linux/x86_64/deps/Dockerfile8
40 files changed, 515 insertions, 340 deletions
diff --git a/Help/command/install.rst b/Help/command/install.rst
index cf04eda..3b72ea6 100644
--- a/Help/command/install.rst
+++ b/Help/command/install.rst
@@ -705,6 +705,11 @@ executable from the installation tree using the imported target name
Generated Installation Script
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+.. note::
+
+ Use of this feature is not recommended. Please consider using the
+ ``--install`` argument of :manual:`cmake(1)` instead.
+
The ``install()`` command generates a file, ``cmake_install.cmake``, inside
the build directory, which is used internally by the generated install target
and by CPack. You can also invoke this script manually with ``cmake -P``. This
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index e497890..9a43499 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -242,10 +242,12 @@ Options
:command:`message(SEND_ERROR)` calls.
``--debug-find``
- Put cmake find in a debug mode.
+ Put cmake find commands in a debug mode.
Print extra find call information during the cmake run to standard
error. Output is designed for human consumption and not for parsing.
+ See also the :variable:`CMAKE_FIND_DEBUG_MODE` variable for debugging
+ a more local part of the project.
``--trace``
Put cmake in trace mode.
diff --git a/Help/variable/CMAKE_FIND_DEBUG_MODE.rst b/Help/variable/CMAKE_FIND_DEBUG_MODE.rst
index 33ffdd6..f5fd8ce 100644
--- a/Help/variable/CMAKE_FIND_DEBUG_MODE.rst
+++ b/Help/variable/CMAKE_FIND_DEBUG_MODE.rst
@@ -3,6 +3,7 @@ CMAKE_FIND_DEBUG_MODE
Print extra find call information for the following commands to standard
error:
+
* :command:`find_program`
* :command:`find_library`
* :command:`find_file`
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 326ee06..a7f0411 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -2598,7 +2598,7 @@ function(_ep_add_download_command name)
set(cmd ${CMAKE_COMMAND} -E rm -rf ${source_dir}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${abs_dir} ${source_dir})
else()
- get_property(no_extract TARGET "${name}" PROPERTY _EP_DOWNLOAD_NO_EXTRACT SET)
+ get_property(no_extract TARGET "${name}" PROPERTY _EP_DOWNLOAD_NO_EXTRACT)
if("${url}" MATCHES "^[a-z]+://")
# TODO: Should download and extraction be different steps?
if("x${fname}" STREQUAL "x")
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 68be3f9..5467b77 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -1046,7 +1046,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
- if (NOT _${_PYTHON_PREFIX}_FIND_VIRTUALENV STREQUAL "ONLY")
+ if (_${_PYTHON_PREFIX}_FIND_VIRTUALENV STREQUAL "ONLY")
break()
endif()
endif()
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 76f930b..7e5e336 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 20200401)
+set(CMake_VERSION_PATCH 20200406)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake
index c16286c..3b00dfb 100644
--- a/Source/Checks/cm_cxx_features.cmake
+++ b/Source/Checks/cm_cxx_features.cmake
@@ -32,8 +32,6 @@ function(cm_check_cxx_feature name)
string(REGEX REPLACE "[^\n]* xcodebuild\\[[0-9]*:[0-9]*\\] warning: [^\n]*" "" check_output "${check_output}")
# Filter out ld warnings.
string(REGEX REPLACE "[^\n]*ld: warning: [^\n]*" "" check_output "${check_output}")
- # Filter out CUDA installation warnings.
- string(REGEX REPLACE "[^\n]*clang: warning: Unknown CUDA version[^\n]*" "" check_output "${check_output}")
# If using the feature causes warnings, treat it as broken/unavailable.
if(check_output MATCHES "(^|[ :])[Ww][Aa][Rr][Nn][Ii][Nn][Gg]")
set(CMake_HAVE_CXX_${FEATURE} OFF CACHE INTERNAL "TRY_COMPILE" FORCE)
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 033cb60..939f757 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -98,17 +98,20 @@ void cmCommonTargetGenerator::AppendFortranFormatFlags(
}
std::string cmCommonTargetGenerator::GetFlags(const std::string& l,
- const std::string& config)
+ const std::string& config,
+ const std::string& arch)
{
- auto i = this->Configs[config].FlagsByLanguage.find(l);
- if (i == this->Configs[config].FlagsByLanguage.end()) {
+ const std::string key = config + arch;
+
+ auto i = this->Configs[key].FlagsByLanguage.find(l);
+ if (i == this->Configs[key].FlagsByLanguage.end()) {
std::string flags;
this->LocalCommonGenerator->GetTargetCompileFlags(this->GeneratorTarget,
- config, l, flags);
+ config, l, flags, arch);
ByLanguageMap::value_type entry(l, flags);
- i = this->Configs[config].FlagsByLanguage.insert(entry).first;
+ i = this->Configs[key].FlagsByLanguage.insert(entry).first;
}
return i->second;
}
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index b40a2ed..78cedf5 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -51,7 +51,8 @@ protected:
void AppendOSXVerFlag(std::string& flags, const std::string& lang,
const char* name, bool so);
- std::string GetFlags(const std::string& l, const std::string& config);
+ std::string GetFlags(const std::string& l, const std::string& config,
+ const std::string& arch = std::string());
std::string GetDefines(const std::string& l, const std::string& config);
std::string GetIncludes(std::string const& l, const std::string& config);
std::string GetManifests(const std::string& config);
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 737b0e5..1c5bcaa 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -754,11 +754,11 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
emmited.clear();
for (const auto& lgen : this->GlobalGenerator->GetLocalGenerators()) {
- if (const char* cdefs =
+ if (cmProp cdefs =
lgen->GetMakefile()->GetProperty("COMPILE_DEFINITIONS")) {
// Expand the list.
std::vector<std::string> defs;
- cmGeneratorExpression::Split(cdefs, defs);
+ cmGeneratorExpression::Split(*cdefs, defs);
for (std::string const& d : defs) {
if (cmGeneratorExpression::Find(d) != std::string::npos) {
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 955195f..70f5847 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -872,14 +872,27 @@ CompileData Target::BuildCompileData(cmSourceFile* sf)
}
// Add precompile headers compile options.
- const std::string pchSource =
- this->GT->GetPchSource(this->Config, fd.Language);
+ std::vector<std::string> architectures;
+ this->GT->GetAppleArchs(this->Config, architectures);
+ if (architectures.empty()) {
+ architectures.emplace_back();
+ }
+
+ std::unordered_map<std::string, std::string> pchSources;
+ for (const std::string& arch : architectures) {
+ const std::string pchSource =
+ this->GT->GetPchSource(this->Config, fd.Language, arch);
+ if (!pchSource.empty()) {
+ pchSources.insert(std::make_pair(pchSource, arch));
+ }
+ }
- if (!pchSource.empty() && !sf->GetProperty("SKIP_PRECOMPILE_HEADERS")) {
+ if (!pchSources.empty() && !sf->GetProperty("SKIP_PRECOMPILE_HEADERS")) {
std::string pchOptions;
- if (sf->ResolveFullPath() == pchSource) {
- pchOptions =
- this->GT->GetPchCreateCompileOptions(this->Config, fd.Language);
+ auto pchIt = pchSources.find(sf->ResolveFullPath());
+ if (pchIt != pchSources.end()) {
+ pchOptions = this->GT->GetPchCreateCompileOptions(
+ this->Config, fd.Language, pchIt->second);
} else {
pchOptions =
this->GT->GetPchUseCompileOptions(this->Config, fd.Language);
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index e81b619..611f7b0 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3540,7 +3540,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetPrecompileHeaders(
}
std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
- const std::string& language) const
+ const std::string& language,
+ const std::string& arch) const
{
if (language != "C" && language != "CXX" && language != "OBJC" &&
language != "OBJCXX") {
@@ -3555,7 +3556,7 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
generatorTarget->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM");
const auto inserted =
- this->PchHeaders.insert(std::make_pair(language + config, ""));
+ this->PchHeaders.insert(std::make_pair(language + config + arch, ""));
if (inserted.second) {
const std::vector<BT<std::string>> headers =
this->GetPrecompileHeaders(config, language);
@@ -3587,7 +3588,8 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
}
filename =
- cmStrCat(filename, "/cmake_pch", languageToExtension.at(language));
+ cmStrCat(filename, "/cmake_pch", arch.empty() ? "" : cmStrCat("_", arch),
+ languageToExtension.at(language));
const std::string filename_tmp = cmStrCat(filename, ".tmp");
if (!pchReuseFrom) {
@@ -3646,16 +3648,17 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
}
std::string cmGeneratorTarget::GetPchSource(const std::string& config,
- const std::string& language) const
+ const std::string& language,
+ const std::string& arch) const
{
if (language != "C" && language != "CXX" && language != "OBJC" &&
language != "OBJCXX") {
return std::string();
}
const auto inserted =
- this->PchSources.insert(std::make_pair(language + config, ""));
+ this->PchSources.insert(std::make_pair(language + config + arch, ""));
if (inserted.second) {
- const std::string pchHeader = this->GetPchHeader(config, language);
+ const std::string pchHeader = this->GetPchHeader(config, language, arch);
if (pchHeader.empty()) {
return std::string();
}
@@ -3682,13 +3685,15 @@ std::string cmGeneratorTarget::GetPchSource(const std::string& config,
{ "OBJCXX", ".objcxx.hxx.mm" }
};
- filename += languageToExtension.at(language);
+ filename = cmStrCat(filename, arch.empty() ? "" : cmStrCat("_", arch),
+ languageToExtension.at(language));
} else {
const std::map<std::string, std::string> languageToExtension = {
{ "C", ".c" }, { "CXX", ".cxx" }, { "OBJC", ".m" }, { "OBJCXX", ".mm" }
};
- filename += languageToExtension.at(language);
+ filename = cmStrCat(filename, arch.empty() ? "" : cmStrCat("_", arch),
+ languageToExtension.at(language));
}
const std::string filename_tmp = cmStrCat(filename, ".tmp");
@@ -3705,16 +3710,17 @@ std::string cmGeneratorTarget::GetPchSource(const std::string& config,
}
std::string cmGeneratorTarget::GetPchFileObject(const std::string& config,
- const std::string& language)
+ const std::string& language,
+ const std::string& arch)
{
if (language != "C" && language != "CXX" && language != "OBJC" &&
language != "OBJCXX") {
return std::string();
}
const auto inserted =
- this->PchObjectFiles.insert(std::make_pair(language + config, ""));
+ this->PchObjectFiles.insert(std::make_pair(language + config + arch, ""));
if (inserted.second) {
- const std::string pchSource = this->GetPchSource(config, language);
+ const std::string pchSource = this->GetPchSource(config, language, arch);
if (pchSource.empty()) {
return std::string();
}
@@ -3731,10 +3737,11 @@ std::string cmGeneratorTarget::GetPchFileObject(const std::string& config,
}
std::string cmGeneratorTarget::GetPchFile(const std::string& config,
- const std::string& language)
+ const std::string& language,
+ const std::string& arch)
{
const auto inserted =
- this->PchFiles.insert(std::make_pair(language + config, ""));
+ this->PchFiles.insert(std::make_pair(language + config + arch, ""));
if (inserted.second) {
std::string& pchFile = inserted.first->second;
@@ -3762,12 +3769,12 @@ std::string cmGeneratorTarget::GetPchFile(const std::string& config,
}
const std::string pchFileObject =
- generatorTarget->GetPchFileObject(config, language);
+ generatorTarget->GetPchFileObject(config, language, arch);
if (!pchExtension.empty()) {
pchFile = replaceExtension(pchFileObject, pchExtension);
}
} else {
- pchFile = this->GetPchHeader(config, language);
+ pchFile = this->GetPchHeader(config, language, arch);
pchFile += pchExtension;
}
}
@@ -3775,10 +3782,11 @@ std::string cmGeneratorTarget::GetPchFile(const std::string& config,
}
std::string cmGeneratorTarget::GetPchCreateCompileOptions(
- const std::string& config, const std::string& language)
+ const std::string& config, const std::string& language,
+ const std::string& arch)
{
const auto inserted = this->PchCreateCompileOptions.insert(
- std::make_pair(language + config, ""));
+ std::make_pair(language + config + arch, ""));
if (inserted.second) {
std::string& createOptionList = inserted.first->second;
@@ -3793,8 +3801,8 @@ std::string cmGeneratorTarget::GetPchCreateCompileOptions(
createOptionList = cmStrCat(
createOptionList, ";", this->Makefile->GetSafeDefinition(createOptVar));
- const std::string pchHeader = this->GetPchHeader(config, language);
- const std::string pchFile = this->GetPchFile(config, language);
+ const std::string pchHeader = this->GetPchHeader(config, language, arch);
+ const std::string pchFile = this->GetPchFile(config, language, arch);
cmSystemTools::ReplaceString(createOptionList, "<PCH_HEADER>", pchHeader);
cmSystemTools::ReplaceString(createOptionList, "<PCH_FILE>", pchFile);
@@ -3803,10 +3811,11 @@ std::string cmGeneratorTarget::GetPchCreateCompileOptions(
}
std::string cmGeneratorTarget::GetPchUseCompileOptions(
- const std::string& config, const std::string& language)
+ const std::string& config, const std::string& language,
+ const std::string& arch)
{
- const auto inserted =
- this->PchUseCompileOptions.insert(std::make_pair(language + config, ""));
+ const auto inserted = this->PchUseCompileOptions.insert(
+ std::make_pair(language + config + arch, ""));
if (inserted.second) {
std::string& useOptionList = inserted.first->second;
@@ -3816,13 +3825,18 @@ std::string cmGeneratorTarget::GetPchUseCompileOptions(
}
const std::string useOptVar =
- cmStrCat("CMAKE_", language, "_COMPILE_OPTIONS_USE_PCH");
+ cmStrCat(language, "_COMPILE_OPTIONS_USE_PCH");
+
+ const std::string useOptionListProperty = this->GetSafeProperty(useOptVar);
- useOptionList = cmStrCat(useOptionList, ";",
- this->Makefile->GetSafeDefinition(useOptVar));
+ useOptionList = cmStrCat(
+ useOptionList, ";",
+ useOptionListProperty.empty()
+ ? this->Makefile->GetSafeDefinition(cmStrCat("CMAKE_", useOptVar))
+ : useOptionListProperty);
- const std::string pchHeader = this->GetPchHeader(config, language);
- const std::string pchFile = this->GetPchFile(config, language);
+ const std::string pchHeader = this->GetPchHeader(config, language, arch);
+ const std::string pchFile = this->GetPchFile(config, language, arch);
cmSystemTools::ReplaceString(useOptionList, "<PCH_HEADER>", pchHeader);
cmSystemTools::ReplaceString(useOptionList, "<PCH_FILE>", pchFile);
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 12d30c5..9136928 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -478,17 +478,23 @@ public:
const std::string& config, const std::string& language) const;
std::string GetPchHeader(const std::string& config,
- const std::string& language) const;
+ const std::string& language,
+ const std::string& arch = std::string()) const;
std::string GetPchSource(const std::string& config,
- const std::string& language) const;
+ const std::string& language,
+ const std::string& arch = std::string()) const;
std::string GetPchFileObject(const std::string& config,
- const std::string& language);
+ const std::string& language,
+ const std::string& arch = std::string());
std::string GetPchFile(const std::string& config,
- const std::string& language);
- std::string GetPchCreateCompileOptions(const std::string& config,
- const std::string& language);
+ const std::string& language,
+ const std::string& arch = std::string());
+ std::string GetPchCreateCompileOptions(
+ const std::string& config, const std::string& language,
+ const std::string& arch = std::string());
std::string GetPchUseCompileOptions(const std::string& config,
- const std::string& language);
+ const std::string& language,
+ const std::string& arch = std::string());
void AddSourceFileToUnityBatch(const std::string& sourceFilename);
bool IsSourceFilePartOfUnityBatch(const std::string& sourceFilename) const;
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index 4a9509b..0480876 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -23,13 +23,13 @@ bool cmGetCMakePropertyCommand(std::vector<std::string> const& args,
std::string output = "NOTFOUND";
if (args[1] == "VARIABLES") {
- if (const char* varsProp = status.GetMakefile().GetProperty("VARIABLES")) {
- output = varsProp;
+ if (cmProp varsProp = status.GetMakefile().GetProperty("VARIABLES")) {
+ output = *varsProp;
}
} else if (args[1] == "MACROS") {
output.clear();
- if (const char* macrosProp = status.GetMakefile().GetProperty("MACROS")) {
- output = macrosProp;
+ if (cmProp macrosProp = status.GetMakefile().GetProperty("MACROS")) {
+ output = *macrosProp;
}
} else if (args[1] == "COMPONENTS") {
const std::set<std::string>* components =
diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx
index 65b3457..2833977 100644
--- a/Source/cmGetDirectoryPropertyCommand.cxx
+++ b/Source/cmGetDirectoryPropertyCommand.cxx
@@ -85,7 +85,9 @@ bool cmGetDirectoryPropertyCommand(std::vector<std::string> const& args,
break;
}
}
- prop = dir->GetProperty(*i);
+ if (cmProp p = dir->GetProperty(*i)) {
+ prop = p->c_str();
+ }
}
StoreResult(status.GetMakefile(), variable, prop);
return true;
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index c704803..c3ac672 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -289,8 +289,9 @@ bool HandleDirectoryMode(cmExecutionStatus& status, const std::string& name,
}
// Get the property.
+ cmProp p = mf->GetProperty(propertyName);
return StoreResult(infoType, status.GetMakefile(), variable,
- mf->GetProperty(propertyName));
+ p ? p->c_str() : nullptr);
}
bool HandleTargetMode(cmExecutionStatus& status, const std::string& name,
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 152e294..ccbbf53 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1678,8 +1678,8 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
for (std::string const& c : configs) {
std::string defPropName =
cmStrCat("COMPILE_DEFINITIONS_", cmSystemTools::UpperCase(c));
- if (const char* val = mf->GetProperty(defPropName)) {
- t->AppendProperty(defPropName, val);
+ if (cmProp val = mf->GetProperty(defPropName)) {
+ t->AppendProperty(defPropName, *val);
}
}
}
@@ -3034,7 +3034,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
#ifndef CMAKE_BOOTSTRAP
// Check whether labels are enabled for this target.
const char* targetLabels = target->GetProperty("LABELS");
- const char* directoryLabels =
+ cmProp directoryLabels =
target->Target->GetMakefile()->GetProperty("LABELS");
const char* cmakeDirectoryLabels =
target->Target->GetMakefile()->GetDefinition("CMAKE_DIRECTORY_LABELS");
@@ -3068,7 +3068,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
std::vector<std::string> cmakeDirectoryLabelsList;
if (directoryLabels) {
- cmExpandList(directoryLabels, directoryLabelsList);
+ cmExpandList(*directoryLabels, directoryLabelsList);
}
if (cmakeDirectoryLabels) {
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 9a9900a..4b8010a 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -526,8 +526,8 @@ void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections(
extensibilityAddInsOverridden = true;
}
fout << "\tGlobalSection(" << name << ") = " << sectionType << "\n";
- std::vector<std::string> keyValuePairs =
- cmExpandedList(root->GetMakefile()->GetProperty(it));
+ cmProp p = root->GetMakefile()->GetProperty(it);
+ std::vector<std::string> keyValuePairs = cmExpandedList(p ? *p : "");
for (std::string const& itPair : keyValuePairs) {
const std::string::size_type posEqual = itPair.find('=');
if (posEqual != std::string::npos) {
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 1ec1559..d2f9760 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -507,9 +507,9 @@ std::string cmGlobalVisualStudioGenerator::GetUtilityDepend(
std::string cmGlobalVisualStudioGenerator::GetStartupProjectName(
cmLocalGenerator const* root) const
{
- const char* n = root->GetMakefile()->GetProperty("VS_STARTUP_PROJECT");
- if (n && *n) {
- std::string startup = n;
+ cmProp n = root->GetMakefile()->GetProperty("VS_STARTUP_PROJECT");
+ if (n && !n->empty()) {
+ std::string startup = *n;
if (this->FindTarget(startup)) {
return startup;
} else {
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 1c1aaad..e74d618 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1861,7 +1861,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY ||
gtgt->GetType() == cmStateEnums::STATIC_LIBRARY) {
this->CurrentLocalGenerator->GetStaticLibraryFlags(
- extraLinkOptions, cmSystemTools::UpperCase(configName), llang, gtgt);
+ extraLinkOptions, configName, llang, gtgt);
} else {
const char* targetLinkFlags = gtgt->GetProperty("LINK_FLAGS");
if (targetLinkFlags) {
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 0a78af6..6227f81 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -301,16 +301,14 @@ void cmLocalGenerator::GenerateTestFiles()
"# testing this directory and lists subdirectories to "
"be tested as well.\n";
- const char* testIncludeFile =
- this->Makefile->GetProperty("TEST_INCLUDE_FILE");
+ cmProp testIncludeFile = this->Makefile->GetProperty("TEST_INCLUDE_FILE");
if (testIncludeFile) {
- fout << "include(\"" << testIncludeFile << "\")\n";
+ fout << "include(\"" << *testIncludeFile << "\")\n";
}
- const char* testIncludeFiles =
- this->Makefile->GetProperty("TEST_INCLUDE_FILES");
+ cmProp testIncludeFiles = this->Makefile->GetProperty("TEST_INCLUDE_FILES");
if (testIncludeFiles) {
- std::vector<std::string> includesList = cmExpandedList(testIncludeFiles);
+ std::vector<std::string> includesList = cmExpandedList(*testIncludeFiles);
for (std::string const& i : includesList) {
fout << "include(\"" << i << "\")\n";
}
@@ -335,12 +333,12 @@ void cmLocalGenerator::GenerateTestFiles()
// Add directory labels property
const char* directoryLabels =
this->Makefile->GetDefinition("CMAKE_DIRECTORY_LABELS");
- const char* labels = this->Makefile->GetProperty("LABELS");
+ cmProp labels = this->Makefile->GetProperty("LABELS");
if (labels || directoryLabels) {
fout << "set_directory_properties(PROPERTIES LABELS ";
if (labels) {
- fout << cmOutputConverter::EscapeForCMake(labels);
+ fout << cmOutputConverter::EscapeForCMake(*labels);
}
if (labels && directoryLabels) {
fout << ";";
@@ -775,7 +773,8 @@ const char* cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target,
if (target) {
return target->GetProperty(prop);
}
- return this->Makefile->GetProperty(prop);
+ cmProp p = this->Makefile->GetProperty(prop);
+ return p ? p->c_str() : nullptr;
}
std::string cmLocalGenerator::ConvertToIncludeReference(
@@ -1293,14 +1292,15 @@ std::vector<BT<std::string>> cmLocalGenerator::GetStaticLibraryFlags(
std::string const& config, std::string const& linkLanguage,
cmGeneratorTarget* target)
{
+ const std::string configUpper = cmSystemTools::UpperCase(config);
std::vector<BT<std::string>> flags;
if (linkLanguage != "Swift") {
std::string staticLibFlags;
this->AppendFlags(
staticLibFlags,
this->Makefile->GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS"));
- if (!config.empty()) {
- std::string name = "CMAKE_STATIC_LINKER_FLAGS_" + config;
+ if (!configUpper.empty()) {
+ std::string name = "CMAKE_STATIC_LINKER_FLAGS_" + configUpper;
this->AppendFlags(staticLibFlags,
this->Makefile->GetSafeDefinition(name));
}
@@ -1312,8 +1312,8 @@ std::vector<BT<std::string>> cmLocalGenerator::GetStaticLibraryFlags(
std::string staticLibFlags;
this->AppendFlags(staticLibFlags,
target->GetSafeProperty("STATIC_LIBRARY_FLAGS"));
- if (!config.empty()) {
- std::string name = "STATIC_LIBRARY_FLAGS_" + config;
+ if (!configUpper.empty()) {
+ std::string name = "STATIC_LIBRARY_FLAGS_" + configUpper;
this->AppendFlags(staticLibFlags, target->GetSafeProperty(name));
}
@@ -1350,17 +1350,17 @@ void cmLocalGenerator::GetTargetFlags(
std::vector<BT<std::string>>& linkFlags, std::string& frameworkPath,
std::vector<BT<std::string>>& linkPath, cmGeneratorTarget* target)
{
- const std::string buildType = cmSystemTools::UpperCase(config);
+ const std::string configUpper = cmSystemTools::UpperCase(config);
cmComputeLinkInformation* pcli = target->GetLinkInformation(config);
const char* libraryLinkVariable =
"CMAKE_SHARED_LINKER_FLAGS"; // default to shared library
const std::string linkLanguage =
- linkLineComputer->GetLinkerLanguage(target, buildType);
+ linkLineComputer->GetLinkerLanguage(target, config);
switch (target->GetType()) {
case cmStateEnums::STATIC_LIBRARY:
- linkFlags = this->GetStaticLibraryFlags(buildType, linkLanguage, target);
+ linkFlags = this->GetStaticLibraryFlags(config, linkLanguage, target);
if (pcli && dynamic_cast<cmLinkLineDeviceComputer*>(linkLineComputer)) {
// Compute the required cuda device link libraries when
// resolving cuda device symbols
@@ -1376,8 +1376,8 @@ void cmLocalGenerator::GetTargetFlags(
if (linkLanguage != "Swift") {
sharedLibFlags = cmStrCat(
this->Makefile->GetSafeDefinition(libraryLinkVariable), ' ');
- if (!buildType.empty()) {
- std::string build = cmStrCat(libraryLinkVariable, '_', buildType);
+ if (!configUpper.empty()) {
+ std::string build = cmStrCat(libraryLinkVariable, '_', configUpper);
sharedLibFlags += this->Makefile->GetSafeDefinition(build);
sharedLibFlags += " ";
}
@@ -1385,7 +1385,7 @@ void cmLocalGenerator::GetTargetFlags(
!(this->Makefile->IsOn("CYGWIN") ||
this->Makefile->IsOn("MINGW"))) {
std::vector<cmSourceFile*> sources;
- target->GetSourceFiles(sources, buildType);
+ target->GetSourceFiles(sources, config);
std::string defFlag =
this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
for (cmSourceFile* sf : sources) {
@@ -1404,9 +1404,9 @@ void cmLocalGenerator::GetTargetFlags(
sharedLibFlags += targetLinkFlags;
sharedLibFlags += " ";
}
- if (!buildType.empty()) {
+ if (!configUpper.empty()) {
targetLinkFlags =
- target->GetProperty(cmStrCat("LINK_FLAGS_", buildType));
+ target->GetProperty(cmStrCat("LINK_FLAGS_", configUpper));
if (targetLinkFlags) {
sharedLibFlags += targetLinkFlags;
sharedLibFlags += " ";
@@ -1431,9 +1431,9 @@ void cmLocalGenerator::GetTargetFlags(
if (linkLanguage != "Swift") {
exeFlags = this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
exeFlags += " ";
- if (!buildType.empty()) {
+ if (!configUpper.empty()) {
exeFlags += this->Makefile->GetSafeDefinition(
- cmStrCat("CMAKE_EXE_LINKER_FLAGS_", buildType));
+ cmStrCat("CMAKE_EXE_LINKER_FLAGS_", configUpper));
exeFlags += " ";
}
if (linkLanguage.empty()) {
@@ -1460,7 +1460,7 @@ void cmLocalGenerator::GetTargetFlags(
}
}
- this->AddLanguageFlagsForLinking(flags, target, linkLanguage, buildType);
+ this->AddLanguageFlagsForLinking(flags, target, linkLanguage, config);
if (pcli) {
this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
frameworkPath, linkPath);
@@ -1485,9 +1485,9 @@ void cmLocalGenerator::GetTargetFlags(
exeFlags += targetLinkFlags;
exeFlags += " ";
}
- if (!buildType.empty()) {
+ if (!configUpper.empty()) {
targetLinkFlags =
- target->GetProperty(cmStrCat("LINK_FLAGS_", buildType));
+ target->GetProperty(cmStrCat("LINK_FLAGS_", configUpper));
if (targetLinkFlags) {
exeFlags += targetLinkFlags;
exeFlags += " ";
@@ -1520,16 +1520,17 @@ void cmLocalGenerator::GetTargetFlags(
void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target,
std::string const& config,
std::string const& lang,
- std::string& flags)
+ std::string& flags,
+ std::string const& arch)
{
std::vector<BT<std::string>> tmpFlags =
- this->GetTargetCompileFlags(target, config, lang);
+ this->GetTargetCompileFlags(target, config, lang, arch);
this->AppendFlags(flags, tmpFlags);
}
std::vector<BT<std::string>> cmLocalGenerator::GetTargetCompileFlags(
cmGeneratorTarget* target, std::string const& config,
- std::string const& lang)
+ std::string const& lang, std::string const& arch)
{
std::vector<BT<std::string>> flags;
std::string compileFlags;
@@ -1543,7 +1544,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetTargetCompileFlags(
this->AppendFeatureOptions(compileFlags, lang, "IPO");
}
- this->AddArchitectureFlags(compileFlags, target, lang, config);
+ this->AddArchitectureFlags(compileFlags, target, lang, config, arch);
if (lang == "Fortran") {
this->AppendFlags(compileFlags,
@@ -1771,7 +1772,8 @@ std::string cmLocalGenerator::GetLinkLibsCMP0065(
void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
cmGeneratorTarget const* target,
const std::string& lang,
- const std::string& config)
+ const std::string& config,
+ const std::string& filterArch)
{
// Only add Apple specific flags on Apple platforms
if (this->Makefile->IsOn("APPLE") && this->EmitUniversalBinaryFlags) {
@@ -1780,8 +1782,10 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
if (!archs.empty() && !lang.empty() &&
(lang[0] == 'C' || lang[0] == 'F' || lang[0] == 'O')) {
for (std::string const& arch : archs) {
- flags += " -arch ";
- flags += arch;
+ if (filterArch.empty() || filterArch == arch) {
+ flags += " -arch ";
+ flags += arch;
+ }
}
}
@@ -1804,10 +1808,12 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
if (arch_sysroots[i].empty()) {
continue;
}
- flags += " -Xarch_" + archs[i] + " ";
- // Combine sysroot flag and path to work with -Xarch
- std::string arch_sysroot = sysrootFlag + arch_sysroots[i];
- flags += this->ConvertToOutputFormat(arch_sysroot, SHELL);
+ if (filterArch.empty() || filterArch == archs[i]) {
+ flags += " -Xarch_" + archs[i] + " ";
+ // Combine sysroot flag and path to work with -Xarch
+ std::string arch_sysroot = sysrootFlag + arch_sysroots[i];
+ flags += this->ConvertToOutputFormat(arch_sysroot, SHELL);
+ }
}
} else if (sysroot && *sysroot) {
flags += " ";
@@ -2446,146 +2452,174 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
continue;
}
- const std::string pchSource = target->GetPchSource(config, lang);
- const std::string pchHeader = target->GetPchHeader(config, lang);
-
- if (pchSource.empty() || pchHeader.empty()) {
- continue;
+ std::vector<std::string> architectures;
+ if (!this->GetGlobalGenerator()->IsXcode()) {
+ target->GetAppleArchs(config, architectures);
}
+ if (architectures.empty()) {
+ architectures.emplace_back();
+ } else {
+ std::string useMultiArchPch;
+ for (const std::string& arch : architectures) {
+ const std::string pchHeader =
+ target->GetPchHeader(config, lang, arch);
+ if (!pchHeader.empty()) {
+ useMultiArchPch = cmStrCat(useMultiArchPch, ";-Xarch_", arch,
+ ";-include", pchHeader);
+ }
+ }
- const std::string pchExtension =
- this->Makefile->GetSafeDefinition("CMAKE_PCH_EXTENSION");
-
- if (pchExtension.empty()) {
- continue;
+ if (!useMultiArchPch.empty()) {
+ target->Target->SetProperty(
+ cmStrCat(lang, "_COMPILE_OPTIONS_USE_PCH"), useMultiArchPch);
+ }
}
- const char* pchReuseFrom =
- target->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM");
+ for (const std::string& arch : architectures) {
+ const std::string pchSource = target->GetPchSource(config, lang, arch);
+ const std::string pchHeader = target->GetPchHeader(config, lang, arch);
+
+ if (pchSource.empty() || pchHeader.empty()) {
+ continue;
+ }
- auto pch_sf = this->Makefile->GetOrCreateSource(
- pchSource, false, cmSourceFileLocationKind::Known);
+ const std::string pchExtension =
+ this->Makefile->GetSafeDefinition("CMAKE_PCH_EXTENSION");
- if (!this->GetGlobalGenerator()->IsXcode()) {
- if (!pchReuseFrom) {
- target->AddSource(pchSource, true);
+ if (pchExtension.empty()) {
+ continue;
}
- const std::string pchFile = target->GetPchFile(config, lang);
+ const char* pchReuseFrom =
+ target->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM");
- // Exclude the pch files from linking
- if (this->Makefile->IsOn("CMAKE_LINK_PCH")) {
- if (!pchReuseFrom) {
- pch_sf->SetProperty("OBJECT_OUTPUTS", pchFile.c_str());
- } else {
- auto reuseTarget =
- this->GlobalGenerator->FindGeneratorTarget(pchReuseFrom);
+ auto pch_sf = this->Makefile->GetOrCreateSource(
+ pchSource, false, cmSourceFileLocationKind::Known);
- if (this->Makefile->IsOn("CMAKE_PCH_COPY_COMPILE_PDB")) {
+ if (!this->GetGlobalGenerator()->IsXcode()) {
+ if (!pchReuseFrom) {
+ target->AddSource(pchSource, true);
+ }
- const std::string pdb_prefix =
- this->GetGlobalGenerator()->IsMultiConfig()
- ? cmStrCat(this->GlobalGenerator->GetCMakeCFGIntDir(), "/")
- : "";
+ const std::string pchFile = target->GetPchFile(config, lang, arch);
- const std::string target_compile_pdb_dir = cmStrCat(
- target->GetLocalGenerator()->GetCurrentBinaryDirectory(), "/",
- target->GetName(), ".dir/");
+ // Exclude the pch files from linking
+ if (this->Makefile->IsOn("CMAKE_LINK_PCH")) {
+ if (!pchReuseFrom) {
+ pch_sf->SetProperty("OBJECT_OUTPUTS", pchFile.c_str());
+ } else {
+ auto reuseTarget =
+ this->GlobalGenerator->FindGeneratorTarget(pchReuseFrom);
- const std::string copy_script =
- cmStrCat(target_compile_pdb_dir, "copy_idb_pdb.cmake");
- cmGeneratedFileStream file(copy_script);
+ if (this->Makefile->IsOn("CMAKE_PCH_COPY_COMPILE_PDB")) {
- file << "# CMake generated file\n";
- for (auto extension : { ".pdb", ".idb" }) {
- const std::string from_file =
- cmStrCat(reuseTarget->GetLocalGenerator()
- ->GetCurrentBinaryDirectory(),
- "/", pchReuseFrom, ".dir/${PDB_PREFIX}",
- pchReuseFrom, extension);
+ const std::string pdb_prefix =
+ this->GetGlobalGenerator()->IsMultiConfig()
+ ? cmStrCat(this->GlobalGenerator->GetCMakeCFGIntDir(), "/")
+ : "";
- const std::string to_dir = cmStrCat(
+ const std::string target_compile_pdb_dir = cmStrCat(
target->GetLocalGenerator()->GetCurrentBinaryDirectory(),
- "/", target->GetName(), ".dir/${PDB_PREFIX}");
+ "/", target->GetName(), ".dir/");
- const std::string to_file =
- cmStrCat(to_dir, pchReuseFrom, extension);
+ const std::string copy_script =
+ cmStrCat(target_compile_pdb_dir, "copy_idb_pdb.cmake");
+ cmGeneratedFileStream file(copy_script);
- std::string dest_file = to_file;
+ file << "# CMake generated file\n";
+ for (auto extension : { ".pdb", ".idb" }) {
+ const std::string from_file =
+ cmStrCat(reuseTarget->GetLocalGenerator()
+ ->GetCurrentBinaryDirectory(),
+ "/", pchReuseFrom, ".dir/${PDB_PREFIX}",
+ pchReuseFrom, extension);
- const std::string prefix = target->GetSafeProperty("PREFIX");
- if (!prefix.empty()) {
- dest_file =
- cmStrCat(to_dir, prefix, pchReuseFrom, extension);
- }
+ const std::string to_dir = cmStrCat(
+ target->GetLocalGenerator()->GetCurrentBinaryDirectory(),
+ "/", target->GetName(), ".dir/${PDB_PREFIX}");
- file << "if (EXISTS \"" << from_file << "\" AND \""
- << from_file << "\" IS_NEWER_THAN \"" << dest_file
- << "\")\n";
- file << " file(COPY \"" << from_file << "\""
- << " DESTINATION \"" << to_dir << "\")\n";
- if (!prefix.empty()) {
- file << " file(REMOVE \"" << dest_file << "\")\n";
- file << " file(RENAME \"" << to_file << "\" \"" << dest_file
+ const std::string to_file =
+ cmStrCat(to_dir, pchReuseFrom, extension);
+
+ std::string dest_file = to_file;
+
+ const std::string prefix = target->GetSafeProperty("PREFIX");
+ if (!prefix.empty()) {
+ dest_file =
+ cmStrCat(to_dir, prefix, pchReuseFrom, extension);
+ }
+
+ file << "if (EXISTS \"" << from_file << "\" AND \""
+ << from_file << "\" IS_NEWER_THAN \"" << dest_file
<< "\")\n";
+ file << " file(COPY \"" << from_file << "\""
+ << " DESTINATION \"" << to_dir << "\")\n";
+ if (!prefix.empty()) {
+ file << " file(REMOVE \"" << dest_file << "\")\n";
+ file << " file(RENAME \"" << to_file << "\" \""
+ << dest_file << "\")\n";
+ }
+ file << "endif()\n";
}
- file << "endif()\n";
- }
- cmCustomCommandLines commandLines = cmMakeSingleCommandLine(
- { cmSystemTools::GetCMakeCommand(),
- cmStrCat("-DPDB_PREFIX=", pdb_prefix), "-P", copy_script });
-
- const std::string no_main_dependency;
- const std::vector<std::string> no_deps;
- const char* no_message = "";
- const char* no_current_dir = nullptr;
- std::vector<std::string> no_byproducts;
-
- std::vector<std::string> outputs;
- outputs.push_back(cmStrCat(target_compile_pdb_dir, pdb_prefix,
- pchReuseFrom, ".pdb"));
-
- if (this->GetGlobalGenerator()->IsVisualStudio()) {
- this->AddCustomCommandToTarget(
- target->GetName(), outputs, no_deps, commandLines,
- cmCustomCommandType::PRE_BUILD, no_message, no_current_dir);
- } else {
- cmImplicitDependsList no_implicit_depends;
- cmSourceFile* copy_rule = this->AddCustomCommandToOutput(
- outputs, no_byproducts, no_deps, no_main_dependency,
- no_implicit_depends, commandLines, no_message,
- no_current_dir);
-
- if (copy_rule) {
- target->AddSource(copy_rule->ResolveFullPath());
+ cmCustomCommandLines commandLines = cmMakeSingleCommandLine(
+ { cmSystemTools::GetCMakeCommand(),
+ cmStrCat("-DPDB_PREFIX=", pdb_prefix), "-P",
+ copy_script });
+
+ const std::string no_main_dependency;
+ const std::vector<std::string> no_deps;
+ const char* no_message = "";
+ const char* no_current_dir = nullptr;
+ std::vector<std::string> no_byproducts;
+
+ std::vector<std::string> outputs;
+ outputs.push_back(cmStrCat(target_compile_pdb_dir, pdb_prefix,
+ pchReuseFrom, ".pdb"));
+
+ if (this->GetGlobalGenerator()->IsVisualStudio()) {
+ this->AddCustomCommandToTarget(
+ target->GetName(), outputs, no_deps, commandLines,
+ cmCustomCommandType::PRE_BUILD, no_message,
+ no_current_dir);
+ } else {
+ cmImplicitDependsList no_implicit_depends;
+ cmSourceFile* copy_rule = this->AddCustomCommandToOutput(
+ outputs, no_byproducts, no_deps, no_main_dependency,
+ no_implicit_depends, commandLines, no_message,
+ no_current_dir);
+
+ if (copy_rule) {
+ target->AddSource(copy_rule->ResolveFullPath());
+ }
}
- }
- target->Target->SetProperty("COMPILE_PDB_OUTPUT_DIRECTORY",
- target_compile_pdb_dir);
- }
+ target->Target->SetProperty("COMPILE_PDB_OUTPUT_DIRECTORY",
+ target_compile_pdb_dir);
+ }
- std::string pchSourceObj =
- reuseTarget->GetPchFileObject(config, lang);
+ std::string pchSourceObj =
+ reuseTarget->GetPchFileObject(config, lang, arch);
- // Link to the pch object file
- target->Target->AppendProperty(
- "LINK_FLAGS",
- cmStrCat(" ", this->ConvertToOutputFormat(pchSourceObj, SHELL)),
- true);
+ // Link to the pch object file
+ target->Target->AppendProperty(
+ "LINK_FLAGS",
+ cmStrCat(" ",
+ this->ConvertToOutputFormat(pchSourceObj, SHELL)),
+ true);
+ }
+ } else {
+ pch_sf->SetProperty("PCH_EXTENSION", pchExtension.c_str());
}
- } else {
- pch_sf->SetProperty("PCH_EXTENSION", pchExtension.c_str());
- }
- // Add pchHeader to source files, which will
- // be grouped as "Precompile Header File"
- auto pchHeader_sf = this->Makefile->GetOrCreateSource(
- pchHeader, false, cmSourceFileLocationKind::Known);
- std::string err;
- pchHeader_sf->ResolveFullPath(&err);
- target->AddSource(pchHeader);
+ // Add pchHeader to source files, which will
+ // be grouped as "Precompile Header File"
+ auto pchHeader_sf = this->Makefile->GetOrCreateSource(
+ pchHeader, false, cmSourceFileLocationKind::Known);
+ std::string err;
+ pchHeader_sf->ResolveFullPath(&err);
+ target->AddSource(pchHeader);
+ }
}
}
}
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 88194b7..25ed265 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -105,8 +105,8 @@ public:
void AddArchitectureFlags(std::string& flags,
cmGeneratorTarget const* target,
- const std::string& lang,
- const std::string& config);
+ const std::string& lang, const std::string& config,
+ const std::string& filterArch = std::string());
void AddLanguageFlags(std::string& flags, cmGeneratorTarget const* target,
const std::string& lang, const std::string& config);
@@ -435,10 +435,11 @@ public:
std::string const& lang) const;
void GetTargetCompileFlags(cmGeneratorTarget* target,
std::string const& config,
- std::string const& lang, std::string& flags);
- std::vector<BT<std::string>> GetTargetCompileFlags(cmGeneratorTarget* target,
- std::string const& config,
- std::string const& lang);
+ std::string const& lang, std::string& flags,
+ std::string const& arch = std::string());
+ std::vector<BT<std::string>> GetTargetCompileFlags(
+ cmGeneratorTarget* target, std::string const& config,
+ std::string const& lang, std::string const& arch = std::string());
std::string GetFrameworkFlags(std::string const& l,
std::string const& config,
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index e62371d..d1944a4 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -628,10 +628,9 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements(
std::string cmLocalNinjaGenerator::MakeCustomLauncher(
cmCustomCommandGenerator const& ccg)
{
- const char* property_value =
- this->Makefile->GetProperty("RULE_LAUNCH_CUSTOM");
+ cmProp property_value = this->Makefile->GetProperty("RULE_LAUNCH_CUSTOM");
- if (!property_value || !*property_value) {
+ if (!property_value || property_value->empty()) {
return std::string();
}
@@ -653,7 +652,7 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher(
std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
this->CreateRulePlaceholderExpander());
- std::string launcher = property_value;
+ std::string launcher = *property_value;
rulePlaceholderExpander->ExpandRuleVariables(this, launcher, vars);
if (!launcher.empty()) {
launcher += " ";
@@ -664,11 +663,11 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher(
void cmLocalNinjaGenerator::AdditionalCleanFiles(const std::string& config)
{
- if (const char* prop_value =
+ if (cmProp prop_value =
this->Makefile->GetProperty("ADDITIONAL_CLEAN_FILES")) {
std::vector<std::string> cleanFiles;
{
- cmExpandList(cmGeneratorExpression::Evaluate(prop_value, this, config),
+ cmExpandList(cmGeneratorExpression::Evaluate(*prop_value, this, config),
cleanFiles);
}
std::string const& binaryDir = this->GetCurrentBinaryDirectory();
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 593a6d9..99428bc 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1099,10 +1099,10 @@ void cmLocalUnixMakefileGenerator3::AppendDirectoryCleanCommand(
{
std::vector<std::string> cleanFiles;
// Look for additional files registered for cleaning in this directory.
- if (const char* prop_value =
+ if (cmProp prop_value =
this->Makefile->GetProperty("ADDITIONAL_CLEAN_FILES")) {
cmExpandList(cmGeneratorExpression::Evaluate(
- prop_value, this,
+ *prop_value, this,
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")),
cleanFiles);
}
@@ -1889,9 +1889,9 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
// Store include transform rule properties. Write the directory
// rules first because they may be overridden by later target rules.
std::vector<std::string> transformRules;
- if (const char* xform =
+ if (cmProp xform =
this->Makefile->GetProperty("IMPLICIT_DEPENDS_INCLUDE_TRANSFORM")) {
- cmExpandList(xform, transformRules);
+ cmExpandList(*xform, transformRules);
}
if (const char* xform =
target->GetProperty("IMPLICIT_DEPENDS_INCLUDE_TRANSFORM")) {
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 0c1f0cc..9148b27 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1004,9 +1004,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
}
}
std::string libflags;
- this->GetStaticLibraryFlags(libflags, configTypeUpper,
- target->GetLinkerLanguage(configName),
- target);
+ this->GetStaticLibraryFlags(
+ libflags, configName, target->GetLinkerLanguage(configName), target);
if (!libflags.empty()) {
fout << "\t\t\t\tAdditionalOptions=\"" << libflags << "\"\n";
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index af6b44e..69f316d 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1391,9 +1391,9 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
const char* define = def.c_str() + 2;
if (remove) {
- if (const char* cdefs = this->GetProperty("COMPILE_DEFINITIONS")) {
+ if (cmProp cdefs = this->GetProperty("COMPILE_DEFINITIONS")) {
// Expand the list.
- std::vector<std::string> defs = cmExpandedList(cdefs);
+ std::vector<std::string> defs = cmExpandedList(*cdefs);
// Recompose the list without the definition.
auto defEnd = std::remove(defs.begin(), defs.end(), define);
@@ -1422,29 +1422,32 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
// Include transform property. There is no per-config version.
{
const char* prop = "IMPLICIT_DEPENDS_INCLUDE_TRANSFORM";
- this->SetProperty(prop, parent->GetProperty(prop));
+ cmProp p = parent->GetProperty(prop);
+ this->SetProperty(prop, p ? p->c_str() : nullptr);
}
// compile definitions property and per-config versions
cmPolicies::PolicyStatus polSt = this->GetPolicyStatus(cmPolicies::CMP0043);
if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) {
- this->SetProperty("COMPILE_DEFINITIONS",
- parent->GetProperty("COMPILE_DEFINITIONS"));
+ cmProp p = parent->GetProperty("COMPILE_DEFINITIONS");
+ this->SetProperty("COMPILE_DEFINITIONS", p ? p->c_str() : nullptr);
std::vector<std::string> configs;
this->GetConfigurations(configs);
for (std::string const& config : configs) {
std::string defPropName =
cmStrCat("COMPILE_DEFINITIONS_", cmSystemTools::UpperCase(config));
- const char* prop = parent->GetProperty(defPropName);
- this->SetProperty(defPropName, prop);
+ cmProp prop = parent->GetProperty(defPropName);
+ this->SetProperty(defPropName, prop ? prop->c_str() : nullptr);
}
}
// labels
- this->SetProperty("LABELS", parent->GetProperty("LABELS"));
+ cmProp p = parent->GetProperty("LABELS");
+ this->SetProperty("LABELS", p ? p->c_str() : nullptr);
// link libraries
- this->SetProperty("LINK_LIBRARIES", parent->GetProperty("LINK_LIBRARIES"));
+ p = parent->GetProperty("LINK_LIBRARIES");
+ this->SetProperty("LINK_LIBRARIES", p ? p->c_str() : nullptr);
// the initial project name
this->StateSnapshot.SetProjectName(parent->StateSnapshot.GetProjectName());
@@ -2006,8 +2009,8 @@ void cmMakefile::AddGlobalLinkInformation(cmTarget& target)
default:;
}
- if (const char* linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
- std::vector<std::string> linkLibs = cmExpandedList(linkLibsProp);
+ if (cmProp linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
+ std::vector<std::string> linkLibs = cmExpandedList(*linkLibsProp);
for (auto j = linkLibs.begin(); j != linkLibs.end(); ++j) {
std::string libraryName = *j;
@@ -2451,14 +2454,14 @@ void cmMakefile::ExpandVariablesCMP0019()
}
std::ostringstream w;
- const char* includeDirs = this->GetProperty("INCLUDE_DIRECTORIES");
- if (mightExpandVariablesCMP0019(includeDirs)) {
- std::string dirs = includeDirs;
+ cmProp includeDirs = this->GetProperty("INCLUDE_DIRECTORIES");
+ if (includeDirs && mightExpandVariablesCMP0019(includeDirs->c_str())) {
+ std::string dirs = *includeDirs;
this->ExpandVariablesInString(dirs, true, true);
- if (pol == cmPolicies::WARN && dirs != includeDirs) {
+ if (pol == cmPolicies::WARN && dirs != *includeDirs) {
/* clang-format off */
w << "Evaluated directory INCLUDE_DIRECTORIES\n"
- << " " << includeDirs << "\n"
+ << " " << *includeDirs << "\n"
<< "as\n"
<< " " << dirs << "\n";
/* clang-format on */
@@ -2473,14 +2476,14 @@ void cmMakefile::ExpandVariablesCMP0019()
t.GetType() == cmStateEnums::GLOBAL_TARGET) {
continue;
}
- cmProp includeDirs2 = t.GetProperty("INCLUDE_DIRECTORIES");
- if (includeDirs2 && mightExpandVariablesCMP0019(includeDirs2->c_str())) {
- std::string dirs = *includeDirs2;
+ includeDirs = t.GetProperty("INCLUDE_DIRECTORIES");
+ if (includeDirs && mightExpandVariablesCMP0019(includeDirs->c_str())) {
+ std::string dirs = *includeDirs;
this->ExpandVariablesInString(dirs, true, true);
- if (pol == cmPolicies::WARN && dirs != *includeDirs2) {
+ if (pol == cmPolicies::WARN && dirs != *includeDirs) {
/* clang-format off */
w << "Evaluated target " << t.GetName() << " INCLUDE_DIRECTORIES\n"
- << " " << *includeDirs2 << "\n"
+ << " " << *includeDirs << "\n"
<< "as\n"
<< " " << dirs << "\n";
/* clang-format on */
@@ -2489,9 +2492,9 @@ void cmMakefile::ExpandVariablesCMP0019()
}
}
- if (const char* linkDirsProp = this->GetProperty("LINK_DIRECTORIES")) {
- if (mightExpandVariablesCMP0019(linkDirsProp)) {
- std::string d = linkDirsProp;
+ if (cmProp linkDirsProp = this->GetProperty("LINK_DIRECTORIES")) {
+ if (mightExpandVariablesCMP0019(linkDirsProp->c_str())) {
+ std::string d = *linkDirsProp;
const std::string orig = d;
this->ExpandVariablesInString(d, true, true);
if (pol == cmPolicies::WARN && d != orig) {
@@ -2505,8 +2508,8 @@ void cmMakefile::ExpandVariablesCMP0019()
}
}
- if (const char* linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
- std::vector<std::string> linkLibs = cmExpandedList(linkLibsProp);
+ if (cmProp linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
+ std::vector<std::string> linkLibs = cmExpandedList(*linkLibsProp);
for (auto l = linkLibs.begin(); l != linkLibs.end(); ++l) {
std::string libName = *l;
@@ -4084,7 +4087,7 @@ void cmMakefile::AppendProperty(const std::string& prop,
this->Backtrace);
}
-const char* cmMakefile::GetProperty(const std::string& prop) const
+cmProp cmMakefile::GetProperty(const std::string& prop) const
{
// Check for computed properties.
static std::string output;
@@ -4097,22 +4100,21 @@ const char* cmMakefile::GetProperty(const std::string& prop) const
return pair.first;
});
output = cmJoin(keys, ";");
- return output.c_str();
+ return &output;
}
- cmProp retVal = this->StateSnapshot.GetDirectory().GetProperty(prop);
- return retVal ? retVal->c_str() : nullptr;
+ return this->StateSnapshot.GetDirectory().GetProperty(prop);
}
-const char* cmMakefile::GetProperty(const std::string& prop, bool chain) const
+cmProp cmMakefile::GetProperty(const std::string& prop, bool chain) const
{
- cmProp retVal = this->StateSnapshot.GetDirectory().GetProperty(prop, chain);
- return retVal ? retVal->c_str() : nullptr;
+ return this->StateSnapshot.GetDirectory().GetProperty(prop, chain);
}
bool cmMakefile::GetPropertyAsBool(const std::string& prop) const
{
- return cmIsOn(this->GetProperty(prop));
+ cmProp p = this->GetProperty(prop);
+ return p && cmIsOn(*p);
}
std::vector<std::string> cmMakefile::GetPropertyKeys() const
@@ -4164,8 +4166,8 @@ void cmMakefile::GetTests(const std::string& config,
void cmMakefile::AddCMakeDependFilesFromUser()
{
std::vector<std::string> deps;
- if (const char* deps_str = this->GetProperty("CMAKE_CONFIGURE_DEPENDS")) {
- cmExpandList(deps_str, deps);
+ if (cmProp deps_str = this->GetProperty("CMAKE_CONFIGURE_DEPENDS")) {
+ cmExpandList(*deps_str, deps);
}
for (std::string const& dep : deps) {
if (cmSystemTools::FileIsFullPath(dep)) {
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index d628681..9a7eff9 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -58,6 +58,8 @@ class cmTestGenerator;
class cmVariableWatch;
class cmake;
+using cmProp = const std::string*;
+
/** Flag if byproducts shall also be considered. */
enum class cmSourceOutputKind
{
@@ -417,7 +419,8 @@ public:
}
const char* GetIncludeRegularExpression() const
{
- return this->GetProperty("INCLUDE_REGULAR_EXPRESSION");
+ cmProp p = this->GetProperty("INCLUDE_REGULAR_EXPRESSION");
+ return p ? p->c_str() : nullptr;
}
/**
@@ -795,8 +798,8 @@ public:
void SetProperty(const std::string& prop, const char* value);
void AppendProperty(const std::string& prop, const std::string& value,
bool asString = false);
- const char* GetProperty(const std::string& prop) const;
- const char* GetProperty(const std::string& prop, bool chain) const;
+ cmProp GetProperty(const std::string& prop) const;
+ cmProp GetProperty(const std::string& prop, bool chain) const;
bool GetPropertyAsBool(const std::string& prop) const;
std::vector<std::string> GetPropertyKeys() const;
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 4434f1d..372b43b 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -141,8 +141,7 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
std::string extraFlags;
this->LocalGenerator->GetStaticLibraryFlags(
- extraFlags, cmSystemTools::UpperCase(this->GetConfigName()), linkLanguage,
- this->GeneratorTarget);
+ extraFlags, this->GetConfigName(), linkLanguage, this->GeneratorTarget);
this->WriteLibraryRules(linkRuleVar, extraFlags, false);
}
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 4fb84ee..5bb4c57 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -5,6 +5,7 @@
#include <cassert>
#include <cstdio>
#include <sstream>
+#include <unordered_map>
#include <utility>
#include <cm/memory>
@@ -164,9 +165,9 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
};
// Look for additional files registered for cleaning in this directory.
- if (const char* prop_value =
+ if (cmProp prop_value =
this->Makefile->GetProperty("ADDITIONAL_MAKE_CLEAN_FILES")) {
- std::vector<std::string> const files = evaluatedFiles(prop_value);
+ std::vector<std::string> const files = evaluatedFiles(*prop_value);
this->CleanFiles.insert(files.begin(), files.end());
}
@@ -183,8 +184,8 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
}
// add custom commands to the clean rules?
- const char* clean_no_custom = this->Makefile->GetProperty("CLEAN_NO_CUSTOM");
- bool clean = cmIsOff(clean_no_custom);
+ cmProp clean_no_custom = this->Makefile->GetProperty("CLEAN_NO_CUSTOM");
+ bool clean = clean_no_custom ? cmIsOff(*clean_no_custom) : true;
// First generate the object rule files. Save a list of all object
// files for this target.
@@ -341,16 +342,25 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
}
for (std::string const& language : languages) {
- std::string flags = this->GetFlags(language, this->GetConfigName());
std::string defines = this->GetDefines(language, this->GetConfigName());
std::string includes = this->GetIncludes(language, this->GetConfigName());
// Escape comment characters so they do not terminate assignment.
- cmSystemTools::ReplaceString(flags, "#", "\\#");
cmSystemTools::ReplaceString(defines, "#", "\\#");
cmSystemTools::ReplaceString(includes, "#", "\\#");
- *this->FlagFileStream << language << "_FLAGS = " << flags << "\n\n";
*this->FlagFileStream << language << "_DEFINES = " << defines << "\n\n";
*this->FlagFileStream << language << "_INCLUDES = " << includes << "\n\n";
+
+ std::vector<std::string> architectures;
+ this->GeneratorTarget->GetAppleArchs(this->GetConfigName(), architectures);
+ architectures.emplace_back();
+
+ for (const std::string& arch : architectures) {
+ std::string flags =
+ this->GetFlags(language, this->GetConfigName(), arch);
+ cmSystemTools::ReplaceString(flags, "#", "\\#");
+ *this->FlagFileStream << language << "_FLAGS" << arch << " = " << flags
+ << "\n\n";
+ }
}
}
@@ -463,17 +473,37 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
std::string configUpper = cmSystemTools::UpperCase(config);
// Add precompile headers dependencies
- const std::string pchSource =
- this->GeneratorTarget->GetPchSource(config, lang);
- if (!pchSource.empty() && !source.GetProperty("SKIP_PRECOMPILE_HEADERS")) {
- std::string const& pchHeader =
- this->GeneratorTarget->GetPchHeader(config, lang);
- depends.push_back(pchHeader);
- if (source.GetFullPath() != pchSource) {
- depends.push_back(this->GeneratorTarget->GetPchFile(config, lang));
+ std::vector<std::string> architectures;
+ this->GeneratorTarget->GetAppleArchs(config, architectures);
+ if (architectures.empty()) {
+ architectures.emplace_back();
+ }
+
+ std::string filterArch;
+ std::unordered_map<std::string, std::string> pchSources;
+ for (const std::string& arch : architectures) {
+ const std::string pchSource =
+ this->GeneratorTarget->GetPchSource(config, lang, arch);
+ if (pchSource == source.GetFullPath()) {
+ filterArch = arch;
+ }
+ if (!pchSource.empty()) {
+ pchSources.insert(std::make_pair(pchSource, arch));
+ }
+ }
+
+ if (!pchSources.empty() && !source.GetProperty("SKIP_PRECOMPILE_HEADERS")) {
+ for (const std::string& arch : architectures) {
+ std::string const& pchHeader =
+ this->GeneratorTarget->GetPchHeader(config, lang, arch);
+ depends.push_back(pchHeader);
+ if (pchSources.find(source.GetFullPath()) == pchSources.end()) {
+ depends.push_back(
+ this->GeneratorTarget->GetPchFile(config, lang, arch));
+ }
+ this->LocalGenerator->AddImplicitDepends(this->GeneratorTarget, lang,
+ objFullPath, pchHeader);
}
- this->LocalGenerator->AddImplicitDepends(this->GeneratorTarget, lang,
- objFullPath, pchHeader);
}
std::string relativeObj =
@@ -484,7 +514,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
std::string flags;
// Add language-specific flags.
- std::string langFlags = cmStrCat("$(", lang, "_FLAGS)");
+ std::string langFlags = cmStrCat("$(", lang, "_FLAGS", filterArch, ")");
this->LocalGenerator->AppendFlags(flags, langFlags);
cmGeneratorExpressionInterpreter genexInterpreter(
@@ -517,11 +547,12 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
}
// Add precompile headers compile options.
- if (!pchSource.empty() && !source.GetProperty("SKIP_PRECOMPILE_HEADERS")) {
+ if (!pchSources.empty() && !source.GetProperty("SKIP_PRECOMPILE_HEADERS")) {
std::string pchOptions;
- if (source.GetFullPath() == pchSource) {
- pchOptions =
- this->GeneratorTarget->GetPchCreateCompileOptions(config, lang);
+ auto pchIt = pchSources.find(source.GetFullPath());
+ if (pchIt != pchSources.end()) {
+ pchOptions = this->GeneratorTarget->GetPchCreateCompileOptions(
+ config, lang, pchIt->second);
} else {
pchOptions =
this->GeneratorTarget->GetPchUseCompileOptions(config, lang);
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 8833fa4..ed74cf9 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -7,6 +7,8 @@
#include <iterator>
#include <map>
#include <ostream>
+#include <unordered_map>
+#include <unordered_set>
#include <utility>
#include <cm/memory>
@@ -157,7 +159,26 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject(
cmSourceFile const* source, const std::string& language,
const std::string& config)
{
- std::string flags = this->GetFlags(language, config);
+ std::vector<std::string> architectures;
+ std::unordered_map<std::string, std::string> pchSources;
+ this->GeneratorTarget->GetAppleArchs(config, architectures);
+ if (architectures.empty()) {
+ architectures.emplace_back();
+ }
+
+ std::string filterArch;
+ for (const std::string& arch : architectures) {
+ const std::string pchSource =
+ this->GeneratorTarget->GetPchSource(config, language, arch);
+ if (pchSource == source->GetFullPath()) {
+ filterArch = arch;
+ }
+ if (!pchSource.empty()) {
+ pchSources.insert(std::make_pair(pchSource, arch));
+ }
+ }
+
+ std::string flags = this->GetFlags(language, config, filterArch);
// Add Fortran format flags.
if (language == "Fortran") {
@@ -181,14 +202,12 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject(
}
// Add precompile headers compile options.
- const std::string pchSource =
- this->GeneratorTarget->GetPchSource(config, language);
-
- if (!pchSource.empty() && !source->GetProperty("SKIP_PRECOMPILE_HEADERS")) {
+ if (!pchSources.empty() && !source->GetProperty("SKIP_PRECOMPILE_HEADERS")) {
std::string pchOptions;
- if (source->GetFullPath() == pchSource) {
- pchOptions =
- this->GeneratorTarget->GetPchCreateCompileOptions(config, language);
+ auto pchIt = pchSources.find(source->GetFullPath());
+ if (pchIt != pchSources.end()) {
+ pchOptions = this->GeneratorTarget->GetPchCreateCompileOptions(
+ config, language, pchIt->second);
} else {
pchOptions =
this->GeneratorTarget->GetPchUseCompileOptions(config, language);
@@ -1050,12 +1069,30 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
// Add precompile headers dependencies
std::vector<std::string> depList;
- const std::string pchSource =
- this->GeneratorTarget->GetPchSource(config, language);
- if (!pchSource.empty() && !source->GetProperty("SKIP_PRECOMPILE_HEADERS")) {
- depList.push_back(this->GeneratorTarget->GetPchHeader(config, language));
- if (source->GetFullPath() != pchSource) {
- depList.push_back(this->GeneratorTarget->GetPchFile(config, language));
+ std::vector<std::string> architectures;
+ this->GeneratorTarget->GetAppleArchs(config, architectures);
+ if (architectures.empty()) {
+ architectures.emplace_back();
+ }
+
+ std::unordered_set<std::string> pchSources;
+ for (const std::string& arch : architectures) {
+ const std::string pchSource =
+ this->GeneratorTarget->GetPchSource(config, language, arch);
+
+ if (!pchSource.empty()) {
+ pchSources.insert(pchSource);
+ }
+ }
+
+ if (!pchSources.empty() && !source->GetProperty("SKIP_PRECOMPILE_HEADERS")) {
+ for (const std::string& arch : architectures) {
+ depList.push_back(
+ this->GeneratorTarget->GetPchHeader(config, language, arch));
+ if (pchSources.find(source->GetFullPath()) == pchSources.end()) {
+ depList.push_back(
+ this->GeneratorTarget->GetPchFile(config, language, arch));
+ }
}
}
@@ -1208,8 +1245,9 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
this->addPoolNinjaVariable("JOB_POOL_COMPILE", this->GetGeneratorTarget(),
vars);
- if (!pchSource.empty() && !source->GetProperty("SKIP_PRECOMPILE_HEADERS")) {
- if (source->GetFullPath() == pchSource) {
+ if (!pchSources.empty() && !source->GetProperty("SKIP_PRECOMPILE_HEADERS")) {
+ auto pchIt = pchSources.find(source->GetFullPath());
+ if (pchIt != pchSources.end()) {
this->addPoolNinjaVariable("JOB_POOL_PRECOMPILE_HEADER",
this->GetGeneratorTarget(), vars);
}
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index dddba0a..a5af810 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -1670,6 +1670,13 @@ cmQtAutoGenInitializer::GetQtVersion(cmGeneratorTarget const* target)
}
return 0u;
};
+ auto toUInt2 = [](cmProp input) -> unsigned int {
+ unsigned long tmp = 0;
+ if (input != nullptr && cmStrToULong(*input, &tmp)) {
+ return static_cast<unsigned int>(tmp);
+ }
+ return 0u;
+ };
// Initialize return value to a default
std::pair<IntegerVersion, unsigned int> res(
@@ -1691,9 +1698,9 @@ cmQtAutoGenInitializer::GetQtVersion(cmGeneratorTarget const* target)
knownQtVersions.reserve(keys.size() * 2);
// Adds a version to the result (nullptr safe)
- auto addVersion = [&knownQtVersions, &toUInt](const char* major,
- const char* minor) {
- cmQtAutoGen::IntegerVersion ver(toUInt(major), toUInt(minor));
+ auto addVersion = [&knownQtVersions, &toUInt2](cmProp major,
+ cmProp minor) {
+ cmQtAutoGen::IntegerVersion ver(toUInt2(major), toUInt2(minor));
if (ver.Major != 0) {
knownQtVersions.emplace_back(ver);
}
@@ -1701,8 +1708,8 @@ cmQtAutoGenInitializer::GetQtVersion(cmGeneratorTarget const* target)
// Read versions from variables
for (auto const& keyPair : keys) {
- addVersion(target->Makefile->GetDefinition(std::string(keyPair.first)),
- target->Makefile->GetDefinition(std::string(keyPair.second)));
+ addVersion(target->Makefile->GetDef(std::string(keyPair.first)),
+ target->Makefile->GetDef(std::string(keyPair.second)));
}
// Read versions from directory properties
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 5dc8b05..ad59cd6 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -367,7 +367,9 @@ const char* cmSourceFile::GetProperty(const std::string& prop) const
const bool chain =
mf->GetState()->IsPropertyChained(prop, cmProperty::SOURCE_FILE);
if (chain) {
- return mf->GetProperty(prop, chain);
+ if (cmProp p = mf->GetProperty(prop, chain)) {
+ return p->c_str();
+ }
}
return nullptr;
}
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index 56c441a..a26bef3 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -39,7 +39,9 @@ const char* cmTest::GetProperty(const std::string& prop) const
const bool chain =
this->Makefile->GetState()->IsPropertyChained(prop, cmProperty::TEST);
if (chain) {
- return this->Makefile->GetProperty(prop, chain);
+ if (cmProp p = this->Makefile->GetProperty(prop, chain)) {
+ return p->c_str();
+ }
}
return nullptr;
}
diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index 35b9a1d..ecae16d 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -42,7 +42,7 @@ void cmVariableWatchCommandVariableAccessed(const std::string& variable,
/// Ultra bad!!
cmMakefile* makefile = const_cast<cmMakefile*>(mf);
- std::string stack = makefile->GetProperty("LISTFILE_STACK");
+ std::string stack = *mf->GetProperty("LISTFILE_STACK");
if (!data->Command.empty()) {
cmListFileFunction newLFF;
const char* const currentListFile =
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 96543e5..ec7fe96 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -3409,9 +3409,8 @@ void cmVisualStudio10TargetGenerator::WriteLibOptions(
this->GeneratorTarget->GetLinkClosure(config)->LinkerLanguage;
std::string libflags;
- this->LocalGenerator->GetStaticLibraryFlags(
- libflags, cmSystemTools::UpperCase(config), linkLanguage,
- this->GeneratorTarget);
+ this->LocalGenerator->GetStaticLibraryFlags(libflags, config, linkLanguage,
+ this->GeneratorTarget);
if (!libflags.empty()) {
Elem e2(e1, "Lib");
cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator;
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index 670e8dc..aa38aec 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -328,7 +328,14 @@ static bool CheckFileOperations()
}
// While we're at it, check proper TestFileAccess functionality.
- if (kwsys::SystemTools::TestFileAccess(testNewFile,
+ bool do_write_test = true;
+#if defined(__linux__)
+ // If we are running as root on linux ignore this check, as
+ // root can always write to files
+ do_write_test = (getuid() != 0);
+#endif
+ if (do_write_test &&
+ kwsys::SystemTools::TestFileAccess(testNewFile,
kwsys::TEST_FILE_WRITE)) {
std::cerr
<< "TestFileAccess incorrectly indicated that this is a writable file:"
diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt
index 450e7e5..c8850ea 100644
--- a/Tests/ExternalProject/CMakeLists.txt
+++ b/Tests/ExternalProject/CMakeLists.txt
@@ -100,6 +100,15 @@ ExternalProject_Add(${proj}
INSTALL_COMMAND ""
)
+set(proj NoExtractBool)
+ExternalProject_Add(${proj}
+ URL ${CMAKE_CURRENT_SOURCE_DIR}/gitrepo.tgz
+ DOWNLOAD_NO_EXTRACT 0
+ LOG_DOWNLOAD 1
+ BUILD_COMMAND ""
+ CONFIGURE_COMMAND ""
+ INSTALL_COMMAND ""
+)
# CVS-based tests:
#
diff --git a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
index 3f684fc..381b800 100644
--- a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
@@ -4,12 +4,9 @@ include(RunCMake)
function(run_test name)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build)
run_cmake(${name})
- # Precompiled headers are not supported with multiple architectures.
- if(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]")
- set(RunCMake_TEST_NO_CLEAN 1)
- run_cmake_command(${name}-build ${CMAKE_COMMAND} --build . --config Debug)
- run_cmake_command(${name}-test ${CMAKE_CTEST_COMMAND} -C Debug)
- endif()
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(${name}-build ${CMAKE_COMMAND} --build . --config Debug)
+ run_cmake_command(${name}-test ${CMAKE_CTEST_COMMAND} -C Debug)
endfunction()
run_cmake(DisabledPch)
diff --git a/Utilities/Release/linux/x86_64/Dockerfile b/Utilities/Release/linux/x86_64/Dockerfile
index 1ba753c..41391d2 100644
--- a/Utilities/Release/linux/x86_64/Dockerfile
+++ b/Utilities/Release/linux/x86_64/Dockerfile
@@ -5,8 +5,8 @@
# Build using the CMake source directory as the build context.
# The resulting image will have an '/out' directory containing the package.
-ARG FROM_IMAGE_NAME=kitware/cmake:build-linux-x86_64-deps-2019-08-09
-ARG FROM_IMAGE_DIGEST=@sha256:630c320b26a67fc584e0bc98314f1fb0cb0abc764348bb2613ef07437f7101f9
+ARG FROM_IMAGE_NAME=kitware/cmake:build-linux-x86_64-deps-2020-04-02
+ARG FROM_IMAGE_DIGEST=@sha256:77e9ab183f34680990db9da5945473e288f0d6556bce79ecc1589670d656e157
ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST
FROM $FROM_IMAGE
diff --git a/Utilities/Release/linux/x86_64/deps/Dockerfile b/Utilities/Release/linux/x86_64/deps/Dockerfile
index db5551c..7864aac 100644
--- a/Utilities/Release/linux/x86_64/deps/Dockerfile
+++ b/Utilities/Release/linux/x86_64/deps/Dockerfile
@@ -129,10 +129,10 @@ COPY openssl-source.patch /opt/openssl/src/
RUN : \
&& mkdir -p /opt/openssl/src \
&& cd /opt/openssl/src \
- && curl -O https://www.openssl.org/source/openssl-1.1.1c.tar.gz \
- && sha512sum openssl-1.1.1c.tar.gz | grep -q 8e2c5cc11c120efbb7d7850980cb6eaa782d29b4996b3f3378d37613c1679f852d7cc08a90d62e78fcec3439f06bdbee70064579a8c2adaffd91532a97f646ff \
- && tar xzf openssl-1.1.1c.tar.gz \
- && cd openssl-1.1.1c \
+ && curl -O https://www.openssl.org/source/openssl-1.1.1f.tar.gz \
+ && sha512sum openssl-1.1.1f.tar.gz | grep -q b00bd9b5ad5298fbceeec6bb19c1ab0c106ca5cfb31178497c58bf7e0e0cf30fcc19c20f84e23af31cc126bf2447d3e4f8461db97bafa7bd78f69561932f000c \
+ && tar xzf openssl-1.1.1f.tar.gz \
+ && cd openssl-1.1.1f \
&& patch -p1 -i ../openssl-source.patch \
&& source /opt/rh/devtoolset-6/enable \
&& ./Configure --prefix=/opt/openssl linux-elf no-asm no-shared -D_POSIX_C_SOURCE=199506L -D_POSIX_SOURCE=1 -D_SVID_SOURCE=1 -D_BSD_SOURCE=1 \