diff options
Diffstat (limited to 'Source')
35 files changed, 361 insertions, 122 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0d7701c..1dced9a 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 18) -set(CMake_VERSION_PATCH 20200716) +set(CMake_VERSION_PATCH 20200728) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CursesDialog/form/frm_driver.c b/Source/CursesDialog/form/frm_driver.c index e4e72aa..112ab08 100644 --- a/Source/CursesDialog/form/frm_driver.c +++ b/Source/CursesDialog/form/frm_driver.c @@ -2983,7 +2983,7 @@ INLINE static FIELD *Right_Neighbour_Field(FIELD * field) | Function : static FIELD *Upper_Neighbour_Field(FIELD * field) | | Description : Because of the row-major nature of sorting the fields, -| its more difficult to define whats the upper neighbour +| its more difficult to define what's the upper neighbour | field really means. We define that it must be on a | 'previous' line (cyclic order!) and is the rightmost | field laying on the left side of the given field. If @@ -3030,7 +3030,7 @@ static FIELD *Upper_Neighbour_Field(FIELD * field) | Function : static FIELD *Down_Neighbour_Field(FIELD * field) | | Description : Because of the row-major nature of sorting the fields, -| its more difficult to define whats the down neighbour +| its more difficult to define what's the down neighbour | field really means. We define that it must be on a | 'next' line (cyclic order!) and is the leftmost | field laying on the right side of the given field. If diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 659a512..3bf4409 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -220,8 +220,9 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props) #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) QSet<QCMakeProperty> oldProps = this->properties().toSet(); #else - QSet<QCMakeProperty> oldProps = QSet<QCMakeProperty>( - this->properties().begin(), this->properties().end()); + QCMakePropertyList const& oldPropsList = this->properties(); + QSet<QCMakeProperty> oldProps = + QSet<QCMakeProperty>(oldPropsList.begin(), oldPropsList.end()); #endif oldProps.intersect(newProps); newProps.subtract(oldProps); diff --git a/Source/cmCMakeLanguageCommand.h b/Source/cmCMakeLanguageCommand.h index 7306515..aeb8f60 100644 --- a/Source/cmCMakeLanguageCommand.h +++ b/Source/cmCMakeLanguageCommand.h @@ -11,7 +11,7 @@ class cmExecutionStatus; struct cmListFileArgument; /** - * \brief Calls a scripted or build-in command + * \brief Calls a scripted or built-in command * */ bool cmCMakeLanguageCommand(std::vector<cmListFileArgument> const& args, diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index e9bf5a5..607b948 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -253,13 +253,13 @@ cmComputeLinkDepends::Compute() // Compute the final set of link entries. // Iterate in reverse order so we can keep only the last occurrence // of a shared library. - std::set<int> emmitted; + std::set<int> emitted; for (int i : cmReverseRange(this->FinalLinkOrder)) { LinkEntry const& e = this->EntryList[i]; cmGeneratorTarget const* t = e.Target; // Entries that we know the linker will re-use do not need to be repeated. bool uniquify = t && t->GetType() == cmStateEnums::SHARED_LIBRARY; - if (!uniquify || emmitted.insert(i).second) { + if (!uniquify || emitted.insert(i).second) { this->FinalLinkEntries.push_back(e); } } diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index be22ad4..511168b 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -95,7 +95,7 @@ struct Tree std::string path; // only one component of the path std::vector<Tree> folders; std::set<std::string> files; - void InsertPath(const std::vector<std::string>& splitted, + void InsertPath(const std::vector<std::string>& split, std::vector<std::string>::size_type start, const std::string& fileName); void BuildVirtualFolder(cmXMLWriter& xml) const; @@ -106,34 +106,34 @@ struct Tree const std::string& fsPath) const; }; -void Tree::InsertPath(const std::vector<std::string>& splitted, +void Tree::InsertPath(const std::vector<std::string>& split, std::vector<std::string>::size_type start, const std::string& fileName) { - if (start == splitted.size()) { + if (start == split.size()) { files.insert(fileName); return; } for (Tree& folder : folders) { - if (folder.path == splitted[start]) { - if (start + 1 < splitted.size()) { - folder.InsertPath(splitted, start + 1, fileName); + if (folder.path == split[start]) { + if (start + 1 < split.size()) { + folder.InsertPath(split, start + 1, fileName); return; } - // last part of splitted + // last part of split folder.files.insert(fileName); return; } } // Not found in folders, thus insert Tree newFolder; - newFolder.path = splitted[start]; - if (start + 1 < splitted.size()) { - newFolder.InsertPath(splitted, start + 1, fileName); + newFolder.path = split[start]; + if (start + 1 < split.size()) { + newFolder.InsertPath(split, start + 1, fileName); folders.push_back(newFolder); return; } - // last part of splitted + // last part of split newFolder.files.insert(fileName); folders.push_back(newFolder); } @@ -224,11 +224,11 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( const std::string& relative = cmSystemTools::RelativePath( it.second[0]->GetSourceDirectory(), listFile); - std::vector<std::string> splitted; - cmSystemTools::SplitPath(relative, splitted, false); + std::vector<std::string> split; + cmSystemTools::SplitPath(relative, split, false); // Split filename from path - std::string fileName = *(splitted.end() - 1); - splitted.erase(splitted.end() - 1, splitted.end()); + std::string fileName = *(split.end() - 1); + split.erase(split.end() - 1, split.end()); // We don't want paths with CMakeFiles in them // or do we? @@ -238,10 +238,10 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( // CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES variable. const bool excludeExternal = it.second[0]->GetMakefile()->IsOn( "CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES"); - if (!splitted.empty() && + if (!split.empty() && (!excludeExternal || (relative.find("..") == std::string::npos)) && relative.find("CMakeFiles") == std::string::npos) { - tree.InsertPath(splitted, 1, fileName); + tree.InsertPath(split, 1, fileName); } } } diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 7bc4536..b6c0a7a 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -604,7 +604,7 @@ void cmExtraEclipseCDT4Generator::AppendIncludeDirectories( void cmExtraEclipseCDT4Generator::CreateCProjectFile() const { - std::set<std::string> emmited; + std::set<std::string> emitted; const auto& lg = this->GlobalGenerator->GetLocalGenerators()[0]; const cmMakefile* mf = lg->GetMakefile(); @@ -751,7 +751,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const xml.EndElement(); // add pre-processor definitions to allow eclipse to gray out sections - emmited.clear(); + emitted.clear(); for (const auto& lgen : this->GlobalGenerator->GetLocalGenerators()) { if (cmProp cdefs = @@ -780,8 +780,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const } // insert the definition if not already added. - if (emmited.find(def) == emmited.end()) { - emmited.insert(def); + if (emitted.find(def) == emitted.end()) { + emitted.insert(def); xml.StartElement("pathentry"); xml.Attribute("kind", "mac"); xml.Attribute("name", def); @@ -812,8 +812,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const } // insert the definition if not already added. - if (emmited.find(def) == emmited.end()) { - emmited.insert(def); + if (emitted.find(def) == emitted.end()) { + emitted.insert(def); xml.StartElement("pathentry"); xml.Attribute("kind", "mac"); xml.Attribute("name", def); @@ -844,8 +844,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const } // insert the definition if not already added. - if (emmited.find(def) == emmited.end()) { - emmited.insert(def); + if (emitted.find(def) == emitted.end()) { + emitted.insert(def); xml.StartElement("pathentry"); xml.Attribute("kind", "mac"); xml.Attribute("name", def); @@ -858,7 +858,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const } // include dirs - emmited.clear(); + emitted.clear(); for (const auto& lgen : this->GlobalGenerator->GetLocalGenerators()) { const auto& targets = lgen->GetGeneratorTargets(); for (const auto& target : targets) { @@ -868,7 +868,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const std::vector<std::string> includeDirs; std::string config = mf->GetSafeDefinition("CMAKE_BUILD_TYPE"); lgen->GetIncludeDirectories(includeDirs, target.get(), "C", config); - this->AppendIncludeDirectories(xml, includeDirs, emmited); + this->AppendIncludeDirectories(xml, includeDirs, emitted); } } // now also the system include directories, in case we found them in @@ -879,14 +879,14 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const std::string systemIncludeDirs = mf->GetSafeDefinition("CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS"); std::vector<std::string> dirs = cmExpandedList(systemIncludeDirs); - this->AppendIncludeDirectories(xml, dirs, emmited); + this->AppendIncludeDirectories(xml, dirs, emitted); } compiler = mf->GetSafeDefinition("CMAKE_CXX_COMPILER"); if (this->CXXEnabled && !compiler.empty()) { std::string systemIncludeDirs = mf->GetSafeDefinition("CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS"); std::vector<std::string> dirs = cmExpandedList(systemIncludeDirs); - this->AppendIncludeDirectories(xml, dirs, emmited); + this->AppendIncludeDirectories(xml, dirs, emitted); } xml.EndElement(); // storageModule @@ -895,7 +895,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const xml.StartElement("storageModule"); xml.Attribute("moduleId", "org.eclipse.cdt.make.core.buildtargets"); xml.StartElement("buildTargets"); - emmited.clear(); + emitted.clear(); const std::string& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); const std::string& makeArgs = mf->GetSafeDefinition("CMAKE_ECLIPSE_MAKE_ARGUMENTS"); diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index a1a0ae8..fdc8f29 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1476,8 +1476,9 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode } if (isInterfaceProperty) { - return target->EvaluateInterfaceProperty(propertyName, context, - dagCheckerParent); + return cmGeneratorExpression::StripEmptyListElements( + target->EvaluateInterfaceProperty(propertyName, context, + dagCheckerParent)); } cmGeneratorExpressionDAGChecker dagChecker( @@ -1563,8 +1564,9 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode } if (!interfacePropertyName.empty()) { - result = this->EvaluateDependentExpression(result, context->LG, context, - target, &dagChecker, target); + result = cmGeneratorExpression::StripEmptyListElements( + this->EvaluateDependentExpression(result, context->LG, context, target, + &dagChecker, target)); std::string linkedTargetsContent = getLinkedTargetsContent( target, interfacePropertyName, context, &dagChecker); if (!linkedTargetsContent.empty()) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 72dc80b..b10ce89 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1365,6 +1365,9 @@ void AddSwiftImplicitIncludeDirectories( for (const cmLinkImplItem& library : libraries->Libraries) { if (const cmGeneratorTarget* dependency = library.Target) { + if (dependency->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + continue; + } if (cm::contains(dependency->GetAllConfigCompileLanguages(), "Swift")) { EvaluatedTargetPropertyEntry entry{ library, library.Backtrace }; @@ -3161,7 +3164,7 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(std::string& flags) const } else { this->Makefile->IssueMessage( MessageType::FATAL_ERROR, - "Uknown CUDA architecture specifier \"" + std::string(specifier) + + "Unknown CUDA architecture specifier \"" + std::string(specifier) + "\"."); } } @@ -3877,7 +3880,7 @@ std::string cmGeneratorTarget::GetPchSource(const std::string& config, cmStrCat(generatorTarget->LocalGenerator->GetCurrentBinaryDirectory(), "/CMakeFiles/", generatorTarget->GetName(), ".dir/cmake_pch"); - // For GCC the source extension will be tranformed into .h[xx].gch + // For GCC the source extension will be transformed into .h[xx].gch if (!this->Makefile->IsOn("CMAKE_LINK_PCH")) { const std::map<std::string, std::string> languageToExtension = { { "C", ".h.c" }, diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index f03ca44..5f26387 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -43,7 +43,7 @@ private: void SetCompilerFlags(std::string const& config, const std::string& language); - std::string GetDefines(const std::string& langugae, + std::string GetDefines(const std::string& language, std::string const& config); void WriteIncludes(std::ostream& fout, const std::string& config, diff --git a/Source/cmGlobalCommonGenerator.cxx b/Source/cmGlobalCommonGenerator.cxx index 9dc86f4..5eff3b8 100644 --- a/Source/cmGlobalCommonGenerator.cxx +++ b/Source/cmGlobalCommonGenerator.cxx @@ -5,8 +5,12 @@ #include <memory> #include <utility> +#include <cmext/algorithm> + +#include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" #include "cmLocalGenerator.h" +#include "cmMakefile.h" #include "cmProperty.h" #include "cmStateDirectory.h" #include "cmStateSnapshot.h" @@ -31,6 +35,8 @@ cmGlobalCommonGenerator::ComputeDirectoryTargets() const lg->GetStateSnapshot().GetDirectory().GetCurrentBinary()); DirectoryTarget& dirTarget = dirTargets[currentBinaryDir]; dirTarget.LG = lg.get(); + const std::vector<std::string>& configs = + lg->GetMakefile()->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig); // The directory-level rule should depend on the target-level rules // for all targets in the directory. @@ -46,11 +52,18 @@ cmGlobalCommonGenerator::ComputeDirectoryTargets() const } DirectoryTarget::Target t; t.GT = gt.get(); - if (cmProp exclude = gt->GetProperty("EXCLUDE_FROM_ALL")) { - if (cmIsOn(*exclude)) { - // This target has been explicitly excluded. - t.ExcludeFromAll = true; - } else { + const std::string EXCLUDE_FROM_ALL("EXCLUDE_FROM_ALL"); + if (cmProp exclude = gt->GetProperty(EXCLUDE_FROM_ALL)) { + for (const std::string& config : configs) { + cmGeneratorExpressionInterpreter genexInterpreter(lg.get(), config, + gt.get()); + if (cmIsOn(genexInterpreter.Evaluate(*exclude, EXCLUDE_FROM_ALL))) { + // This target has been explicitly excluded. + t.ExcludedFromAllInConfigs.push_back(config); + } + } + + if (t.ExcludedFromAllInConfigs.empty()) { // This target has been explicitly un-excluded. The directory-level // rule for every directory between this and the root should depend // on the target-level rule for this target. @@ -78,3 +91,12 @@ cmGlobalCommonGenerator::ComputeDirectoryTargets() const return dirTargets; } + +bool cmGlobalCommonGenerator::IsExcludedFromAllInConfig( + const DirectoryTarget::Target& t, const std::string& config) +{ + if (this->IsMultiConfig()) { + return cm::contains(t.ExcludedFromAllInConfigs, config); + } + return !t.ExcludedFromAllInConfigs.empty(); +} diff --git a/Source/cmGlobalCommonGenerator.h b/Source/cmGlobalCommonGenerator.h index 7d16dac..f97b5f4 100644 --- a/Source/cmGlobalCommonGenerator.h +++ b/Source/cmGlobalCommonGenerator.h @@ -30,7 +30,7 @@ public: struct Target { cmGeneratorTarget const* GT = nullptr; - bool ExcludeFromAll = false; + std::vector<std::string> ExcludedFromAllInConfigs; }; std::vector<Target> Targets; struct Dir @@ -41,6 +41,8 @@ public: std::vector<Dir> Children; }; std::map<std::string, DirectoryTarget> ComputeDirectoryTargets() const; + bool IsExcludedFromAllInConfig(const DirectoryTarget::Target& t, + const std::string& config); }; #endif diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 49b73a8..17c7e99 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -309,17 +309,7 @@ bool cmGlobalGenerator::CheckTargetsForMissingSources() const continue; } - std::vector<std::string> configs = - target->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig); - std::vector<cmSourceFile*> srcs; - for (std::string const& config : configs) { - target->GetSourceFiles(srcs, config); - if (!srcs.empty()) { - break; - } - } - - if (srcs.empty()) { + if (target->GetAllConfigSources().empty()) { std::ostringstream e; e << "No SOURCES given to target: " << target->GetName(); this->GetCMakeInstance()->IssueMessage( @@ -2173,13 +2163,38 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, } bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, - cmGeneratorTarget* target) const + const cmGeneratorTarget* target) const { if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { return true; } - if (cmProp exclude = target->GetProperty("EXCLUDE_FROM_ALL")) { - return cmIsOn(*exclude); + cmMakefile* mf = root->GetMakefile(); + const std::string EXCLUDE_FROM_ALL = "EXCLUDE_FROM_ALL"; + if (cmProp exclude = target->GetProperty(EXCLUDE_FROM_ALL)) { + // Expand the property value per configuration. + unsigned int trueCount = 0; + unsigned int falseCount = 0; + const std::vector<std::string>& configs = + mf->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig); + for (const std::string& config : configs) { + cmGeneratorExpressionInterpreter genexInterpreter(root, config, target); + if (cmIsOn(genexInterpreter.Evaluate(*exclude, EXCLUDE_FROM_ALL))) { + ++trueCount; + } else { + ++falseCount; + } + } + + // Check whether the genex expansion of the property agrees in all + // configurations. + if (trueCount && falseCount) { + std::ostringstream e; + e << "The EXCLUDE_FROM_ALL property of target \"" << target->GetName() + << "\" varies by configuration. This is not supported by the \"" + << root->GetGlobalGenerator()->GetName() << "\" generator."; + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + } + return trueCount; } // This target is included in its directory. Check whether the // directory is excluded. diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 57c7808..c2c80c2 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -542,7 +542,8 @@ protected: bool IsExcluded(cmStateSnapshot const& root, cmStateSnapshot const& snp) const; bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const; - bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) const; + bool IsExcluded(cmLocalGenerator* root, + const cmGeneratorTarget* target) const; virtual void InitializeProgressMarks() {} struct GlobalTargetInfo diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h index 3709365..13cfe4d 100644 --- a/Source/cmGlobalGeneratorFactory.h +++ b/Source/cmGlobalGeneratorFactory.h @@ -44,7 +44,7 @@ public: /** Get the list of supported platforms name for this generator */ virtual std::vector<std::string> GetKnownPlatforms() const = 0; - /** If the generator suports platforms, get its default. */ + /** If the generator supports platforms, get its default. */ virtual std::string GetDefaultPlatformName() const = 0; }; diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 2fcba9a..1664dd0 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -470,7 +470,7 @@ void cmGlobalGhsMultiGenerator::WriteAllTarget( if (t->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } - if (!cmIsOn(t->GetProperty("EXCLUDE_FROM_ALL"))) { + if (!IsExcluded(t->GetLocalGenerator(), t)) { defaultTargets.push_back(t); } } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 48eb405..b52dd28 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1189,7 +1189,7 @@ void cmGlobalNinjaGenerator::AppendTargetDependsClosure( // finally generate the outputs of the target itself, if applicable cmNinjaDeps outs; if (!omit_self) { - this->AppendTargetOutputs(target, outs, config); + this->AppendTargetOutputs(target, outs, config, DependOnTargetArtifact); } outputs.insert(outs.begin(), outs.end()); } @@ -1201,7 +1201,7 @@ void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias, std::string outputPath = this->NinjaOutputPath(alias); std::string buildAlias = this->BuildAlias(outputPath, config); cmNinjaDeps outputs; - this->AppendTargetOutputs(target, outputs, config); + this->AppendTargetOutputs(target, outputs, config, DependOnTargetArtifact); // Mark the target's outputs as ambiguous to ensure that no other target // uses the output as an alias. for (std::string const& output : outputs) { @@ -1267,11 +1267,12 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os) if (ta.second.Config == "all") { for (auto const& config : this->CrossConfigs) { this->AppendTargetOutputs(ta.second.GeneratorTarget, - build.ExplicitDeps, config); + build.ExplicitDeps, config, + DependOnTargetArtifact); } } else { this->AppendTargetOutputs(ta.second.GeneratorTarget, build.ExplicitDeps, - ta.second.Config); + ta.second.Config, DependOnTargetArtifact); } this->WriteBuild(this->EnableCrossConfigBuild() && (ta.second.Config == "all" || @@ -1299,7 +1300,8 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os) build.Outputs.front() = ta.first; build.ExplicitDeps.clear(); this->AppendTargetOutputs(ta.second.GeneratorTarget, - build.ExplicitDeps, config); + build.ExplicitDeps, config, + DependOnTargetArtifact); this->WriteBuild(*this->GetConfigFileStream(config), build); } } @@ -1321,7 +1323,8 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os) build.ExplicitDeps.clear(); for (auto const& config : this->DefaultConfigs) { this->AppendTargetOutputs(ta.second.GeneratorTarget, - build.ExplicitDeps, config); + build.ExplicitDeps, config, + DependOnTargetArtifact); } this->WriteBuild(*this->GetDefaultFileStream(), build); } @@ -1357,8 +1360,9 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os) build.Outputs.front() = this->BuildAlias(buildDirAllTarget, config); configDeps.emplace_back(build.Outputs.front()); for (DirectoryTarget::Target const& t : dt.Targets) { - if (!t.ExcludeFromAll) { - this->AppendTargetOutputs(t.GT, build.ExplicitDeps, config); + if (!IsExcludedFromAllInConfig(t, config)) { + this->AppendTargetOutputs(t.GT, build.ExplicitDeps, config, + DependOnTargetArtifact); } } for (DirectoryTarget::Dir const& d : dt.Children) { diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 44e632f..10f5cf6 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -318,14 +318,13 @@ public: virtual std::string OrderDependsTargetForTarget( cmGeneratorTarget const* target, const std::string& config) const; - void AppendTargetOutputs( - cmGeneratorTarget const* target, cmNinjaDeps& outputs, - const std::string& config, - cmNinjaTargetDepends depends = DependOnTargetArtifact); - void AppendTargetDepends( - cmGeneratorTarget const* target, cmNinjaDeps& outputs, - const std::string& config, const std::string& fileConfig, - cmNinjaTargetDepends depends = DependOnTargetArtifact); + void AppendTargetOutputs(cmGeneratorTarget const* target, + cmNinjaDeps& outputs, const std::string& config, + cmNinjaTargetDepends depends); + void AppendTargetDepends(cmGeneratorTarget const* target, + cmNinjaDeps& outputs, const std::string& config, + const std::string& fileConfig, + cmNinjaTargetDepends depends); void AppendTargetDependsClosure(cmGeneratorTarget const* target, cmNinjaDeps& outputs, const std::string& config); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index c31983b..1764429 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -143,7 +143,7 @@ void cmGlobalUnixMakefileGenerator3::Generate() total += pmi.second.NumberOfActions; } - // write each target's progress.make this loop is done twice. Bascially the + // write each target's progress.make this loop is done twice. Basically the // Generate pass counts all the actions, the first loop below determines // how many actions have progress updates for each target and writes to // corrrect variable values for everything except the all targets. The @@ -416,7 +416,7 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2( std::vector<std::string> depends; for (DirectoryTarget::Target const& t : dt.Targets) { // Add this to the list of depends rules in this directory. - if ((!check_all || !t.ExcludeFromAll) && + if ((!check_all || t.ExcludedFromAllInConfigs.empty()) && (!check_relink || t.GT->NeedRelinkBeforeInstall(lg->GetConfigName()))) { // The target may be from a different directory; use its local gen. @@ -846,7 +846,7 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks() cmLocalGenerator* tlg = gt->GetLocalGenerator(); if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY || - gt->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { + IsExcluded(lg.get(), gt.get())) { continue; } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 2d47d2c..f632257 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -12,6 +12,7 @@ #include <cm/memory> #include <cmext/algorithm> +#include <cmext/string_view> #include "cmsys/RegularExpression.hxx" @@ -272,6 +273,13 @@ std::string cmGlobalXCodeGenerator::FindXcodeBuildCommand() return makeProgram; } +bool cmGlobalXCodeGenerator::SetSystemName(std::string const& s, + cmMakefile* mf) +{ + this->SystemName = s; + return this->cmGlobalGenerator::SetSystemName(s, mf); +} + bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts, bool build, cmMakefile* mf) { @@ -3375,6 +3383,14 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( if (archs.empty()) { // Tell Xcode to use NATIVE_ARCH instead of ARCHS. buildSettings->AddAttribute("ONLY_ACTIVE_ARCH", this->CreateString("YES")); + // When targeting macOS, use only the host architecture. + if (this->SystemName == "Darwin"_s && + (!sysroot || !*sysroot || + cmSystemTools::LowerCase(sysroot).find("macos") != + std::string::npos)) { + buildSettings->AddAttribute("ARCHS", + this->CreateString("$(NATIVE_ARCH_ACTUAL)")); + } } else { // Tell Xcode to use ARCHS (ONLY_ACTIVE_ARCH defaults to NO). buildSettings->AddAttribute("ARCHS", this->CreateString(archs)); @@ -3406,6 +3422,12 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( std::string symroot = cmStrCat(root->GetCurrentBinaryDirectory(), "/build"); buildSettings->AddAttribute("SYMROOT", this->CreateString(symroot)); + // Inside a try_compile project, do not require signing on any platform. + if (this->CMakeInstance->GetIsInTryCompile()) { + buildSettings->AddAttribute("CODE_SIGNING_ALLOWED", + this->CreateString("NO")); + } + for (auto& config : configs) { cmXCodeObject* buildSettingsForCfg = this->CreateFlatClone(buildSettings); @@ -3474,7 +3496,8 @@ void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf) } if (this->Architectures.empty()) { - // With no ARCHS we use ONLY_ACTIVE_ARCH. + // With no ARCHS we use ONLY_ACTIVE_ARCH and possibly a + // platform-specific default ARCHS placeholder value. // Look up the arch that Xcode chooses in this case. if (const char* arch = mf->GetDefinition("CMAKE_XCODE_ARCHS")) { this->ObjectDirArchDefault = arch; @@ -3730,6 +3753,8 @@ void cmGlobalXCodeGenerator::OutputXCodeWorkspaceSettings( if (this->XcodeVersion >= 100) { xout.Element("key", "BuildSystemType"); xout.Element("string", "Original"); + xout.Element("key", "DisableBuildSystemDeprecationWarning"); + xout.Element("true"); } if (hasGeneratedSchemes) { xout.Element("key", diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 276a9ee..7018de7 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -109,6 +109,7 @@ public: bool ShouldStripResourcePath(cmMakefile*) const override; + bool SetSystemName(std::string const& s, cmMakefile* mf) override; bool SetGeneratorToolset(std::string const& ts, bool build, cmMakefile* mf) override; void AppendFlag(std::string& flags, std::string const& flag) const; @@ -301,6 +302,7 @@ private: std::vector<std::string> Architectures; std::string ObjectDirArchDefault; std::string ObjectDirArch; + std::string SystemName; std::string GeneratorToolset; std::map<cmGeneratorTarget const*, size_t> TargetOrderIndex; std::vector<std::string> EnabledLangs; diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 0fcda4e..c23156d 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -67,6 +67,36 @@ const char* getShapeForTarget(const cmLinkItem& item) return GRAPHVIZ_NODE_SHAPE_LIBRARY_UNKNOWN; } } + +struct DependeesDir +{ + template <typename T> + static const cmLinkItem& src(const T& con) + { + return con.src; + } + + template <typename T> + static const cmLinkItem& dst(const T& con) + { + return con.dst; + } +}; + +struct DependersDir +{ + template <typename T> + static const cmLinkItem& src(const T& con) + { + return con.dst; + } + + template <typename T> + static const cmLinkItem& dst(const T& con) + { + return con.src; + } +}; } cmGraphVizWriter::cmGraphVizWriter(std::string const& fileName, @@ -173,18 +203,16 @@ void cmGraphVizWriter::VisitLink(cmLinkItem const& depender, return; } + // write global data directly this->WriteConnection(this->GlobalFileStream, depender, dependee, scopeType); if (this->GeneratePerTarget) { - auto fileStream = PerTargetFileStreams[depender.AsStr()].get(); - this->WriteNode(*fileStream, dependee); - this->WriteConnection(*fileStream, depender, dependee, scopeType); + PerTargetConnections[depender].emplace_back(depender, dependee, scopeType); } if (this->GenerateDependers) { - auto fileStream = TargetDependersFileStreams[dependee.AsStr()].get(); - this->WriteNode(*fileStream, depender); - this->WriteConnection(*fileStream, depender, dependee, scopeType); + TargetDependersConnections[dependee].emplace_back(dependee, depender, + scopeType); } } @@ -288,10 +316,86 @@ void cmGraphVizWriter::Write() } } + // write global data and collect all connection data for per target graphs for (auto const gt : sortedGeneratorTargets) { auto item = cmLinkItem(gt, false, gt->GetBacktrace()); this->VisitItem(item); } + + if (this->GeneratePerTarget) { + WritePerTargetConnections<DependeesDir>(PerTargetConnections, + PerTargetFileStreams); + } + + if (this->GenerateDependers) { + WritePerTargetConnections<DependersDir>(TargetDependersConnections, + TargetDependersFileStreams); + } +} + +void cmGraphVizWriter::FindAllConnections(const ConnectionsMap& connectionMap, + const cmLinkItem& rootItem, + Connections& extendedCons, + std::set<cmLinkItem>& visitedItems) +{ + // some "targets" are not in map, e.g. linker flags as -lm or + // targets without dependency. + // in both cases we are finished with traversing the graph + if (connectionMap.find(rootItem) == connectionMap.cend()) { + return; + } + + const Connections& origCons = connectionMap.at(rootItem); + + for (const Connection& con : origCons) { + extendedCons.emplace_back(con); + const cmLinkItem& dstItem = con.dst; + bool const visited = visitedItems.find(dstItem) != visitedItems.cend(); + if (!visited) { + visitedItems.insert(dstItem); + FindAllConnections(connectionMap, dstItem, extendedCons, visitedItems); + } + } +} + +void cmGraphVizWriter::FindAllConnections(const ConnectionsMap& connectionMap, + const cmLinkItem& rootItem, + Connections& extendedCons) +{ + std::set<cmLinkItem> visitedItems = { rootItem }; + FindAllConnections(connectionMap, rootItem, extendedCons, visitedItems); +} + +template <typename DirFunc> +void cmGraphVizWriter::WritePerTargetConnections( + const ConnectionsMap& connections, const FileStreamMap& streams) +{ + // the per target connections must be extended by indirect dependencies + ConnectionsMap extendedConnections; + for (auto const& conPerTarget : connections) { + const cmLinkItem& rootItem = conPerTarget.first; + Connections& extendedCons = extendedConnections[conPerTarget.first]; + FindAllConnections(connections, rootItem, extendedCons); + } + + for (auto const& conPerTarget : extendedConnections) { + const cmLinkItem& rootItem = conPerTarget.first; + + // some of the nodes are excluded completely and are not written + if (this->ItemExcluded(rootItem)) { + continue; + } + + const Connections& cons = conPerTarget.second; + auto fileStream = streams.at(rootItem.AsStr()).get(); + + for (const Connection& con : cons) { + const cmLinkItem& src = DirFunc::src(con); + const cmLinkItem& dst = DirFunc::dst(con); + this->WriteNode(*fileStream, con.dst); + this->WriteConnection(*fileStream, src, dst, con.scopeType); + } + } } void cmGraphVizWriter::WriteHeader(cmGeneratedFileStream& fs, diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h index 578660d..9766068 100644 --- a/Source/cmGraphVizWriter.h +++ b/Source/cmGraphVizWriter.h @@ -7,16 +7,18 @@ #include <map> #include <memory> +#include <set> #include <string> +#include <utility> #include <vector> #include "cmsys/RegularExpression.hxx" #include "cmGeneratedFileStream.h" +#include "cmLinkItem.h" #include "cmLinkItemGraphVisitor.h" #include "cmStateTypes.h" -class cmLinkItem; class cmGlobalGenerator; /** This class implements writing files for graphviz (dot) for graphs @@ -47,6 +49,22 @@ private: using FileStreamMap = std::map<std::string, std::unique_ptr<cmGeneratedFileStream>>; + struct Connection + { + Connection(cmLinkItem s, cmLinkItem d, std::string scope) + : src(std::move(s)) + , dst(std::move(d)) + , scopeType(std::move(scope)) + { + } + + cmLinkItem src; + cmLinkItem dst; + std::string scopeType; + }; + using Connections = std::vector<Connection>; + using ConnectionsMap = std::map<cmLinkItem, Connections>; + void VisitLink(cmLinkItem const& depender, cmLinkItem const& dependee, bool isDirectLink, std::string const& scopeType = ""); @@ -66,6 +84,19 @@ private: cmLinkItem const& dependeeTargetName, std::string const& edgeStyle); + void FindAllConnections(const ConnectionsMap& connectionMap, + const cmLinkItem& rootItem, + Connections& extendedCons, + std::set<cmLinkItem>& visitedItems); + + void FindAllConnections(const ConnectionsMap& connectionMap, + const cmLinkItem& rootItem, + Connections& extendedCons); + + template <typename DirFunc> + void WritePerTargetConnections(const ConnectionsMap& connections, + const FileStreamMap& streams); + bool ItemExcluded(cmLinkItem const& item); bool ItemNameFilteredOut(std::string const& itemName); bool TargetTypeEnabled(cmStateEnums::TargetType targetType) const; @@ -83,6 +114,9 @@ private: FileStreamMap PerTargetFileStreams; FileStreamMap TargetDependersFileStreams; + ConnectionsMap PerTargetConnections; + ConnectionsMap TargetDependersConnections; + std::string GraphName; std::string GraphHeader; std::string GraphNodePrefix; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index fe0d0a7..028053d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1273,7 +1273,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit( } } - // Emit remaining non implicit user direcories. + // Emit remaining non implicit user directories. for (BT<std::string> const& udr : userDirs) { if (notExcluded(udr.Value)) { emitBT(udr); diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index aee7f45..c47a9b2 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -102,9 +102,10 @@ void cmLocalNinjaGenerator::Generate() this->GetGlobalGenerator()->IsMultiConfig()) { cmNinjaBuild phonyAlias("phony"); this->GetGlobalNinjaGenerator()->AppendTargetOutputs( - target.get(), phonyAlias.Outputs, ""); + target.get(), phonyAlias.Outputs, "", DependOnTargetArtifact); this->GetGlobalNinjaGenerator()->AppendTargetOutputs( - target.get(), phonyAlias.ExplicitDeps, config); + target.get(), phonyAlias.ExplicitDeps, config, + DependOnTargetArtifact); this->GetGlobalNinjaGenerator()->WriteBuild( *this->GetGlobalNinjaGenerator()->GetConfigFileStream(config), phonyAlias); @@ -115,11 +116,12 @@ void cmLocalNinjaGenerator::Generate() if (!this->GetGlobalNinjaGenerator()->GetDefaultConfigs().empty()) { cmNinjaBuild phonyAlias("phony"); this->GetGlobalNinjaGenerator()->AppendTargetOutputs( - target.get(), phonyAlias.Outputs, ""); + target.get(), phonyAlias.Outputs, "", DependOnTargetArtifact); for (auto const& config : this->GetGlobalNinjaGenerator()->GetDefaultConfigs()) { this->GetGlobalNinjaGenerator()->AppendTargetOutputs( - target.get(), phonyAlias.ExplicitDeps, config); + target.get(), phonyAlias.ExplicitDeps, config, + DependOnTargetArtifact); } this->GetGlobalNinjaGenerator()->WriteBuild( *this->GetGlobalNinjaGenerator()->GetDefaultFileStream(), @@ -127,10 +129,11 @@ void cmLocalNinjaGenerator::Generate() } cmNinjaBuild phonyAlias("phony"); this->GetGlobalNinjaGenerator()->AppendTargetOutputs( - target.get(), phonyAlias.Outputs, "all"); + target.get(), phonyAlias.Outputs, "all", DependOnTargetArtifact); for (auto const& config : this->GetConfigNames()) { this->GetGlobalNinjaGenerator()->AppendTargetOutputs( - target.get(), phonyAlias.ExplicitDeps, config); + target.get(), phonyAlias.ExplicitDeps, config, + DependOnTargetArtifact); } this->GetGlobalNinjaGenerator()->WriteBuild( *this->GetGlobalNinjaGenerator()->GetDefaultFileStream(), @@ -355,8 +358,8 @@ void cmLocalNinjaGenerator::AppendTargetOutputs(cmGeneratorTarget* target, cmNinjaDeps& outputs, const std::string& config) { - this->GetGlobalNinjaGenerator()->AppendTargetOutputs(target, outputs, - config); + this->GetGlobalNinjaGenerator()->AppendTargetOutputs(target, outputs, config, + DependOnTargetArtifact); } void cmLocalNinjaGenerator::AppendTargetDepends(cmGeneratorTarget* target, diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index ef160e7..73c0cde 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -66,10 +66,10 @@ public: void AppendTargetOutputs(cmGeneratorTarget* target, cmNinjaDeps& outputs, const std::string& config); - void AppendTargetDepends( - cmGeneratorTarget* target, cmNinjaDeps& outputs, const std::string& config, - const std::string& fileConfig, - cmNinjaTargetDepends depends = DependOnTargetArtifact); + void AppendTargetDepends(cmGeneratorTarget* target, cmNinjaDeps& outputs, + const std::string& config, + const std::string& fileConfig, + cmNinjaTargetDepends depends); void AddCustomCommandTarget(cmCustomCommand const* cc, cmGeneratorTarget* target); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 86a888a..df4bf6a 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1744,7 +1744,7 @@ public: return false; } // If it's an absolute path, check if it starts with the source - // direcotory: + // directory: return ( !(IsInDirectory(SourceDir, path) || IsInDirectory(BinaryDir, path))); } diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 66e1e40..924a44e 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -733,12 +733,18 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement( static_cast<int>(cmSystemTools::CalculateCommandLineLengthLimit()) - globalGen->GetRuleCmdLength(this->LanguageLinkerDeviceRule(config)); - build.RspFile = this->ConvertToNinjaPath(std::string("CMakeFiles/") + - genTarget->GetName() + ".rsp"); + std::string path = localGen.GetHomeRelativeOutputPath(); + if (!path.empty()) { + path += '/'; + } + build.RspFile = this->ConvertToNinjaPath( + cmStrCat(path, "CMakeFiles/", genTarget->GetName(), + globalGen->IsMultiConfig() ? cmStrCat('.', config) : "", ".rsp")); // Gather order-only dependencies. this->GetLocalGenerator()->AppendTargetDepends( - this->GetGeneratorTarget(), build.OrderOnlyDeps, config, config); + this->GetGeneratorTarget(), build.OrderOnlyDeps, config, config, + DependOnTargetArtifact); // Write the build statement for this target. bool usedResponseFile = false; @@ -1154,12 +1160,17 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( globalGen->GetRuleCmdLength(linkBuild.Rule); } - linkBuild.RspFile = this->ConvertToNinjaPath(std::string("CMakeFiles/") + - gt->GetName() + ".rsp"); + std::string path = localGen.GetHomeRelativeOutputPath(); + if (!path.empty()) { + path += '/'; + } + linkBuild.RspFile = this->ConvertToNinjaPath( + cmStrCat(path, "CMakeFiles/", gt->GetName(), + globalGen->IsMultiConfig() ? cmStrCat('.', config) : "", ".rsp")); // Gather order-only dependencies. - this->GetLocalGenerator()->AppendTargetDepends(gt, linkBuild.OrderOnlyDeps, - config, fileConfig); + this->GetLocalGenerator()->AppendTargetDepends( + gt, linkBuild.OrderOnlyDeps, config, fileConfig, DependOnTargetArtifact); // Add order-only dependencies on versioning symlinks of shared libs we link. if (!this->GeneratorTarget->IsDLLPlatform()) { diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index 8d863c3..9508bb9 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -101,7 +101,8 @@ void cmNinjaUtilityTargetGenerator::Generate(const std::string& config) lg->AppendTargetOutputs(genTarget, gg->GetByproductsForCleanTarget(), config); } - lg->AppendTargetDepends(genTarget, deps, config, config); + lg->AppendTargetDepends(genTarget, deps, config, config, + DependOnTargetArtifact); if (commands.empty()) { phonyBuild.Comment = "Utility command for " + this->GetTargetName(); diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 218bd4c..205097d 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -862,7 +862,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() if (sf != nullptr) { auto eMuf = makeMUFile(sf, fullPath, true); - // Ony process moc/uic when the parent is processed as well + // Only process moc/uic when the parent is processed as well if (!muf.MocIt) { eMuf->MocIt = false; } diff --git a/Source/cmStandardLexer.h b/Source/cmStandardLexer.h index cc67ac2..e0b2116 100644 --- a/Source/cmStandardLexer.h +++ b/Source/cmStandardLexer.h @@ -3,6 +3,10 @@ #ifndef cmStandardLexer_h #define cmStandardLexer_h +#if defined(__linux) +/* Needed for glibc < 2.12 */ +# define _XOPEN_SOURCE 600 +#endif #if !defined(_WIN32) && !defined(__sun) /* POSIX APIs are needed */ # define _POSIX_C_SOURCE 200809L diff --git a/Source/cmString.cxx b/Source/cmString.cxx index 2a0c125..898b828 100644 --- a/Source/cmString.cxx +++ b/Source/cmString.cxx @@ -17,7 +17,7 @@ static std::string const empty_string_; void String::internally_mutate_to_stable_string() { // We assume that only one thread mutates this instance at - // a time even if we point to a shared string buffer refernced + // a time even if we point to a shared string buffer referenced // by other threads. *this = String(data(), size()); } diff --git a/Source/cmString.hxx b/Source/cmString.hxx index 87bfdff..40fe20d 100644 --- a/Source/cmString.hxx +++ b/Source/cmString.hxx @@ -383,7 +383,7 @@ public: instance is mutated or destroyed. */ std::string const* str_if_stable() const; - /** Get a refernce to a normal std::string. The reference + /** Get a reference to a normal std::string. The reference is valid until this instance is mutated or destroyed. */ std::string const& str(); diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx index 13f73dc..bd6bb3d 100644 --- a/Source/cmTimestamp.cxx +++ b/Source/cmTimestamp.cxx @@ -164,7 +164,7 @@ std::string cmTimestamp::AddTimestampComponent(char flag, break; case 's': // Seconds since UNIX epoch (midnight 1-jan-1970) { - // Build a time_t for UNIX epoch and substract from the input "timeT": + // Build a time_t for UNIX epoch and subtract from the input "timeT": struct tm tmUnixEpoch; memset(&tmUnixEpoch, 0, sizeof(tmUnixEpoch)); tmUnixEpoch.tm_mday = 1; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 5d9199b..a06dab3 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2293,7 +2293,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0) e2.Attribute("UnityFilesDirectory", unityDir); } else { // Visual Studio versions prior to 2017 15.8 do not know about unity - // builds, thus we exclude the files alredy part of unity sources. + // builds, thus we exclude the files already part of unity sources. if (!si.Source->GetPropertyAsBool("SKIP_UNITY_BUILD_INCLUSION")) { exclude_configs = si.Configs; } @@ -2919,6 +2919,12 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( clOptions.RemoveFlag("SpectreMitigation"); } + // Remove any target-wide -TC or -TP flag added by the project. + // Such flags are unnecessary and break our model of language selection. + if (langForClCompile == "C" || langForClCompile == "CXX") { + clOptions.RemoveFlag("CompileAs"); + } + this->ClOptions[configName] = std::move(pOptions); return true; } |