diff options
145 files changed, 528 insertions, 272 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 21e8c46..da99a6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -368,11 +368,24 @@ macro (CMAKE_BUILD_UTILITIES) # Setup third-party libraries. # Everything in the tree should be able to include files from the # Utilities directory. + if (CMAKE_SYSTEM_NAME STREQUAL "AIX" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # using -isystem option generate error "template with C linkage" + include_directories("${CMake_SOURCE_DIR}/Utilities/std") + else() + include_directories(SYSTEM "${CMake_SOURCE_DIR}/Utilities/std") + endif() + include_directories( ${CMake_BINARY_DIR}/Utilities ${CMake_SOURCE_DIR}/Utilities ) + #--------------------------------------------------------------------- + # Build CMake std library for CMake and CTest. + set(CMAKE_STD_LIBRARY cmstd) + add_subdirectory(Utilities/std) + CMAKE_SET_TARGET_FOLDER(cmstd "Utilities/std") + # check for the use of system libraries versus builtin ones # (a macro defined in this file) CMAKE_HANDLE_SYSTEM_LIBRARIES() diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 7b580e5..8ed7b2f 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -437,9 +437,6 @@ set(SRCS cmXMLWriter.h cmake.cxx cmake.h - cm_string_view.cxx - cm_string_view.hxx - cm_static_string_view.hxx cmCommand.cxx cmCommand.h @@ -681,13 +678,13 @@ set(SRCS cmWriteFileCommand.cxx cmWriteFileCommand.h + cm_static_string_view.hxx cm_get_date.h cm_get_date.c cm_utf8.h cm_utf8.c cm_codecvt.hxx cm_codecvt.cxx - cm_thread.hxx cmDuration.h cmDuration.cxx @@ -853,6 +850,7 @@ endforeach() # create a library used by the command line and the GUI add_library(CMakeLib ${SRCS}) target_link_libraries(CMakeLib cmsys + ${CMAKE_STD_LIBRARY} ${CMAKE_EXPAT_LIBRARIES} ${CMAKE_ZLIB_LIBRARIES} ${CMAKE_TAR_LIBRARIES} ${CMAKE_CURL_LIBRARIES} diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index f784832..683f275 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -11,8 +11,9 @@ #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmUuid.h" -#include "cm_string_view.hxx" + #include <algorithm> +#include <cm/string_view> #include "cmWIXDirectoriesSourceWriter.h" #include "cmWIXFeaturesSourceWriter.h" diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx index dd3caf9..7705d83 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx @@ -9,10 +9,10 @@ #include "cmSystemTools.h" #include "cmUuid.h" -#include "cm_sys_stat.h" - #include "cmCMakeToWixPath.h" +#include "cm_sys_stat.h" + cmWIXFilesSourceWriter::cmWIXFilesSourceWriter(cmCPackLog* logger, std::string const& filename, GuidType componentGuidType) diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 0e64b5a..4f299f7 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -10,9 +10,11 @@ #include "cmGeneratedFileStream.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -#include "cm_sys_stat.h" #include "cmsys/Glob.hxx" + +#include "cm_sys_stat.h" + #include <cstring> #include <map> #include <ostream> diff --git a/Source/CPack/cmCPackExternalGenerator.cxx b/Source/CPack/cmCPackExternalGenerator.cxx index 5dc6ace..05e5c21 100644 --- a/Source/CPack/cmCPackExternalGenerator.cxx +++ b/Source/CPack/cmCPackExternalGenerator.cxx @@ -17,7 +17,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> int cmCPackExternalGenerator::InitializeInternal() { diff --git a/Source/CPack/cmCPackExternalGenerator.h b/Source/CPack/cmCPackExternalGenerator.h index 176d6a9..b77e45b 100644 --- a/Source/CPack/cmCPackExternalGenerator.h +++ b/Source/CPack/cmCPackExternalGenerator.h @@ -4,6 +4,7 @@ #define cmCPackExternalGenerator_h #include "cmCPackGenerator.h" + #include "cm_sys_stat.h" #include <memory> diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index fc00b09..33026c1 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -10,9 +10,10 @@ #include <string> #include <vector> +#include "cm_sys_stat.h" + #include "cmCPackComponentGroup.h" #include "cmSystemTools.h" -#include "cm_sys_stat.h" class cmCPackLog; class cmGlobalGenerator; diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index 992299a..cd65694 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -4,13 +4,14 @@ #include <sstream> +#include "cm_sys_stat.h" + #include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmDuration.h" #include "cmGeneratedFileStream.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -#include "cm_sys_stat.h" cmCPackOSXX11Generator::cmCPackOSXX11Generator() = default; diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index eb48c37..eb1e24c 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -8,11 +8,12 @@ #include <string> #include <vector> +#include "cm_sys_stat.h" + #include "cmArchiveWrite.h" #include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmSystemTools.h" -#include "cm_sys_stat.h" cmCPackSTGZGenerator::cmCPackSTGZGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressGZip, "paxr", ".sh") diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h index a62c301..14f70bf 100644 --- a/Source/CTest/cmCTestBuildCommand.h +++ b/Source/CTest/cmCTestBuildCommand.h @@ -12,7 +12,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> class cmCTestBuildHandler; class cmCTestGenericHandler; diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx index b9b90c8..5baeecd 100644 --- a/Source/CTest/cmCTestCVS.cxx +++ b/Source/CTest/cmCTestCVS.cxx @@ -7,10 +7,12 @@ #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmXMLWriter.h" -#include "cm_string_view.hxx" #include "cmsys/FStream.hxx" #include "cmsys/RegularExpression.hxx" + +#include <cm/string_view> + #include <utility> cmCTestCVS::cmCTestCVS(cmCTest* ct, std::ostream& log) diff --git a/Source/CTest/cmCTestConfigureCommand.h b/Source/CTest/cmCTestConfigureCommand.h index 4677c83..36ca7d5 100644 --- a/Source/CTest/cmCTestConfigureCommand.h +++ b/Source/CTest/cmCTestConfigureCommand.h @@ -11,7 +11,7 @@ #include <string> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> class cmCTestGenericHandler; diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h index 24b96c0..75aefdf 100644 --- a/Source/CTest/cmCTestCoverageCommand.h +++ b/Source/CTest/cmCTestCoverageCommand.h @@ -12,7 +12,7 @@ #include <string> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> class cmCTestGenericHandler; diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h index 84250cb..4232b9e 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h @@ -12,7 +12,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> class cmExecutionStatus; diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h index 837a687..5dad4e7 100644 --- a/Source/CTest/cmCTestMemCheckCommand.h +++ b/Source/CTest/cmCTestMemCheckCommand.h @@ -7,7 +7,7 @@ #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCTestTestCommand.h" #include "cmCommand.h" diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h index db2ac5e..8199cbc 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.h +++ b/Source/CTest/cmCTestReadCustomFilesCommand.h @@ -12,7 +12,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> class cmExecutionStatus; diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h index 6961f6e..d262a83 100644 --- a/Source/CTest/cmCTestRunScriptCommand.h +++ b/Source/CTest/cmCTestRunScriptCommand.h @@ -12,7 +12,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> class cmExecutionStatus; diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 3629a50..d8a5923 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -20,7 +20,7 @@ #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> cmCTestRunTest::cmCTestRunTest(cmCTestMultiProcessHandler& multiHandler) : MultiTestHandler(multiHandler) diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 354e3c4..c988e3a 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -5,7 +5,7 @@ #include "cmsys/Directory.hxx" #include "cmsys/Process.h" -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCTest.h" #include "cmCTestBuildCommand.h" diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h index 7b17081..b98079d 100644 --- a/Source/CTest/cmCTestSleepCommand.h +++ b/Source/CTest/cmCTestSleepCommand.h @@ -12,7 +12,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> class cmExecutionStatus; diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h index 7c71f36..598c937 100644 --- a/Source/CTest/cmCTestStartCommand.h +++ b/Source/CTest/cmCTestStartCommand.h @@ -13,7 +13,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> class cmExecutionStatus; diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index d16aac0..2e2cf1a 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -13,7 +13,7 @@ #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> class cmExecutionStatus; diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index d74136c..a9ba3ab 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -11,7 +11,7 @@ #include <string> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> class cmCTestGenericHandler; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 10f9f9b..ee0d8c8 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -2,7 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmCTestTestHandler.h" -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmCTest.h" diff --git a/Source/CTest/cmCTestUpdateCommand.h b/Source/CTest/cmCTestUpdateCommand.h index 55c4b80..5b0e07e 100644 --- a/Source/CTest/cmCTestUpdateCommand.h +++ b/Source/CTest/cmCTestUpdateCommand.h @@ -11,7 +11,7 @@ #include <string> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> class cmCTestGenericHandler; diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index a6a3542..c4cb233 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -20,7 +20,7 @@ #include <chrono> #include <sstream> -#include "cm_memory.hxx" +#include <cm/memory> static const char* cmCTestUpdateHandlerUpdateStrings[] = { "Unknown", "CVS", "SVN", "BZR", "GIT", "HG", "P4" diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h index 9e49769..39314f2 100644 --- a/Source/CTest/cmCTestUploadCommand.h +++ b/Source/CTest/cmCTestUploadCommand.h @@ -12,7 +12,7 @@ #include <string> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> class cmCTestGenericHandler; diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 60b746c..06ea9f6 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -238,81 +238,4 @@ typename Range::const_iterator cmFindNot(Range const& r, T const& t) return std::find_if(r.begin(), r.end(), [&t](T const& i) { return i != t; }); } -template <class Iter> -std::reverse_iterator<Iter> cmMakeReverseIterator(Iter it) -{ - return std::reverse_iterator<Iter>(it); -} - -namespace cm { - -#if __cplusplus >= 201703L || defined(_MSVC_LANG) && _MSVC_LANG >= 201703L - -using std::size; - -#else - -// std::size backport from C++17. -template <class C> -# if !defined(_MSC_VER) || _MSC_VER >= 1900 -constexpr -# endif - auto - size(C const& c) -> decltype(c.size()) -{ - return c.size(); -} - -template <typename T, size_t N> -# if !defined(_MSC_VER) || _MSC_VER >= 1900 -constexpr -# endif - std::size_t - size(const T (&)[N]) throw() -{ - return N; -} - -#endif - -template <typename T> -int isize(const T& t) -{ - return static_cast<int>(cm::size(t)); -} - -#if __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L - -using std::cbegin; -using std::cend; - -#else - -// std::c{begin,end} backport from C++14 -template <class C> -# if defined(_MSC_VER) && _MSC_VER < 1900 -auto cbegin(C const& c) -# else -constexpr auto cbegin(C const& c) noexcept(noexcept(std::begin(c))) -# endif - -> decltype(std::begin(c)) -{ - return std::begin(c); -} - -template <class C> -# if defined(_MSC_VER) && _MSC_VER < 1900 -auto cend(C const& c) -# else -constexpr auto cend(C const& c) noexcept(noexcept(std::end(c))) -# endif - -> decltype(std::end(c)) -{ - return std::end(c); -} - -#endif - -} // namespace cm - #endif diff --git a/Source/cmArgumentParser.h b/Source/cmArgumentParser.h index 6cfe946..b6798bc 100644 --- a/Source/cmArgumentParser.h +++ b/Source/cmArgumentParser.h @@ -6,7 +6,7 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cm_static_string_view.hxx" -#include "cm_string_view.hxx" +#include <cm/string_view> #include <cassert> #include <functional> diff --git a/Source/cmBinUtilsLinuxELFLinker.cxx b/Source/cmBinUtilsLinuxELFLinker.cxx index 6316a29..a1125a9 100644 --- a/Source/cmBinUtilsLinuxELFLinker.cxx +++ b/Source/cmBinUtilsLinuxELFLinker.cxx @@ -15,7 +15,7 @@ #include <sstream> -#include "cm_memory.hxx" +#include <cm/memory> static std::string ReplaceOrigin(const std::string& rpath, const std::string& origin) diff --git a/Source/cmBinUtilsMacOSMachOLinker.cxx b/Source/cmBinUtilsMacOSMachOLinker.cxx index 7ff8584..b1f718b 100644 --- a/Source/cmBinUtilsMacOSMachOLinker.cxx +++ b/Source/cmBinUtilsMacOSMachOLinker.cxx @@ -12,7 +12,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> cmBinUtilsMacOSMachOLinker::cmBinUtilsMacOSMachOLinker( cmRuntimeDependencyArchive* archive) diff --git a/Source/cmBinUtilsWindowsPELinker.cxx b/Source/cmBinUtilsWindowsPELinker.cxx index 5a9ad66..bfafaeb 100644 --- a/Source/cmBinUtilsWindowsPELinker.cxx +++ b/Source/cmBinUtilsWindowsPELinker.cxx @@ -12,7 +12,7 @@ #include <sstream> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #ifdef _WIN32 # include <windows.h> diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 5e17ce8..1031f40 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -29,7 +29,7 @@ # include <unistd.h> // IWYU pragma: keep #endif -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmCTestBuildAndTestHandler.h" diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index 38fcf5b..262590b 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -1,7 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommands.h" #include "cmPolicies.h" diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 08113de..ab4371a 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -22,7 +22,7 @@ #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> /* diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx index f9f9581..ff683ad 100644 --- a/Source/cmCryptoHash.cxx +++ b/Source/cmCryptoHash.cxx @@ -6,7 +6,7 @@ #include "cm_rhash.h" #include "cmsys/FStream.hxx" -#include "cm_memory.hxx" +#include <cm/memory> static unsigned int const cmCryptoHashAlgoToId[] = { /* clang-format needs this comment to break after the opening brace */ diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h index 145ff91..05552bd 100644 --- a/Source/cmCryptoHash.h +++ b/Source/cmCryptoHash.h @@ -5,7 +5,7 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include "cm_string_view.hxx" +#include <cm/string_view> #include <cstddef> #include <memory> diff --git a/Source/cmCustomCommandLines.h b/Source/cmCustomCommandLines.h index 213aeb1..ead5792 100644 --- a/Source/cmCustomCommandLines.h +++ b/Source/cmCustomCommandLines.h @@ -9,7 +9,7 @@ #include <string> #include <vector> -#include "cm_string_view.hxx" // IWYU pragma: keep +#include <cm/string_view> // IWYU pragma: keep /** Data structure to represent a single command line. */ class cmCustomCommandLine : public std::vector<std::string> diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 2a117c1..32f47b0 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -2,7 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmDefinitions.h" -#include "cm_string_view.hxx" +#include <cm/string_view> #include <cassert> #include <functional> diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 008821d..72e88b5 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -5,11 +5,12 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include "cm_string_view.hxx" - #include "cmLinkedTree.h" + #include "cmString.hxx" +#include <cm/string_view> + #include <functional> #include <string> #include <unordered_map> diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx index 63a96d0..18b49b8 100644 --- a/Source/cmDependsJavaParserHelper.cxx +++ b/Source/cmDependsJavaParserHelper.cxx @@ -5,8 +5,8 @@ #include "cmDependsJavaLexer.h" #include "cmSystemTools.h" -#include "cm_string_view.hxx" #include "cmsys/FStream.hxx" +#include <cm/string_view> #include <cstdio> #include <cstdlib> #include <cstring> diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index 12f996d..06b5511 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -4,8 +4,8 @@ #include "cmAlgorithms.h" #include "cm_kwiml.h" -#include "cm_memory.hxx" #include "cmsys/FStream.hxx" +#include <cm/memory> #include <cstddef> #include <map> #include <memory> diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h index 50463af..819a3c3 100644 --- a/Source/cmExportCommand.h +++ b/Source/cmExportCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index e588f7b..f9a28cd 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -24,7 +24,7 @@ #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> static std::string cmExportFileGeneratorEscape(std::string const& str) { diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index bab394a..fd2401e 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -6,7 +6,7 @@ #include <map> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmExecutionStatus.h" #include "cmGeneratedFileStream.h" diff --git a/Source/cmFSPermissions.h b/Source/cmFSPermissions.h index 7a6e708..fef72e6 100644 --- a/Source/cmFSPermissions.h +++ b/Source/cmFSPermissions.h @@ -5,10 +5,10 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include "cm_sys_stat.h" - #include <string> +#include "cm_sys_stat.h" + namespace cmFSPermissions { // Table of permissions flags. diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 4701d29..c7a0e55 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -20,7 +20,9 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> + +#include "cm_sys_stat.h" #include "cmAlgorithms.h" #include "cmArgumentParser.h" @@ -44,7 +46,6 @@ #include "cmSubcommandTable.h" #include "cmSystemTools.h" #include "cmTimestamp.h" -#include "cm_sys_stat.h" #include "cmake.h" #if !defined(CMAKE_BOOTSTRAP) diff --git a/Source/cmFileCopier.h b/Source/cmFileCopier.h index 263a365..8fc481c 100644 --- a/Source/cmFileCopier.h +++ b/Source/cmFileCopier.h @@ -6,9 +6,10 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmFileTimeCache.h" -#include "cm_sys_stat.h" #include "cmsys/RegularExpression.hxx" +#include "cm_sys_stat.h" + #include <string> #include <vector> diff --git a/Source/cmFileTimes.cxx b/Source/cmFileTimes.cxx index 3824e9b..54ac4ed 100644 --- a/Source/cmFileTimes.cxx +++ b/Source/cmFileTimes.cxx @@ -2,11 +2,11 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmFileTimes.h" -#include "cm_sys_stat.h" - #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> + +#include "cm_sys_stat.h" #if defined(_WIN32) # include "cmSystemTools.h" diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index fea7e08..17e9869 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -18,7 +18,7 @@ #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmMakefile.h" diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index d563a1d..44392ba 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -6,9 +6,10 @@ #include <cstdlib> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> +#include <cm/string_view> + #include "cm_static_string_view.hxx" -#include "cm_string_view.hxx" #include "cmExecutionStatus.h" #include "cmFunctionBlocker.h" diff --git a/Source/cmFunctionBlocker.h b/Source/cmFunctionBlocker.h index 87bdccd..59bb892 100644 --- a/Source/cmFunctionBlocker.h +++ b/Source/cmFunctionBlocker.h @@ -7,7 +7,7 @@ #include <vector> -#include "cm_string_view.hxx" +#include <cm/string_view> #include "cmListFileCache.h" diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index fdc5e50..b3ddfe0 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -5,9 +5,10 @@ #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> +#include <cm/string_view> + #include "cm_static_string_view.hxx" -#include "cm_string_view.hxx" #include "cmAlgorithms.h" #include "cmExecutionStatus.h" diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h index 06ebeac..c3bc4c8 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.h +++ b/Source/cmGeneratorExpressionEvaluationFile.h @@ -10,9 +10,10 @@ #include <string> #include <vector> +#include "cm_sys_stat.h" + #include "cmGeneratorExpression.h" #include "cmPolicies.h" -#include "cm_sys_stat.h" class cmLocalGenerator; diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 6cb7a96..d524867 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -29,12 +29,13 @@ #include "cmsys/RegularExpression.hxx" #include "cmsys/String.h" +#include <cm/iterator> + #include <algorithm> #include <cassert> #include <cerrno> #include <cstdlib> #include <cstring> -#include <iterator> #include <map> #include <memory> #include <set> diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index ce9699b..18ca478 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -17,6 +17,8 @@ #include <unordered_set> #include <utility> +#include <cm/string_view> + #include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" #include "cmCustomCommand.h" @@ -42,7 +44,6 @@ #include "cmTarget.h" #include "cmTargetLinkLibraryType.h" #include "cmTargetPropertyComputer.h" -#include "cm_string_view.hxx" #include "cmake.h" class cmMessenger; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 9ce6324..7bba874 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -12,7 +12,7 @@ #include <iterator> #include <sstream> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmDocumentationEntry.h" diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index c7a0330..0b211b8 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -7,7 +7,7 @@ #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmDocumentationEntry.h" diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index b355775..92316d3 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -11,10 +11,11 @@ #include "cmState.h" #include "cmStringAlgorithms.h" #include "cmUuid.h" -#include "cm_string_view.hxx" #include "cmake.h" #include "cmsys/Encoding.hxx" +#include <cm/string_view> + #include <assert.h> #include <vector> #include <windows.h> diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index a0ce740..61e8f58 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -10,7 +10,8 @@ #include <shellapi.h> #include <windows.h> -#include "cmAlgorithms.h" +#include <cm/iterator> + #include "cmCallVisualStudioMacro.h" #include "cmCustomCommand.h" #include "cmCustomCommandLines.h" diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 4d41fd7..643cc99 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -9,7 +9,7 @@ #include <iomanip> #include <sstream> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index f719041..b36d96b 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -2,9 +2,10 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmIfCommand.h" -#include "cm_memory.hxx" +#include <cm/memory> +#include <cm/string_view> + #include "cm_static_string_view.hxx" -#include "cm_string_view.hxx" #include "cmConditionEvaluator.h" #include "cmExecutionStatus.h" diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h index 4df94eb..bcaae9d 100644 --- a/Source/cmIncludeDirectoryCommand.h +++ b/Source/cmIncludeDirectoryCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index 28bf443..9ffb842 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h index 1a439de..489d90f 100644 --- a/Source/cmLinkDirectoriesCommand.h +++ b/Source/cmLinkDirectoriesCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 826abf5..7bf35c3 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -16,7 +16,8 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> + #include "cm_static_string_view.hxx" #include "cmAlgorithms.h" diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h index 45e52f0..37f0372 100644 --- a/Source/cmLoadCacheCommand.h +++ b/Source/cmLoadCacheCommand.h @@ -9,7 +9,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index 6f5df46..1e02632 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -10,7 +10,7 @@ #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCPluginAPI.cxx" #include "cmCPluginAPI.h" diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 31e2dc0..e059548 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -30,7 +30,6 @@ #include "cmTarget.h" #include "cmTestGenerator.h" #include "cmVersion.h" -#include "cm_string_view.hxx" #include "cmake.h" #include "cmsys/RegularExpression.hxx" @@ -39,6 +38,8 @@ # include "cmCryptoHash.h" #endif +#include <cm/string_view> + #include <algorithm> #include <cassert> #include <cstdio> diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 0be1de5..a7be04e 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -9,7 +9,7 @@ #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmCustomCommand.h" // IWYU pragma: keep diff --git a/Source/cmMachO.cxx b/Source/cmMachO.cxx index bec3ad8..ee5eb00 100644 --- a/Source/cmMachO.cxx +++ b/Source/cmMachO.cxx @@ -9,7 +9,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> // Include the Mach-O format information system header. #include <mach-o/fat.h> diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index af97761..ba9947a 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -5,9 +5,10 @@ #include <cstdio> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> +#include <cm/string_view> + #include "cm_static_string_view.hxx" -#include "cm_string_view.hxx" #include "cmAlgorithms.h" #include "cmExecutionStatus.h" diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e6bb25c..34081ed 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -10,12 +10,11 @@ #include <cstdio> #include <cstdlib> #include <cstring> -#include <iterator> -#include <memory> #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/iterator> +#include <cm/memory> #include "cmAlgorithms.h" #include "cmCommandArgumentParserHelper.h" diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 42a769a..db37477 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -17,7 +17,7 @@ #include <unordered_map> #include <vector> -#include "cm_string_view.hxx" +#include <cm/string_view> #include "cmAlgorithms.h" #include "cmListFileCache.h" diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index e44ca7b..91bd47e 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -8,7 +8,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmGeneratedFileStream.h" diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index b37a933..faa0d67 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -8,7 +8,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmGeneratedFileStream.h" diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx index d4045b3..47e2665 100644 --- a/Source/cmMakefileUtilityTargetGenerator.cxx +++ b/Source/cmMakefileUtilityTargetGenerator.cxx @@ -7,7 +7,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmGeneratedFileStream.h" #include "cmGeneratorTarget.h" diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 97742c1..bd5abd1 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -10,7 +10,7 @@ #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmCustomCommand.h" // IWYU pragma: keep diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 84a98fd..2ab5adf 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -11,7 +11,7 @@ #include <ostream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 671efe7..c2053c7 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -6,7 +6,8 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmStateSnapshot.h" -#include "cm_string_view.hxx" + +#include <cm/string_view> #include <string> diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx index 0b320b6..c802fb4 100644 --- a/Source/cmParseArgumentsCommand.cxx +++ b/Source/cmParseArgumentsCommand.cxx @@ -14,7 +14,7 @@ #include "cmRange.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -#include "cm_string_view.hxx" +#include <cm/string_view> static std::string EscapeArg(const std::string& arg) { diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h index 8b9bcc8..ffbd330 100644 --- a/Source/cmProjectCommand.h +++ b/Source/cmProjectCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h index 71969ee..2a28c1e 100644 --- a/Source/cmQtAutoGen.h +++ b/Source/cmQtAutoGen.h @@ -5,7 +5,7 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include "cm_string_view.hxx" +#include <cm/string_view> #include <memory> #include <string> diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index abc69d0..576a034 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -17,7 +17,7 @@ #include "cmSystemTools.h" #include "cmTarget.h" -#include "cm_memory.hxx" +#include <cm/memory> #include <utility> diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index ad4e4d5..9045722 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -41,7 +41,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> namespace { diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index bedda30..7ce9fad 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -6,7 +6,8 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmGeneratedFileStream.h" #include "cmQtAutoGen.h" -#include "cm_string_view.hxx" + +#include <cm/string_view> #include <map> #include <memory> diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index 086b68c..eb829fa 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -2,7 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmQtAutoGenerator.h" -#include "cm_memory.hxx" +#include <cm/memory> + #include "cmsys/FStream.hxx" #include "cmGlobalGenerator.h" diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h index 371b25c..f60acb0 100644 --- a/Source/cmQtAutoGenerator.h +++ b/Source/cmQtAutoGenerator.h @@ -7,7 +7,8 @@ #include "cmFileTime.h" #include "cmQtAutoGen.h" -#include "cm_string_view.hxx" + +#include <cm/string_view> #include <mutex> #include <string> diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index 4e4875e..5cd1ba1 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -2,6 +2,12 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmQtAutoMocUic.h" +#include <algorithm> +#include <set> +#include <utility> + +#include <cm/memory> + #include "cmAlgorithms.h" #include "cmCryptoHash.h" #include "cmGeneratedFileStream.h" @@ -9,13 +15,9 @@ #include "cmQtAutoGen.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -#include "cm_memory.hxx" #include "cmake.h" #include "cmsys/FStream.hxx" -#include <algorithm> -#include <set> -#include <utility> #if defined(__APPLE__) # include <unistd.h> #endif diff --git a/Source/cmQtAutoMocUic.h b/Source/cmQtAutoMocUic.h index 43123f2..15b66ca 100644 --- a/Source/cmQtAutoMocUic.h +++ b/Source/cmQtAutoMocUic.h @@ -9,9 +9,10 @@ #include "cmQtAutoGen.h" #include "cmQtAutoGenerator.h" #include "cmWorkerPool.h" -#include "cm_string_view.hxx" #include "cmsys/RegularExpression.hxx" +#include <cm/string_view> + #include <atomic> #include <cstddef> #include <map> diff --git a/Source/cmQtAutoRcc.cxx b/Source/cmQtAutoRcc.cxx index cd3e034..1bf8ca4 100644 --- a/Source/cmQtAutoRcc.cxx +++ b/Source/cmQtAutoRcc.cxx @@ -11,7 +11,8 @@ #include "cmQtAutoGen.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -#include "cm_string_view.hxx" + +#include <cm/string_view> #include <algorithm> diff --git a/Source/cmRuntimeDependencyArchive.cxx b/Source/cmRuntimeDependencyArchive.cxx index 1b3f387..ed2e3e4 100644 --- a/Source/cmRuntimeDependencyArchive.cxx +++ b/Source/cmRuntimeDependencyArchive.cxx @@ -27,7 +27,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #if defined(_WIN32) static void AddVisualStudioPath(std::vector<std::string>& paths, diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx index 9df1883..f150cf3 100644 --- a/Source/cmServer.cxx +++ b/Source/cmServer.cxx @@ -20,7 +20,8 @@ #include <mutex> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> +#include <cm/shared_mutex> void on_signal(uv_signal_t* signal, int signum) { diff --git a/Source/cmServer.h b/Source/cmServer.h index ab2ad23..9b12604 100644 --- a/Source/cmServer.h +++ b/Source/cmServer.h @@ -5,11 +5,12 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cm_jsoncpp_value.h" -#include "cm_thread.hxx" #include "cm_uv.h" #include "cmUVHandlePtr.h" +#include <cm/shared_mutex> + #include <memory> #include <string> #include <vector> diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index d576f36..f889129 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -23,7 +23,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> // Get rid of some windows macros: #undef max diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index 7e4606e..e77b752 100644 --- a/Source/cmSetTargetPropertiesCommand.h +++ b/Source/cmSetTargetPropertiesCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h index 87a6114..6273d92 100644 --- a/Source/cmSourceGroupCommand.h +++ b/Source/cmSourceGroupCommand.h @@ -9,7 +9,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 7463bf8..93ad2d7 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -9,7 +9,7 @@ #include <cstring> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCacheManager.h" #include "cmCommand.h" diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx index ede00a0..1262f53 100644 --- a/Source/cmStateDirectory.cxx +++ b/Source/cmStateDirectory.cxx @@ -5,9 +5,10 @@ #include <algorithm> #include <cassert> -#include <iterator> #include <vector> +#include <cm/iterator> + #include "cmAlgorithms.h" #include "cmProperty.h" #include "cmPropertyMap.h" @@ -177,7 +178,7 @@ cmStringRange GetPropertyContent(T const& content, U contentEndPosition) { auto end = content.begin() + contentEndPosition; - auto rbegin = cmMakeReverseIterator(end); + auto rbegin = cm::make_reverse_iterator(end); rbegin = std::find(rbegin, content.rend(), cmPropertySentinal); return cmMakeRange(rbegin.base(), end); @@ -189,7 +190,7 @@ cmBacktraceRange GetPropertyBacktraces(T const& content, U const& backtraces, { auto entryEnd = content.begin() + contentEndPosition; - auto rbegin = cmMakeReverseIterator(entryEnd); + auto rbegin = cm::make_reverse_iterator(entryEnd); rbegin = std::find(rbegin, content.rend(), cmPropertySentinal); auto it = backtraces.begin() + std::distance(content.begin(), rbegin.base()); @@ -270,7 +271,7 @@ void cmStateDirectory::PrependIncludeDirectoriesEntry( this->Snapshot_.Position->IncludeDirectoryPosition; auto rend = this->DirectoryState->IncludeDirectories.rend(); - auto rbegin = cmMakeReverseIterator(entryEnd); + auto rbegin = cm::make_reverse_iterator(entryEnd); rbegin = std::find(rbegin, rend, cmPropertySentinal); auto entryIt = rbegin.base(); @@ -440,7 +441,7 @@ void cmStateDirectory::PrependLinkDirectoriesEntry( this->Snapshot_.Position->LinkDirectoriesPosition; auto rend = this->DirectoryState->LinkDirectories.rend(); - auto rbegin = cmMakeReverseIterator(entryEnd); + auto rbegin = cm::make_reverse_iterator(entryEnd); rbegin = std::find(rbegin, rend, cmPropertySentinal); auto entryIt = rbegin.base(); diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index 28d5170..645907c 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -5,10 +5,10 @@ #include <algorithm> #include <cassert> -#include <iterator> #include <string> -#include "cmAlgorithms.h" +#include <cm/iterator> + #include "cmDefinitions.h" #include "cmListFileCache.h" #include "cmPropertyMap.h" @@ -279,7 +279,7 @@ void InitializeContentFromParent(T& parentContent, T& thisContent, auto parentBegin = parentContent.begin(); auto parentEnd = parentContent.end(); - auto parentRbegin = cmMakeReverseIterator(parentEnd); + auto parentRbegin = cm::make_reverse_iterator(parentEnd); auto parentRend = parentContent.rend(); parentRbegin = std::find(parentRbegin, parentRend, cmPropertySentinal); auto parentIt = parentRbegin.base(); diff --git a/Source/cmStateSnapshot.h b/Source/cmStateSnapshot.h index da39127..021fd53 100644 --- a/Source/cmStateSnapshot.h +++ b/Source/cmStateSnapshot.h @@ -9,7 +9,7 @@ #include <string> #include <vector> -#include "cm_string_view.hxx" +#include <cm/string_view> #include "cmLinkedTree.h" #include "cmPolicies.h" diff --git a/Source/cmString.hxx b/Source/cmString.hxx index a401ad1..6223b78 100644 --- a/Source/cmString.hxx +++ b/Source/cmString.hxx @@ -6,7 +6,7 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cm_static_string_view.hxx" -#include "cm_string_view.hxx" +#include <cm/string_view> #include <algorithm> #include <cstddef> diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h index cb6b8ba..6631e98 100644 --- a/Source/cmStringAlgorithms.h +++ b/Source/cmStringAlgorithms.h @@ -6,7 +6,9 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmRange.h" -#include "cm_string_view.hxx" + +#include <cm/string_view> + #include <cctype> #include <cstring> #include <initializer_list> diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 809d05e..28616c2 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -9,12 +9,12 @@ #include <cctype> #include <cstdio> #include <cstdlib> -#include <iterator> #include <memory> +#include <cm/iterator> + #include "cm_static_string_view.hxx" -#include "cmAlgorithms.h" #include "cmCryptoHash.h" #include "cmExecutionStatus.h" #include "cmGeneratorExpression.h" diff --git a/Source/cmSubcommandTable.h b/Source/cmSubcommandTable.h index 21342bb..6e39a1f 100644 --- a/Source/cmSubcommandTable.h +++ b/Source/cmSubcommandTable.h @@ -6,7 +6,8 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cm_static_string_view.hxx" -#include "cm_string_view.hxx" + +#include <cm/string_view> #include <initializer_list> #include <string> diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index e7eef33..108215c 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -8,9 +8,9 @@ #include "cmCryptoHash.h" #include "cmDuration.h" #include "cmProcessOutput.h" -#include "cm_string_view.hxx" #include "cmsys/Process.h" #include "cmsys/SystemTools.hxx" // IWYU pragma: export +#include <cm/string_view> #include <cstddef> #include <functional> #include <string> diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c56aa9d..1b88db6 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -12,7 +12,7 @@ #include <sstream> #include <unordered_set> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmCustomCommand.h" diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h index 25af21d..f85dc0a 100644 --- a/Source/cmTargetCompileDefinitionsCommand.h +++ b/Source/cmTargetCompileDefinitionsCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmTargetPropCommandBase.h" diff --git a/Source/cmTargetCompileFeaturesCommand.h b/Source/cmTargetCompileFeaturesCommand.h index 07948fa..39597ca 100644 --- a/Source/cmTargetCompileFeaturesCommand.h +++ b/Source/cmTargetCompileFeaturesCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmTargetPropCommandBase.h" diff --git a/Source/cmTargetCompileOptionsCommand.h b/Source/cmTargetCompileOptionsCommand.h index a571cfb..b328ba2 100644 --- a/Source/cmTargetCompileOptionsCommand.h +++ b/Source/cmTargetCompileOptionsCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmTargetPropCommandBase.h" diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h index 6defab2..f6481db 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.h +++ b/Source/cmTargetIncludeDirectoriesCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmTargetPropCommandBase.h" diff --git a/Source/cmTargetLinkDirectoriesCommand.h b/Source/cmTargetLinkDirectoriesCommand.h index a2fcfa9..a651d73 100644 --- a/Source/cmTargetLinkDirectoriesCommand.h +++ b/Source/cmTargetLinkDirectoriesCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmTargetPropCommandBase.h" diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index 6698ce0..caf2cf4 100644 --- a/Source/cmTargetLinkLibrariesCommand.h +++ b/Source/cmTargetLinkLibrariesCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmTargetLinkLibraryType.h" diff --git a/Source/cmTargetLinkOptionsCommand.h b/Source/cmTargetLinkOptionsCommand.h index 3710739..918a8d7 100644 --- a/Source/cmTargetLinkOptionsCommand.h +++ b/Source/cmTargetLinkOptionsCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmTargetPropCommandBase.h" diff --git a/Source/cmTargetPrecompileHeadersCommand.h b/Source/cmTargetPrecompileHeadersCommand.h index 1ddf2af..7e4558e 100644 --- a/Source/cmTargetPrecompileHeadersCommand.h +++ b/Source/cmTargetPrecompileHeadersCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" diff --git a/Source/cmTargetSourcesCommand.h b/Source/cmTargetSourcesCommand.h index 90fd45f..1cff8c3 100644 --- a/Source/cmTargetSourcesCommand.h +++ b/Source/cmTargetSourcesCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmTargetPropCommandBase.h" diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h index ec9f8b8..e525e85 100644 --- a/Source/cmTryCompileCommand.h +++ b/Source/cmTryCompileCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmCoreTryCompile.h" diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h index bacfcdb..c53a694 100644 --- a/Source/cmTryRunCommand.h +++ b/Source/cmTryRunCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmCoreTryCompile.h" diff --git a/Source/cmUVProcessChain.cxx b/Source/cmUVProcessChain.cxx index 2c37a64..3adc47a 100644 --- a/Source/cmUVProcessChain.cxx +++ b/Source/cmUVProcessChain.cxx @@ -13,7 +13,7 @@ #include <iterator> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> struct cmUVProcessChain::InternalData { diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index ba72294..4b83595 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -21,7 +21,7 @@ #include <iterator> #include <set> -#include "cm_memory.hxx" +#include <cm/memory> static void ConvertToWindowsSlash(std::string& s); diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 3e423e9..1139aa9 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -1,5 +1,7 @@ #include "cmVisualStudioGeneratorOptions.h" +#include <cm/iterator> + #include "cmAlgorithms.h" #include "cmLocalVisualStudioGenerator.h" #include "cmOutputConverter.h" @@ -269,8 +271,8 @@ void cmVisualStudioGeneratorOptions::FixManifestUACFlags() } if (keyValue[1].front() == '\'' && keyValue[1].back() == '\'') { - keyValue[1] = - keyValue[1].substr(1, std::max(0, cm::isize(keyValue[1]) - 2)); + keyValue[1] = keyValue[1].substr( + 1, std::max(std::string::size_type(0), keyValue[1].length() - 2)); } if (keyValue[0] == "level") { diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index a396852..bd71546 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -2,9 +2,10 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmWhileCommand.h" -#include "cm_memory.hxx" +#include <cm/memory> +#include <cm/string_view> + #include "cm_static_string_view.hxx" -#include "cm_string_view.hxx" #include "cmConditionEvaluator.h" #include "cmExecutionStatus.h" diff --git a/Source/cmWorkerPool.cxx b/Source/cmWorkerPool.cxx index 5ac81df..9d279ab 100644 --- a/Source/cmWorkerPool.cxx +++ b/Source/cmWorkerPool.cxx @@ -17,7 +17,7 @@ #include <mutex> #include <thread> -#include "cm_memory.hxx" +#include <cm/memory> /** * @brief libuv pipe buffer class diff --git a/Source/cmWorkerPool.h b/Source/cmWorkerPool.h index bf07299..9179922 100644 --- a/Source/cmWorkerPool.h +++ b/Source/cmWorkerPool.h @@ -10,7 +10,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> // -- Types class cmWorkerPoolInternal; diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index fdf07bb..264dd3f 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -2,13 +2,14 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmWriteFileCommand.h" +#include "cm_sys_stat.h" + #include "cmsys/FStream.hxx" #include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -#include "cm_sys_stat.h" // cmLibraryCommand bool cmWriteFileCommand(std::vector<std::string> const& args, diff --git a/Source/cm_static_string_view.hxx b/Source/cm_static_string_view.hxx index 1bef0c6..8351cd7 100644 --- a/Source/cm_static_string_view.hxx +++ b/Source/cm_static_string_view.hxx @@ -5,7 +5,7 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include "cm_string_view.hxx" +#include <cm/string_view> #include <cstddef> diff --git a/Source/cm_sys_stat.h b/Source/cm_sys_stat.h index d3b9ef2..eb874c7 100644 --- a/Source/cm_sys_stat.h +++ b/Source/cm_sys_stat.h @@ -14,6 +14,6 @@ using gid_t = unsigned short; #include <sys/types.h> // include sys/stat.h after sys/types.h -#include <sys/stat.h> +#include <sys/stat.h> // IWYU pragma: export #endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 9a66805..96d903e 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2,7 +2,13 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmake.h" -#include "cm_memory.hxx" +#include <cm/memory> +#include <cm/string_view> +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) +# include <cm/iterator> +#endif + +#include "cm_sys_stat.h" #include "cmAlgorithms.h" #include "cmCommands.h" @@ -28,8 +34,6 @@ #include "cmUtils.hxx" #include "cmVersionConfig.h" #include "cmWorkingDirectory.h" -#include "cm_string_view.hxx" -#include "cm_sys_stat.h" #if !defined(CMAKE_BOOTSTRAP) # include "cm_jsoncpp_writer.h" diff --git a/Tests/CMakeLib/testArgumentParser.cxx b/Tests/CMakeLib/testArgumentParser.cxx index 788fece..909f71b 100644 --- a/Tests/CMakeLib/testArgumentParser.cxx +++ b/Tests/CMakeLib/testArgumentParser.cxx @@ -4,7 +4,7 @@ #include "cmArgumentParser.h" #include "cm_static_string_view.hxx" -#include "cm_string_view.hxx" +#include <cm/string_view> #include <initializer_list> #include <iostream> diff --git a/Tests/CMakeLib/testOptional.cxx b/Tests/CMakeLib/testOptional.cxx index a5e30fb..cefe9fa 100644 --- a/Tests/CMakeLib/testOptional.cxx +++ b/Tests/CMakeLib/testOptional.cxx @@ -1,9 +1,8 @@ -#include "cm_optional.hxx" -#include "cm_utility.hxx" +#include <cm/optional> +#include <cm/utility> #include <iostream> #include <type_traits> -#include <utility> #include <vector> class EventLogger; diff --git a/Tests/CMakeLib/testString.cxx b/Tests/CMakeLib/testString.cxx index 075892f..3b47a9c 100644 --- a/Tests/CMakeLib/testString.cxx +++ b/Tests/CMakeLib/testString.cxx @@ -4,7 +4,7 @@ #include "cmString.hxx" #include "cm_static_string_view.hxx" -#include "cm_string_view.hxx" +#include <cm/string_view> #include <cstddef> #include <cstring> diff --git a/Tests/CMakeLib/testStringAlgorithms.cxx b/Tests/CMakeLib/testStringAlgorithms.cxx index a92a910..4e48f6e 100644 --- a/Tests/CMakeLib/testStringAlgorithms.cxx +++ b/Tests/CMakeLib/testStringAlgorithms.cxx @@ -3,7 +3,8 @@ #include <cmConfigure.h> // IWYU pragma: keep -#include "cm_string_view.hxx" +#include <cm/string_view> + #include <iostream> #include <sstream> #include <string> diff --git a/Tests/CMakeLib/testUVProcessChain.cxx b/Tests/CMakeLib/testUVProcessChain.cxx index 63c9943..8cee49d 100644 --- a/Tests/CMakeLib/testUVProcessChain.cxx +++ b/Tests/CMakeLib/testUVProcessChain.cxx @@ -15,7 +15,7 @@ #include <csignal> -#include "cm_memory.hxx" +#include <cm/memory> struct ExpectedStatus { diff --git a/Utilities/IWYU/mapping.imp b/Utilities/IWYU/mapping.imp index 78026fa..ef31e8b 100644 --- a/Utilities/IWYU/mapping.imp +++ b/Utilities/IWYU/mapping.imp @@ -95,7 +95,6 @@ { include: [ "<inttypes.h>", public, "\"cm_kwiml.h\"", public ] }, # Self-sufficient wrapper for <sys/stat.h> - { include: [ "<sys/stat.h>", public, "\"cm_sys_stat.h\"", public ] }, { symbol: [ "mode_t", private, "\"cm_sys_stat.h\"", public ] }, # Wrappers for 3rd-party libraries used from the system. diff --git a/Utilities/std/.gitattributes b/Utilities/std/.gitattributes new file mode 100644 index 0000000..cd20549 --- /dev/null +++ b/Utilities/std/.gitattributes @@ -0,0 +1 @@ +cm/* our-c-style diff --git a/Utilities/std/CMakeLists.txt b/Utilities/std/CMakeLists.txt new file mode 100644 index 0000000..63c0a60 --- /dev/null +++ b/Utilities/std/CMakeLists.txt @@ -0,0 +1,10 @@ + +# source files for CMake std library +set(SRCS cm/bits/string_view.cxx + cm/memory + cm/optional + cm/shared_mutex + cm/string_view + cm/utility) + +add_library(cmstd STATIC ${SRCS}) diff --git a/Source/cm_string_view.cxx b/Utilities/std/cm/bits/string_view.cxx index 61fa80e..3b283da 100644 --- a/Source/cm_string_view.cxx +++ b/Utilities/std/cm/bits/string_view.cxx @@ -1,7 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cm_string_view.hxx" +#include <cm/string_view> // IWYU pragma: associated #ifndef CMake_HAVE_CXX_STRING_VIEW diff --git a/Utilities/std/cm/iterator b/Utilities/std/cm/iterator new file mode 100644 index 0000000..718f1d6 --- /dev/null +++ b/Utilities/std/cm/iterator @@ -0,0 +1,216 @@ +// -*-c++-*- +// vim: set ft=cpp: + +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cm_iterator +#define cm_iterator + +#include <iterator> // IWYU pragma: export + +namespace cm { + +#if __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L +using std::make_reverse_iterator; + +using std::cbegin; +using std::cend; + +using std::rbegin; +using std::rend; +using std::crbegin; +using std::crend; +#else +template <class Iter> +std::reverse_iterator<Iter> make_reverse_iterator(Iter it) +{ + return std::reverse_iterator<Iter>(it); +} + +// std::c{begin,end} backport from C++14 +template <class C> +# if defined(_MSC_VER) && _MSC_VER < 1900 +auto cbegin(C const& c) +# else +constexpr auto cbegin(C const& c) noexcept(noexcept(std::begin(c))) +# endif + -> decltype(std::begin(c)) +{ + return std::begin(c); +} + +template <class C> +# if defined(_MSC_VER) && _MSC_VER < 1900 +auto cend(C const& c) +# else +constexpr auto cend(C const& c) noexcept(noexcept(std::end(c))) +# endif + -> decltype(std::end(c)) +{ + return std::end(c); +} + +// std::r{begin,end} backport from C++14 +template <class C> +# if !defined(_MSC_VER) || _MSC_VER >= 1900 +constexpr +# endif + auto + rbegin(C& c) -> decltype(c.rbegin()) +{ + return c.rbegin(); +} +template <class C> +# if !defined(_MSC_VER) || _MSC_VER >= 1900 +constexpr +# endif + auto + rbegin(C const& c) -> decltype(c.rbegin()) +{ + return c.rbegin(); +} +template <typename T, size_t N> +# if !defined(_MSC_VER) || _MSC_VER >= 1900 +constexpr +# endif + std::reverse_iterator<T*> + rbegin(T (&arr)[N]) +{ + return std::reverse_iterator<T*>(arr + N); +} + +template <class C> +# if !defined(_MSC_VER) || _MSC_VER >= 1900 +constexpr +# endif + auto + rend(C& c) -> decltype(c.rend()) +{ + return c.rend(); +} +template <class C> +# if !defined(_MSC_VER) || _MSC_VER >= 1900 +constexpr +# endif + auto + rend(C const& c) -> decltype(c.rend()) +{ + return c.rend(); +} +template <typename T, size_t N> +# if !defined(_MSC_VER) || _MSC_VER >= 1900 +constexpr +# endif + std::reverse_iterator<T*> + rend(T (&arr)[N]) +{ + return std::reverse_iterator<T*>(arr); +} + +// std::cr{begin,end} backport from C++14 +template <class C> +# if !defined(_MSC_VER) || _MSC_VER >= 1900 +constexpr +# endif + auto + crbegin(C const& c) -> decltype(cm::rbegin(c)) +{ + return cm::rbegin(c); +} + +template <class C> +# if !defined(_MSC_VER) || _MSC_VER >= 1900 +constexpr +# endif + auto + crend(C const& c) -> decltype(cm::rend(c)) +{ + return cm::rend(c); +} +#endif + +#if __cplusplus >= 201703L || defined(_MSVC_LANG) && _MSVC_LANG >= 201703L +using std::size; + +using std::empty; +using std::data; +#else + +// std::size backport from C++17. +template <class C> +# if !defined(_MSC_VER) || _MSC_VER >= 1900 +constexpr +# endif + auto + size(C const& c) -> decltype(c.size()) +{ + return c.size(); +} + +template <typename T, size_t N> +# if !defined(_MSC_VER) || _MSC_VER >= 1900 +constexpr +# endif + std::size_t + size(const T (&)[N]) throw() +{ + return N; +} + +// std::empty backport from C++17. +template <class C> +# if defined(_MSC_VER) && _MSC_VER < 1900 +auto empty(C const& c) +# else +constexpr auto empty(C const& c) noexcept(noexcept(c.empty())) +# endif + -> decltype(c.empty()) +{ + return c.empty(); +} +template <typename T, size_t N> +# if defined(_MSC_VER) && _MSC_VER < 1900 +bool empty(const T (&)[N]) +# else +constexpr bool empty(const T (&)[N]) noexcept +# endif +{ + return false; +} + +// std::data backport from C++17. +template <class C> +# if defined(_MSC_VER) && _MSC_VER < 1900 +auto data(C const& c) +# else +constexpr auto data(C const& c) noexcept(noexcept(c.data())) +# endif + -> decltype(c.data()) +{ + return c.data(); +} +template <class C> +# if defined(_MSC_VER) && _MSC_VER < 1900 +auto data(C& c) +# else +constexpr auto data(C& c) noexcept(noexcept(c.data())) +# endif + -> decltype(c.data()) +{ + return c.data(); +} +template <typename T, size_t N> +# if defined(_MSC_VER) && _MSC_VER < 1900 +T* data(T (&)[N]) +# else +constexpr T* data(T (&arr)[N]) noexcept +# endif +{ + return arr; +} + +#endif + +} // namespace cm + +#endif diff --git a/Source/cm_memory.hxx b/Utilities/std/cm/memory index 9f5e678..8ebded2 100644 --- a/Source/cm_memory.hxx +++ b/Utilities/std/cm/memory @@ -1,9 +1,10 @@ +// -*-c++-*- +// vim: set ft=cpp: + /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_memory_hxx -#define cm_memory_hxx - -#include "cmConfigure.h" // IWYU pragma: keep +#ifndef cm_memory +#define cm_memory #include <memory> // IWYU pragma: export #if !defined(CMake_HAVE_CXX_MAKE_UNIQUE) diff --git a/Source/cm_optional.hxx b/Utilities/std/cm/optional index 295571d..80b0951 100644 --- a/Source/cm_optional.hxx +++ b/Utilities/std/cm/optional @@ -1,20 +1,21 @@ +// -*-c++-*- +// vim: set ft=cpp: + /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_optional_hxx -#define cm_optional_hxx - -#include "cmConfigure.h" // IWYU pragma: keep +#ifndef cm_optional +#define cm_optional #if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) # define CMake_HAVE_CXX_OPTIONAL #endif #if defined(CMake_HAVE_CXX_OPTIONAL) -# include <optional> +# include <optional> // IWYU pragma: export #else -# include "cm_utility.hxx" # include <memory> -# include <utility> + +# include <cm/utility> #endif namespace cm { diff --git a/Source/cm_thread.hxx b/Utilities/std/cm/shared_mutex index b1f0645..2ac9447 100644 --- a/Source/cm_thread.hxx +++ b/Utilities/std/cm/shared_mutex @@ -1,18 +1,36 @@ +// -*-c++-*- +// vim: set ft=cpp: + /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef CM_THREAD_HXX -#define CM_THREAD_HXX +#ifndef cm_shared_mutex +#define cm_shared_mutex -#include "cmConfigure.h" // IWYU pragma: keep -#include "cm_uv.h" +#if __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L +# define CMake_HAVE_CXX_SHARED_LOCK +#endif +#if __cplusplus >= 201703L || defined(_MSVC_LANG) && _MSVC_LANG >= 201703L +# define CMake_HAVE_CXX_SHARED_MUTEX +#endif -namespace cm { +#if defined(CMake_HAVE_CXX_SHARED_LOCK) +# include <shared_mutex> // IWYU pragma: export +#endif +#if !defined(CMake_HAVE_CXX_SHARED_MUTEX) +# include "cm_uv.h" +#endif +namespace cm { +#if defined(CMake_HAVE_CXX_SHARED_MUTEX) +using std::shared_mutex; +#else class shared_mutex { uv_rwlock_t _M_; public: + using native_handle_type = uv_rwlock_t*; + shared_mutex() { uv_rwlock_init(&_M_); } ~shared_mutex() { uv_rwlock_destroy(&_M_); } @@ -20,18 +38,27 @@ public: shared_mutex& operator=(shared_mutex const&) = delete; void lock() { uv_rwlock_wrlock(&_M_); } + bool try_lock() { return uv_rwlock_trywrlock(&_M_) == 0; } void unlock() { uv_rwlock_wrunlock(&_M_); } void lock_shared() { uv_rwlock_rdlock(&_M_); } void unlock_shared() { uv_rwlock_rdunlock(&_M_); } + + native_handle_type native_handle() { return &_M_; } }; +#endif +#if defined(CMake_HAVE_CXX_SHARED_LOCK) +using std::shared_lock; +#else template <typename T> class shared_lock { T& _mutex; public: + using mutex_type = T; + shared_lock(T& m) : _mutex(m) { @@ -43,6 +70,7 @@ public: shared_lock(shared_lock const&) = delete; shared_lock& operator=(shared_lock const&) = delete; }; +#endif } #endif diff --git a/Source/cm_string_view.hxx b/Utilities/std/cm/string_view index 04de797..4d359cb 100644 --- a/Source/cm_string_view.hxx +++ b/Utilities/std/cm/string_view @@ -1,16 +1,17 @@ +// -*-c++-*- +// vim: set ft=cpp: + /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_string_view_hxx -#define cm_string_view_hxx - -#include "cmConfigure.h" // IWYU pragma: keep +#ifndef cm_string_view +#define cm_string_view #if __cplusplus >= 201703L || defined(_MSVC_LANG) && _MSVC_LANG >= 201703L # define CMake_HAVE_CXX_STRING_VIEW #endif #ifdef CMake_HAVE_CXX_STRING_VIEW -# include <string_view> +# include <string_view> // IWYU pragma: export namespace cm { using std::string_view; } diff --git a/Source/cm_utility.hxx b/Utilities/std/cm/utility index 99d7f8b..3acac4f 100644 --- a/Source/cm_utility.hxx +++ b/Utilities/std/cm/utility @@ -1,17 +1,16 @@ +// -*-c++-*- +// vim: set ft=cpp: + /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_utility_hxx -#define cm_utility_hxx - -#include "cmConfigure.h" // IWYU pragma: keep +#ifndef cm_utility +#define cm_utility #if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) # define CMake_HAVE_CXX_IN_PLACE #endif -#if defined(CMake_HAVE_CXX_IN_PLACE) -# include <utility> -#endif +#include <utility> // IWYU pragma: export namespace cm { @@ -452,7 +452,6 @@ CMAKE_CXX_SOURCES="\ cmake \ cmakemain \ cmcmd \ - cm_string_view \ " if ${cmake_system_mingw}; then @@ -463,6 +462,17 @@ if ${cmake_system_mingw}; then " fi +CMAKE_STD_CXX_HEADERS="\ + memory \ + optional \ + shared_mutex \ + string_view \ + utility \ +" +CMAKE_STD_CXX_SOURCES="\ + string_view \ +" + LexerParser_CXX_SOURCES="\ cmCommandArgumentLexer \ cmCommandArgumentParser \ @@ -1345,6 +1355,8 @@ cmake_compiler_settings_comment="/* * * Sources: * ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} + * STD Sources: + * ${CMAKE_STD_CXX_HEADERS} ${CMAKE_STD_CXX_SOURCES} * LexerParser Sources: * ${LexerParser_CXX_SOURCES} ${LexerParser_C_SOURCES} * kwSys Sources: @@ -1411,9 +1423,12 @@ done cmake_generate_file "${cmake_bootstrap_dir}/cmThirdParty.h" "" # Generate Makefile -dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h" +dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.hxx `cmake_escape \"${cmake_source_dir}\"`/Source/*.h" +for h in ${CMAKE_STD_CXX_HEADERS}; do + dep="${dep} `cmake_escape \"${cmake_source_dir}\"`/Utilities/std/cm/${h}" +done objs="" -for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${LexerParser_CXX_SOURCES} ${LexerParser_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}; do +for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${CMAKE_STD_CXX_SOURCES} ${LexerParser_CXX_SOURCES} ${LexerParser_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}; do objs="${objs} ${a}.o" done for a in ${LIBUV_C_SOURCES}; do @@ -1497,6 +1512,7 @@ cmake_cxx_flags="${cmake_cxx_flags} \ -I`cmake_escape \"${cmake_bootstrap_dir}\"` \ -I`cmake_escape \"${cmake_source_dir}/Source\"` \ -I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \ + -I`cmake_escape \"${cmake_source_dir}/Utilities/std\"` \ -I`cmake_escape \"${cmake_source_dir}/Utilities\"`" echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile" echo " ${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} ${libs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile" @@ -1511,6 +1527,12 @@ for a in ${CMAKE_C_SOURCES}; do echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile" echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile" done +for a in ${CMAKE_STD_CXX_SOURCES}; do + src=`cmake_escape "${cmake_source_dir}/Utilities/std/cm/bits/${a}.cxx"` + src_flags=`eval echo \\${cmake_cxx_flags_\${a}}` + echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile" + echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile" +done for a in ${LexerParser_CXX_SOURCES}; do src=`cmake_escape "${cmake_source_dir}/Source/LexerParser/${a}.cxx"` src_flags=`eval echo \\${cmake_cxx_flags_\${a}}` |