This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, master has been updated via ccd2c2824aea342b66adde1001753181375c49dc (commit) via aec81b301ecf82f7b131d9d49d67d9b6be82a13a (commit) via f59ae1a698561657afa32245f9c8f3fc90aa392d (commit) via cea7f88a54f060b8c4720f0d20432f7cf4bd8d56 (commit) via 5b46bc319435f429e3e616246e5e39b06f0e7fd0 (commit) via eae743bf17605c28ee4afd02991d3271efb5c8a9 (commit) via 45f8b10e0c12b3e17315851afd1bcd178225ce6a (commit) via 88e0dca40df9c88e7d9b9d352fe19f63091bc7c3 (commit) via 55f7df4961ef3ae4dd01eaae3be149f5c8798e11 (commit) via 46371132b3d79d2a4c86ee2a99b7a0fed4367750 (commit) via f93385283fc86639c0a13b920c66c3a8f42276bb (commit) via 665954fa8d2d2e0a74aab78b7d739c0feae5211b (commit) via 9a5418320ea40d61a63fd47e5ac133c3ff780062 (commit) via 101b5288ffa988b86fc1fe83f3ff65c9694b1484 (commit) via e6069613a111ff30e9bb9a0e7294b2ea9da574c1 (commit) from 2af4841428b7d7e5303d0a0afc3e55958214e22c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ccd2c2824aea342b66adde1001753181375c49dc commit ccd2c2824aea342b66adde1001753181375c49dc Merge: aec81b301e f93385283f Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Nov 12 14:55:10 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Nov 12 09:55:20 2019 -0500 Merge topic 'modernize-memory-management' f93385283f cmLocalGenerator: modernize memory management 101b5288ff cmAlgorithm: Extend cmAppend capabilities Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !4028 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aec81b301ecf82f7b131d9d49d67d9b6be82a13a commit aec81b301ecf82f7b131d9d49d67d9b6be82a13a Merge: f59ae1a698 46371132b3 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Nov 12 14:52:03 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Nov 12 09:53:42 2019 -0500 Merge topic 'findcuda_stop_exposing_raw_pthreads_lib' 46371132b3 FindCUDA: CUDA_LIBRARIES doesn't contain raw `-pthread` Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !4035 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f59ae1a698561657afa32245f9c8f3fc90aa392d commit f59ae1a698561657afa32245f9c8f3fc90aa392d Merge: cea7f88a54 e6069613a1 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Nov 12 14:51:47 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Nov 12 09:52:32 2019 -0500 Merge topic 'cpack-pkg-background' e6069613a1 CPack: Set background image in macOS installer Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3995 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cea7f88a54f060b8c4720f0d20432f7cf4bd8d56 commit cea7f88a54f060b8c4720f0d20432f7cf4bd8d56 Merge: 5b46bc3194 eae743bf17 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Nov 12 14:51:05 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Nov 12 09:51:16 2019 -0500 Merge branch 'release-3.16' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5b46bc319435f429e3e616246e5e39b06f0e7fd0 commit 5b46bc319435f429e3e616246e5e39b06f0e7fd0 Merge: 45f8b10e0c 9a5418320e Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Nov 12 14:51:05 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Nov 12 09:51:16 2019 -0500 Merge topic 'unity-HEADER_FILE_ONLY' 9a5418320e Unity: Don't include sources with HEADER_FILE_ONLY property set Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !4023 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=45f8b10e0c12b3e17315851afd1bcd178225ce6a commit 45f8b10e0c12b3e17315851afd1bcd178225ce6a Merge: 55f7df4961 88e0dca40d Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Nov 12 14:47:35 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Nov 12 09:47:44 2019 -0500 Merge branch 'release-3.16' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=55f7df4961ef3ae4dd01eaae3be149f5c8798e11 commit 55f7df4961ef3ae4dd01eaae3be149f5c8798e11 Merge: 2af4841428 665954fa8d Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Nov 12 14:47:35 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Nov 12 09:47:44 2019 -0500 Merge topic 'objc-standard-docs' 665954fa8d ObjC: Document ObjC/ObjCXX standard properties / variables Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !4031 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=46371132b3d79d2a4c86ee2a99b7a0fed4367750 commit 46371132b3d79d2a4c86ee2a99b7a0fed4367750 Author: Robert Maynard <robert.mayn...@kitware.com> AuthorDate: Mon Nov 11 11:49:52 2019 -0500 Commit: Robert Maynard <robert.mayn...@kitware.com> CommitDate: Mon Nov 11 11:52:02 2019 -0500 FindCUDA: CUDA_LIBRARIES doesn't contain raw `-pthread` If a person tried to pass `CUDA_LIBRARIES` to nvcc compiler it could fail as it might have `-pthread` which nvcc doesn't support. Instead we now use the `Threads::Threads` so that nvcc gets the correct `-Xcompiler -pthread` flag. diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 85d705c8d6..2a3e1317a8 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -924,7 +924,7 @@ set(CUDA_LIBRARIES) if(CUDA_BUILD_EMULATION AND CUDA_CUDARTEMU_LIBRARY) list(APPEND CUDA_LIBRARIES ${CUDA_CUDARTEMU_LIBRARY}) elseif(CUDA_USE_STATIC_CUDA_RUNTIME AND CUDA_cudart_static_LIBRARY) - list(APPEND CUDA_LIBRARIES ${CUDA_cudart_static_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) + list(APPEND CUDA_LIBRARIES ${CUDA_cudart_static_LIBRARY} Threads::Threads ${CMAKE_DL_LIBS}) if (CUDA_rt_LIBRARY) list(APPEND CUDA_LIBRARIES ${CUDA_rt_LIBRARY}) endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f93385283fc86639c0a13b920c66c3a8f42276bb commit f93385283fc86639c0a13b920c66c3a8f42276bb Author: Marc Chevrier <marc.chevr...@gmail.com> AuthorDate: Thu Nov 7 18:52:06 2019 +0100 Commit: Marc Chevrier <marc.chevr...@gmail.com> CommitDate: Mon Nov 11 16:41:13 2019 +0100 cmLocalGenerator: modernize memory management diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 162bab2987..c22cf4ac7b 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -4,6 +4,7 @@ #include <cassert> #include <cstdio> +#include <memory> #include <sstream> #include <utility> @@ -160,12 +161,10 @@ void cmComputeTargetDepends::CollectTargets() std::vector<cmLocalGenerator*> const& lgens = this->GlobalGenerator->GetLocalGenerators(); for (cmLocalGenerator* lgen : lgens) { - const std::vector<cmGeneratorTarget*>& targets = - lgen->GetGeneratorTargets(); - for (cmGeneratorTarget const* ti : targets) { + for (const auto& ti : lgen->GetGeneratorTargets()) { int index = static_cast<int>(this->Targets.size()); - this->TargetIndex[ti] = index; - this->Targets.push_back(ti); + this->TargetIndex[ti.get()] = index; + this->Targets.push_back(ti.get()); } } } diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 5a5d959104..d1da2d783d 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -3,6 +3,7 @@ #include "cmExtraCodeBlocksGenerator.h" #include <map> +#include <memory> #include <ostream> #include <set> #include <utility> @@ -283,8 +284,8 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( // add all executable and library targets and some of the GLOBAL // and UTILITY targets for (cmLocalGenerator* lg : lgs) { - const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets(); - for (cmGeneratorTarget* target : targets) { + const auto& targets = lg->GetGeneratorTargets(); + for (const auto& target : targets) { std::string targetName = target->GetName(); switch (target->GetType()) { case cmStateEnums::GLOBAL_TARGET: { @@ -315,7 +316,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( case cmStateEnums::SHARED_LIBRARY: case cmStateEnums::MODULE_LIBRARY: case cmStateEnums::OBJECT_LIBRARY: { - cmGeneratorTarget* gt = target; + cmGeneratorTarget* gt = target.get(); this->AppendTarget(xml, targetName, gt, make, lg, compiler, makeArgs); std::string fastTarget = cmStrCat(targetName, "/fast"); @@ -341,8 +342,8 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( for (cmLocalGenerator* lg : lgs) { cmMakefile* makefile = lg->GetMakefile(); - const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets(); - for (cmGeneratorTarget* target : targets) { + const auto& targets = lg->GetGeneratorTargets(); + for (const auto& target : targets) { switch (target->GetType()) { case cmStateEnums::EXECUTABLE: case cmStateEnums::STATIC_LIBRARY: @@ -352,13 +353,12 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( case cmStateEnums::UTILITY: // can have sources since 2.6.3 { std::vector<cmSourceFile*> sources; - cmGeneratorTarget* gt = target; - gt->GetSourceFiles(sources, - makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); + target->GetSourceFiles( + sources, makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); for (cmSourceFile* s : sources) { // don't add source files from UTILITY target which have the // GENERATED property set: - if (gt->GetType() == cmStateEnums::UTILITY && + if (target->GetType() == cmStateEnums::UTILITY && s->GetIsGenerated()) { continue; } @@ -391,7 +391,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( } CbpUnit& cbpUnit = allFiles[fullPath]; - cbpUnit.Targets.push_back(target); + cbpUnit.Targets.push_back(target.get()); } } default: // intended fallthrough diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index c7b74570f7..269e8dde29 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -4,6 +4,7 @@ #include <cstring> #include <map> +#include <memory> #include <set> #include <sstream> #include <utility> @@ -119,7 +120,7 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByTarget( const std::vector<cmLocalGenerator*>& lgs = this->GlobalGenerator->GetLocalGenerators(); for (cmLocalGenerator* lg : lgs) { - for (cmGeneratorTarget* lt : lg->GetGeneratorTargets()) { + for (const auto& lt : lg->GetGeneratorTargets()) { cmStateEnums::TargetType type = lt->GetType(); std::string const& outputDir = lg->GetCurrentBinaryDirectory(); std::string targetName = lt->GetName(); @@ -142,7 +143,7 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByTarget( xml->Attribute("Active", "No"); xml->EndElement(); - CreateNewProjectFile(lt, filename); + CreateNewProjectFile(lt.get(), filename); break; default: break; @@ -269,9 +270,9 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile( for (cmLocalGenerator* lg : lgs) { cmMakefile* makefile = lg->GetMakefile(); - const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets(); - for (cmGeneratorTarget* target : targets) { - projectType = CollectSourceFiles(makefile, target, cFiles, otherFiles); + for (const auto& target : lg->GetGeneratorTargets()) { + projectType = + CollectSourceFiles(makefile, target.get(), cFiles, otherFiles); } } diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index b286acf0c8..cf7937572e 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -6,6 +6,7 @@ #include <cassert> #include <cstdio> #include <map> +#include <memory> #include <sstream> #include <utility> @@ -496,9 +497,9 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml) for (cmLocalGenerator* lg : this->GlobalGenerator->GetLocalGenerators()) { cmMakefile* makefile = lg->GetMakefile(); - const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets(); + const auto& targets = lg->GetGeneratorTargets(); - for (cmGeneratorTarget* target : targets) { + for (const auto& target : targets) { std::string linkName2 = cmStrCat(linkName, '/'); switch (target->GetType()) { case cmStateEnums::EXECUTABLE: @@ -519,10 +520,9 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml) std::vector<cmSourceGroup> sourceGroups = makefile->GetSourceGroups(); // get the files from the source lists then add them to the groups - cmGeneratorTarget* gt = const_cast<cmGeneratorTarget*>(target); std::vector<cmSourceFile*> files; - gt->GetSourceFiles(files, - makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); + target->GetSourceFiles( + files, makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); for (cmSourceFile* sf : files) { // Add the file to the list of sources. std::string const& source = sf->ResolveFullPath(); @@ -860,15 +860,14 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const // include dirs emmited.clear(); for (cmLocalGenerator* lgen : this->GlobalGenerator->GetLocalGenerators()) { - const std::vector<cmGeneratorTarget*>& targets = - lgen->GetGeneratorTargets(); - for (cmGeneratorTarget* target : targets) { + const auto& targets = lgen->GetGeneratorTargets(); + for (const auto& target : targets) { if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } std::vector<std::string> includeDirs; std::string config = mf->GetSafeDefinition("CMAKE_BUILD_TYPE"); - lgen->GetIncludeDirectories(includeDirs, target, "C", config); + lgen->GetIncludeDirectories(includeDirs, target.get(), "C", config); this->AppendIncludeDirectories(xml, includeDirs, emmited); } } @@ -916,15 +915,14 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const // add all executable and library targets and some of the GLOBAL // and UTILITY targets for (cmLocalGenerator* lgen : this->GlobalGenerator->GetLocalGenerators()) { - const std::vector<cmGeneratorTarget*>& targets = - lgen->GetGeneratorTargets(); + const auto& targets = lgen->GetGeneratorTargets(); std::string subdir = lgen->MaybeConvertToRelativePath( this->HomeOutputDirectory, lgen->GetCurrentBinaryDirectory()); if (subdir == ".") { subdir.clear(); } - for (cmGeneratorTarget* target : targets) { + for (const auto& target : targets) { std::string targetName = target->GetName(); switch (target->GetType()) { case cmStateEnums::GLOBAL_TARGET: { @@ -975,8 +973,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const std::string cleanArgs = cmStrCat("-E chdir \"", lgen->GetCurrentBinaryDirectory(), "\" \"", cmSystemTools::GetCMakeCommand(), "\" -P \""); - cmGeneratorTarget* gt = target; - cleanArgs += lgen->GetTargetDirectory(gt); + cleanArgs += lgen->GetTargetDirectory(target.get()); cleanArgs += "/cmake_clean.cmake\""; cmExtraEclipseCDT4Generator::AppendTarget( xml, "Clean", cmSystemTools::GetCMakeCommand(), cleanArgs, diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index e8c9dd0020..bbbc281bbe 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -3,6 +3,7 @@ #include "cmExtraKateGenerator.h" #include <cstring> +#include <memory> #include <ostream> #include <set> #include <vector> @@ -111,12 +112,11 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg, // and UTILITY targets for (cmLocalGenerator* localGen : this->GlobalGenerator->GetLocalGenerators()) { - const std::vector<cmGeneratorTarget*>& targets = - localGen->GetGeneratorTargets(); + const auto& targets = localGen->GetGeneratorTargets(); std::string currentDir = localGen->GetCurrentBinaryDirectory(); bool topLevel = (currentDir == localGen->GetBinaryDirectory()); - for (cmGeneratorTarget* target : targets) { + for (const auto& target : targets) { std::string const& targetName = target->GetName(); switch (target->GetType()) { case cmStateEnums::GLOBAL_TARGET: { diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 495324cbf3..603fea38da 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -3,6 +3,7 @@ #include "cmExtraSublimeTextGenerator.h" #include <cstring> +#include <memory> #include <set> #include <sstream> #include <utility> @@ -182,8 +183,8 @@ void cmExtraSublimeTextGenerator::AppendAllTargets( // and UTILITY targets for (cmLocalGenerator* lg : lgs) { cmMakefile* makefile = lg->GetMakefile(); - const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets(); - for (cmGeneratorTarget* target : targets) { + const auto& targets = lg->GetGeneratorTargets(); + for (const auto& target : targets) { std::string targetName = target->GetName(); switch (target->GetType()) { case cmStateEnums::GLOBAL_TARGET: { @@ -216,11 +217,11 @@ void cmExtraSublimeTextGenerator::AppendAllTargets( case cmStateEnums::SHARED_LIBRARY: case cmStateEnums::MODULE_LIBRARY: case cmStateEnums::OBJECT_LIBRARY: { - this->AppendTarget(fout, targetName, lg, target, make.c_str(), + this->AppendTarget(fout, targetName, lg, target.get(), make.c_str(), makefile, compiler.c_str(), sourceFileFlags, false); std::string fastTarget = cmStrCat(targetName, "/fast"); - this->AppendTarget(fout, fastTarget, lg, target, make.c_str(), + this->AppendTarget(fout, fastTarget, lg, target.get(), make.c_str(), makefile, compiler.c_str(), sourceFileFlags, false); } break; diff --git a/Source/cmGlobalCommonGenerator.cxx b/Source/cmGlobalCommonGenerator.cxx index 9fa4467b2a..d6c0a87298 100644 --- a/Source/cmGlobalCommonGenerator.cxx +++ b/Source/cmGlobalCommonGenerator.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmGlobalCommonGenerator.h" +#include <memory> #include <utility> #include "cmGeneratorTarget.h" @@ -32,7 +33,7 @@ cmGlobalCommonGenerator::ComputeDirectoryTargets() const // The directory-level rule should depend on the target-level rules // for all targets in the directory. - for (auto gt : lg->GetGeneratorTargets()) { + for (const auto& gt : lg->GetGeneratorTargets()) { cmStateEnums::TargetType const type = gt->GetType(); if (type != cmStateEnums::EXECUTABLE && type != cmStateEnums::STATIC_LIBRARY && @@ -43,7 +44,7 @@ cmGlobalCommonGenerator::ComputeDirectoryTargets() const continue; } DirectoryTarget::Target t; - t.GT = gt; + t.GT = gt.get(); if (const char* exclude = gt->GetProperty("EXCLUDE_FROM_ALL")) { if (cmIsOn(exclude)) { // This target has been explicitly excluded. diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2efafc64ba..d903289e4b 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -10,6 +10,9 @@ #include <initializer_list> #include <iterator> #include <sstream> +#include <utility> + +#include <cm/memory> #include "cmsys/Directory.hxx" #include "cmsys/FStream.hxx" @@ -296,7 +299,7 @@ bool cmGlobalGenerator::CheckTargetsForMissingSources() const { bool failed = false; for (cmLocalGenerator* localGen : this->LocalGenerators) { - for (cmGeneratorTarget* target : localGen->GetGeneratorTargets()) { + for (const auto& target : localGen->GetGeneratorTargets()) { if (target->GetType() == cmStateEnums::TargetType::GLOBAL_TARGET || target->GetType() == cmStateEnums::TargetType::INTERFACE_LIBRARY || target->GetType() == cmStateEnums::TargetType::UTILITY || @@ -336,7 +339,7 @@ bool cmGlobalGenerator::CheckTargetsForType() const } bool failed = false; for (cmLocalGenerator* generator : this->LocalGenerators) { - for (cmGeneratorTarget* target : generator->GetGeneratorTargets()) { + for (const auto& target : generator->GetGeneratorTargets()) { if (target->GetType() == cmStateEnums::EXECUTABLE && target->GetPropertyAsBool("WIN32_EXECUTABLE")) { std::vector<std::string> const& configs = @@ -364,7 +367,7 @@ bool cmGlobalGenerator::CheckTargetsForPchCompilePdb() const } bool failed = false; for (cmLocalGenerator* generator : this->LocalGenerators) { - for (cmGeneratorTarget* target : generator->GetGeneratorTargets()) { + for (const auto& target : generator->GetGeneratorTargets()) { if (target->GetType() == cmStateEnums::TargetType::GLOBAL_TARGET || target->GetType() == cmStateEnums::TargetType::INTERFACE_LIBRARY || target->GetType() == cmStateEnums::TargetType::UTILITY || @@ -1557,12 +1560,12 @@ bool cmGlobalGenerator::AddAutomaticSources() { for (cmLocalGenerator* lg : this->LocalGenerators) { lg->CreateEvaluationFileOutputs(); - for (cmGeneratorTarget* gt : lg->GetGeneratorTargets()) { + for (const auto& gt : lg->GetGeneratorTargets()) { if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } - lg->AddUnityBuild(gt); - lg->AddPchDependencies(gt); + lg->AddUnityBuild(gt.get()); + lg->AddPchDependencies(gt.get()); } } return true; @@ -1650,8 +1653,7 @@ void cmGlobalGenerator::CreateGeneratorTargets( if (targetTypes == AllTargets) { for (auto& target : mf->GetTargets()) { cmTarget* t = &target.second; - cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg); - lg->AddGeneratorTarget(gt); + lg->AddGeneratorTarget(cm::make_unique<cmGeneratorTarget>(t, lg)); } } @@ -1667,9 +1669,9 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes) cmMakefile* mf = this->Makefiles[i]; for (cmTarget* ownedImpTgt : mf->GetOwnedImportedTargets()) { cmLocalGenerator* lg = this->LocalGenerators[i]; - cmGeneratorTarget* gt = new cmGeneratorTarget(ownedImpTgt, lg); - lg->AddOwnedImportedGeneratorTarget(gt); - importedMap[ownedImpTgt] = gt; + auto gt = cm::make_unique<cmGeneratorTarget>(ownedImpTgt, lg); + importedMap[ownedImpTgt] = gt.get(); + lg->AddOwnedImportedGeneratorTarget(std::move(gt)); } } @@ -2766,15 +2768,15 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets, continue; } // loop over all the generator targets in the makefile - for (cmGeneratorTarget* target : generator->GetGeneratorTargets()) { - if (this->IsRootOnlyTarget(target) && + for (const auto& target : generator->GetGeneratorTargets()) { + if (this->IsRootOnlyTarget(target.get()) && target->GetLocalGenerator() != root) { continue; } // put the target in the set of original targets - originalTargets.insert(target); + originalTargets.insert(target.get()); // Get the set of targets that depend on target - this->AddTargetDepends(target, projectTargets); + this->AddTargetDepends(target.get(), projectTargets); } } } @@ -2951,11 +2953,11 @@ void cmGlobalGenerator::WriteSummary() cmGeneratedFileStream fout(fname); for (cmLocalGenerator* lg : this->LocalGenerators) { - for (cmGeneratorTarget* tgt : lg->GetGeneratorTargets()) { + for (const auto& tgt : lg->GetGeneratorTargets()) { if (tgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } - this->WriteSummary(tgt); + this->WriteSummary(tgt.get()); fout << tgt->GetSupportDirectory() << "\n"; } } diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 4c2d69f091..dfc495edf9 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -374,16 +374,15 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefileLanguageRules( for (cmLocalGenerator* lGenerator : lGenerators) { lg = static_cast<cmLocalUnixMakefileGenerator3*>(lGenerator); // for all of out targets - for (cmGeneratorTarget* tgt : lg->GetGeneratorTargets()) { + for (const auto& tgt : lg->GetGeneratorTargets()) { if ((tgt->GetType() == cmStateEnums::EXECUTABLE) || (tgt->GetType() == cmStateEnums::STATIC_LIBRARY) || (tgt->GetType() == cmStateEnums::SHARED_LIBRARY) || (tgt->GetType() == cmStateEnums::MODULE_LIBRARY) || (tgt->GetType() == cmStateEnums::OBJECT_LIBRARY) || (tgt->GetType() == cmStateEnums::UTILITY)) { - cmGeneratorTarget* gt = tgt; - std::string tname = - cmStrCat(lg->GetRelativeTargetDirectory(gt), "/DependInfo.cmake"); + std::string tname = cmStrCat(lg->GetRelativeTargetDirectory(tgt.get()), + "/DependInfo.cmake"); cmSystemTools::ConvertToUnixSlashes(tname); cmakefileStream << " \"" << tname << "\"\n"; } @@ -549,7 +548,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules( cmLocalUnixMakefileGenerator3* lg = static_cast<cmLocalUnixMakefileGenerator3*>(localGen); // for each target Generate the rule files for each target. - for (cmGeneratorTarget* gtarget : lg->GetGeneratorTargets()) { + for (const auto& gtarget : lg->GetGeneratorTargets()) { // Don't emit the same rule twice (e.g. two targets with the same // simple name) int type = gtarget->GetType(); @@ -580,7 +579,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules( depends, commands, true); // Add a fast rule to build the target - std::string localName = lg->GetRelativeTargetDirectory(gtarget); + std::string localName = lg->GetRelativeTargetDirectory(gtarget.get()); std::string makefileName; makefileName = cmStrCat(localName, "/build.make"); depends.clear(); @@ -595,8 +594,8 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules( // Add a local name for the rule to relink the target before // installation. if (gtarget->NeedRelinkBeforeInstall(lg->GetConfigName())) { - makeTargetName = - cmStrCat(lg->GetRelativeTargetDirectory(gtarget), "/preinstall"); + makeTargetName = cmStrCat( + lg->GetRelativeTargetDirectory(gtarget.get()), "/preinstall"); localName = cmStrCat(name, "/preinstall"); depends.clear(); commands.clear(); @@ -625,7 +624,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( } // for each target Generate the rule files for each target. - for (cmGeneratorTarget* gtarget : lg->GetGeneratorTargets()) { + for (const auto& gtarget : lg->GetGeneratorTargets()) { int type = gtarget->GetType(); std::string name = gtarget->GetName(); if (!name.empty() && @@ -637,7 +636,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( (type == cmStateEnums::UTILITY))) { std::string makefileName; // Add a rule to build the target by name. - localName = lg->GetRelativeTargetDirectory(gtarget); + localName = lg->GetRelativeTargetDirectory(gtarget.get()); makefileName = cmStrCat(localName, "/build.make"); lg->WriteDivider(ruleFileStream); @@ -661,7 +660,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( { std::ostringstream progressArg; const char* sep = ""; - for (unsigned long progFile : this->ProgressMap[gtarget].Marks) { + for (unsigned long progFile : this->ProgressMap[gtarget.get()].Marks) { progressArg << sep << progFile; sep = ","; } @@ -680,7 +679,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( cmLocalUnixMakefileGenerator3::EchoNormal, &progress); } - this->AppendGlobalTargetDepends(depends, gtarget); + this->AppendGlobalTargetDepends(depends, gtarget.get()); lg->WriteMakeRule(ruleFileStream, "All Build rule for target.", localName, depends, commands, true); @@ -697,7 +696,8 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( cmOutputConverter::SHELL); // std::set<cmGeneratorTarget const*> emitted; - progCmd << " " << this->CountProgressMarksInTarget(gtarget, emitted); + progCmd << " " + << this->CountProgressMarksInTarget(gtarget.get(), emitted); commands.push_back(progCmd.str()); } std::string tmp = "CMakeFiles/Makefile2"; @@ -715,7 +715,8 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( if (regenerate) { depends.emplace_back("cmake_check_build_system"); } - localName = cmStrCat(lg->GetRelativeTargetDirectory(gtarget), "/rule"); + localName = + cmStrCat(lg->GetRelativeTargetDirectory(gtarget.get()), "/rule"); lg->WriteMakeRule(ruleFileStream, "Build rule for subdir invocation for target.", localName, depends, commands, true); @@ -729,8 +730,8 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( // Add rules to prepare the target for installation. if (gtarget->NeedRelinkBeforeInstall(lg->GetConfigName())) { - localName = - cmStrCat(lg->GetRelativeTargetDirectory(gtarget), "/preinstall"); + localName = cmStrCat(lg->GetRelativeTargetDirectory(gtarget.get()), + "/preinstall"); depends.clear(); commands.clear(); commands.push_back(lg->GetRecursiveMakeCall(makefileName, localName)); @@ -740,7 +741,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( } // add the clean rule - localName = lg->GetRelativeTargetDirectory(gtarget); + localName = lg->GetRelativeTargetDirectory(gtarget.get()); makeTargetName = cmStrCat(localName, "/clean"); depends.clear(); commands.clear(); @@ -760,7 +761,7 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks() this->DirectoryTargetsMap.clear(); // Loop over all targets in all local generators. for (cmLocalGenerator* lg : this->LocalGenerators) { - for (cmGeneratorTarget* gt : lg->GetGeneratorTargets()) { + for (const auto& gt : lg->GetGeneratorTargets()) { cmLocalGenerator* tlg = gt->GetLocalGenerator(); if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY || @@ -778,12 +779,13 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks() // This local generator includes the target. std::set<cmGeneratorTarget const*>& targetSet = this->DirectoryTargetsMap[csnp]; - targetSet.insert(gt); + targetSet.insert(gt.get()); // Add dependencies of the included target. An excluded // target may still be included if it is a dependency of a // non-excluded target. - for (cmTargetDepend const& tgtdep : this->GetTargetDirectDepends(gt)) { + for (cmTargetDepend const& tgtdep : + this->GetTargetDirectDepends(gt.get())) { targetSet.insert(tgtdep); } } @@ -894,7 +896,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule( // the targets if (lg2 == lg || lg->IsRootMakefile()) { // for each target Generate the rule files for each target. - for (cmGeneratorTarget* target : lg2->GetGeneratorTargets()) { + for (const auto& target : lg2->GetGeneratorTargets()) { cmStateEnums::TargetType type = target->GetType(); if ((type == cmStateEnums::EXECUTABLE) || (type == cmStateEnums::STATIC_LIBRARY) || diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 8e6125b8a2..d39d42a0db 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmGlobalVisualStudio8Generator.h" +#include <cm/memory> + #include "cmCustomCommand.h" #include "cmCustomCommandLines.h" #include "cmDocumentationEntry.h" @@ -109,8 +111,9 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() CMAKE_CHECK_BUILD_SYSTEM_TARGET, cmCommandOrigin::Generator, false, no_working_directory, no_byproducts, no_depends, no_commands); - cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg); - lg->AddGeneratorTarget(gt); + auto ptr = cm::make_unique<cmGeneratorTarget>(tgt, lg); + auto gt = ptr.get(); + lg->AddGeneratorTarget(std::move(ptr)); // Organize in the "predefined targets" folder: // @@ -203,10 +206,9 @@ void cmGlobalVisualStudio8Generator::AddExtraIDETargets() cmGlobalVisualStudio7Generator::AddExtraIDETargets(); if (this->AddCheckTarget()) { for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) { - const std::vector<cmGeneratorTarget*>& tgts = - this->LocalGenerators[i]->GetGeneratorTargets(); + const auto& tgts = this->LocalGenerators[i]->GetGeneratorTargets(); // All targets depend on the build-system check target. - for (cmGeneratorTarget const* ti : tgts) { + for (const auto& ti : tgts) { if (ti->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) { ti->Target->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET); } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 54124070d7..218199420e 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -7,6 +7,7 @@ #include <iostream> #include <cm/iterator> +#include <cm/memory> #include <windows.h> @@ -200,8 +201,8 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets() "ALL_BUILD", cmCommandOrigin::Generator, true, no_working_dir, no_byproducts, no_depends, no_commands, false, "Build all projects"); - cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]); - gen[0]->AddGeneratorTarget(gt); + gen[0]->AddGeneratorTarget( + cm::make_unique<cmGeneratorTarget>(allBuild, gen[0])); // // Organize in the "predefined targets" folder: @@ -212,12 +213,12 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets() // Now make all targets depend on the ALL_BUILD target for (cmLocalGenerator const* i : gen) { - for (cmGeneratorTarget* tgt : i->GetGeneratorTargets()) { + for (const auto& tgt : i->GetGeneratorTargets()) { if (tgt->GetType() == cmStateEnums::GLOBAL_TARGET || tgt->IsImported()) { continue; } - if (!this->IsExcluded(gen[0], tgt)) { + if (!this->IsExcluded(gen[0], tgt.get())) { allBuild->AddUtility(tgt->GetName()); } } @@ -389,8 +390,8 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends() } for (auto const& it : this->ProjectMap) { for (const cmLocalGenerator* i : it.second) { - for (cmGeneratorTarget* ti : i->GetGeneratorTargets()) { - this->ComputeVSTargetDepends(ti); + for (const auto& ti : i->GetGeneratorTargets()) { + this->ComputeVSTargetDepends(ti.get()); } } } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 998ffa6918..7a0ab380b8 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmGlobalXCodeGenerator.h" +#include <algorithm> #include <cassert> #include <cstdio> #include <cstring> @@ -412,10 +413,10 @@ void cmGlobalXCodeGenerator::ComputeTargetOrder() { size_t index = 0; auto const& lgens = this->GetLocalGenerators(); - for (cmLocalGenerator* lgen : lgens) { - auto const& targets = lgen->GetGeneratorTargets(); - for (cmGeneratorTarget const* gt : targets) { - this->ComputeTargetOrder(gt, index); + for (auto const& lgen : lgens) { + const auto& targets = lgen->GetGeneratorTargets(); + for (const auto& gt : targets) { + this->ComputeTargetOrder(gt.get(), index); } } assert(index == this->TargetOrderIndex.size()); @@ -511,8 +512,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets( no_byproducts, no_depends, cmMakeSingleCommandLine({ "echo", "Build all projects" })); - cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root); - root->AddGeneratorTarget(allBuildGt); + root->AddGeneratorTarget(cm::make_unique<cmGeneratorTarget>(allbuild, root)); // Add XCODE depend helper std::string dir = root->GetCurrentBinaryDirectory(); @@ -536,14 +536,13 @@ void cmGlobalXCodeGenerator::AddExtraTargets( no_working_directory, no_byproducts, no_depends, cmMakeSingleCommandLine({ "make", "-f", file })); - cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root); - root->AddGeneratorTarget(checkGt); + root->AddGeneratorTarget(cm::make_unique<cmGeneratorTarget>(check, root)); } // now make the allbuild depend on all the non-utility targets // in the project for (auto& gen : gens) { - for (auto target : gen->GetGeneratorTargets()) { + for (const auto& target : gen->GetGeneratorTargets()) { if (target->GetType() == cmStateEnums::GLOBAL_TARGET) { continue; } @@ -567,7 +566,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets( cmObjectLibraryCommands::Accept); } - if (!this->IsExcluded(gens[0], target)) { + if (!this->IsExcluded(gens[0], target.get())) { allbuild->AddUtility(target->GetName()); } } @@ -1092,8 +1091,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( cmLocalGenerator* gen, std::vector<cmXCodeObject*>& targets) { this->SetCurrentLocalGenerator(gen); - std::vector<cmGeneratorTarget*> gts = - this->CurrentLocalGenerator->GetGeneratorTargets(); + std::vector<cmGeneratorTarget*> gts; + cmAppend(gts, this->CurrentLocalGenerator->GetGeneratorTargets()); std::sort(gts.begin(), gts.end(), [this](cmGeneratorTarget const* l, cmGeneratorTarget const* r) { return this->TargetOrderIndex[l] < this->TargetOrderIndex[r]; @@ -1363,9 +1362,9 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguages() { for (auto localGenerator : this->LocalGenerators) { // All targets depend on the build-system check target. - for (auto tgt : localGenerator->GetGeneratorTargets()) { + for (const auto& tgt : localGenerator->GetGeneratorTargets()) { // This makes sure all targets link using the proper language. - this->ForceLinkerLanguage(tgt); + this->ForceLinkerLanguage(tgt.get()); } } } @@ -2822,7 +2821,7 @@ bool cmGlobalXCodeGenerator::CreateGroups( for (auto& generator : generators) { cmMakefile* mf = generator->GetMakefile(); std::vector<cmSourceGroup> sourceGroups = mf->GetSourceGroups(); - for (auto gtgt : generator->GetGeneratorTargets()) { + for (const auto& gtgt : generator->GetGeneratorTargets()) { // Same skipping logic here as in CreateXCodeTargets so that we do not // end up with (empty anyhow) ZERO_CHECK, install, or test source // groups: @@ -2837,11 +2836,12 @@ bool cmGlobalXCodeGenerator::CreateGroups( continue; } - auto addSourceToGroup = [this, mf, gtgt, + auto addSourceToGroup = [this, mf, >gt, &sourceGroups](std::string const& source) { cmSourceGroup* sourceGroup = mf->FindSourceGroup(source, sourceGroups); - cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(gtgt, sourceGroup); - std::string key = GetGroupMapKeyFromPath(gtgt, source); + cmXCodeObject* pbxgroup = + this->CreateOrGetPBXGroup(gtgt.get(), sourceGroup); + std::string key = GetGroupMapKeyFromPath(gtgt.get(), source); this->GroupMap[key] = pbxgroup; }; @@ -2867,7 +2867,7 @@ bool cmGlobalXCodeGenerator::CreateGroups( // Add the Info.plist we are about to generate for an App Bundle. if (gtgt->GetPropertyAsBool("MACOSX_BUNDLE")) { - std::string plist = this->ComputeInfoPListLocation(gtgt); + std::string plist = this->ComputeInfoPListLocation(gtgt.get()); cmSourceFile* sf = gtgt->Makefile->GetOrCreateSource( plist, true, cmSourceFileLocationKind::Known); addSourceToGroup(sf->ResolveFullPath()); diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 7759c5f9d3..9c1a924b25 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -278,12 +278,12 @@ void cmGraphVizWriter::Write() sortedGeneratorTargets; for (cmLocalGenerator const* lg : gg->GetLocalGenerators()) { - for (cmGeneratorTarget const* gt : lg->GetGeneratorTargets()) { + for (const auto& gt : lg->GetGeneratorTargets()) { // Reserved targets have inconsistent names across platforms (e.g. 'all' // vs. 'ALL_BUILD'), which can disrupt the traversal ordering. // We don't need or want them anyway. if (!cmGlobalGenerator::IsReservedTarget(gt->GetName())) { - sortedGeneratorTargets.insert(gt); + sortedGeneratorTargets.insert(gt.get()); } } } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 4b9b0159f2..50c42af9cf 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2,6 +2,20 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmLocalGenerator.h" +#include <algorithm> +#include <cassert> +#include <cstdio> +#include <cstdlib> +#include <cstring> +#include <initializer_list> +#include <iterator> +#include <sstream> +#include <unordered_set> +#include <utility> +#include <vector> + +#include <cm/string_view> + #include "cmsys/RegularExpression.hxx" #include "cmAlgorithms.h" @@ -40,20 +54,6 @@ # include "cmCryptoHash.h" #endif -#include <algorithm> -#include <cassert> -#include <cstdio> -#include <cstdlib> -#include <cstring> -#include <initializer_list> -#include <iterator> -#include <sstream> -#include <unordered_set> -#include <utility> -#include <vector> - -#include <cm/string_view> - #if defined(__HAIKU__) # include <FindDirectory.h> # include <StorageDefs.h> @@ -181,11 +181,7 @@ cmRulePlaceholderExpander* cmLocalGenerator::CreateRulePlaceholderExpander() this->LinkerSysroot); } -cmLocalGenerator::~cmLocalGenerator() -{ - cmDeleteAll(this->GeneratorTargets); - cmDeleteAll(this->OwnedImportedGeneratorTargets); -} +cmLocalGenerator::~cmLocalGenerator() = default; void cmLocalGenerator::IssueMessage(MessageType t, std::string const& text) const @@ -263,8 +259,8 @@ static void MoveSystemIncludesToEnd(std::vector<BT<std::string>>& includeDirs, void cmLocalGenerator::TraceDependencies() { // Generate the rule files for each target. - const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); - for (cmGeneratorTarget* target : targets) { + const auto& targets = this->GetGeneratorTargets(); + for (const auto& target : targets) { if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -635,11 +631,14 @@ void cmLocalGenerator::GenerateInstallRules() } } -void cmLocalGenerator::AddGeneratorTarget(cmGeneratorTarget* gt) +void cmLocalGenerator::AddGeneratorTarget( + std::unique_ptr<cmGeneratorTarget> gt) { - this->GeneratorTargets.push_back(gt); - this->GeneratorTargetSearchIndex.emplace(gt->GetName(), gt); - this->GlobalGenerator->IndexGeneratorTarget(gt); + cmGeneratorTarget* gt_ptr = gt.get(); + + this->GeneratorTargets.push_back(std::move(gt)); + this->GeneratorTargetSearchIndex.emplace(gt_ptr->GetName(), gt_ptr); + this->GlobalGenerator->IndexGeneratorTarget(gt_ptr); } void cmLocalGenerator::AddImportedGeneratorTarget(cmGeneratorTarget* gt) @@ -648,9 +647,10 @@ void cmLocalGenerator::AddImportedGeneratorTarget(cmGeneratorTarget* gt) this->GlobalGenerator->IndexGeneratorTarget(gt); } -void cmLocalGenerator::AddOwnedImportedGeneratorTarget(cmGeneratorTarget* gt) +void cmLocalGenerator::AddOwnedImportedGeneratorTarget( + std::unique_ptr<cmGeneratorTarget> gt) { - this->OwnedImportedGeneratorTargets.push_back(gt); + this->OwnedImportedGeneratorTargets.push_back(std::move(gt)); } cmGeneratorTarget* cmLocalGenerator::FindLocalNonAliasGeneratorTarget( @@ -673,8 +673,8 @@ void cmLocalGenerator::ComputeTargetManifest() } // Add our targets to the manifest for each configuration. - const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); - for (cmGeneratorTarget* target : targets) { + const auto& targets = this->GetGeneratorTargets(); + for (const auto& target : targets) { if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -694,8 +694,8 @@ bool cmLocalGenerator::ComputeTargetCompileFeatures() } // Process compile features of all targets. - const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); - for (cmGeneratorTarget* target : targets) { + const auto& targets = this->GetGeneratorTargets(); + for (const auto& target : targets) { for (std::string const& c : configNames) { if (!target->ComputeCompileFeatures(c)) { return false; @@ -2842,8 +2842,8 @@ void cmLocalGenerator::GenerateTargetInstallRules( { // Convert the old-style install specification from each target to // an install generator and run it. - const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets(); - for (cmGeneratorTarget* l : tgts) { + const auto& tgts = this->GetGeneratorTargets(); + for (const auto& l : tgts) { if (l->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 12359dbddd..e5c89f9b86 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -7,6 +7,7 @@ #include <iosfwd> #include <map> +#include <memory> #include <set> #include <string> #include <unordered_map> @@ -143,14 +144,16 @@ public: bool forResponseFile = false, const std::string& config = ""); - const std::vector<cmGeneratorTarget*>& GetGeneratorTargets() const + using GeneratorTargetVector = + std::vector<std::unique_ptr<cmGeneratorTarget>>; + const GeneratorTargetVector& GetGeneratorTargets() const { return this->GeneratorTargets; } - void AddGeneratorTarget(cmGeneratorTarget* gt); + void AddGeneratorTarget(std::unique_ptr<cmGeneratorTarget> gt); void AddImportedGeneratorTarget(cmGeneratorTarget* gt); - void AddOwnedImportedGeneratorTarget(cmGeneratorTarget* gt); + void AddOwnedImportedGeneratorTarget(std::unique_ptr<cmGeneratorTarget> gt); cmGeneratorTarget* FindLocalNonAliasGeneratorTarget( const std::string& name) const; @@ -461,11 +464,11 @@ protected: using GeneratorTargetMap = std::unordered_map<std::string, cmGeneratorTarget*>; GeneratorTargetMap GeneratorTargetSearchIndex; - std::vector<cmGeneratorTarget*> GeneratorTargets; + GeneratorTargetVector GeneratorTargets; std::set<cmGeneratorTarget const*> WarnCMP0063; GeneratorTargetMap ImportedGeneratorTargets; - std::vector<cmGeneratorTarget*> OwnedImportedGeneratorTargets; + GeneratorTargetVector OwnedImportedGeneratorTargets; std::map<std::string, std::string> AliasTargets; std::map<std::string, std::string> Compilers; diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx index 4b10798e1f..29c169f132 100644 --- a/Source/cmLocalGhsMultiGenerator.cxx +++ b/Source/cmLocalGhsMultiGenerator.cxx @@ -5,6 +5,7 @@ #include <algorithm> #include <utility> +#include "cmAlgorithms.h" #include "cmGeneratorTarget.h" #include "cmGhsMultiTargetGenerator.h" #include "cmGlobalGenerator.h" @@ -50,10 +51,11 @@ void cmLocalGhsMultiGenerator::GenerateTargetsDepthFirst( void cmLocalGhsMultiGenerator::Generate() { - std::vector<cmGeneratorTarget*> remaining = this->GetGeneratorTargets(); + std::vector<cmGeneratorTarget*> remaining; + cmAppend(remaining, this->GetGeneratorTargets()); for (auto& t : remaining) { if (t) { - GenerateTargetsDepthFirst(t, remaining); + this->GenerateTargetsDepthFirst(t, remaining); } } } diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 134bbe18af..ea500acfc9 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -82,11 +82,11 @@ void cmLocalNinjaGenerator::Generate() } } - for (cmGeneratorTarget* target : this->GetGeneratorTargets()) { + for (const auto& target : this->GetGeneratorTargets()) { if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } - auto tg = cmNinjaTargetGenerator::New(target); + auto tg = cmNinjaTargetGenerator::New(target.get()); if (tg) { tg->Generate(); } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 4a70248d6f..ce3be63c33 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -121,12 +121,12 @@ void cmLocalUnixMakefileGenerator3::Generate() // Generate the rule files for each target. cmGlobalUnixMakefileGenerator3* gg = static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator); - for (cmGeneratorTarget* target : this->GetGeneratorTargets()) { + for (const auto& target : this->GetGeneratorTargets()) { if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } std::unique_ptr<cmMakefileTargetGenerator> tg( - cmMakefileTargetGenerator::New(target)); + cmMakefileTargetGenerator::New(target.get())); if (tg) { tg->WriteRuleFiles(); gg->RecordTargetProgress(tg.get()); @@ -157,7 +157,7 @@ void cmLocalUnixMakefileGenerator3::ComputeHomeRelativeOutputPath() void cmLocalUnixMakefileGenerator3::GetLocalObjectFiles( std::map<std::string, LocalObjectInfo>& localObjectFiles) { - for (cmGeneratorTarget* gt : this->GetGeneratorTargets()) { + for (const auto& gt : this->GetGeneratorTargets()) { if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -165,7 +165,7 @@ void cmLocalUnixMakefileGenerator3::GetLocalObjectFiles( gt->GetObjectSources(objectSources, this->ConfigName); // Compute full path to object file directory for this target. std::string dir = cmStrCat(gt->LocalGenerator->GetCurrentBinaryDirectory(), - '/', this->GetTargetDirectory(gt), '/'); + '/', this->GetTargetDirectory(gt.get()), '/'); // Compute the name of each object file. for (cmSourceFile const* sf : objectSources) { bool hasSourceExtension = true; @@ -176,7 +176,7 @@ void cmLocalUnixMakefileGenerator3::GetLocalObjectFiles( } LocalObjectInfo& info = localObjectFiles[objectName]; info.HasSourceExtension = hasSourceExtension; - info.emplace_back(gt, sf->GetLanguage()); + info.emplace_back(gt.get(), sf->GetLanguage()); } } } @@ -352,7 +352,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets( // for each target we just provide a rule to cd up to the top and do a make // on the target std::string localName; - for (cmGeneratorTarget* target : this->GetGeneratorTargets()) { + for (const auto& target : this->GetGeneratorTargets()) { if ((target->GetType() == cmStateEnums::EXECUTABLE) || (target->GetType() == cmStateEnums::STATIC_LIBRARY) || (target->GetType() == cmStateEnums::SHARED_LIBRARY) || @@ -362,7 +362,8 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets( emitted.insert(target->GetName()); // for subdirs add a rule to build this specific target by name. - localName = cmStrCat(this->GetRelativeTargetDirectory(target), "/rule"); + localName = + cmStrCat(this->GetRelativeTargetDirectory(target.get()), "/rule"); commands.clear(); depends.clear(); @@ -383,11 +384,11 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets( } // Add a fast rule to build the target - std::string makefileName = - cmStrCat(this->GetRelativeTargetDirectory(target), "/build.make"); + std::string makefileName = cmStrCat( + this->GetRelativeTargetDirectory(target.get()), "/build.make"); // make sure the makefile name is suitable for a makefile std::string makeTargetName = - cmStrCat(this->GetRelativeTargetDirectory(target), "/build"); + cmStrCat(this->GetRelativeTargetDirectory(target.get()), "/build"); localName = cmStrCat(target->GetName(), "/fast"); depends.clear(); commands.clear(); @@ -401,8 +402,8 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets( // Add a local name for the rule to relink the target before // installation. if (target->NeedRelinkBeforeInstall(this->ConfigName)) { - makeTargetName = - cmStrCat(this->GetRelativeTargetDirectory(target), "/preinstall"); + makeTargetName = cmStrCat( + this->GetRelativeTargetDirectory(target.get()), "/preinstall"); localName = cmStrCat(target->GetName(), "/preinstall"); depends.clear(); commands.clear(); @@ -1551,8 +1552,8 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( this->WriteDivider(ruleFileStream); ruleFileStream << "# Targets provided globally by CMake.\n" << "\n"; - const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); - for (cmGeneratorTarget* gt : targets) { + const auto& targets = this->GetGeneratorTargets(); + for (const auto& gt : targets) { if (gt->GetType() == cmStateEnums::GLOBAL_TARGET) { std::string targetString = "Special rule for the target " + gt->GetName(); @@ -1573,10 +1574,10 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( // Global targets store their rules in pre- and post-build commands. this->AppendCustomDepends(depends, gt->GetPreBuildCommands()); this->AppendCustomDepends(depends, gt->GetPostBuildCommands()); - this->AppendCustomCommands(commands, gt->GetPreBuildCommands(), gt, - this->GetCurrentBinaryDirectory()); - this->AppendCustomCommands(commands, gt->GetPostBuildCommands(), gt, + this->AppendCustomCommands(commands, gt->GetPreBuildCommands(), gt.get(), this->GetCurrentBinaryDirectory()); + this->AppendCustomCommands(commands, gt->GetPostBuildCommands(), + gt.get(), this->GetCurrentBinaryDirectory()); std::string targetName = gt->GetName(); this->WriteMakeRule(ruleFileStream, targetString.c_str(), targetName, depends, commands, true); diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index f3d828b28e..d9c4ce0f70 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -4,6 +4,7 @@ #include "cm_expat.h" +#include "cmAlgorithms.h" #include "cmGeneratorTarget.h" #include "cmGlobalVisualStudio10Generator.h" #include "cmMakefile.h" @@ -101,10 +102,11 @@ void cmLocalVisualStudio10Generator::GenerateTargetsDepthFirst( void cmLocalVisualStudio10Generator::Generate() { - std::vector<cmGeneratorTarget*> remaining = this->GetGeneratorTargets(); + std::vector<cmGeneratorTarget*> remaining; + cmAppend(remaining, this->GetGeneratorTargets()); for (auto& t : remaining) { if (t) { - GenerateTargetsDepthFirst(t, remaining); + this->GenerateTargetsDepthFirst(t, remaining); } } this->WriteStampFiles(); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index fd346df685..672b19049b 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -64,8 +64,8 @@ cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator() void cmLocalVisualStudio7Generator::AddHelperCommands() { // Now create GUIDs for targets - const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets(); - for (cmGeneratorTarget const* l : tgts) { + const auto& tgts = this->GetGeneratorTargets(); + for (const auto& l : tgts) { if (l->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -89,8 +89,8 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets() // Visual Studio .NET 2003 Service Pack 1 will not run post-build // commands for targets in which no sources are built. Add dummy // rules to force these targets to build. - const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets(); - for (cmGeneratorTarget* l : tgts) { + const auto& tgts = this->GetGeneratorTargets(); + for (auto& l : tgts) { if (l->GetType() == cmStateEnums::GLOBAL_TARGET) { std::vector<std::string> no_depends; cmCustomCommandLines force_commands = @@ -125,17 +125,17 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles() } // Get the set of targets in this directory. - const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets(); + const auto& tgts = this->GetGeneratorTargets(); // Create the project file for each target. - for (cmGeneratorTarget* l : tgts) { + for (const auto& l : tgts) { if (l->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace // so don't build a projectfile for it if (!l->GetProperty("EXTERNAL_MSPROJECT")) { - this->CreateSingleVCProj(l->GetName(), l); + this->CreateSingleVCProj(l->GetName(), l.get()); } } } diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index 5a06d4a53b..ac0d35ea88 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -40,7 +40,7 @@ void cmLocalXCodeGenerator::Generate() { cmLocalGenerator::Generate(); - for (auto target : this->GetGeneratorTargets()) { + for (const auto& target : this->GetGeneratorTargets()) { target->HasMacOSXRpathInstallNameDir(""); } } @@ -49,7 +49,7 @@ void cmLocalXCodeGenerator::GenerateInstallRules() { cmLocalGenerator::GenerateInstallRules(); - for (auto target : this->GetGeneratorTargets()) { + for (const auto& target : this->GetGeneratorTargets()) { target->HasMacOSXRpathInstallNameDir(""); } } diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index ef6b886364..4792860a59 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -73,7 +73,7 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( } // Find targets that require AUTOMOC/UIC/RCC processing - for (cmGeneratorTarget* target : localGen->GetGeneratorTargets()) { + for (const auto& target : localGen->GetGeneratorTargets()) { // Process only certain target types switch (target->GetType()) { case cmStateEnums::EXECUTABLE: @@ -104,7 +104,7 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( target->GetSafeProperty(kw().AUTORCC_EXECUTABLE); // We support Qt4, Qt5 and Qt6 - auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target); + auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target.get()); bool const validQt = (qtVersion.first.Major == 4) || (qtVersion.first.Major == 5) || (qtVersion.first.Major == 6); @@ -135,8 +135,8 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( if (mocIsValid || uicIsValid || rccIsValid) { // Create autogen target initializer Initializers_.emplace_back(cm::make_unique<cmQtAutoGenInitializer>( - this, target, qtVersion.first, mocIsValid, uicIsValid, rccIsValid, - globalAutoGenTarget, globalAutoRccTarget)); + this, target.get(), qtVersion.first, mocIsValid, uicIsValid, + rccIsValid, globalAutoGenTarget, globalAutoRccTarget)); } } } @@ -160,7 +160,8 @@ void cmQtAutoGenGlobalInitializer::GetOrCreateGlobalTarget( std::vector<std::string>() /*output*/, std::vector<std::string>() /*depends*/, cmCustomCommandLines(), false, comment.c_str()); - localGen->AddGeneratorTarget(new cmGeneratorTarget(target, localGen)); + localGen->AddGeneratorTarget( + cm::make_unique<cmGeneratorTarget>(target, localGen)); // Set FOLDER property in the target { diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index a20f1060f8..68b71224f1 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -1126,7 +1126,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() commandLines, false, autogenComment.c_str()); // Create autogen generator target this->LocalGen->AddGeneratorTarget( - new cmGeneratorTarget(autogenTarget, this->LocalGen)); + cm::make_unique<cmGeneratorTarget>(autogenTarget, this->LocalGen)); // Forward origin utilities to autogen target if (this->AutogenTarget.DependOrigin) { @@ -1206,7 +1206,7 @@ bool cmQtAutoGenInitializer::InitRccTargets() // Create autogen generator target this->LocalGen->AddGeneratorTarget( - new cmGeneratorTarget(autoRccTarget, this->LocalGen)); + cm::make_unique<cmGeneratorTarget>(autoRccTarget, this->LocalGen)); // Set FOLDER property in autogen target if (!this->TargetsFolder.empty()) { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=101b5288ffa988b86fc1fe83f3ff65c9694b1484 commit 101b5288ffa988b86fc1fe83f3ff65c9694b1484 Author: Marc Chevrier <marc.chevr...@gmail.com> AuthorDate: Thu Nov 7 18:19:49 2019 +0100 Commit: Marc Chevrier <marc.chevr...@gmail.com> CommitDate: Mon Nov 11 10:57:58 2019 +0100 cmAlgorithm: Extend cmAppend capabilities diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index e0d27eedf9..e83f16078e 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -8,6 +8,7 @@ #include <algorithm> #include <functional> #include <iterator> +#include <memory> #include <unordered_set> #include <utility> #include <vector> @@ -144,6 +145,13 @@ void cmDeleteAll(Range const& r) ContainerAlgorithms::DefaultDeleter<Range>()); } +template <typename T> +void cmAppend(std::vector<T*>& v, std::vector<std::unique_ptr<T>> const& r) +{ + std::transform(r.begin(), r.end(), std::back_inserter(v), + [](const std::unique_ptr<T>& item) { return item.get(); }); +} + template <typename T, typename Range> void cmAppend(std::vector<T>& v, Range const& r) { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e6069613a111ff30e9bb9a0e7294b2ea9da574c1 commit e6069613a111ff30e9bb9a0e7294b2ea9da574c1 Author: Sergey Larin <cerg2010cerg2...@mail.ru> AuthorDate: Tue Nov 5 15:23:47 2019 +0300 Commit: Brad King <brad.k...@kitware.com> CommitDate: Fri Nov 8 14:09:25 2019 -0500 CPack: Set background image in macOS installer Now you can set a background image and it's parameters in productbuild and PackageMaker based installers. diff --git a/Help/cpack_gen/packagemaker.rst b/Help/cpack_gen/packagemaker.rst index e9464b749a..81acb9d57e 100644 --- a/Help/cpack_gen/packagemaker.rst +++ b/Help/cpack_gen/packagemaker.rst @@ -15,9 +15,60 @@ macOS using PackageMaker: compatible with. Different versions of macOS support different features. For example, CPack can only build component-based installers for macOS 10.4 or newer, and can only build installers that download - component son-the-fly for macOS 10.5 or newer. If left blank, this value + components on-the-fly for macOS 10.5 or newer. If left blank, this value will be set to the minimum version of macOS that supports the requested features. Set this variable to some value (e.g., 10.4) only if you want to guarantee that your installer will work on that version of macOS, and don't mind missing extra features available in the installer shipping with later versions of macOS. + +.. variable:: CPACK_PACKAGEMAKER_BACKGROUND + + Adds a background to Distribtion XML if specified. The value contains the + path to image in ``Resources`` directory. + +.. variable:: CPACK_PACKAGEMAKER_BACKGROUND_ALIGNMENT + + Adds an ``alignment`` attribute to the background in Distribution XML. + Refer to Apple documentation for valid values. + +.. variable:: CPACK_PACKAGEMAKER_BACKGROUND_SCALING + + Adds a ``scaling`` attribute to the background in Distribution XML. + Refer to Apple documentation for valid values. + +.. variable:: CPACK_PACKAGEMAKER_BACKGROUND_MIME_TYPE + + Adds a ``mime-type`` attribute to the background in Distribution XML. + The option contains MIME type of an image. + +.. variable:: CPACK_PACKAGEMAKER_BACKGROUND_UTI + + Adds an ``uti`` attribute to the background in Distribution XML. + The option contains UTI type of an image. + +.. variable:: CPACK_PACKAGEMAKER_BACKGROUND_DARKAQUA + + Adds a background for the Dark Aqua theme to Distribution XML if + specified. The value contains the path to image in ``Resources`` + directory. + +.. variable:: CPACK_PACKAGEMAKER_BACKGROUND_DARKAQUA_ALIGNMENT + + Does the same as :variable:`CPACK_PACKAGEMAKER_BACKGROUND_ALIGNMENT` option, + but for the dark theme. + +.. variable:: CPACK_PACKAGEMAKER_BACKGROUND_DARKAQUA_SCALING + + Does the same as :variable:`CPACK_PACKAGEMAKER_BACKGROUND_SCALING` option, + but for the dark theme. + +.. variable:: CPACK_PACKAGEMAKER_BACKGROUND_DARKAQUA_MIME_TYPE + + Does the same as :variable:`CPACK_PACKAGEMAKER_BACKGROUND_MIME_TYPE` option, + but for the dark theme. + +.. variable:: CPACK_PACKAGEMAKER_BACKGROUND_DARKAQUA_UTI + + Does the same as :variable:`CPACK_PACKAGEMAKER_BACKGROUND_UTI` option, + but for the dark theme. diff --git a/Help/cpack_gen/productbuild.rst b/Help/cpack_gen/productbuild.rst index d22fcd48a5..82b79aeacf 100644 --- a/Help/cpack_gen/productbuild.rst +++ b/Help/cpack_gen/productbuild.rst @@ -58,7 +58,6 @@ macOS using ProductBuild: component name. No ``postinstall`` script is added if this variable is not defined for a given component. - .. variable:: CPACK_PRODUCTBUILD_RESOURCES_DIR If specified the productbuild generator copies files from this directory @@ -66,3 +65,54 @@ macOS using ProductBuild: before the :variable:`CPACK_RESOURCE_FILE_WELCOME`, :variable:`CPACK_RESOURCE_FILE_README`, and :variable:`CPACK_RESOURCE_FILE_LICENSE` files are copied. + +.. variable:: CPACK_PRODUCTBUILD_BACKGROUND + + Adds a background to Distribtion XML if specified. The value contains the + path to image in ``Resources`` directory. + +.. variable:: CPACK_PRODUCTBUILD_BACKGROUND_ALIGNMENT + + Adds an ``alignment`` attribute to the background in Distribution XML. + Refer to Apple documentation for valid values. + +.. variable:: CPACK_PRODUCTBUILD_BACKGROUND_SCALING + + Adds a ``scaling`` attribute to the background in Distribution XML. + Refer to Apple documentation for valid values. + +.. variable:: CPACK_PRODUCTBUILD_BACKGROUND_MIME_TYPE + + Adds a ``mime-type`` attribute to the background in Distribution XML. + The option contains MIME type of an image. + +.. variable:: CPACK_PRODUCTBUILD_BACKGROUND_UTI + + Adds an ``uti`` attribute to the background in Distribution XML. + The option contains UTI type of an image. + +.. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA + + Adds a background for the Dark Aqua theme to Distribution XML if + specified. The value contains the path to image in ``Resources`` + directory. + +.. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_ALIGNMENT + + Does the same as :variable:`CPACK_PRODUCTBUILD_BACKGROUND_ALIGNMENT` option, + but for the dark theme. + +.. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_SCALING + + Does the same as :variable:`CPACK_PRODUCTBUILD_BACKGROUND_SCALING` option, + but for the dark theme. + +.. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_MIME_TYPE + + Does the same as :variable:`CPACK_PRODUCTBUILD_BACKGROUND_MIME_TYPE` option, + but for the dark theme. + +.. variable:: CPACK_PRODUCTBUILD_BACKGROUND_DARKAQUA_UTI + + Does the same as :variable:`CPACK_PRODUCTBUILD_BACKGROUND_UTI` option, + but for the dark theme. diff --git a/Help/release/dev/cpack-pkg-background.rst b/Help/release/dev/cpack-pkg-background.rst new file mode 100644 index 0000000000..796f5d62ba --- /dev/null +++ b/Help/release/dev/cpack-pkg-background.rst @@ -0,0 +1,8 @@ +cpack-pkg-background +-------------------- + +* The :cpack_gen:`CPack productbuild Generator` and + :cpack_gen:`CPack PackageMaker Generator` gained options + :variable:`CPACK_PRODUCTBUILD_BACKGROUND` and + :variable:`CPACK_PACKAGEMAKER_BACKGROUND`, respectively, + to specify a background image for the macOS installer. diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index 3e1a51b83d..328aac3826 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -46,7 +46,66 @@ std::string cmCPackPKGGenerator::GetPackageName( return component.ArchiveFile + ".pkg"; } -void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile) +void cmCPackPKGGenerator::CreateBackground(const char* themeName, + const char* metapackageFile, + cm::string_view genName, + cmXMLWriter& xout) +{ + std::string paramSuffix = + (themeName == nullptr) ? "" : cmSystemTools::UpperCase(themeName); + std::string opt = (themeName == nullptr) + ? cmStrCat("CPACK_", genName, "_BACKGROUND") + : cmStrCat("CPACK_", genName, "_BACKGROUND_", paramSuffix); + const char* bgFileName = this->GetOption(opt); + if (bgFileName == nullptr) { + return; + } + + std::string bgFilePath = cmStrCat(metapackageFile, "/Contents/", bgFileName); + + if (!cmSystemTools::FileExists(bgFilePath)) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Background image doesn't exist in the resource directory: " + << bgFileName << std::endl); + return; + } + + if (themeName == nullptr) { + xout.StartElement("background"); + } else { + xout.StartElement(cmStrCat("background-", themeName)); + } + + xout.Attribute("file", bgFileName); + + const char* param = this->GetOption(cmStrCat(opt, "_ALIGNMENT")); + if (param != nullptr) { + xout.Attribute("alignment", param); + } + + param = this->GetOption(cmStrCat(opt, "_SCALING")); + if (param != nullptr) { + xout.Attribute("scaling", param); + } + + // Apple docs say that you must provide either mime-type or uti + // attribute for the background, but I've seen examples that + // doesn't have them, so don't make them mandatory. + param = this->GetOption(cmStrCat(opt, "_MIME_TYPE")); + if (param != nullptr) { + xout.Attribute("mime-type", param); + } + + param = this->GetOption(cmStrCat(opt, "_UTI")); + if (param != nullptr) { + xout.Attribute("uti", param); + } + + xout.EndElement(); +} + +void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile, + const char* genName) { std::string distributionTemplate = this->FindTemplate("Internal/CPack/CPack.distribution.dist.in"); @@ -102,6 +161,11 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile) CreateChoice(PostFlightComponent, xout); } + // default background + this->CreateBackground(nullptr, metapackageFile, genName, xout); + // Dark Aqua + this->CreateBackground("darkAqua", metapackageFile, genName, xout); + this->SetOption("CPACK_PACKAGEMAKER_CHOICES", choiceOut.str().c_str()); // Create the distribution.dist file in the metapackage to turn it diff --git a/Source/CPack/cmCPackPKGGenerator.h b/Source/CPack/cmCPackPKGGenerator.h index 69286ffde6..be730abddf 100644 --- a/Source/CPack/cmCPackPKGGenerator.h +++ b/Source/CPack/cmCPackPKGGenerator.h @@ -9,6 +9,8 @@ #include <sstream> #include <string> +#include <cm/string_view> + #include "cmCPackComponentGroup.h" #include "cmCPackGenerator.h" @@ -57,7 +59,7 @@ protected: // inter-component dependencies. metapackageFile is the name of the // metapackage for the distribution. Only valid for a // component-based install. - void WriteDistributionFile(const char* metapackageFile); + void WriteDistributionFile(const char* metapackageFile, const char* genName); // Subroutine of WriteDistributionFile that writes out the // dependency attributes for inter-component dependencies. @@ -85,6 +87,10 @@ protected: /// installer GUI. void CreateChoice(const cmCPackComponent& component, cmXMLWriter& xout); + /// Creates a background in the distribution XML. + void CreateBackground(const char* themeName, const char* metapackageFile, + cm::string_view genName, cmXMLWriter& xout); + // The PostFlight component when creating a metapackage cmCPackComponent PostFlightComponent; }; diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index c5ba726d50..12ea97b47f 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -279,7 +279,7 @@ int cmCPackPackageMakerGenerator::PackageFiles() } else { // We have built the package in place. Generate the // distribution.dist file to describe it for the installer. - WriteDistributionFile(packageDirFileName.c_str()); + WriteDistributionFile(packageDirFileName.c_str(), "PACKAGEMAKER"); } std::string tmpFile = cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx index dae268c5ce..a3e55de5c2 100644 --- a/Source/CPack/cmCPackProductBuildGenerator.cxx +++ b/Source/CPack/cmCPackProductBuildGenerator.cxx @@ -81,7 +81,7 @@ int cmCPackProductBuildGenerator::PackageFiles() } // combine package(s) into a distribution - WriteDistributionFile(packageDirFileName.c_str()); + WriteDistributionFile(packageDirFileName.c_str(), "PRODUCTBUILD"); std::ostringstream pkgCmd; std::string version = this->GetOption("CPACK_PACKAGE_VERSION"); ----------------------------------------------------------------------- Summary of changes: Help/command/try_compile.rst | 11 +++- Help/cpack_gen/packagemaker.rst | 53 +++++++++++++++- Help/cpack_gen/productbuild.rst | 52 +++++++++++++++- Help/manual/cmake-properties.7.rst | 6 ++ Help/manual/cmake-variables.7.rst | 6 ++ Help/prop_tgt/OBJCXX_EXTENSIONS.rst | 20 ++++++ Help/prop_tgt/OBJCXX_STANDARD.rst | 35 +++++++++++ Help/prop_tgt/OBJCXX_STANDARD_REQUIRED.rst | 20 ++++++ Help/prop_tgt/OBJC_EXTENSIONS.rst | 20 ++++++ Help/prop_tgt/OBJC_STANDARD.rst | 35 +++++++++++ Help/prop_tgt/OBJC_STANDARD_REQUIRED.rst | 20 ++++++ Help/release/dev/cpack-pkg-background.rst | 8 +++ Help/variable/CMAKE_OBJCXX_EXTENSIONS.rst | 11 ++++ Help/variable/CMAKE_OBJCXX_STANDARD.rst | 11 ++++ Help/variable/CMAKE_OBJCXX_STANDARD_REQUIRED.rst | 11 ++++ Help/variable/CMAKE_OBJC_EXTENSIONS.rst | 11 ++++ Help/variable/CMAKE_OBJC_STANDARD.rst | 11 ++++ Help/variable/CMAKE_OBJC_STANDARD_REQUIRED.rst | 11 ++++ Modules/FindCUDA.cmake | 2 +- Source/CPack/cmCPackPKGGenerator.cxx | 66 +++++++++++++++++++- Source/CPack/cmCPackPKGGenerator.h | 8 ++- Source/CPack/cmCPackPackageMakerGenerator.cxx | 2 +- Source/CPack/cmCPackProductBuildGenerator.cxx | 2 +- Source/cmAlgorithms.h | 8 +++ Source/cmComputeTargetDepends.cxx | 9 ++- Source/cmExtraCodeBlocksGenerator.cxx | 20 +++--- Source/cmExtraCodeLiteGenerator.cxx | 11 ++-- Source/cmExtraEclipseCDT4Generator.cxx | 25 ++++---- Source/cmExtraKateGenerator.cxx | 6 +- Source/cmExtraSublimeTextGenerator.cxx | 9 +-- Source/cmFileAPICodemodel.cxx | 1 + Source/cmGeneratorTarget.cxx | 19 ++++++ Source/cmGeneratorTarget.h | 9 ++- Source/cmGlobalCommonGenerator.cxx | 5 +- Source/cmGlobalGenerator.cxx | 36 ++++++----- Source/cmGlobalUnixMakefileGenerator3.cxx | 44 ++++++------- Source/cmGlobalVisualStudio8Generator.cxx | 12 ++-- Source/cmGlobalVisualStudioGenerator.cxx | 13 ++-- Source/cmGlobalXCodeGenerator.cxx | 42 +++++++------ Source/cmGraphVizWriter.cxx | 4 +- Source/cmLocalGenerator.cxx | 72 +++++++++++----------- Source/cmLocalGenerator.h | 13 ++-- Source/cmLocalGhsMultiGenerator.cxx | 6 +- Source/cmLocalNinjaGenerator.cxx | 4 +- Source/cmLocalUnixMakefileGenerator3.cxx | 35 ++++++----- Source/cmLocalVisualStudio10Generator.cxx | 6 +- Source/cmLocalVisualStudio7Generator.cxx | 14 ++--- Source/cmLocalXCodeGenerator.cxx | 4 +- Source/cmQtAutoGenGlobalInitializer.cxx | 11 ++-- Source/cmQtAutoGenInitializer.cxx | 4 +- Source/cmVisualStudio10TargetGenerator.cxx | 1 + Tests/RunCMake/UnityBuild/unitybuild_runtest.cmake | 1 + .../UnityBuild/unitybuild_skip-check.cmake | 6 +- Tests/RunCMake/UnityBuild/unitybuild_skip.cmake | 5 +- 54 files changed, 680 insertions(+), 207 deletions(-) create mode 100644 Help/prop_tgt/OBJCXX_EXTENSIONS.rst create mode 100644 Help/prop_tgt/OBJCXX_STANDARD.rst create mode 100644 Help/prop_tgt/OBJCXX_STANDARD_REQUIRED.rst create mode 100644 Help/prop_tgt/OBJC_EXTENSIONS.rst create mode 100644 Help/prop_tgt/OBJC_STANDARD.rst create mode 100644 Help/prop_tgt/OBJC_STANDARD_REQUIRED.rst create mode 100644 Help/release/dev/cpack-pkg-background.rst create mode 100644 Help/variable/CMAKE_OBJCXX_EXTENSIONS.rst create mode 100644 Help/variable/CMAKE_OBJCXX_STANDARD.rst create mode 100644 Help/variable/CMAKE_OBJCXX_STANDARD_REQUIRED.rst create mode 100644 Help/variable/CMAKE_OBJC_EXTENSIONS.rst create mode 100644 Help/variable/CMAKE_OBJC_STANDARD.rst create mode 100644 Help/variable/CMAKE_OBJC_STANDARD_REQUIRED.rst hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org https://cmake.org/mailman/listinfo/cmake-commits