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 28ef1081401fb62da98157083eae254502d350c0 (commit) via b6412b38ee7dbb7c2e2095e1d83260de7441c240 (commit) via dfb5936f0f1f689d6f729b78379a840971d8149c (commit) via ea4c3976fb593d0daf49c52e0a42818cd743b9ff (commit) via bd3f088abe6488dbc84197bf695a74bb8e8ddda4 (commit) via 3402e6cf82c9ef1258530bff8cd4f2be01839d32 (commit) via bfe0ea2d98944e3668439b6fb2b05e82a5dca60e (commit) via 3b51343ea1942171b0588f4f8367de3bd815e35d (commit) via 66654135c1bcd5548df2ad15283d250621e2f28e (commit) via d17580909f5c3bec2939b75549b7192500b8942d (commit) via be7807478c463c5c875798a3e2e72e148c0d0c3e (commit) via e07e2bc8bbf25178270e8086575ff398dd1fa0c6 (commit) via c1787cb5eb82ad815a824f88d4cc636e949fae73 (commit) via 141e3074845675d37a8c7f7c3efcc09d0ab5158c (commit) via a18100898ae5188883acab295179c6758e84f496 (commit) via 2dfc52675c3ea732bd389852675e680e296415cb (commit) via 891e670e59265468be74484302800dc1469e7eea (commit) via bb6e95ca6d31829f8ed03512f447e8c02ea46c43 (commit) from 2ad09c5ddd133bc4e543b15eb5e75b6e0aaaf197 (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=28ef1081401fb62da98157083eae254502d350c0 commit 28ef1081401fb62da98157083eae254502d350c0 Merge: b6412b3 bb6e95c Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Aug 21 15:58:10 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Wed Aug 21 11:59:38 2019 -0400 Merge topic 'source_group-tests' bb6e95ca6d source_group: Improved generated filters tests Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3675 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b6412b38ee7dbb7c2e2095e1d83260de7441c240 commit b6412b38ee7dbb7c2e2095e1d83260de7441c240 Merge: dfb5936 d175809 Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Aug 21 15:57:10 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Wed Aug 21 11:58:27 2019 -0400 Merge topic 'double-export-error-message-install' d17580909f cmExportInstallFileGenerator: improve error message a18100898a cmInstallExportGenerator: add a method for the file destination Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3703 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dfb5936f0f1f689d6f729b78379a840971d8149c commit dfb5936f0f1f689d6f729b78379a840971d8149c Merge: ea4c397 be78074 Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Aug 21 15:56:11 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Wed Aug 21 11:57:05 2019 -0400 Merge topic 'shared-string' be7807478c cmDefinitions: Reduce allocation of keys and values in MakeClosure e07e2bc8bb bootstrap: Compile cm::String c1787cb5eb cpack.cxx: Re-order include blocks to follow our conventions 141e307484 cmConfigure.h: Tell windows.h not to define min/max macros Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3669 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ea4c3976fb593d0daf49c52e0a42818cd743b9ff commit ea4c3976fb593d0daf49c52e0a42818cd743b9ff Merge: bd3f088 891e670 Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Aug 21 15:55:01 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Wed Aug 21 11:55:58 2019 -0400 Merge topic 'install-fail-reason' 891e670e59 install: print reason of failure Acked-by: Kitware Robot <kwro...@kitware.com> Acked-by: Alex Turbov <i.za...@gmail.com> Merge-request: !3696 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bd3f088abe6488dbc84197bf695a74bb8e8ddda4 commit bd3f088abe6488dbc84197bf695a74bb8e8ddda4 Merge: 3402e6c 6665413 Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Aug 21 15:54:24 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Wed Aug 21 11:54:48 2019 -0400 Merge topic 'ccmake-find-system-form-header' 66654135c1 ccmake: Fix form.h include with CMAKE_USE_SYSTEM_FORM Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3683 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3402e6cf82c9ef1258530bff8cd4f2be01839d32 commit 3402e6cf82c9ef1258530bff8cd4f2be01839d32 Merge: bfe0ea2 3b51343 Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Aug 21 15:53:11 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Wed Aug 21 11:53:23 2019 -0400 Merge topic 'vs-sln-bom' 3b51343ea1 VS: Emit UTF-8 BOM for generated solution files Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3705 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bfe0ea2d98944e3668439b6fb2b05e82a5dca60e commit bfe0ea2d98944e3668439b6fb2b05e82a5dca60e Merge: 2ad09c5 2dfc526 Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Aug 21 15:51:55 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Wed Aug 21 11:52:06 2019 -0400 Merge topic 'cm-contains' 2dfc52675c cmAlgorithms: Add cmContains Acked-by: Kitware Robot <kwro...@kitware.com> Acked-by: Sebastian Holtermann <sebh...@web.de> Acked-by: Daniel Pfeifer <dan...@pfeifer-mail.de> Merge-request: !3700 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3b51343ea1942171b0588f4f8367de3bd815e35d commit 3b51343ea1942171b0588f4f8367de3bd815e35d Author: Justin Goshi <jgo...@microsoft.com> AuthorDate: Mon Aug 19 12:40:50 2019 -0700 Commit: Brad King <brad.k...@kitware.com> CommitDate: Tue Aug 20 11:09:31 2019 -0400 VS: Emit UTF-8 BOM for generated solution files We write UTF-8-encoded content to the `.sln` files, so tell VS to read them as such. Fixes: #19594 diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index ba541a9..cdb0b5f 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -104,6 +104,9 @@ const char* cmGlobalVisualStudioGenerator::GetIDEVersion() const void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout) { + char utf8bom[] = { char(0xEF), char(0xBB), char(0xBF) }; + fout.write(utf8bom, 3); + switch (this->Version) { case cmGlobalVisualStudioGenerator::VS9: fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=66654135c1bcd5548df2ad15283d250621e2f28e commit 66654135c1bcd5548df2ad15283d250621e2f28e Author: Christoph GrĂ¼ninger <f...@grueninger.de> AuthorDate: Sun Aug 11 23:04:41 2019 +0200 Commit: Brad King <brad.k...@kitware.com> CommitDate: Tue Aug 20 10:45:32 2019 -0400 ccmake: Fix form.h include with CMAKE_USE_SYSTEM_FORM Some distributions have form.h in ncurses/ next to the ncurses.h found by FindCurses. Fixes: #19589 diff --git a/Source/CursesDialog/CMakeLists.txt b/Source/CursesDialog/CMakeLists.txt index c51b0dd..270b07e 100644 --- a/Source/CursesDialog/CMakeLists.txt +++ b/Source/CursesDialog/CMakeLists.txt @@ -23,6 +23,10 @@ include_directories(${CURSES_INCLUDE_PATH}) add_executable(ccmake ${CURSES_SRCS} ) target_link_libraries(ccmake CMakeLib) if(CMAKE_USE_SYSTEM_FORM) + find_path(CURSES_FORM_INCLUDE_DIR NAMES form.h HINTS ${CURSES_INCLUDE_PATH} ${CURSES_INCLUDE_PATH}/ncurses) + if(CURSES_FORM_INCLUDE_DIR) + target_include_directories(ccmake PRIVATE ${CURSES_FORM_INCLUDE_DIR}) + endif() target_link_libraries(ccmake ${CURSES_FORM_LIBRARY} ${CURSES_LIBRARY} https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d17580909f5c3bec2939b75549b7192500b8942d commit d17580909f5c3bec2939b75549b7192500b8942d Author: Ben Boeckel <ben.boec...@kitware.com> AuthorDate: Mon Aug 19 14:18:08 2019 -0400 Commit: Ben Boeckel <ben.boec...@kitware.com> CommitDate: Tue Aug 20 10:15:03 2019 -0400 cmExportInstallFileGenerator: improve error message Following commit 49cfd390 (cmExportBuildFileGenerator: improve error message, 2019-06-26), improve the error message related to installed export sets by referencing the files which contain the exported target ambiguously. diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 4bc2d1b..7056577 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -458,10 +458,10 @@ void cmExportInstallFileGenerator::HandleMissingTarget( { const std::string name = dependee->GetName(); cmGlobalGenerator* gg = dependee->GetLocalGenerator()->GetGlobalGenerator(); - std::vector<std::string> namespaces = this->FindNamespaces(gg, name); - int targetOccurrences = static_cast<int>(namespaces.size()); - if (targetOccurrences == 1) { - std::string missingTarget = namespaces[0]; + auto exportInfo = this->FindNamespaces(gg, name); + std::vector<std::string> const& exportFiles = exportInfo.first; + if (exportFiles.size() == 1) { + std::string missingTarget = exportInfo.second; missingTarget += dependee->GetExportName(); link_libs += missingTarget; @@ -469,14 +469,16 @@ void cmExportInstallFileGenerator::HandleMissingTarget( } else { // All exported targets should be known here and should be unique. // This is probably user-error. - this->ComplainAboutMissingTarget(depender, dependee, targetOccurrences); + this->ComplainAboutMissingTarget(depender, dependee, exportFiles); } } -std::vector<std::string> cmExportInstallFileGenerator::FindNamespaces( - cmGlobalGenerator* gg, const std::string& name) +std::pair<std::vector<std::string>, std::string> +cmExportInstallFileGenerator::FindNamespaces(cmGlobalGenerator* gg, + const std::string& name) { - std::vector<std::string> namespaces; + std::vector<std::string> exportFiles; + std::string ns; const cmExportSetMap& exportSets = gg->GetExportSets(); for (auto const& expIt : exportSets) { @@ -496,27 +498,33 @@ std::vector<std::string> cmExportInstallFileGenerator::FindNamespaces( std::vector<cmInstallExportGenerator const*> const* installs = exportSet->GetInstallations(); for (cmInstallExportGenerator const* install : *installs) { - namespaces.push_back(install->GetNamespace()); + exportFiles.push_back(install->GetDestinationFile()); + ns = install->GetNamespace(); } } } - return namespaces; + return std::make_pair(exportFiles, ns); } void cmExportInstallFileGenerator::ComplainAboutMissingTarget( - cmGeneratorTarget* depender, cmGeneratorTarget* dependee, int occurrences) + cmGeneratorTarget* depender, cmGeneratorTarget* dependee, + std::vector<std::string> const& exportFiles) { std::ostringstream e; e << "install(EXPORT \"" << this->IEGen->GetExportSet()->GetName() << "\" ...) " << "includes target \"" << depender->GetName() << "\" which requires target \"" << dependee->GetName() << "\" "; - if (occurrences == 0) { - e << "that is not in the export set."; + if (exportFiles.empty()) { + e << "that is not in any export set."; } else { - e << "that is not in this export set, but " << occurrences - << " times in others."; + e << "that is not in this export set, but in multiple other export sets: " + << cmJoin(exportFiles, ", ") << ".\n"; + e << "An exported target cannot depend upon another target which is " + "exported multiple times. Consider consolidating the exports of the " + "\"" + << dependee->GetName() << "\" target to a single export."; } cmSystemTools::Error(e.str()); } diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h index cbd6507..fcd1aca 100644 --- a/Source/cmExportInstallFileGenerator.h +++ b/Source/cmExportInstallFileGenerator.h @@ -12,6 +12,7 @@ #include <map> #include <set> #include <string> +#include <utility> #include <vector> class cmGeneratorTarget; @@ -70,10 +71,10 @@ protected: void ComplainAboutMissingTarget(cmGeneratorTarget* depender, cmGeneratorTarget* dependee, - int occurrences); + std::vector<std::string> const& exportFiles); - std::vector<std::string> FindNamespaces(cmGlobalGenerator* gg, - const std::string& name); + std::pair<std::vector<std::string>, std::string> FindNamespaces( + cmGlobalGenerator* gg, const std::string& name); /** Generate the relative import prefix. */ virtual void GenerateImportPrefix(std::ostream&); diff --git a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt index f2f0f94..c663707 100644 --- a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt @@ -1 +1 @@ -CMake Error: install\(EXPORT "exp" ...\) includes target "UseA" which requires target "A" that is not in the export set. +CMake Error: install\(EXPORT "exp" ...\) includes target "UseA" which requires target "A" that is not in any export set. diff --git a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt index 6bb44ab..3204225 100644 --- a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt +++ b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt @@ -1 +1 @@ -CMake Error: install\(EXPORT "Exp" ...\) includes target "foo" which requires target "not_exported" that is not in the export set. +CMake Error: install\(EXPORT "Exp" ...\) includes target "foo" which requires target "not_exported" that is not in any export set. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=be7807478c463c5c875798a3e2e72e148c0d0c3e commit be7807478c463c5c875798a3e2e72e148c0d0c3e Author: Brad King <brad.k...@kitware.com> AuthorDate: Thu Aug 8 14:50:09 2019 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Tue Aug 20 09:36:45 2019 -0400 cmDefinitions: Reduce allocation of keys and values in MakeClosure Use `cm::String` to store keys and values so that `MakeClosure` does not need to allocate new copies of all of them. Issue: #19581 diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index cc38d84..e688890 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -17,7 +17,7 @@ cmDefinitions::Def const& cmDefinitions::GetInternal(const std::string& key, { assert(begin != end); { - auto it = begin->Map.find(key); + auto it = begin->Map.find(cm::String::borrow(key)); if (it != begin->Map.end()) { it->second.Used = true; return it->second; @@ -39,7 +39,7 @@ const std::string* cmDefinitions::Get(const std::string& key, StackIter begin, StackIter end) { Def const& def = cmDefinitions::GetInternal(key, begin, end, false); - return def.Exists ? &def.Value : nullptr; + return def.Value ? def.Value.str_if_stable() : nullptr; } void cmDefinitions::Raise(const std::string& key, StackIter begin, @@ -52,7 +52,7 @@ bool cmDefinitions::HasKey(const std::string& key, StackIter begin, StackIter end) { for (StackIter it = begin; it != end; ++it) { - if (it->Map.find(key) != it->Map.end()) { + if (it->Map.find(cm::String::borrow(key)) != it->Map.end()) { return true; } } @@ -68,11 +68,11 @@ cmDefinitions cmDefinitions::MakeClosure(StackIter begin, StackIter end) for (auto const& mi : it->Map) { // Use this key if it is not already set or unset. if (closure.Map.find(mi.first) == closure.Map.end() && - undefined.find(mi.first) == undefined.end()) { - if (mi.second.Exists) { + undefined.find(mi.first.view()) == undefined.end()) { + if (mi.second.Value) { closure.Map.insert(mi); } else { - undefined.emplace(mi.first); + undefined.emplace(mi.first.view()); } } } @@ -90,8 +90,8 @@ std::vector<std::string> cmDefinitions::ClosureKeys(StackIter begin, defined.reserve(defined.size() + it->Map.size()); for (auto const& mi : it->Map) { // Use this key if it is not already set or unset. - if (bound.emplace(mi.first).second && mi.second.Exists) { - defined.push_back(mi.first); + if (bound.emplace(mi.first.view()).second && mi.second.Value) { + defined.push_back(*mi.first.str_if_stable()); } } } @@ -116,7 +116,7 @@ std::vector<std::string> cmDefinitions::UnusedKeys() const // Consider local definitions. for (auto const& mi : this->Map) { if (!mi.second.Used) { - keys.push_back(mi.first); + keys.push_back(*mi.first.str_if_stable()); } } return keys; diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 787471a..b4d6419 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -8,7 +8,9 @@ #include "cm_string_view.hxx" #include "cmLinkedTree.h" +#include "cmString.hxx" +#include <functional> #include <string> #include <unordered_map> #include <vector> @@ -57,16 +59,14 @@ private: Def() = default; Def(cm::string_view value) : Value(value) - , Exists(true) { } - std::string Value; - bool Exists = false; + cm::String Value; bool Used = false; }; static Def NoDef; - std::unordered_map<std::string, Def> Map; + std::unordered_map<cm::String, Def> Map; static Def const& GetInternal(const std::string& key, StackIter begin, StackIter end, bool raise); diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 9f761ed..78facf8 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -19,11 +19,11 @@ #include "cmState.h" #include "cmStateSnapshot.h" #include "cmStateTypes.h" +#include "cmString.hxx" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cm_static_string_view.hxx" -#include "cm_string_view.hxx" #include "cmake.h" #include "cmsys/RegularExpression.hxx" https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e07e2bc8bbf25178270e8086575ff398dd1fa0c6 commit e07e2bc8bbf25178270e8086575ff398dd1fa0c6 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Aug 19 15:33:06 2019 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Tue Aug 20 09:36:45 2019 -0400 bootstrap: Compile cm::String diff --git a/bootstrap b/bootstrap index c7e3945..eaccfc8 100755 --- a/bootstrap +++ b/bootstrap @@ -423,6 +423,7 @@ CMAKE_CXX_SOURCES="\ cmState \ cmStateDirectory \ cmStateSnapshot \ + cmString \ cmStringAlgorithms \ cmStringReplaceHelper \ cmStringCommand \ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c1787cb5eb82ad815a824f88d4cc636e949fae73 commit c1787cb5eb82ad815a824f88d4cc636e949fae73 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Aug 20 08:55:03 2019 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Tue Aug 20 09:36:45 2019 -0400 cpack.cxx: Re-order include blocks to follow our conventions diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 3cf0c10..5abf0ab 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -1,20 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmsys/CommandLineArguments.hxx" -#include "cmsys/Encoding.hxx" -#include <iostream> -#include <map> -#include <sstream> -#include <stddef.h> -#include <string> -#include <utility> -#include <vector> - -#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP) -# include "cmsys/ConsoleBuf.hxx" -#endif - #include "cmCPackGenerator.h" #include "cmCPackGeneratorFactory.h" #include "cmCPackLog.h" @@ -29,6 +15,21 @@ #include "cmSystemTools.h" #include "cmake.h" +#include "cmsys/CommandLineArguments.hxx" +#include "cmsys/Encoding.hxx" + +#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP) +# include "cmsys/ConsoleBuf.hxx" +#endif + +#include <iostream> +#include <map> +#include <sstream> +#include <stddef.h> +#include <string> +#include <utility> +#include <vector> + namespace { const char* cmDocumentationName[][2] = { { nullptr, " cpack - Packaging driver provided by CMake." }, https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=141e3074845675d37a8c7f7c3efcc09d0ab5158c commit 141e3074845675d37a8c7f7c3efcc09d0ab5158c Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Aug 19 15:39:02 2019 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Tue Aug 20 09:36:45 2019 -0400 cmConfigure.h: Tell windows.h not to define min/max macros diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index 19b1cd4..4de1c5d 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -26,4 +26,8 @@ #define CM_FALLTHROUGH cmsys_FALLTHROUGH +#if defined(_WIN32) && !defined(NOMINMAX) +# define NOMINMAX +#endif + #endif diff --git a/bootstrap b/bootstrap index 4581239..c7e3945 100755 --- a/bootstrap +++ b/bootstrap @@ -1364,6 +1364,12 @@ cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insall cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\"" cmake_report cmConfigure.h${_tmp} "#define CM_FALLTHROUGH" +if ${cmake_system_mingw}; then + cmake_report cmConfigure.h${_tmp} "#if defined(_WIN32) && !defined(NOMINMAX)" + cmake_report cmConfigure.h${_tmp} "# define NOMINMAX" + cmake_report cmConfigure.h${_tmp} "#endif" +fi + # Regenerate configured headers for h in Configure VersionConfig; do if "${_diff}" cm${h}.h cm${h}.h${_tmp} > /dev/null 2> /dev/null; then https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a18100898ae5188883acab295179c6758e84f496 commit a18100898ae5188883acab295179c6758e84f496 Author: Ben Boeckel <ben.boec...@kitware.com> AuthorDate: Mon Aug 19 14:17:17 2019 -0400 Commit: Ben Boeckel <ben.boec...@kitware.com> CommitDate: Mon Aug 19 14:17:17 2019 -0400 cmInstallExportGenerator: add a method for the file destination This will be used in the error message which remarks about a target being exported ambiguously into different installations. diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index af06b9d..5412af3 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -218,3 +218,8 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os, false, this->FilePermissions.c_str(), nullptr, nullptr, nullptr, indent); } + +std::string cmInstallExportGenerator::GetDestinationFile() const +{ + return this->Destination + '/' + this->FileName; +} diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index c4d252c..e680066 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -41,6 +41,7 @@ public: const std::string& GetNamespace() const { return this->Namespace; } std::string const& GetDestination() const { return this->Destination; } + std::string GetDestinationFile() const; protected: void GenerateScript(std::ostream& os) override; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2dfc52675c3ea732bd389852675e680e296415cb commit 2dfc52675c3ea732bd389852675e680e296415cb Author: Regina Pfeifer <reg...@mailbox.org> AuthorDate: Mon Aug 19 14:31:52 2019 +0200 Commit: Regina Pfeifer <reg...@mailbox.org> CommitDate: Mon Aug 19 20:01:39 2019 +0200 cmAlgorithms: Add cmContains Also, use the new function where applicable. diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 458a335..64eded5 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmCPackWIXGenerator.h" +#include "cmAlgorithms.h" #include "cmCPackComponentGroup.h" #include "cmCPackLog.h" #include "cmCryptoHash.h" @@ -942,9 +943,7 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitions( shortcut.workingDirectoryId = directoryId; shortcuts.insert(cmWIXShortcuts::START_MENU, id, shortcut); - if (!desktopExecutables.empty() && - std::find(desktopExecutables.begin(), desktopExecutables.end(), - executableName) != desktopExecutables.end()) { + if (cmContains(desktopExecutables, executableName)) { shortcuts.insert(cmWIXShortcuts::DESKTOP, id, shortcut); } } diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index cfa34dc..5440a6b 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmCPackNSISGenerator.h" +#include "cmAlgorithms.h" #include "cmCPackComponentGroup.h" #include "cmCPackGenerator.h" #include "cmCPackLog.h" @@ -501,10 +502,7 @@ int cmCPackNSISGenerator::InitializeInternal() << ".lnk\"" << std::endl; // see if CPACK_CREATE_DESKTOP_LINK_ExeName is on // if so add a desktop link - if (!cpackPackageDesktopLinksVector.empty() && - std::find(cpackPackageDesktopLinksVector.begin(), - cpackPackageDesktopLinksVector.end(), - execName) != cpackPackageDesktopLinksVector.end()) { + if (cmContains(cpackPackageDesktopLinksVector, execName)) { str << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n"; str << " CreateShortCut \"$DESKTOP\\" << linkName << R"(.lnk" "$INSTDIR\)" << cpackNsisExecutablesDirectory << "\\" diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index ae965ea..2d07420 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -173,8 +173,7 @@ bool cmCTestMultiProcessHandler::StartTestProcess(int test) // Find any failed dependencies for this test. We assume the more common // scenario has no failed tests, so make it the outer loop. for (std::string const& f : *this->Failed) { - if (this->Properties[test]->RequireSuccessDepends.find(f) != - this->Properties[test]->RequireSuccessDepends.end()) { + if (cmContains(this->Properties[test]->RequireSuccessDepends, f)) { testRun->AddFailedDependency(f); } } @@ -275,7 +274,7 @@ bool cmCTestMultiProcessHandler::StartTest(int test) { // Check for locked resources for (std::string const& i : this->Properties[test]->LockedResources) { - if (this->LockedResources.find(i) != this->LockedResources.end()) { + if (cmContains(this->LockedResources, i)) { return false; } } @@ -621,9 +620,7 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList() // In parallel test runs add previously failed tests to the front // of the cost list and queue other tests for further sorting for (auto const& t : this->Tests) { - if (std::find(this->LastTestsFailed.begin(), this->LastTestsFailed.end(), - this->Properties[t.first]->Name) != - this->LastTestsFailed.end()) { + if (cmContains(this->LastTestsFailed, this->Properties[t.first]->Name)) { // If the test failed last time, it should be run first. this->SortedTests.push_back(t.first); alreadySortedTests.insert(t.first); @@ -662,7 +659,7 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList() TestComparator(this)); for (auto const& j : sortedCopy) { - if (alreadySortedTests.find(j) == alreadySortedTests.end()) { + if (!cmContains(alreadySortedTests, j)) { this->SortedTests.push_back(j); alreadySortedTests.insert(j); } @@ -694,7 +691,7 @@ void cmCTestMultiProcessHandler::CreateSerialTestCostList() TestSet alreadySortedTests; for (int test : presortedList) { - if (alreadySortedTests.find(test) != alreadySortedTests.end()) { + if (cmContains(alreadySortedTests, test)) { continue; } @@ -702,8 +699,7 @@ void cmCTestMultiProcessHandler::CreateSerialTestCostList() GetAllTestDependencies(test, dependencies); for (int testDependency : dependencies) { - if (alreadySortedTests.find(testDependency) == - alreadySortedTests.end()) { + if (!cmContains(alreadySortedTests, testDependency)) { alreadySortedTests.insert(testDependency); this->SortedTests.push_back(testDependency); } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index a3c480a..32d1d5c 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -20,6 +20,7 @@ #include "cm_memory.hxx" +#include "cmAlgorithms.h" #include "cmCTest.h" #include "cmCTestMultiProcessHandler.h" #include "cmCommand.h" @@ -715,7 +716,7 @@ void cmCTestTestHandler::PrintLabelOrSubprojectSummary(bool doSubProject) cmCTestTestProperties& p = *result.Properties; for (std::string const& l : p.Labels) { // only use labels found in labels - if (labels.find(l) != labels.end()) { + if (cmContains(labels, l)) { labelTimes[l] += result.ExecutionTime.count() * result.Properties->Processors; ++labelCounts[l]; @@ -857,17 +858,14 @@ void cmCTestTestHandler::ComputeTestList() if (this->UseUnion) { // if it is not in the list and not in the regexp then skip - if ((!this->TestsToRun.empty() && - std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt) == - this->TestsToRun.end()) && + if ((!this->TestsToRun.empty() && !cmContains(this->TestsToRun, cnt)) && !tp.IsInBasedOnREOptions) { continue; } } else { // is this test in the list of tests to run? If not then skip it if ((!this->TestsToRun.empty() && - std::find(this->TestsToRun.begin(), this->TestsToRun.end(), - inREcnt) == this->TestsToRun.end()) || + !cmContains(this->TestsToRun, inREcnt)) || !tp.IsInBasedOnREOptions) { continue; } @@ -896,9 +894,7 @@ void cmCTestTestHandler::ComputeTestListForRerunFailed() cnt++; // if this test is not in our list of tests to run, then skip it. - if ((!this->TestsToRun.empty() && - std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt) == - this->TestsToRun.end())) { + if ((!this->TestsToRun.empty() && !cmContains(TestsToRun, cnt))) { continue; } @@ -1019,8 +1015,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const sIt != setupRange.second; ++sIt) { const std::string& setupTestName = sIt->second->Name; tests[i].RequireSuccessDepends.insert(setupTestName); - if (std::find(tests[i].Depends.begin(), tests[i].Depends.end(), - setupTestName) == tests[i].Depends.end()) { + if (!cmContains(tests[i].Depends, setupTestName)) { tests[i].Depends.push_back(setupTestName); } } @@ -1127,8 +1122,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const const std::vector<size_t>& indices = cIt->second; for (size_t index : indices) { const std::string& reqTestName = tests[index].Name; - if (std::find(p.Depends.begin(), p.Depends.end(), reqTestName) == - p.Depends.end()) { + if (!cmContains(p.Depends, reqTestName)) { p.Depends.push_back(reqTestName); } } @@ -1141,8 +1135,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const const std::vector<size_t>& indices = cIt->second; for (size_t index : indices) { const std::string& setupTestName = tests[index].Name; - if (std::find(p.Depends.begin(), p.Depends.end(), setupTestName) == - p.Depends.end()) { + if (!cmContains(p.Depends, setupTestName)) { p.Depends.push_back(setupTestName); } } diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index d7ea483..59aa86f 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -14,6 +14,16 @@ #include <utility> #include <vector> +template <std::size_t N> +struct cmOverloadPriority : cmOverloadPriority<N - 1> +{ +}; + +template <> +struct cmOverloadPriority<0> +{ +}; + template <typename FwdIt> FwdIt cmRotate(FwdIt first, FwdIt middle, FwdIt last) { @@ -30,6 +40,34 @@ void cmEraseIf(Container& cont, Predicate pred) cont.erase(std::remove_if(cont.begin(), cont.end(), pred), cont.end()); } +template <typename Range, typename Key> +auto cmContainsImpl(Range const& range, Key const& key, cmOverloadPriority<2>) + -> decltype(range.exists(key)) +{ + return range.exists(key); +} + +template <typename Range, typename Key> +auto cmContainsImpl(Range const& range, Key const& key, cmOverloadPriority<1>) + -> decltype(range.find(key) != range.end()) +{ + return range.find(key) != range.end(); +} + +template <typename Range, typename Key> +bool cmContainsImpl(Range const& range, Key const& key, cmOverloadPriority<0>) +{ + using std::begin; + using std::end; + return std::find(begin(range), end(range), key) != end(range); +} + +template <typename Range, typename Key> +bool cmContains(Range const& range, Key const& key) +{ + return cmContainsImpl(range, key, cmOverloadPriority<2>{}); +} + namespace ContainerAlgorithms { template <typename T> @@ -176,7 +214,7 @@ ForwardIterator cmRemoveDuplicates(ForwardIterator first, ForwardIterator last) ForwardIterator result = first; while (first != last) { - if (uniq.find(first) == uniq.end()) { + if (!cmContains(uniq, first)) { if (result != first) { *result = std::move(*first); } diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 5f5317c..8387aa7 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmComputeLinkInformation.h" +#include "cmAlgorithms.h" #include "cmComputeLinkDepends.h" #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" @@ -553,7 +554,7 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang) std::vector<std::string> libsVec; cmExpandList(libs, libsVec); for (std::string const& i : libsVec) { - if (this->ImplicitLinkLibs.find(i) == this->ImplicitLinkLibs.end()) { + if (!cmContains(this->ImplicitLinkLibs, i)) { this->AddItem(i, nullptr); } } @@ -998,8 +999,8 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item, // For compatibility with CMake 2.4 include the item's directory in // the linker search path. if (this->OldLinkDirMode && !target->IsFrameworkOnApple() && - this->OldLinkDirMask.find(cmSystemTools::GetFilenamePath(item)) == - this->OldLinkDirMask.end()) { + !cmContains(this->OldLinkDirMask, + cmSystemTools::GetFilenamePath(item))) { this->OldLinkDirItems.push_back(item); } @@ -1052,8 +1053,8 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item) // For compatibility with CMake 2.4 include the item's directory in // the linker search path. if (this->OldLinkDirMode && - this->OldLinkDirMask.find(cmSystemTools::GetFilenamePath(item)) == - this->OldLinkDirMask.end()) { + !cmContains(this->OldLinkDirMask, + cmSystemTools::GetFilenamePath(item))) { this->OldLinkDirItems.push_back(item); } @@ -1072,7 +1073,7 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item) // Check if this item is in an implicit link directory. std::string dir = cmSystemTools::GetFilenamePath(item); - if (this->ImplicitLinkDirs.find(dir) == this->ImplicitLinkDirs.end()) { + if (!cmContains(this->ImplicitLinkDirs, dir)) { // Only libraries in implicit link directories are converted to // pathless items. return false; diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 3a53067..008528b 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -3,7 +3,6 @@ #include "cmConditionEvaluator.h" #include "cmsys/RegularExpression.hxx" -#include <algorithm> #include <functional> #include <sstream> #include <stdio.h> @@ -672,7 +671,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs, std::vector<std::string> list; cmExpandList(def2, list, true); - result = std::find(list.begin(), list.end(), def) != list.end(); + result = cmContains(list, def); } this->HandleBinaryOp(result, reducible, arg, newArgs, argP1, argP2); diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx index 22cc0bc..9b1e15e 100644 --- a/Source/cmExportBuildAndroidMKGenerator.cxx +++ b/Source/cmExportBuildAndroidMKGenerator.cxx @@ -2,10 +2,10 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmExportBuildAndroidMKGenerator.h" -#include <algorithm> #include <sstream> #include <utility> +#include "cmAlgorithms.h" #include "cmGeneratorTarget.h" #include "cmLinkItem.h" #include "cmMakefile.h" @@ -167,8 +167,7 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( // Tell the NDK build system if prebuilt static libraries use C++. if (target->GetType() == cmStateEnums::STATIC_LIBRARY) { cmLinkImplementation const* li = target->GetLinkImplementation(config); - if (std::find(li->Languages.begin(), li->Languages.end(), "CXX") != - li->Languages.end()) { + if (cmContains(li->Languages, "CXX")) { os << "LOCAL_HAS_CPP := true\n"; } } diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 33806f2..dee50ac 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -16,7 +16,6 @@ #include "cmTargetExport.h" #include "cmake.h" -#include <algorithm> #include <map> #include <set> #include <sstream> @@ -306,7 +305,7 @@ cmExportBuildFileGenerator::FindBuildExportInfo(cmGlobalGenerator* gg, const cmExportBuildFileGenerator* exportSet = exp.second; std::vector<std::string> targets; exportSet->GetTargets(targets); - if (std::find(targets.begin(), targets.end(), name) != targets.end()) { + if (cmContains(targets, name)) { exportFiles.push_back(exp.first); ns = exportSet->GetNamespace(); } diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index a849aa2..598eafe 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -5,11 +5,11 @@ #include "cm_static_string_view.hxx" #include "cmsys/RegularExpression.hxx" -#include <algorithm> #include <map> #include <sstream> #include <utility> +#include "cmAlgorithms.h" #include "cmArgumentParser.h" #include "cmExportBuildAndroidMKGenerator.h" #include "cmExportBuildFileGenerator.h" @@ -133,9 +133,7 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args, } ExportSet = it->second; } else if (!arguments.Targets.empty() || - std::find(keywordsMissingValue.begin(), - keywordsMissingValue.end(), - "TARGETS") != keywordsMissingValue.end()) { + cmContains(keywordsMissingValue, "TARGETS")) { for (std::string const& currentTarget : arguments.Targets) { if (this->Makefile->IsAlias(currentTarget)) { std::ostringstream e; diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 53bc3cd..12ea2ef 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -306,10 +306,7 @@ static const struct InListNode : public cmGeneratorExpressionNode break; } - return std::find(values.cbegin(), values.cend(), parameters.front()) == - values.cend() - ? "0" - : "1"; + return cmContains(values, parameters.front()) ? "1" : "0"; } } inListNode; @@ -915,9 +912,8 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode if (const char* mapValue = context->CurrentTarget->GetProperty(mapProp)) { cmExpandList(cmSystemTools::UpperCase(mapValue), mappedConfigs); - return std::find(mappedConfigs.begin(), mappedConfigs.end(), - cmSystemTools::UpperCase(parameters.front())) != - mappedConfigs.end() + return cmContains(mappedConfigs, + cmSystemTools::UpperCase(parameters.front())) ? "1" : "0"; } @@ -1510,8 +1506,7 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode const char* standardDefault = context->LG->GetMakefile()->GetDefinition( "CMAKE_" + lit.first + "_STANDARD_DEFAULT"); for (std::string const& it : lit.second) { - if (std::find(langAvailable.begin(), langAvailable.end(), it) == - langAvailable.end()) { + if (!cmContains(langAvailable, it)) { return "0"; } if (standardDefault && !*standardDefault) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 9412d82..932dd41 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1421,9 +1421,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths( cmExpandList(debugProp, debugProperties); } - bool debugSources = !this->DebugSourcesDone && - std::find(debugProperties.begin(), debugProperties.end(), "SOURCES") != - debugProperties.end(); + bool debugSources = + !this->DebugSourcesDone && cmContains(debugProperties, "SOURCES"); if (this->LocalGenerator->GetGlobalGenerator()->GetConfigureDoneCMP0026()) { this->DebugSourcesDone = true; @@ -2647,7 +2646,7 @@ cmTargetTraceDependencies::cmTargetTraceDependencies(cmGeneratorTarget* target) for (cmSourceFile* sf : sources) { const std::set<cmGeneratorTarget const*> tgts = this->GlobalGenerator->GetFilenameTargetDepends(sf); - if (tgts.find(this->GeneratorTarget) != tgts.end()) { + if (cmContains(tgts, this->GeneratorTarget)) { std::ostringstream e; e << "Evaluation output file\n \"" << sf->GetFullPath() << "\"\ndepends on the sources of a target it is used in. This " @@ -3072,8 +3071,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories( } bool debugIncludes = !this->DebugIncludesDone && - std::find(debugProperties.begin(), debugProperties.end(), - "INCLUDE_DIRECTORIES") != debugProperties.end(); + cmContains(debugProperties, "INCLUDE_DIRECTORIES"); if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { this->DebugIncludesDone = true; @@ -3183,8 +3181,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileOptions( } bool debugOptions = !this->DebugCompileOptionsDone && - std::find(debugProperties.begin(), debugProperties.end(), - "COMPILE_OPTIONS") != debugProperties.end(); + cmContains(debugProperties, "COMPILE_OPTIONS"); if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { this->DebugCompileOptionsDone = true; @@ -3230,8 +3227,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileFeatures( } bool debugFeatures = !this->DebugCompileFeaturesDone && - std::find(debugProperties.begin(), debugProperties.end(), - "COMPILE_FEATURES") != debugProperties.end(); + cmContains(debugProperties, "COMPILE_FEATURES"); if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { this->DebugCompileFeaturesDone = true; @@ -3279,8 +3275,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions( } bool debugDefines = !this->DebugCompileDefinitionsDone && - std::find(debugProperties.begin(), debugProperties.end(), - "COMPILE_DEFINITIONS") != debugProperties.end(); + cmContains(debugProperties, "COMPILE_DEFINITIONS"); if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { this->DebugCompileDefinitionsDone = true; @@ -3353,9 +3348,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions( cmExpandList(debugProp, debugProperties); } - bool debugOptions = !this->DebugLinkOptionsDone && - std::find(debugProperties.begin(), debugProperties.end(), - "LINK_OPTIONS") != debugProperties.end(); + bool debugOptions = + !this->DebugLinkOptionsDone && cmContains(debugProperties, "LINK_OPTIONS"); if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { this->DebugLinkOptionsDone = true; @@ -3612,8 +3606,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDirectories( } bool debugDirectories = !this->DebugLinkDirectoriesDone && - std::find(debugProperties.begin(), debugProperties.end(), - "LINK_DIRECTORIES") != debugProperties.end(); + cmContains(debugProperties, "LINK_DIRECTORIES"); if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { this->DebugLinkDirectoriesDone = true; @@ -4784,9 +4777,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, PropertyType propContent = getTypedProperty<PropertyType>(tgt, p); std::vector<std::string> headPropKeys = tgt->GetPropertyKeys(); - const bool explicitlySet = - std::find(headPropKeys.begin(), headPropKeys.end(), p) != - headPropKeys.end(); + const bool explicitlySet = cmContains(headPropKeys, p); const bool impliedByUse = tgt->IsNullImpliedByLinkLibraries(p); assert((impliedByUse ^ explicitlySet) || (!impliedByUse && !explicitlySet)); @@ -4826,8 +4817,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, std::vector<std::string> propKeys = theTarget->GetPropertyKeys(); - const bool ifaceIsSet = std::find(propKeys.begin(), propKeys.end(), - interfaceProperty) != propKeys.end(); + const bool ifaceIsSet = cmContains(propKeys, interfaceProperty); PropertyType ifacePropContent = getTypedProperty<PropertyType>( theTarget, interfaceProperty, genexInterpreter.get()); @@ -5112,9 +5102,8 @@ void cmGeneratorTarget::ReportPropertyOrigin( cmExpandList(debugProp, debugProperties); } - bool debugOrigin = !this->DebugCompatiblePropertiesDone[p] && - std::find(debugProperties.begin(), debugProperties.end(), p) != - debugProperties.end(); + bool debugOrigin = + !this->DebugCompatiblePropertiesDone[p] && cmContains(debugProperties, p); if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { this->DebugCompatiblePropertiesDone[p] = true; @@ -6226,8 +6215,7 @@ cmGeneratorTarget::GetLinkImplementationLibrariesInternal( bool cmGeneratorTarget::IsNullImpliedByLinkLibraries( const std::string& p) const { - return this->LinkImplicitNullProperties.find(p) != - this->LinkImplicitNullProperties.end(); + return cmContains(this->LinkImplicitNullProperties, p); } void cmGeneratorTarget::ComputeLinkImplementationLibraries( diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 86fcae0..5791137 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -368,8 +368,7 @@ bool cmGlobalGenerator::IsExportedTargetsFile( if (it == this->BuildExportSets.end()) { return false; } - return this->BuildExportExportSets.find(filename) == - this->BuildExportExportSets.end(); + return !cmContains(this->BuildExportExportSets, filename); } // Find the make program for the generator, required for try compiles @@ -497,7 +496,7 @@ void cmGlobalGenerator::EnableLanguage( if (lang == "NONE") { this->SetLanguageEnabled("NONE", mf); } else { - if (this->LanguagesReady.find(lang) == this->LanguagesReady.end()) { + if (!cmContains(this->LanguagesReady, lang)) { std::ostringstream e; e << "The test project needs language " << lang << " which is not enabled."; @@ -1097,8 +1096,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l, { // use LanguageToLinkerPreference to detect whether this functions has // run before - if (this->LanguageToLinkerPreference.find(l) != - this->LanguageToLinkerPreference.end()) { + if (cmContains(this->LanguageToLinkerPreference, l)) { return; } @@ -2153,7 +2151,7 @@ void cmGlobalGenerator::AddAlias(const std::string& name, bool cmGlobalGenerator::IsAlias(const std::string& name) const { - return this->AliasTargets.find(name) != this->AliasTargets.end(); + return cmContains(this->AliasTargets, name); } void cmGlobalGenerator::IndexTarget(cmTarget* t) @@ -2703,8 +2701,7 @@ bool cmGlobalGenerator::IsReservedTarget(std::string const& name) "clean", "edit_cache", "rebuild_cache", "ZERO_CHECK" }; - return std::find(cm::cbegin(reservedTargets), cm::cend(reservedTargets), - name) != cm::cend(reservedTargets); + return cmContains(reservedTargets, name); } void cmGlobalGenerator::SetExternalMakefileProjectGenerator( diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 4db829f..c719ff5 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmGlobalGhsMultiGenerator.h" +#include "cmAlgorithms.h" #include "cmDocumentationEntry.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorTarget.h" @@ -589,16 +590,14 @@ cmGlobalGhsMultiGenerator::GenerateBuildCommand( /* if multiple top-projects are found in build directory * then prefer projectName top-project. */ - auto p = std::find(files.begin(), files.end(), proj); - if (p == files.end()) { + if (!cmContains(files, proj)) { proj = files.at(0); } } makeCommand.Add("-top", proj); if (!targetNames.empty()) { - if (std::find(targetNames.begin(), targetNames.end(), "clean") != - targetNames.end()) { + if (cmContains(targetNames, "clean")) { makeCommand.Add("-clean"); } else { for (const auto& tname : targetNames) { diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 29caa16..a457911 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -571,8 +571,7 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures() bool cmGlobalNinjaGenerator::CheckLanguages( std::vector<std::string> const& languages, cmMakefile* mf) const { - if (std::find(languages.begin(), languages.end(), "Fortran") != - languages.end()) { + if (cmContains(languages, "Fortran")) { return this->CheckFortran(mf); } return true; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 19e64e4..584c5fb 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -354,8 +354,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( projectArg += "proj"; makeCommand.Add(projectArg); } - if (std::find(targetNames.begin(), targetNames.end(), "clean") != - targetNames.end()) { + if (cmContains(targetNames, "clean")) { makeCommand.Add("clean"); makeCommand.Add("-target", "ALL_BUILD"); } else { @@ -903,8 +902,7 @@ void cmGlobalXCodeGenerator::AddXCodeProjBuildRule( target->GetLocalGenerator()->GetCurrentSourceDirectory(); listfile += "/CMakeLists.txt"; cmSourceFile* srcCMakeLists = target->Makefile->GetOrCreateSource(listfile); - if (std::find(sources.begin(), sources.end(), srcCMakeLists) == - sources.end()) { + if (!cmContains(sources, srcCMakeLists)) { sources.push_back(srcCMakeLists); } } @@ -1417,10 +1415,8 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt) bool cmGlobalXCodeGenerator::IsHeaderFile(cmSourceFile* sf) { - const std::vector<std::string>& hdrExts = - this->CMakeInstance->GetHeaderExtensions(); - return (std::find(hdrExts.begin(), hdrExts.end(), sf->GetExtension()) != - hdrExts.end()); + return cmContains(this->CMakeInstance->GetHeaderExtensions(), + sf->GetExtension()); } cmXCodeObject* cmGlobalXCodeGenerator::CreateBuildPhase( diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h index d71ff49..2d9378b 100644 --- a/Source/cmLinkItem.h +++ b/Source/cmLinkItem.h @@ -5,12 +5,12 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include <algorithm> #include <map> #include <ostream> #include <string> #include <vector> +#include "cmAlgorithms.h" #include "cmListFileCache.h" #include "cmSystemTools.h" #include "cmTargetLinkLibraryType.h" @@ -120,8 +120,7 @@ inline cmTargetLinkLibraryType CMP0003_ComputeLinkType( // Check if any entry in the list matches this configuration. std::string configUpper = cmSystemTools::UpperCase(config); - if (std::find(debugConfigs.begin(), debugConfigs.end(), configUpper) != - debugConfigs.end()) { + if (cmContains(debugConfigs, configUpper)) { return DEBUG_LibraryType; } // The current configuration is not a debug configuration. diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx index 7cacb24..bc8292a 100644 --- a/Source/cmLinkLineDeviceComputer.cxx +++ b/Source/cmLinkLineDeviceComputer.cxx @@ -3,12 +3,11 @@ #include "cmLinkLineDeviceComputer.h" -#include <algorithm> #include <set> #include <sstream> #include <utility> -#include <vector> +#include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" @@ -187,14 +186,10 @@ bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg, // Determine if we have any dependencies that require // us to do a device link step - const std::string cuda_lang("CUDA"); cmGeneratorTarget::LinkClosure const* closure = target.GetLinkClosure(config); - bool closureHasCUDA = - (std::find(closure->Languages.begin(), closure->Languages.end(), - cuda_lang) != closure->Languages.end()); - if (closureHasCUDA) { + if (cmContains(closure->Languages, "CUDA")) { cmComputeLinkInformation* pcli = target.GetLinkInformation(config); if (pcli) { cmLinkLineDeviceComputer deviceLinkComputer( diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index cbb1d3a..9a6653f 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -121,7 +121,7 @@ bool cmListCommand::GetList(std::vector<std::string>& list, // expand the variable into a list cmExpandList(listString, list, true); // if no empty elements then just return - if (std::find(list.begin(), list.end(), std::string()) == list.end()) { + if (!cmContains(list, std::string())) { return true; } // if we have empty elements we need to check policy CMP0007 diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index c3cfc5f..cdb2947 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -996,8 +996,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit( // directly. In this case adding -I/usr/include can hide SDK headers so we // must still exclude it. if ((lang == "C" || lang == "CXX" || lang == "CUDA") && - std::find(impDirVec.begin(), impDirVec.end(), "/usr/include") == - impDirVec.end() && + !cmContains(impDirVec, "/usr/include") && std::find_if(impDirVec.begin(), impDirVec.end(), [](std::string const& d) { return cmHasLiteralSuffix(d, "/usr/include"); @@ -1018,15 +1017,13 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit( &lang](std::string const& dir) { return ( // Do not exclude directories that are not in an excluded set. - ((implicitSet.find(cmSystemTools::GetRealPath(dir)) == - implicitSet.end()) && - (implicitExclude.find(dir) == implicitExclude.end())) + ((!cmContains(implicitSet, cmSystemTools::GetRealPath(dir))) && + (!cmContains(implicitExclude, dir))) // Do not exclude entries of the CPATH environment variable even though // they are implicitly searched by the compiler. They are meant to be // user-specified directories that can be re-ordered or converted to // -isystem without breaking real compiler builtin headers. - || ((lang == "C" || lang == "CXX") && - (this->EnvCPATH.find(dir) != this->EnvCPATH.end()))); + || ((lang == "C" || lang == "CXX") && cmContains(this->EnvCPATH, dir))); }; // Get the target-specific include directories. @@ -1073,8 +1070,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit( if (!stripImplicitDirs) { // Append implicit directories that were requested by the user only for (BT<std::string> const& udr : userDirs) { - if (implicitSet.find(cmSystemTools::GetRealPath(udr.Value)) != - implicitSet.end()) { + if (cmContains(implicitSet, cmSystemTools::GetRealPath(udr.Value))) { emitBT(udr); } } diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 3d76396..630fb54 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1540,9 +1540,8 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo( const std::string& linkLanguage = gt->GetLinkerLanguage(config.c_str()); // If HEADER_FILE_ONLY is set, we must suppress this generation in // the project file - fc.ExcludedFromBuild = sf.GetPropertyAsBool("HEADER_FILE_ONLY") || - std::find(acs.Configs.begin(), acs.Configs.end(), ci) == - acs.Configs.end(); + fc.ExcludedFromBuild = + sf.GetPropertyAsBool("HEADER_FILE_ONLY") || !cmContains(acs.Configs, ci); if (fc.ExcludedFromBuild) { needfc = true; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 657c3bf..53816d2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1583,7 +1583,7 @@ void cmMakefile::Configure() allowedCommands.insert("message"); isProblem = false; for (cmListFileFunction const& func : listFile.Functions) { - if (allowedCommands.find(func.Name.Lower) == allowedCommands.end()) { + if (!cmContains(allowedCommands, func.Name.Lower)) { isProblem = true; break; } @@ -4012,7 +4012,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name, bool cmMakefile::IsAlias(const std::string& name) const { - if (this->AliasTargets.find(name) != this->AliasTargets.end()) { + if (cmContains(this->AliasTargets, name)) { return true; } return this->GetGlobalGenerator()->IsAlias(name); @@ -4379,8 +4379,7 @@ bool cmMakefile::AddRequiredTargetFeature(cmTarget* target, std::vector<std::string> availableFeatures; cmExpandList(features, availableFeatures); - if (std::find(availableFeatures.begin(), availableFeatures.end(), feature) == - availableFeatures.end()) { + if (!cmContains(availableFeatures, feature)) { std::ostringstream e; e << "The compiler feature \"" << feature << "\" is not known to " << lang << " compiler\n\"" @@ -4649,31 +4648,31 @@ void cmMakefile::CheckNeededCxxLanguage(const std::string& feature, this->GetDefinition("CMAKE_CXX98_COMPILE_FEATURES")) { std::vector<std::string> props; cmExpandList(propCxx98, props); - needCxx98 = std::find(props.begin(), props.end(), feature) != props.end(); + needCxx98 = cmContains(props, feature); } if (const char* propCxx11 = this->GetDefinition("CMAKE_CXX11_COMPILE_FEATURES")) { std::vector<std::string> props; cmExpandList(propCxx11, props); - needCxx11 = std::find(props.begin(), props.end(), feature) != props.end(); + needCxx11 = cmContains(props, feature); } if (const char* propCxx14 = this->GetDefinition("CMAKE_CXX14_COMPILE_FEATURES")) { std::vector<std::string> props; cmExpandList(propCxx14, props); - needCxx14 = std::find(props.begin(), props.end(), feature) != props.end(); + needCxx14 = cmContains(props, feature); } if (const char* propCxx17 = this->GetDefinition("CMAKE_CXX17_COMPILE_FEATURES")) { std::vector<std::string> props; cmExpandList(propCxx17, props); - needCxx17 = std::find(props.begin(), props.end(), feature) != props.end(); + needCxx17 = cmContains(props, feature); } if (const char* propCxx20 = this->GetDefinition("CMAKE_CXX20_COMPILE_FEATURES")) { std::vector<std::string> props; cmExpandList(propCxx20, props); - needCxx20 = std::find(props.begin(), props.end(), feature) != props.end(); + needCxx20 = cmContains(props, feature); } } @@ -4773,19 +4772,19 @@ void cmMakefile::CheckNeededCLanguage(const std::string& feature, this->GetDefinition("CMAKE_C90_COMPILE_FEATURES")) { std::vector<std::string> props; cmExpandList(propC90, props); - needC90 = std::find(props.begin(), props.end(), feature) != props.end(); + needC90 = cmContains(props, feature); } if (const char* propC99 = this->GetDefinition("CMAKE_C99_COMPILE_FEATURES")) { std::vector<std::string> props; cmExpandList(propC99, props); - needC99 = std::find(props.begin(), props.end(), feature) != props.end(); + needC99 = cmContains(props, feature); } if (const char* propC11 = this->GetDefinition("CMAKE_C11_COMPILE_FEATURES")) { std::vector<std::string> props; cmExpandList(propC11, props); - needC11 = std::find(props.begin(), props.end(), feature) != props.end(); + needC11 = cmContains(props, feature); } } diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx index 3026b33..fe04fba 100644 --- a/Source/cmQtAutoGen.cxx +++ b/Source/cmQtAutoGen.cxx @@ -53,9 +53,7 @@ void MergeOptions(std::vector<std::string>& baseOpts, } } // Test if this is a value option and change the existing value - if (!optName.empty() && - (std::find(valueOpts.begin(), valueOpts.end(), optName) != - valueOpts.end())) { + if (!optName.empty() && cmContains(valueOpts, optName)) { const Iter existItNext(existIt + 1); const CIter fitNext(fit + 1); if ((existItNext != baseOpts.end()) && (fitNext != fitEnd)) { diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 8fcb710..670161d 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmServerProtocol.h" +#include "cmAlgorithms.h" #include "cmExternalMakefileProjectGenerator.h" #include "cmFileMonitor.h" #include "cmGlobalGenerator.h" @@ -433,7 +434,7 @@ cmServerResponse cmServerProtocol1::ProcessCache( keys = allKeys; } else { for (auto const& i : keys) { - if (std::find(allKeys.begin(), allKeys.end(), i) == allKeys.end()) { + if (!cmContains(allKeys, i)) { return request.ReportError("Key \"" + i + "\" not found in cache."); } } diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 880773b..146e06d 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -2,11 +2,11 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmSourceGroupCommand.h" -#include <algorithm> #include <set> #include <stddef.h> #include <utility> +#include "cmAlgorithms.h" #include "cmMakefile.h" #include "cmSourceGroup.h" #include "cmStringAlgorithms.h" @@ -140,8 +140,7 @@ cmSourceGroupCommand::getExpectedOptions() const bool cmSourceGroupCommand::isExpectedOption( const std::string& argument, const ExpectedOptions& expectedOptions) { - return std::find(expectedOptions.begin(), expectedOptions.end(), argument) != - expectedOptions.end(); + return cmContains(expectedOptions, argument); } void cmSourceGroupCommand::parseArguments( diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 0e4b0af..0758208 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2603,8 +2603,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( std::string langForClCompile; if (this->ProjectType == csproj) { langForClCompile = "CSharp"; - } else if (std::find(cm::cbegin(clLangs), cm::cend(clLangs), linkLanguage) != - cm::cend(clLangs)) { + } else if (cmContains(clLangs, linkLanguage)) { langForClCompile = linkLanguage; } else { std::set<std::string> languages; @@ -3470,8 +3469,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( std::vector<std::string> libVec; std::vector<std::string> vsTargetVec; this->AddLibraries(cli, libVec, vsTargetVec, config); - if (std::find(linkClosure->Languages.begin(), linkClosure->Languages.end(), - "CUDA") != linkClosure->Languages.end() && + if (cmContains(linkClosure->Languages, "CUDA") && this->CudaOptions[config] != nullptr) { switch (this->CudaOptions[config]->GetCudaRuntime()) { case cmVisualStudioGeneratorOptions::CudaRuntimeStatic: @@ -3758,8 +3756,7 @@ void cmVisualStudio10TargetGenerator::AddTargetsFileAndConfigPair( { for (TargetsFileAndConfigs& i : this->TargetsFileAndConfigsVec) { if (cmSystemTools::ComparePath(targetsFile, i.File)) { - if (std::find(i.Configs.begin(), i.Configs.end(), config) == - i.Configs.end()) { + if (!cmContains(i.Configs, config)) { i.Configs.push_back(config); } return; diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index 51e5d36..0552676 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -12,6 +12,8 @@ #include <utility> #include <vector> +#include "cmAlgorithms.h" + class cmGeneratorTarget; class cmXCodeObject @@ -80,15 +82,10 @@ public: void SetObject(cmXCodeObject* value) { this->Object = value; } cmXCodeObject* GetObject() { return this->Object; } void AddObject(cmXCodeObject* value) { this->List.push_back(value); } - bool HasObject(cmXCodeObject* o) const - { - return !(std::find(this->List.begin(), this->List.end(), o) == - this->List.end()); - } + bool HasObject(cmXCodeObject* o) const { return cmContains(this->List, o); } void AddUniqueObject(cmXCodeObject* value) { - if (std::find(this->List.begin(), this->List.end(), value) == - this->List.end()) { + if (!cmContains(this->List, value)) { this->List.push_back(value); } } diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx index a565a9c..112d1c1 100644 --- a/Source/cmXCodeScheme.cxx +++ b/Source/cmXCodeScheme.cxx @@ -393,9 +393,7 @@ std::string cmXCodeScheme::FindConfiguration(const std::string& name) // Try to find the desired configuration by name, // and if it's not found return first from the list // - if (std::find(this->ConfigList.begin(), this->ConfigList.end(), name) == - this->ConfigList.end() && - !this->ConfigList.empty()) { + if (!cmContains(this->ConfigList, name) && !this->ConfigList.empty()) { return this->ConfigList[0]; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 440a7b1..2500939 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2738,7 +2738,7 @@ void cmake::WatchUnusedCli(const std::string& var) { #ifndef CMAKE_BOOTSTRAP this->VariableWatch->AddWatch(var, cmWarnUnusedCliWarning, this); - if (this->UsedCliVariables.find(var) == this->UsedCliVariables.end()) { + if (!cmContains(this->UsedCliVariables, var)) { this->UsedCliVariables[var] = false; } #endif diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index ba2788e..30aaa9c 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -38,10 +38,8 @@ #include "cmsys/FStream.hxx" #include "cmsys/Process.h" #include "cmsys/Terminal.h" -#include <algorithm> #include <array> #include <iostream> -#include <iterator> #include <memory> #include <sstream> #include <stdio.h> @@ -1075,11 +1073,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) } } else if (cmHasLiteralPrefix(arg, "--format=")) { format = arg.substr(9); - bool isKnown = - std::find(cm::cbegin(knownFormats), cm::cend(knownFormats), - format) != cm::cend(knownFormats); - - if (!isKnown) { + if (!cmContains(knownFormats, format)) { cmSystemTools::Error("Unknown -E tar --format= argument: " + format); return 1; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=891e670e59265468be74484302800dc1469e7eea commit 891e670e59265468be74484302800dc1469e7eea Author: Jon Chronopoulos <patc...@crondog.com> AuthorDate: Sat Aug 17 12:47:19 2019 +1000 Commit: Jon Chronopoulos <patc...@crondog.com> CommitDate: Sat Aug 17 12:47:19 2019 +1000 install: print reason of failure Fixes: #19430 diff --git a/Source/cmFileCopier.cxx b/Source/cmFileCopier.cxx index 62f132d..da425a8 100644 --- a/Source/cmFileCopier.cxx +++ b/Source/cmFileCopier.cxx @@ -91,7 +91,8 @@ bool cmFileCopier::SetPermissions(const std::string& toFile, if (!cmSystemTools::SetPermissions(toFile, permissions)) { std::ostringstream e; - e << this->Name << " cannot set permissions on \"" << toFile << "\""; + e << this->Name << " cannot set permissions on \"" << toFile + << "\": " << cmSystemTools::GetLastSystemError() << "."; this->Status.SetError(e.str()); return false; } @@ -121,7 +122,8 @@ bool cmFileCopier::ReportMissing(const std::string& fromFile) { // The input file does not exist and installation is not optional. std::ostringstream e; - e << this->Name << " cannot find \"" << fromFile << "\"."; + e << this->Name << " cannot find \"" << fromFile + << "\": " << cmSystemTools::GetLastSystemError() << "."; this->Status.SetError(e.str()); return false; } @@ -514,7 +516,8 @@ bool cmFileCopier::InstallSymlinkChain(std::string& fromFile, if (!cmSystemTools::CreateSymlink(symlinkTarget, toFile)) { std::ostringstream e; - e << this->Name << " cannot create symlink \"" << toFile << "\"."; + e << this->Name << " cannot create symlink \"" << toFile + << "\": " << cmSystemTools::GetLastSystemError() << "."; this->Status.SetError(e.str()); return false; } @@ -535,7 +538,8 @@ bool cmFileCopier::InstallSymlink(const std::string& fromFile, if (!cmSystemTools::ReadSymlink(fromFile, symlinkTarget)) { std::ostringstream e; e << this->Name << " cannot read symlink \"" << fromFile - << "\" to duplicate at \"" << toFile << "\"."; + << "\" to duplicate at \"" << toFile + << "\": " << cmSystemTools::GetLastSystemError() << "."; this->Status.SetError(e.str()); return false; } @@ -566,7 +570,8 @@ bool cmFileCopier::InstallSymlink(const std::string& fromFile, if (!cmSystemTools::CreateSymlink(symlinkTarget, toFile)) { std::ostringstream e; e << this->Name << " cannot duplicate symlink \"" << fromFile - << "\" at \"" << toFile << "\"."; + << "\" at \"" << toFile + << "\": " << cmSystemTools::GetLastSystemError() << "."; this->Status.SetError(e.str()); return false; } @@ -595,7 +600,7 @@ bool cmFileCopier::InstallFile(const std::string& fromFile, if (copy && !cmSystemTools::CopyAFile(fromFile, toFile, true)) { std::ostringstream e; e << this->Name << " cannot copy file \"" << fromFile << "\" to \"" - << toFile << "\"."; + << toFile << "\": " << cmSystemTools::GetLastSystemError() << "."; this->Status.SetError(e.str()); return false; } @@ -611,7 +616,7 @@ bool cmFileCopier::InstallFile(const std::string& fromFile, if (!cmFileTimes::Copy(fromFile, toFile)) { std::ostringstream e; e << this->Name << " cannot set modification time on \"" << toFile - << "\""; + << "\": " << cmSystemTools::GetLastSystemError() << "."; this->Status.SetError(e.str()); return false; } @@ -648,7 +653,7 @@ bool cmFileCopier::InstallDirectory(const std::string& source, if (!cmSystemTools::MakeDirectory(destination, default_dir_mode)) { std::ostringstream e; e << this->Name << " cannot make directory \"" << destination - << "\": " << cmSystemTools::GetLastSystemError(); + << "\": " << cmSystemTools::GetLastSystemError() << "."; this->Status.SetError(e.str()); return false; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bb6e95ca6d31829f8ed03512f447e8c02ea46c43 commit bb6e95ca6d31829f8ed03512f447e8c02ea46c43 Author: Mateusz Janek <stryku2...@gmail.com> AuthorDate: Thu Aug 8 21:39:52 2019 +0200 Commit: Mateusz Janek <stryku2...@gmail.com> CommitDate: Fri Aug 16 14:55:47 2019 +0200 source_group: Improved generated filters tests diff --git a/Tests/RunCMake/VS10Project/Dir/DirNested/foo_nested.cpp b/Tests/RunCMake/VS10Project/Dir/DirNested/foo_nested.cpp new file mode 100644 index 0000000..3695dc9 --- /dev/null +++ b/Tests/RunCMake/VS10Project/Dir/DirNested/foo_nested.cpp @@ -0,0 +1,3 @@ +void foo() +{ +} diff --git a/Tests/RunCMake/VS10Project/Dir/foo.cpp b/Tests/RunCMake/VS10Project/Dir/foo.cpp new file mode 100644 index 0000000..3695dc9 --- /dev/null +++ b/Tests/RunCMake/VS10Project/Dir/foo.cpp @@ -0,0 +1,3 @@ +void foo() +{ +} diff --git a/Tests/RunCMake/VS10Project/Prefixed/PrefixedNested/bar_nested.cpp b/Tests/RunCMake/VS10Project/Prefixed/PrefixedNested/bar_nested.cpp new file mode 100644 index 0000000..3695dc9 --- /dev/null +++ b/Tests/RunCMake/VS10Project/Prefixed/PrefixedNested/bar_nested.cpp @@ -0,0 +1,3 @@ +void foo() +{ +} diff --git a/Tests/RunCMake/VS10Project/Prefixed/bar.cpp b/Tests/RunCMake/VS10Project/Prefixed/bar.cpp new file mode 100644 index 0000000..b72a1a5 --- /dev/null +++ b/Tests/RunCMake/VS10Project/Prefixed/bar.cpp @@ -0,0 +1,3 @@ +void bar() +{ +} diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 1cb4ce5..5ca069a 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -5,6 +5,7 @@ run_cmake(VsCSharpCompilerOpts) run_cmake(ExplicitCMakeLists) run_cmake(RuntimeLibrary) run_cmake(SourceGroupCMakeLists) +run_cmake(SourceGroupTreeCMakeLists) run_cmake(VsConfigurationType) run_cmake(VsTargetsFileReferences) diff --git a/Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake b/Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake index c2a94bb..616f38b 100644 --- a/Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake +++ b/Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake @@ -4,30 +4,8 @@ if(NOT EXISTS "${vcFiltersFile}") return() endif() -set(foundFileFilter 0) -set(foundFilter 0) file(STRINGS "${vcFiltersFile}" lines) -foreach(line IN LISTS lines) - if(line MATCHES "<Filter>CMakeListsSourceGroup</Filter>") - set(rule "${CMAKE_MATCH_1}") - if(foundFileFilter) - set(RunCMake_TEST_FAILED "Multiple files listed with filter for CMakeListsSourceGroup.") - return() - endif() - set(foundFileFilter 1) - endif() - if(line MATCHES "<Filter.*Include=\"CMakeListsSourceGroup\"") - set(rule "${CMAKE_MATCH_1}") - if(foundFilter) - set(RunCMake_TEST_FAILED "Multiple copies of CMakeListsSourceGroup filter listed.") - return() - endif() - set(foundFilter 1) - endif() -endforeach() -if(NOT foundFileFilter) - set(RunCMake_TEST_FAILED "File filter for CMakeListsSourceGroup not found.") -endif() -if(NOT foundFilter) - set(RunCMake_TEST_FAILED "Filter CMakeListsSourceGroup not found.") -endif() + +include(${RunCMake_TEST_SOURCE_DIR}/SourceGroupHelpers.cmake) + +find_source_group("${lines}" CMakeListsSourceGroup) diff --git a/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake b/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake new file mode 100644 index 0000000..c82a66e --- /dev/null +++ b/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake @@ -0,0 +1,35 @@ +function(find_source_group LINES NAME) + set(foundFileFilter 0) + set(foundFilter 0) + foreach(line IN LISTS LINES) + if(line MATCHES "<Filter>${NAME}</Filter>") + if(foundFileFilter) + set(RunCMake_TEST_FAILED "Multiple files listed with filter for ${NAME}." PARENT_SCOPE) + set(FILTER_FOUND 0 PARENT_SCOPE) + return() + endif() + set(foundFileFilter 1) + endif() + if(line MATCHES "<Filter.*Include=\"${NAME}\"") + if(foundFilter) + set(RunCMake_TEST_FAILED "Multiple copies of ${NAME} filter listed." PARENT_SCOPE) + set(FILTER_FOUND 0 PARENT_SCOPE) + return() + endif() + set(foundFilter 1) + endif() + endforeach() + + if(NOT foundFileFilter) + set(RunCMake_TEST_FAILED "File filter for ${NAME} not found." PARENT_SCOPE) + set(FILTER_FOUND 0 PARENT_SCOPE) + return() + endif() + if(NOT foundFilter) + set(RunCMake_TEST_FAILED "Filter ${NAME} not found." PARENT_SCOPE) + set(FILTER_FOUND 0 PARENT_SCOPE) + return() + endif() + + set(FILTER_FOUND 1 PARENT_SCOPE) +endfunction() diff --git a/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake new file mode 100644 index 0000000..655120a --- /dev/null +++ b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake @@ -0,0 +1,25 @@ +cmake_policy(SET CMP0011 NEW) + +set(vcFiltersFile "${RunCMake_TEST_BINARY_DIR}/SourceGroupTree.vcxproj.filters") +if(NOT EXISTS "${vcFiltersFile}") + set(RunCMake_TEST_FAILED "Filters file ${vcFiltersFile} does not exist.") + return() +endif() + +file(STRINGS "${vcFiltersFile}" lines) + +include(${RunCMake_TEST_SOURCE_DIR}/SourceGroupHelpers.cmake) + +set(SOURCE_GROUPS_TO_FIND + "Dir" + "Dir\\DirNested" + "SourcesPrefix" + "SourcesPrefix\\PrefixedNested" +) + +foreach(GROUP_NAME IN LISTS ${SOURCE_GROUPS_TO_FIND}) + find_source_group("${lines}" ${GROUP_NAME}) + if(NOT ${FILTER_FOUND}) + return() + endif() +endforeach() diff --git a/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists.cmake b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists.cmake new file mode 100644 index 0000000..83c87a9 --- /dev/null +++ b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists.cmake @@ -0,0 +1,16 @@ +set(CMAKE_CONFIGURATION_TYPES Debug) + +set(SRC_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/Dir/foo.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Dir/DirNested/foo_nested.cpp +) + +set(PREFIXED_SRC_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/Prefixed/bar.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Prefixed/PrefixedNested/bar_nested.cpp +) + +add_custom_target(SourceGroupTree SOURCES ${SRC_FILES} ${PREFIXED_SRC_FILES}) + +source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SRC_FILES}) +source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/Prefixed PREFIX SourcesPrefix FILES ${PREFIXED_SRC_FILES}) ----------------------------------------------------------------------- Summary of changes: Source/CPack/WiX/cmCPackWIXGenerator.cxx | 5 ++- Source/CPack/cmCPackNSISGenerator.cxx | 6 ++-- Source/CPack/cpack.cxx | 29 +++++++-------- Source/CTest/cmCTestMultiProcessHandler.cxx | 16 ++++----- Source/CTest/cmCTestTestHandler.cxx | 23 +++++------- Source/CursesDialog/CMakeLists.txt | 4 +++ Source/cmAlgorithms.h | 40 ++++++++++++++++++++- Source/cmComputeLinkInformation.cxx | 13 +++---- Source/cmConditionEvaluator.cxx | 3 +- Source/cmConfigure.cmake.h.in | 4 +++ Source/cmDefinitions.cxx | 18 +++++----- Source/cmDefinitions.h | 8 ++--- Source/cmExportBuildAndroidMKGenerator.cxx | 5 ++- Source/cmExportBuildFileGenerator.cxx | 3 +- Source/cmExportCommand.cxx | 6 ++-- Source/cmExportInstallFileGenerator.cxx | 38 ++++++++++++-------- Source/cmExportInstallFileGenerator.h | 7 ++-- Source/cmFileCopier.cxx | 21 ++++++----- Source/cmGeneratorExpressionNode.cxx | 15 +++----- Source/cmGeneratorTarget.cxx | 42 ++++++++-------------- Source/cmGlobalGenerator.cxx | 13 +++---- Source/cmGlobalGhsMultiGenerator.cxx | 7 ++-- Source/cmGlobalNinjaGenerator.cxx | 3 +- Source/cmGlobalVisualStudioGenerator.cxx | 3 ++ Source/cmGlobalXCodeGenerator.cxx | 12 +++---- Source/cmInstallExportGenerator.cxx | 5 +++ Source/cmInstallExportGenerator.h | 1 + Source/cmLinkItem.h | 5 ++- Source/cmLinkLineDeviceComputer.cxx | 9 ++--- Source/cmListCommand.cxx | 2 +- Source/cmLocalGenerator.cxx | 14 +++----- Source/cmLocalVisualStudio7Generator.cxx | 5 ++- Source/cmMakefile.cxx | 23 ++++++------ Source/cmQtAutoGen.cxx | 4 +-- Source/cmServerProtocol.cxx | 3 +- Source/cmSourceGroupCommand.cxx | 5 ++- Source/cmVisualStudio10TargetGenerator.cxx | 9 ++--- Source/cmXCodeObject.h | 11 +++--- Source/cmXCodeScheme.cxx | 4 +-- Source/cmake.cxx | 2 +- Source/cmcmd.cxx | 8 +---- .../ObjectLibrary/InstallLinkedObj1-stderr.txt | 2 +- .../Dir/DirNested/foo_nested.cpp} | 0 .../{XcodeProject => VS10Project/Dir}/foo.cpp | 0 .../Prefixed/PrefixedNested/bar_nested.cpp} | 0 Tests/RunCMake/VS10Project/{ => Prefixed}/bar.cpp | 0 Tests/RunCMake/VS10Project/RunCMakeTest.cmake | 1 + .../VS10Project/SourceGroupCMakeLists-check.cmake | 30 +++------------- .../RunCMake/VS10Project/SourceGroupHelpers.cmake | 35 ++++++++++++++++++ .../SourceGroupTreeCMakeLists-check.cmake | 25 +++++++++++++ .../VS10Project/SourceGroupTreeCMakeLists.cmake | 16 +++++++++ .../StaticPrivateDepNotExported-stderr.txt | 2 +- bootstrap | 7 ++++ 53 files changed, 316 insertions(+), 256 deletions(-) copy Tests/RunCMake/{XcodeProject/foo.cpp => VS10Project/Dir/DirNested/foo_nested.cpp} (100%) copy Tests/RunCMake/{XcodeProject => VS10Project/Dir}/foo.cpp (100%) copy Tests/RunCMake/{XcodeProject/foo.cpp => VS10Project/Prefixed/PrefixedNested/bar_nested.cpp} (100%) copy Tests/RunCMake/VS10Project/{ => Prefixed}/bar.cpp (100%) create mode 100644 Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake create mode 100644 Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake create mode 100644 Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists.cmake hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org https://cmake.org/mailman/listinfo/cmake-commits