summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/manual/cmake-variables.7.rst2
-rw-r--r--Help/prop_tgt/CUDA_RESOLVE_DEVICE_SYMBOLS.rst16
-rw-r--r--Help/release/dev/cuda-CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS.rst6
-rw-r--r--Help/release/dev/per-lang-link-library-flag.rst7
-rw-r--r--Help/variable/CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS.rst6
-rw-r--r--Help/variable/CMAKE_LANG_LINK_LIBRARY_FLAG.rst7
-rw-r--r--Modules/CMakeCUDAInformation.cmake3
-rw-r--r--Modules/CMakeSwiftInformation.cmake1
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake1
-rw-r--r--Modules/Platform/Windows-Clang.cmake15
-rw-r--r--Source/CMakeLists.txt3
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/IFW/cmCPackIFWCommon.cxx5
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx7
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx3
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.cxx19
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx18
-rw-r--r--Source/CPack/cmCPackBundleGenerator.cxx3
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx3
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.cxx6
-rw-r--r--Source/CPack/cmCPackFreeBSDGenerator.cxx10
-rw-r--r--Source/CPack/cmCPackGenerator.cxx22
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx9
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.cxx4
-rw-r--r--Source/CPack/cpack.cxx7
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx6
-rw-r--r--Source/CTest/cmCTestConfigureCommand.cxx3
-rw-r--r--Source/CTest/cmCTestGIT.cxx2
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx4
-rw-r--r--Source/CTest/cmCTestP4.cxx3
-rw-r--r--Source/CTest/cmCTestRunTest.cxx2
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx8
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx5
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx9
-rw-r--r--Source/CTest/cmCTestTestCommand.cxx7
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx37
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.cxx3
-rw-r--r--Source/cmAddCompileDefinitionsCommand.cxx14
-rw-r--r--Source/cmAddCompileDefinitionsCommand.h24
-rw-r--r--Source/cmAddCompileOptionsCommand.cxx14
-rw-r--r--Source/cmAddCompileOptionsCommand.h24
-rw-r--r--Source/cmAddCustomCommandCommand.cxx84
-rw-r--r--Source/cmAddCustomCommandCommand.h33
-rw-r--r--Source/cmAddCustomTargetCommand.cxx42
-rw-r--r--Source/cmAddCustomTargetCommand.h31
-rw-r--r--Source/cmAddDefinitionsCommand.cxx16
-rw-r--r--Source/cmAddDefinitionsCommand.h30
-rw-r--r--Source/cmAddDependenciesCommand.cxx21
-rw-r--r--Source/cmAddDependenciesCommand.h29
-rw-r--r--Source/cmAddExecutableCommand.cxx59
-rw-r--r--Source/cmAddExecutableCommand.h30
-rw-r--r--Source/cmAddLibraryCommand.cxx100
-rw-r--r--Source/cmAddLibraryCommand.h30
-rw-r--r--Source/cmAddLinkOptionsCommand.cxx14
-rw-r--r--Source/cmAddLinkOptionsCommand.h24
-rw-r--r--Source/cmAddSubDirectoryCommand.cxx33
-rw-r--r--Source/cmAddSubDirectoryCommand.h31
-rw-r--r--Source/cmAddTestCommand.cxx49
-rw-r--r--Source/cmAddTestCommand.h32
-rw-r--r--Source/cmArchiveWrite.h2
-rw-r--r--Source/cmAuxSourceDirectoryCommand.cxx21
-rw-r--r--Source/cmAuxSourceDirectoryCommand.h33
-rw-r--r--Source/cmCTest.cxx18
-rw-r--r--Source/cmCacheManager.cxx3
-rw-r--r--Source/cmCommands.cxx39
-rw-r--r--Source/cmComputeLinkDepends.cxx3
-rw-r--r--Source/cmComputeLinkInformation.cxx31
-rw-r--r--Source/cmConditionEvaluator.cxx2
-rw-r--r--Source/cmCoreTryCompile.cxx4
-rw-r--r--Source/cmCustomCommandGenerator.cxx10
-rw-r--r--Source/cmDepends.cxx7
-rw-r--r--Source/cmDependsC.cxx3
-rw-r--r--Source/cmDependsFortran.cxx4
-rw-r--r--Source/cmExportBuildAndroidMKGenerator.cxx4
-rw-r--r--Source/cmExportFileGenerator.cxx4
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx4
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx6
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx11
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx2
-rw-r--r--Source/cmFileCommand.cxx17
-rw-r--r--Source/cmFileCopier.cxx2
-rw-r--r--Source/cmFindCommon.cxx5
-rw-r--r--Source/cmFindLibraryCommand.cxx5
-rw-r--r--Source/cmFindPackageCommand.cxx6
-rw-r--r--Source/cmForEachCommand.cxx3
-rw-r--r--Source/cmGeneratedFileStream.cxx8
-rw-r--r--Source/cmGeneratorExpression.cxx5
-rw-r--r--Source/cmGeneratorExpressionNode.cxx22
-rw-r--r--Source/cmGeneratorTarget.cxx99
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx38
-rw-r--r--Source/cmGlobalGenerator.h8
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx2
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx5
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx19
-rw-r--r--Source/cmGraphVizWriter.cxx4
-rw-r--r--Source/cmIDEOptions.cxx6
-rw-r--r--Source/cmIncludeGuardCommand.cxx2
-rw-r--r--Source/cmInstallCommand.cxx8
-rw-r--r--Source/cmInstallDirectoryGenerator.cxx3
-rw-r--r--Source/cmInstallExportGenerator.cxx4
-rw-r--r--Source/cmInstallFilesGenerator.cxx5
-rw-r--r--Source/cmInstalledFile.cxx3
-rw-r--r--Source/cmLDConfigLDConfigTool.cxx3
-rw-r--r--Source/cmLinkLineDeviceComputer.cxx5
-rw-r--r--Source/cmListCommand.cxx6
-rw-r--r--Source/cmListFileCache.cxx3
-rw-r--r--Source/cmLocalGenerator.cxx170
-rw-r--r--Source/cmLocalGenerator.h2
-rw-r--r--Source/cmLocalNinjaGenerator.cxx5
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx17
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx2
-rw-r--r--Source/cmMakefile.cxx68
-rw-r--r--Source/cmMakefile.h8
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx8
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx12
-rw-r--r--Source/cmMakefileTargetGenerator.cxx21
-rw-r--r--Source/cmMessageCommand.cxx7
-rw-r--r--Source/cmMessenger.cxx4
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx10
-rw-r--r--Source/cmNinjaTargetGenerator.cxx27
-rw-r--r--Source/cmOutputConverter.cxx3
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx2
-rw-r--r--Source/cmParseArgumentsCommand.cxx12
-rw-r--r--Source/cmPolicies.cxx2
-rw-r--r--Source/cmQtAutoGenInitializer.cxx16
-rw-r--r--Source/cmQtAutoGenerator.cxx4
-rw-r--r--Source/cmQtAutoMocUic.cxx12
-rw-r--r--Source/cmQtAutoRcc.cxx4
-rw-r--r--Source/cmRemoveCommand.cxx7
-rw-r--r--Source/cmRuntimeDependencyArchive.cxx7
-rw-r--r--Source/cmSearchPath.cxx4
-rw-r--r--Source/cmStringAlgorithms.cxx119
-rw-r--r--Source/cmStringAlgorithms.h54
-rw-r--r--Source/cmStringCommand.cxx6
-rw-r--r--Source/cmSystemTools.cxx133
-rw-r--r--Source/cmSystemTools.h49
-rw-r--r--Source/cmTarget.cxx11
-rw-r--r--Source/cmTestGenerator.cxx5
-rw-r--r--Source/cmTimestamp.cxx2
-rw-r--r--Source/cmTryRunCommand.cxx3
-rw-r--r--Source/cmUVHandlePtr.cxx6
-rw-r--r--Source/cmUnsetCommand.cxx2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx10
-rw-r--r--Source/cmXCodeScheme.cxx4
-rw-r--r--Source/cm_codecvt.hxx2
-rw-r--r--Source/cmake.cxx60
-rw-r--r--Source/cmake.h8
-rw-r--r--Source/cmakemain.cxx22
-rw-r--r--Source/cmcmd.cxx35
-rw-r--r--Source/ctest.cxx4
-rw-r--r--Tests/CMakeLib/testStringAlgorithms.cxx58
-rw-r--r--Tests/CMakeLib/testSystemTools.cxx16
-rw-r--r--Tests/CudaOnly/DontResolveDeviceSymbols/CMakeLists.txt2
-rwxr-xr-xbootstrap4
159 files changed, 1163 insertions, 1441 deletions
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 432d7fc..9ad1195 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -353,6 +353,7 @@ Variables that Control the Build
/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG
/variable/CMAKE_CONFIG_POSTFIX
/variable/CMAKE_CUDA_SEPARABLE_COMPILATION
+ /variable/CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS
/variable/CMAKE_DEBUG_POSTFIX
/variable/CMAKE_ENABLE_EXPORTS
/variable/CMAKE_EXE_LINKER_FLAGS
@@ -383,6 +384,7 @@ Variables that Control the Build
/variable/CMAKE_LANG_CPPCHECK
/variable/CMAKE_LANG_CPPLINT
/variable/CMAKE_LANG_INCLUDE_WHAT_YOU_USE
+ /variable/CMAKE_LANG_LINK_LIBRARY_FLAG
/variable/CMAKE_LANG_VISIBILITY_PRESET
/variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY
/variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY_CONFIG
diff --git a/Help/prop_tgt/CUDA_RESOLVE_DEVICE_SYMBOLS.rst b/Help/prop_tgt/CUDA_RESOLVE_DEVICE_SYMBOLS.rst
index ef74ae2..dae960f 100644
--- a/Help/prop_tgt/CUDA_RESOLVE_DEVICE_SYMBOLS.rst
+++ b/Help/prop_tgt/CUDA_RESOLVE_DEVICE_SYMBOLS.rst
@@ -1,12 +1,16 @@
CUDA_RESOLVE_DEVICE_SYMBOLS
---------------------------
-CUDA only: Enables device linking for the specific library target
-
-If set this will enable device linking on the library target. Normally
-device linking is deferred until a shared library or executable is generated,
-allowing for multiple static libraries to resolve device symbols at the same
-time when they are used by a shared library or executable.
+CUDA only: Enables device linking for the specific library target where
+required.
+
+If set, this will tell the required compilers to enable device linking
+on the library target. Device linking is an additional link step
+required by some CUDA compilers when :prop_tgt:`CUDA_SEPARABLE_COMPILATION` is
+enabled. Normally device linking is deferred until a shared library or
+executable is generated, allowing for multiple static libraries to resolve
+device symbols at the same time when they are used by a shared library or
+executable.
By default static library targets have this property is disabled,
while shared, module, and executable targets have this property enabled.
diff --git a/Help/release/dev/cuda-CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS.rst b/Help/release/dev/cuda-CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS.rst
new file mode 100644
index 0000000..f21fddf
--- /dev/null
+++ b/Help/release/dev/cuda-CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS.rst
@@ -0,0 +1,6 @@
+cuda-CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS
+--------------------------------------
+
+* Variable :variable:`CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS` has been
+ introduced to optionally initialize the
+ :prop_tgt:`CUDA_RESOLVE_DEVICE_SYMBOLS` target property.
diff --git a/Help/release/dev/per-lang-link-library-flag.rst b/Help/release/dev/per-lang-link-library-flag.rst
new file mode 100644
index 0000000..ca1181d
--- /dev/null
+++ b/Help/release/dev/per-lang-link-library-flag.rst
@@ -0,0 +1,7 @@
+per-lang-link-library-flag
+--------------------------
+
+* The new :variable:`CMAKE_<LANG>_LINK_LIBRARY_FLAG` flag allows you to now
+ control the flag used to specify linking to a library on a per-language basis.
+ This is useful for mixed-language projects where the different drivers may use
+ different flags.
diff --git a/Help/variable/CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS.rst b/Help/variable/CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS.rst
new file mode 100644
index 0000000..fc835cd
--- /dev/null
+++ b/Help/variable/CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS.rst
@@ -0,0 +1,6 @@
+CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS
+---------------------------------
+
+Default value for :prop_tgt:`CUDA_RESOLVE_DEVICE_SYMBOLS` target
+property. This variable is used to initialize the property on each target as
+it is created.
diff --git a/Help/variable/CMAKE_LANG_LINK_LIBRARY_FLAG.rst b/Help/variable/CMAKE_LANG_LINK_LIBRARY_FLAG.rst
new file mode 100644
index 0000000..d7bb0d8
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_LINK_LIBRARY_FLAG.rst
@@ -0,0 +1,7 @@
+CMAKE_<LANG>_LINK_LIBRARY_FLAG
+------------------------------
+
+Flag to be used to link a library into a shared library or executable.
+
+This flag will be used to specify a library to link to a shared library or an
+executable for the specific language. On most compilers this is ``-l``.
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake
index 43ae989..b0d80d1 100644
--- a/Modules/CMakeCUDAInformation.cmake
+++ b/Modules/CMakeCUDAInformation.cmake
@@ -171,7 +171,8 @@ if(NOT CMAKE_CUDA_LINK_EXECUTABLE)
"<CMAKE_CUDA_HOST_LINK_LAUNCHER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_LINKS}")
endif()
-if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "8.0.0")
+if( CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND
+ CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "8.0.0")
set(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS "-Wno-deprecated-gpu-targets")
else()
set(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS "")
diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake
index bf3ca40..f22205c 100644
--- a/Modules/CMakeSwiftInformation.cmake
+++ b/Modules/CMakeSwiftInformation.cmake
@@ -36,6 +36,7 @@ set(CMAKE_Swift_DEFINE_FLAG -D)
set(CMAKE_Swift_FRAMEWORK_SEARCH_FLAG "-F ")
set(CMAKE_Swift_LIBRARY_PATH_FLAG "-L ")
set(CMAKE_Swift_LIBRARY_PATH_TERMINATOR "")
+set(CMAKE_Swift_LINK_LIBRARY_FLAG "-l")
set(CMAKE_Swift_LINKER_WRAPPER_FLAG "-Xlinker" " ")
set(CMAKE_Swift_RESPONSE_FILE_LINK_FLAG @)
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
index c0ccb71..b59deda 100644
--- a/Modules/Compiler/NVIDIA-CUDA.cmake
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -1,3 +1,4 @@
+set(CMAKE_CUDA_COMPILER_HAS_DEVICE_LINK_PHASE True)
set(CMAKE_CUDA_VERBOSE_FLAG "-v")
set(CMAKE_CUDA_VERBOSE_COMPILE_FLAG "-Xcompiler=-v")
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
index b317da6..728e0b9 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -99,6 +99,21 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
"or clang-cl as both C and C++ compilers.")
endif()
+ if(NOT CMAKE_RC_COMPILER_INIT)
+ # Check if rc is already in the path
+ # This may happen in cases where the user is already in a visual studio environment when CMake is invoked
+ find_program(__RC_COMPILER_PATH NAMES rc)
+
+ # Default to rc if it's available, otherwise fall back to llvm-rc
+ if(__RC_COMPILER_PATH)
+ set(CMAKE_RC_COMPILER_INIT rc)
+ else()
+ set(CMAKE_RC_COMPILER_INIT llvm-rc)
+ endif()
+
+ unset(__RC_COMPILER_PATH CACHE)
+ endif()
+
if ( "x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC" OR "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC" )
include(Platform/Windows-MSVC)
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index ee82ff5..7cd07a8 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -95,9 +95,6 @@ include_directories(
${CMake_HAIKU_INCLUDE_DIRS}
)
-# let cmake know it is supposed to use it
-add_definitions(-DCMAKE_BUILD_WITH_CMAKE)
-
# Check if we can build the ELF parser.
if(CMAKE_USE_ELF_PARSER)
set(ELF_SRCS cmELF.h cmELF.cxx)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 93f3e63..9a76073 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 15)
-set(CMake_VERSION_PATCH 20190811)
+set(CMake_VERSION_PATCH 20190819)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CPack/IFW/cmCPackIFWCommon.cxx b/Source/CPack/IFW/cmCPackIFWCommon.cxx
index 1e72641..5b1ccbd 100644
--- a/Source/CPack/IFW/cmCPackIFWCommon.cxx
+++ b/Source/CPack/IFW/cmCPackIFWCommon.cxx
@@ -5,6 +5,7 @@
#include "cmCPackGenerator.h"
#include "cmCPackIFWGenerator.h"
#include "cmCPackLog.h" // IWYU pragma: keep
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTimestamp.h"
#include "cmVersionConfig.h"
@@ -78,7 +79,7 @@ void cmCPackIFWCommon::ExpandListArgument(
const std::string& arg, std::map<std::string, std::string>& argsOut)
{
std::vector<std::string> args;
- cmSystemTools::ExpandListArgument(arg, args, false);
+ cmExpandList(arg, args, false);
if (args.empty()) {
return;
}
@@ -100,7 +101,7 @@ void cmCPackIFWCommon::ExpandListArgument(
const std::string& arg, std::multimap<std::string, std::string>& argsOut)
{
std::vector<std::string> args;
- cmSystemTools::ExpandListArgument(arg, args, false);
+ cmExpandList(arg, args, false);
if (args.empty()) {
return;
}
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index c1b6eea..76eb760 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -11,6 +11,7 @@
#include "cmCPackLog.h" // IWYU pragma: keep
#include "cmDuration.h"
#include "cmGeneratedFileStream.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include <sstream>
@@ -292,14 +293,14 @@ int cmCPackIFWGenerator::InitializeInternal()
// Additional packages dirs
this->PkgsDirsVector.clear();
if (const char* dirs = this->GetOption("CPACK_IFW_PACKAGES_DIRECTORIES")) {
- cmSystemTools::ExpandListArgument(dirs, this->PkgsDirsVector);
+ cmExpandList(dirs, this->PkgsDirsVector);
}
// Additional repositories dirs
this->RepoDirsVector.clear();
if (const char* dirs =
this->GetOption("CPACK_IFW_REPOSITORIES_DIRECTORIES")) {
- cmSystemTools::ExpandListArgument(dirs, this->RepoDirsVector);
+ cmExpandList(dirs, this->RepoDirsVector);
}
// Installer
@@ -317,7 +318,7 @@ int cmCPackIFWGenerator::InitializeInternal()
// Repositories
if (const char* RepoAllStr = this->GetOption("CPACK_IFW_REPOSITORIES_ALL")) {
std::vector<std::string> RepoAllVector;
- cmSystemTools::ExpandListArgument(RepoAllStr, RepoAllVector);
+ cmExpandList(RepoAllStr, RepoAllVector);
for (std::string const& r : RepoAllVector) {
this->GetRepository(r);
}
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index f130e05..5313dd0 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -245,8 +245,7 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
if (const char* optIFW_PACKAGE_RESOURCES =
this->GetOption("CPACK_IFW_PACKAGE_RESOURCES")) {
this->Resources.clear();
- cmSystemTools::ExpandListArgument(optIFW_PACKAGE_RESOURCES,
- this->Resources);
+ cmExpandList(optIFW_PACKAGE_RESOURCES, this->Resources);
}
}
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index a1a52b1..7407c49 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -8,6 +8,7 @@
#include "cmCPackIFWInstaller.h"
#include "cmCPackLog.h" // IWYU pragma: keep
#include "cmGeneratedFileStream.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTimestamp.h"
#include "cmXMLWriter.h"
@@ -196,7 +197,7 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
// User interfaces
if (const char* option = this->GetOption(prefix + "USER_INTERFACES")) {
this->UserInterfaces.clear();
- cmSystemTools::ExpandListArgument(option, this->UserInterfaces);
+ cmExpandList(option, this->UserInterfaces);
}
// CMake dependencies
@@ -209,7 +210,7 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
// Licenses
if (const char* option = this->GetOption(prefix + "LICENSES")) {
this->Licenses.clear();
- cmSystemTools::ExpandListArgument(option, this->Licenses);
+ cmExpandList(option, this->Licenses);
if (this->Licenses.size() % 2 != 0) {
cmCPackIFWLogger(
WARNING,
@@ -281,13 +282,13 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
// User interfaces
if (const char* option = this->GetOption(prefix + "USER_INTERFACES")) {
this->UserInterfaces.clear();
- cmSystemTools::ExpandListArgument(option, this->UserInterfaces);
+ cmExpandList(option, this->UserInterfaces);
}
// Licenses
if (const char* option = this->GetOption(prefix + "LICENSES")) {
this->Licenses.clear();
- cmSystemTools::ExpandListArgument(option, this->Licenses);
+ cmExpandList(option, this->Licenses);
if (this->Licenses.size() % 2 != 0) {
cmCPackIFWLogger(
WARNING,
@@ -398,18 +399,18 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
this->Translations.clear();
} else if (const char* value = this->GetOption(option)) {
this->Translations.clear();
- cmSystemTools::ExpandListArgument(value, this->Translations);
+ cmExpandList(value, this->Translations);
}
// QtIFW dependencies
std::vector<std::string> deps;
option = prefix + "DEPENDS";
if (const char* value = this->GetOption(option)) {
- cmSystemTools::ExpandListArgument(value, deps);
+ cmExpandList(value, deps);
}
option = prefix + "DEPENDENCIES";
if (const char* value = this->GetOption(option)) {
- cmSystemTools::ExpandListArgument(value, deps);
+ cmExpandList(value, deps);
}
for (std::string const& d : deps) {
DependenceStruct dep(d);
@@ -431,7 +432,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
this->AlienAutoDependOn.clear();
} else if (const char* value = this->GetOption(option)) {
std::vector<std::string> depsOn;
- cmSystemTools::ExpandListArgument(value, depsOn);
+ cmExpandList(value, depsOn);
for (std::string const& d : depsOn) {
DependenceStruct dep(d);
if (this->Generator->Packages.count(dep.Name)) {
@@ -488,7 +489,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
this->Replaces.clear();
} else if (const char* value = this->GetOption(option)) {
this->Replaces.clear();
- cmSystemTools::ExpandListArgument(value, this->Replaces);
+ cmExpandList(value, this->Replaces);
}
// Requires admin rights
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index fa64d79..458a335 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -7,6 +7,7 @@
#include "cmCryptoHash.h"
#include "cmGeneratedFileStream.h"
#include "cmInstalledFile.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmUuid.h"
#include <algorithm>
@@ -226,7 +227,7 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
const char* patchFilePath = GetOption("CPACK_WIX_PATCH_FILE");
if (patchFilePath) {
std::vector<std::string> patchFilePaths;
- cmSystemTools::ExpandListArgument(patchFilePath, patchFilePaths);
+ cmExpandList(patchFilePath, patchFilePaths);
for (std::string const& p : patchFilePaths) {
if (!this->Patch->LoadFragments(p)) {
@@ -300,7 +301,7 @@ void cmCPackWIXGenerator::AppendUserSuppliedExtraSources()
if (!cpackWixExtraSources)
return;
- cmSystemTools::ExpandListArgument(cpackWixExtraSources, this->WixSources);
+ cmExpandList(cpackWixExtraSources, this->WixSources);
}
void cmCPackWIXGenerator::AppendUserSuppliedExtraObjects(std::ostream& stream)
@@ -311,8 +312,7 @@ void cmCPackWIXGenerator::AppendUserSuppliedExtraObjects(std::ostream& stream)
std::vector<std::string> expandedExtraObjects;
- cmSystemTools::ExpandListArgument(cpackWixExtraObjects,
- expandedExtraObjects);
+ cmExpandList(cpackWixExtraObjects, expandedExtraObjects);
for (std::string const& obj : expandedExtraObjects) {
stream << " " << QuotePath(obj);
@@ -664,8 +664,7 @@ bool cmCPackWIXGenerator::AddComponentsToFeature(
std::vector<std::string> cpackPackageExecutablesList;
const char* cpackPackageExecutables = GetOption("CPACK_PACKAGE_EXECUTABLES");
if (cpackPackageExecutables) {
- cmSystemTools::ExpandListArgument(cpackPackageExecutables,
- cpackPackageExecutablesList);
+ cmExpandList(cpackPackageExecutables, cpackPackageExecutablesList);
if (cpackPackageExecutablesList.size() % 2 != 0) {
cmCPackLogger(
cmCPackLog::LOG_ERROR,
@@ -680,8 +679,7 @@ bool cmCPackWIXGenerator::AddComponentsToFeature(
const char* cpackPackageDesktopLinks =
GetOption("CPACK_CREATE_DESKTOP_LINKS");
if (cpackPackageDesktopLinks) {
- cmSystemTools::ExpandListArgument(cpackPackageDesktopLinks,
- cpackPackageDesktopLinksList);
+ cmExpandList(cpackPackageDesktopLinks, cpackPackageDesktopLinksList);
}
AddDirectoryAndFileDefinitions(
@@ -1137,7 +1135,7 @@ void cmCPackWIXGenerator::CollectExtensions(std::string const& variableName,
return;
std::vector<std::string> list;
- cmSystemTools::ExpandListArgument(variableContent, list);
+ cmExpandList(variableContent, list);
extensions.insert(list.begin(), list.end());
}
@@ -1149,7 +1147,7 @@ void cmCPackWIXGenerator::AddCustomFlags(std::string const& variableName,
return;
std::vector<std::string> list;
- cmSystemTools::ExpandListArgument(variableContent, list);
+ cmExpandList(variableContent, list);
for (std::string const& i : list) {
stream << " " << QuotePath(i);
diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx
index 3a476f4..213ce92 100644
--- a/Source/CPack/cmCPackBundleGenerator.cxx
+++ b/Source/CPack/cmCPackBundleGenerator.cxx
@@ -6,6 +6,7 @@
#include <vector>
#include "cmCPackLog.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
cmCPackBundleGenerator::cmCPackBundleGenerator() = default;
@@ -206,7 +207,7 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
: "";
std::vector<std::string> relFiles;
- cmSystemTools::ExpandListArgument(sign_files, relFiles);
+ cmExpandList(sign_files, relFiles);
// sign the files supplied by the user, ie. frameworks.
for (auto const& file : relFiles) {
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index cfb5efd..06b9876 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -8,6 +8,7 @@
#include "cmCPackLog.h"
#include "cmCryptoHash.h"
#include "cmGeneratedFileStream.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cm_sys_stat.h"
@@ -378,7 +379,7 @@ bool DebGenerator::generateControlTar(std::string const& md5Filename) const
control_tar.ClearPermissions();
std::vector<std::string> controlExtraList;
- cmSystemTools::ExpandListArgument(ControlExtra, controlExtraList);
+ cmExpandList(ControlExtra, controlExtraList);
for (std::string const& i : controlExtraList) {
std::string filenamename = cmsys::SystemTools::GetFilenameName(i);
std::string localcopy = WorkDir + "/" + filenamename;
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx
index 7a3742b..85faa61 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -6,6 +6,7 @@
#include "cmCPackLog.h"
#include "cmDuration.h"
#include "cmGeneratedFileStream.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmsys/FStream.hxx"
@@ -128,8 +129,7 @@ int cmCPackDragNDropGenerator::InitializeInternal()
}
std::vector<std::string> languages;
- cmSystemTools::ExpandListArgument(
- this->GetOption("CPACK_DMG_SLA_LANGUAGES"), languages);
+ cmExpandList(this->GetOption("CPACK_DMG_SLA_LANGUAGES"), languages);
if (languages.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPACK_DMG_SLA_LANGUAGES set but empty" << std::endl);
@@ -527,7 +527,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
std::vector<std::string> languages;
if (!oldStyle) {
- cmSystemTools::ExpandListArgument(cpack_dmg_languages, languages);
+ cmExpandList(cpack_dmg_languages, languages);
}
cmGeneratedFileStream ofs(sla_r);
diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx
index 9fdafa4..b90a27c 100644
--- a/Source/CPack/cmCPackFreeBSDGenerator.cxx
+++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx
@@ -6,6 +6,7 @@
#include "cmCPackArchiveGenerator.h"
#include "cmCPackLog.h"
#include "cmGeneratedFileStream.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
// Needed for ::open() and ::stat()
@@ -228,8 +229,7 @@ void cmCPackFreeBSDGenerator::write_manifest_fields(
"desc", var_lookup("CPACK_FREEBSD_PACKAGE_DESCRIPTION"));
manifest << ManifestKeyValue("www", var_lookup("CPACK_FREEBSD_PACKAGE_WWW"));
std::vector<std::string> licenses;
- cmSystemTools::ExpandListArgument(
- var_lookup("CPACK_FREEBSD_PACKAGE_LICENSE"), licenses);
+ cmExpandList(var_lookup("CPACK_FREEBSD_PACKAGE_LICENSE"), licenses);
std::string licenselogic("single");
if (licenses.empty()) {
cmSystemTools::SetFatalErrorOccured();
@@ -239,13 +239,11 @@ void cmCPackFreeBSDGenerator::write_manifest_fields(
manifest << ManifestKeyValue("licenselogic", licenselogic);
manifest << (ManifestKeyListValue("licenses") << licenses);
std::vector<std::string> categories;
- cmSystemTools::ExpandListArgument(
- var_lookup("CPACK_FREEBSD_PACKAGE_CATEGORIES"), categories);
+ cmExpandList(var_lookup("CPACK_FREEBSD_PACKAGE_CATEGORIES"), categories);
manifest << (ManifestKeyListValue("categories") << categories);
manifest << ManifestKeyValue("prefix", var_lookup("CMAKE_INSTALL_PREFIX"));
std::vector<std::string> deps;
- cmSystemTools::ExpandListArgument(var_lookup("CPACK_FREEBSD_PACKAGE_DEPS"),
- deps);
+ cmExpandList(var_lookup("CPACK_FREEBSD_PACKAGE_DEPS"), deps);
if (!deps.empty()) {
manifest << (ManifestKeyDepsValue("deps") << deps);
}
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 3fd124b..e31787c 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -212,7 +212,7 @@ int cmCPackGenerator::InstallProject()
this->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS");
if (default_dir_install_permissions && *default_dir_install_permissions) {
std::vector<std::string> items;
- cmSystemTools::ExpandListArgument(default_dir_install_permissions, items);
+ cmExpandList(default_dir_install_permissions, items);
for (const auto& arg : items) {
if (!cmFSPermissions::stringToModeT(arg, default_dir_mode_v)) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -275,7 +275,7 @@ int cmCPackGenerator::InstallProjectViaInstallCommands(
tempInstallDirectoryEnv += tempInstallDirectory;
cmSystemTools::PutEnv(tempInstallDirectoryEnv);
std::vector<std::string> installCommandsVector;
- cmSystemTools::ExpandListArgument(installCommands, installCommandsVector);
+ cmExpandList(installCommands, installCommandsVector);
for (std::string const& ic : installCommandsVector) {
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << ic << std::endl);
std::string output;
@@ -312,8 +312,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
const char* cpackIgnoreFiles = this->GetOption("CPACK_IGNORE_FILES");
if (cpackIgnoreFiles) {
std::vector<std::string> ignoreFilesRegexString;
- cmSystemTools::ExpandListArgument(cpackIgnoreFiles,
- ignoreFilesRegexString);
+ cmExpandList(cpackIgnoreFiles, ignoreFilesRegexString);
for (std::string const& ifr : ignoreFilesRegexString) {
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Create ignore files regex for: " << ifr << std::endl);
@@ -324,8 +323,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
this->GetOption("CPACK_INSTALLED_DIRECTORIES");
if (installDirectories && *installDirectories) {
std::vector<std::string> installDirectoriesVector;
- cmSystemTools::ExpandListArgument(installDirectories,
- installDirectoriesVector);
+ cmExpandList(installDirectories, installDirectoriesVector);
if (installDirectoriesVector.size() % 2 != 0) {
cmCPackLogger(
cmCPackLog::LOG_ERROR,
@@ -466,7 +464,7 @@ int cmCPackGenerator::InstallProjectViaInstallScript(
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"- Install scripts: " << cmakeScripts << std::endl);
std::vector<std::string> cmakeScriptsVector;
- cmSystemTools::ExpandListArgument(cmakeScripts, cmakeScriptsVector);
+ cmExpandList(cmakeScripts, cmakeScriptsVector);
for (std::string const& installScript : cmakeScriptsVector) {
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
@@ -531,7 +529,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
return 0;
}
std::vector<std::string> cmakeProjectsVector;
- cmSystemTools::ExpandListArgument(cmakeProjects, cmakeProjectsVector);
+ cmExpandList(cmakeProjects, cmakeProjectsVector);
std::vector<std::string>::iterator it;
for (it = cmakeProjectsVector.begin(); it != cmakeProjectsVector.end();
++it) {
@@ -576,7 +574,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
const char* installTypes = this->GetOption(installTypesVar);
if (installTypes && *installTypes) {
std::vector<std::string> installTypesVector;
- cmSystemTools::ExpandListArgument(installTypes, installTypesVector);
+ cmExpandList(installTypes, installTypesVector);
for (std::string const& installType : installTypesVector) {
project.InstallationTypes.push_back(
this->GetInstallationType(project.ProjectName, installType));
@@ -588,7 +586,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
"CPACK_COMPONENTS_" + cmSystemTools::UpperCase(project.Component);
const char* components = this->GetOption(componentsVar);
if (components && *components) {
- cmSystemTools::ExpandListArgument(components, componentsVector);
+ cmExpandList(components, componentsVector);
for (std::string const& comp : componentsVector) {
project.Components.push_back(
this->GetComponent(project.ProjectName, comp));
@@ -1505,7 +1503,7 @@ cmCPackComponent* cmCPackGenerator::GetComponent(
const char* installTypes = this->GetOption(macroPrefix + "_INSTALL_TYPES");
if (installTypes && *installTypes) {
std::vector<std::string> installTypesVector;
- cmSystemTools::ExpandListArgument(installTypes, installTypesVector);
+ cmExpandList(installTypes, installTypesVector);
for (std::string const& installType : installTypesVector) {
component->InstallationTypes.push_back(
this->GetInstallationType(projectName, installType));
@@ -1516,7 +1514,7 @@ cmCPackComponent* cmCPackGenerator::GetComponent(
const char* depends = this->GetOption(macroPrefix + "_DEPENDS");
if (depends && *depends) {
std::vector<std::string> dependsVector;
- cmSystemTools::ExpandListArgument(depends, dependsVector);
+ cmExpandList(depends, dependsVector);
for (std::string const& depend : dependsVector) {
cmCPackComponent* child = GetComponent(projectName, depend);
component->Dependencies.push_back(child);
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 87c36fa..cfa34dc 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -7,6 +7,7 @@
#include "cmCPackLog.h"
#include "cmDuration.h"
#include "cmGeneratedFileStream.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmsys/Directory.hxx"
@@ -459,8 +460,7 @@ int cmCPackNSISGenerator::InitializeInternal()
"CPACK_CREATE_DESKTOP_LINKS: " << cpackPackageDeskTopLinks
<< std::endl);
- cmSystemTools::ExpandListArgument(cpackPackageDeskTopLinks,
- cpackPackageDesktopLinksVector);
+ cmExpandList(cpackPackageDeskTopLinks, cpackPackageDesktopLinksVector);
for (std::string const& cpdl : cpackPackageDesktopLinksVector) {
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"CPACK_CREATE_DESKTOP_LINKS: " << cpdl << std::endl);
@@ -479,8 +479,7 @@ int cmCPackNSISGenerator::InitializeInternal()
"The cpackPackageExecutables: " << cpackPackageExecutables
<< "." << std::endl);
std::vector<std::string> cpackPackageExecutablesVector;
- cmSystemTools::ExpandListArgument(cpackPackageExecutables,
- cpackPackageExecutablesVector);
+ cmExpandList(cpackPackageExecutables, cpackPackageExecutablesVector);
if (cpackPackageExecutablesVector.size() % 2 != 0) {
cmCPackLogger(
cmCPackLog::LOG_ERROR,
@@ -536,7 +535,7 @@ void cmCPackNSISGenerator::CreateMenuLinks(std::ostream& str,
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"The cpackMenuLinks: " << cpackMenuLinks << "." << std::endl);
std::vector<std::string> cpackMenuLinksVector;
- cmSystemTools::ExpandListArgument(cpackMenuLinks, cpackMenuLinksVector);
+ cmExpandList(cpackMenuLinks, cpackMenuLinksVector);
if (cpackMenuLinksVector.size() % 2 != 0) {
cmCPackLogger(
cmCPackLog::LOG_ERROR,
diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx
index 41470c9..7cc48f4 100644
--- a/Source/CPack/cmCPackOSXX11Generator.cxx
+++ b/Source/CPack/cmCPackOSXX11Generator.cxx
@@ -8,6 +8,7 @@
#include "cmCPackLog.h"
#include "cmDuration.h"
#include "cmGeneratedFileStream.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cm_sys_stat.h"
@@ -29,8 +30,7 @@ int cmCPackOSXX11Generator::PackageFiles()
std::ostringstream str;
std::ostringstream deleteStr;
std::vector<std::string> cpackPackageExecutablesVector;
- cmSystemTools::ExpandListArgument(cpackPackageExecutables,
- cpackPackageExecutablesVector);
+ cmExpandList(cpackPackageExecutables, cpackPackageExecutablesVector);
if (cpackPackageExecutablesVector.size() % 2 != 0) {
cmCPackLogger(
cmCPackLog::LOG_ERROR,
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 89c3b1c..3cf0c10 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -11,7 +11,7 @@
#include <utility>
#include <vector>
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
# include "cmsys/ConsoleBuf.hxx"
#endif
@@ -25,6 +25,7 @@
#include "cmMakefile.h"
#include "cmState.h"
#include "cmStateSnapshot.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -100,7 +101,7 @@ void cpackProgressCallback(const std::string& message, float /*unused*/)
int main(int argc, char const* const* argv)
{
cmSystemTools::EnsureStdPipes();
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
// Replace streambuf so we can output Unicode to console
cmsys::ConsoleBuf::Manager consoleOut(std::cout);
consoleOut.SetUTF8Pipes();
@@ -332,7 +333,7 @@ int main(int argc, char const* const* argv)
"CPack generator not specified" << std::endl);
} else {
std::vector<std::string> generatorsVector;
- cmSystemTools::ExpandListArgument(genList, generatorsVector);
+ cmExpandList(genList, generatorsVector);
for (std::string const& gen : generatorsVector) {
cmMakefile::ScopePushPop raii(&globalMF);
cmMakefile* mf = &globalMF;
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index b98a4e3..bc7c155 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -247,13 +247,11 @@ void cmCTestBuildHandler::PopulateCustomVectors(cmMakefile* mf)
// Record the user-specified custom warning rules.
if (const char* customWarningMatchers =
mf->GetDefinition("CTEST_CUSTOM_WARNING_MATCH")) {
- cmSystemTools::ExpandListArgument(customWarningMatchers,
- this->ReallyCustomWarningMatches);
+ cmExpandList(customWarningMatchers, this->ReallyCustomWarningMatches);
}
if (const char* customWarningExceptions =
mf->GetDefinition("CTEST_CUSTOM_WARNING_EXCEPTION")) {
- cmSystemTools::ExpandListArgument(customWarningExceptions,
- this->ReallyCustomWarningExceptions);
+ cmExpandList(customWarningExceptions, this->ReallyCustomWarningExceptions);
}
}
diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx
index 74a932a..eb7ecb5 100644
--- a/Source/CTest/cmCTestConfigureCommand.cxx
+++ b/Source/CTest/cmCTestConfigureCommand.cxx
@@ -6,6 +6,7 @@
#include "cmCTestConfigureHandler.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -25,7 +26,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
std::vector<std::string> options;
if (this->Values[ctc_OPTIONS]) {
- cmSystemTools::ExpandListArgument(this->Values[ctc_OPTIONS], options);
+ cmExpandList(this->Values[ctc_OPTIONS], options);
}
if (this->CTest->GetCTestConfiguration("BuildDirectory").empty()) {
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 093017c..e330e22 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -212,7 +212,7 @@ bool cmCTestGIT::UpdateByFetchAndReset()
bool cmCTestGIT::UpdateByCustom(std::string const& custom)
{
std::vector<std::string> git_custom_command;
- cmSystemTools::ExpandListArgument(custom, git_custom_command, true);
+ cmExpandList(custom, git_custom_command, true);
std::vector<char const*> git_custom;
git_custom.reserve(git_custom_command.size() + 1);
for (std::string const& i : git_custom_command) {
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 42534f7..ae965ea 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -10,6 +10,7 @@
#include "cmDuration.h"
#include "cmListFileCache.h"
#include "cmRange.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmWorkingDirectory.h"
@@ -110,8 +111,7 @@ void cmCTestMultiProcessHandler::SetTestLoad(unsigned long load)
std::string fake_load_value;
if (cmSystemTools::GetEnv("__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING",
fake_load_value)) {
- if (!cmSystemTools::StringToULong(fake_load_value.c_str(),
- &this->FakeLoadForTesting)) {
+ if (!cmStrToULong(fake_load_value, &this->FakeLoadForTesting)) {
cmSystemTools::Error("Failed to parse fake load value: " +
fake_load_value);
}
diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx
index 2eb8dba..80eb8d9 100644
--- a/Source/CTest/cmCTestP4.cxx
+++ b/Source/CTest/cmCTestP4.cxx
@@ -7,6 +7,7 @@
#include "cmCTestVC.h"
#include "cmProcessTools.h"
#include "cmRange.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmsys/RegularExpression.hxx"
@@ -460,7 +461,7 @@ bool cmCTestP4::LoadModifications()
bool cmCTestP4::UpdateCustom(const std::string& custom)
{
std::vector<std::string> p4_custom_command;
- cmSystemTools::ExpandListArgument(custom, p4_custom_command, true);
+ cmExpandList(custom, p4_custom_command, true);
std::vector<char const*> p4_custom;
p4_custom.reserve(p4_custom_command.size() + 1);
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 65cf646..fb91322 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -689,7 +689,7 @@ bool cmCTestRunTest::ForkProcess(cmDuration testTimeOut, bool explicitTimeout,
this->TestProcess->SetTimeout(timeout);
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmSystemTools::SaveRestoreEnvironment sre;
#endif
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 4288b25..1c40a58 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -495,7 +495,7 @@ void cmCTestScriptHandler::SleepInSeconds(unsigned int secondsToWait)
int cmCTestScriptHandler::RunConfigurationScript(
const std::string& total_script_arg, bool pscope)
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmSystemTools::SaveRestoreEnvironment sre;
#endif
@@ -544,7 +544,7 @@ int cmCTestScriptHandler::RunCurrentScript()
// set any environment variables
if (!this->CTestEnv.empty()) {
std::vector<std::string> envArgs;
- cmSystemTools::ExpandListArgument(this->CTestEnv, envArgs);
+ cmExpandList(this->CTestEnv, envArgs);
cmSystemTools::AppendEnv(envArgs);
}
@@ -651,7 +651,7 @@ int cmCTestScriptHandler::PerformExtraUpdates()
command = this->UpdateCmd;
for (std::string const& eu : this->ExtraUpdates) {
std::vector<std::string> cvsArgs;
- cmSystemTools::ExpandListArgument(eu, cvsArgs);
+ cmExpandList(eu, cvsArgs);
if (cvsArgs.size() == 2) {
std::string fullCommand = command;
fullCommand += " update ";
@@ -795,7 +795,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
// run ctest, it may be more than one command in here
std::vector<std::string> ctestCommands;
- cmSystemTools::ExpandListArgument(this->CTestCmd, ctestCommands);
+ cmExpandList(this->CTestCmd, ctestCommands);
// for each variable/argument do a putenv
for (std::string const& ctestCommand : ctestCommands) {
command = ctestCommand;
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index 58c0a1b..ec1e9bb 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -7,6 +7,7 @@
#include "cmCommand.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include <sstream>
@@ -68,7 +69,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
this->Makefile->GetDefinition("CTEST_NOTES_FILES");
if (notesFilesVariable) {
std::vector<std::string> notesFiles;
- cmSystemTools::ExpandListArgument(notesFilesVariable, notesFiles);
+ cmExpandList(notesFilesVariable, notesFiles);
this->CTest->GenerateNotesFile(notesFiles);
}
@@ -76,7 +77,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
this->Makefile->GetDefinition("CTEST_EXTRA_SUBMIT_FILES");
if (extraFilesVariable) {
std::vector<std::string> extraFiles;
- cmSystemTools::ExpandListArgument(extraFilesVariable, extraFiles);
+ cmExpandList(extraFilesVariable, extraFiles);
if (!this->CTest->SubmitExtraFiles(extraFiles)) {
this->SetError("problem submitting extra files.");
return nullptr;
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 17ef350..414a20d 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -156,7 +156,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
::curl_global_init(CURL_GLOBAL_ALL);
std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions"));
std::vector<std::string> args;
- cmSystemTools::ExpandListArgument(curlopt, args);
+ cmExpandList(curlopt, args);
bool verifyPeerOff = false;
bool verifyHostOff = false;
for (std::string const& arg : args) {
@@ -500,7 +500,7 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
curl.SetQuiet(this->Quiet);
std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions"));
std::vector<std::string> args;
- cmSystemTools::ExpandListArgument(curlopt, args);
+ cmExpandList(curlopt, args);
curl.SetCurlOptions(args);
curl.SetTimeOutSeconds(SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT);
curl.SetHttpHeaders(this->HttpHeaders);
@@ -529,8 +529,7 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
auto retryDelay = std::chrono::seconds(0);
if (!retryDelayString.empty()) {
unsigned long retryDelayValue = 0;
- if (!cmSystemTools::StringToULong(retryDelayString.c_str(),
- &retryDelayValue)) {
+ if (!cmStrToULong(retryDelayString, &retryDelayValue)) {
cmCTestLog(this->CTest, WARNING,
"Invalid value for 'RETRY_DELAY' : " << retryDelayString
<< std::endl);
@@ -540,7 +539,7 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
}
unsigned long retryCount = 0;
if (!retryCountString.empty()) {
- if (!cmSystemTools::StringToULong(retryCountString.c_str(), &retryCount)) {
+ if (!cmStrToULong(retryCountString, &retryCount)) {
cmCTestLog(this->CTest, WARNING,
"Invalid value for 'RETRY_DELAY' : " << retryCountString
<< std::endl);
diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx
index cfd5e3d..24de5b4 100644
--- a/Source/CTest/cmCTestTestCommand.cxx
+++ b/Source/CTest/cmCTestTestCommand.cxx
@@ -7,7 +7,7 @@
#include "cmCTestTestHandler.h"
#include "cmDuration.h"
#include "cmMakefile.h"
-#include "cmSystemTools.h"
+#include "cmStringAlgorithms.h"
#include <chrono>
#include <sstream>
@@ -110,15 +110,14 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
unsigned long testLoad;
const char* ctestTestLoad = this->Makefile->GetDefinition("CTEST_TEST_LOAD");
if (this->Values[ctt_TEST_LOAD] && *this->Values[ctt_TEST_LOAD]) {
- if (!cmSystemTools::StringToULong(this->Values[ctt_TEST_LOAD],
- &testLoad)) {
+ if (!cmStrToULong(this->Values[ctt_TEST_LOAD], &testLoad)) {
testLoad = 0;
cmCTestLog(this->CTest, WARNING,
"Invalid value for 'TEST_LOAD' : "
<< this->Values[ctt_TEST_LOAD] << std::endl);
}
} else if (ctestTestLoad && *ctestTestLoad) {
- if (!cmSystemTools::StringToULong(ctestTestLoad, &testLoad)) {
+ if (!cmStrToULong(ctestTestLoad, &testLoad)) {
testLoad = 0;
cmCTestLog(this->CTest, WARNING,
"Invalid value for 'CTEST_TEST_LOAD' : " << ctestTestLoad
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 67c24ca..a3c480a 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -2180,7 +2180,7 @@ bool cmCTestTestHandler::SetTestsProperties(
if (key == "_BACKTRACE_TRIPLES") {
std::vector<std::string> triples;
// allow empty args in the triples
- cmSystemTools::ExpandListArgument(val, triples, true);
+ cmExpandList(val, triples, true);
// Ensure we have complete triples otherwise the data is corrupt.
if (triples.size() % 3 == 0) {
@@ -2193,8 +2193,7 @@ bool cmCTestTestHandler::SetTestsProperties(
cmListFileContext fc;
fc.FilePath = triples[i - 3];
long line = 0;
- if (!cmSystemTools::StringToLong(triples[i - 2].c_str(),
- &line)) {
+ if (!cmStrToLong(triples[i - 2], &line)) {
line = 0;
}
fc.Line = line;
@@ -2210,32 +2209,32 @@ bool cmCTestTestHandler::SetTestsProperties(
rt.Disabled = cmSystemTools::IsOn(val);
}
if (key == "ATTACHED_FILES") {
- cmSystemTools::ExpandListArgument(val, rt.AttachedFiles);
+ cmExpandList(val, rt.AttachedFiles);
}
if (key == "ATTACHED_FILES_ON_FAIL") {
- cmSystemTools::ExpandListArgument(val, rt.AttachOnFail);
+ cmExpandList(val, rt.AttachOnFail);
}
if (key == "RESOURCE_LOCK") {
std::vector<std::string> lval;
- cmSystemTools::ExpandListArgument(val, lval);
+ cmExpandList(val, lval);
rt.LockedResources.insert(lval.begin(), lval.end());
}
if (key == "FIXTURES_SETUP") {
std::vector<std::string> lval;
- cmSystemTools::ExpandListArgument(val, lval);
+ cmExpandList(val, lval);
rt.FixturesSetup.insert(lval.begin(), lval.end());
}
if (key == "FIXTURES_CLEANUP") {
std::vector<std::string> lval;
- cmSystemTools::ExpandListArgument(val, lval);
+ cmExpandList(val, lval);
rt.FixturesCleanup.insert(lval.begin(), lval.end());
}
if (key == "FIXTURES_REQUIRED") {
std::vector<std::string> lval;
- cmSystemTools::ExpandListArgument(val, lval);
+ cmExpandList(val, lval);
rt.FixturesRequired.insert(lval.begin(), lval.end());
}
@@ -2247,21 +2246,21 @@ bool cmCTestTestHandler::SetTestsProperties(
rt.Cost = static_cast<float>(atof(val.c_str()));
}
if (key == "REQUIRED_FILES") {
- cmSystemTools::ExpandListArgument(val, rt.RequiredFiles);
+ cmExpandList(val, rt.RequiredFiles);
}
if (key == "RUN_SERIAL") {
rt.RunSerial = cmSystemTools::IsOn(val);
}
if (key == "FAIL_REGULAR_EXPRESSION") {
std::vector<std::string> lval;
- cmSystemTools::ExpandListArgument(val, lval);
+ cmExpandList(val, lval);
for (std::string const& cr : lval) {
rt.ErrorRegularExpressions.emplace_back(cr, cr);
}
}
if (key == "SKIP_REGULAR_EXPRESSION") {
std::vector<std::string> lval;
- cmSystemTools::ExpandListArgument(val, lval);
+ cmExpandList(val, lval);
for (std::string const& cr : lval) {
rt.SkipRegularExpressions.emplace_back(cr, cr);
}
@@ -2282,14 +2281,14 @@ bool cmCTestTestHandler::SetTestsProperties(
}
}
if (key == "DEPENDS") {
- cmSystemTools::ExpandListArgument(val, rt.Depends);
+ cmExpandList(val, rt.Depends);
}
if (key == "ENVIRONMENT") {
- cmSystemTools::ExpandListArgument(val, rt.Environment);
+ cmExpandList(val, rt.Environment);
}
if (key == "LABELS") {
std::vector<std::string> Labels;
- cmSystemTools::ExpandListArgument(val, Labels);
+ cmExpandList(val, Labels);
rt.Labels.insert(rt.Labels.end(), Labels.begin(), Labels.end());
// sort the array
std::sort(rt.Labels.begin(), rt.Labels.end());
@@ -2310,7 +2309,7 @@ bool cmCTestTestHandler::SetTestsProperties(
}
if (key == "PASS_REGULAR_EXPRESSION") {
std::vector<std::string> lval;
- cmSystemTools::ExpandListArgument(val, lval);
+ cmExpandList(val, lval);
for (std::string const& cr : lval) {
rt.RequiredRegularExpressions.emplace_back(cr, cr);
}
@@ -2320,7 +2319,7 @@ bool cmCTestTestHandler::SetTestsProperties(
}
if (key == "TIMEOUT_AFTER_MATCH") {
std::vector<std::string> propArgs;
- cmSystemTools::ExpandListArgument(val, propArgs);
+ cmExpandList(val, propArgs);
if (propArgs.size() != 2) {
cmCTestLog(this->CTest, WARNING,
"TIMEOUT_AFTER_MATCH expects two arguments, found "
@@ -2328,7 +2327,7 @@ bool cmCTestTestHandler::SetTestsProperties(
} else {
rt.AlternateTimeout = cmDuration(atof(propArgs[0].c_str()));
std::vector<std::string> lval;
- cmSystemTools::ExpandListArgument(propArgs[1], lval);
+ cmExpandList(propArgs[1], lval);
for (std::string const& cr : lval) {
rt.TimeoutRegularExpressions.emplace_back(cr, cr);
}
@@ -2371,7 +2370,7 @@ bool cmCTestTestHandler::SetDirectoryProperties(
if (cwd == rt.Directory) {
if (key == "LABELS") {
std::vector<std::string> DirectoryLabels;
- cmSystemTools::ExpandListArgument(val, DirectoryLabels);
+ cmExpandList(val, DirectoryLabels);
rt.Labels.insert(rt.Labels.end(), DirectoryLabels.begin(),
DirectoryLabels.end());
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
index c1dd591..4341bf4 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
@@ -11,6 +11,7 @@
#include "cmCursesWidget.h"
#include "cmState.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -71,7 +72,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
new cmCursesOptionsWidget(this->EntryWidth, 1, 1, 1);
this->Entry = ow;
std::vector<std::string> options;
- cmSystemTools::ExpandListArgument(stringsProp, options);
+ cmExpandList(stringsProp, options);
for (auto const& opt : options) {
ow->AddOption(opt);
}
diff --git a/Source/cmAddCompileDefinitionsCommand.cxx b/Source/cmAddCompileDefinitionsCommand.cxx
index 0474819..b00a4a7 100644
--- a/Source/cmAddCompileDefinitionsCommand.cxx
+++ b/Source/cmAddCompileDefinitionsCommand.cxx
@@ -2,19 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmAddCompileDefinitionsCommand.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-class cmExecutionStatus;
-
-bool cmAddCompileDefinitionsCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmAddCompileDefinitionsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
- if (args.empty()) {
- return true;
- }
-
+ cmMakefile& mf = status.GetMakefile();
for (std::string const& i : args) {
- this->Makefile->AddCompileDefinition(i);
+ mf.AddCompileDefinition(i);
}
return true;
}
diff --git a/Source/cmAddCompileDefinitionsCommand.h b/Source/cmAddCompileDefinitionsCommand.h
index 5f90ed9..4bd621c 100644
--- a/Source/cmAddCompileDefinitionsCommand.h
+++ b/Source/cmAddCompileDefinitionsCommand.h
@@ -8,29 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-class cmAddCompileDefinitionsCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddCompileDefinitionsCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAddCompileDefinitionsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddCompileOptionsCommand.cxx b/Source/cmAddCompileOptionsCommand.cxx
index 412fb38..8ccb512 100644
--- a/Source/cmAddCompileOptionsCommand.cxx
+++ b/Source/cmAddCompileOptionsCommand.cxx
@@ -2,19 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmAddCompileOptionsCommand.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-class cmExecutionStatus;
-
-bool cmAddCompileOptionsCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmAddCompileOptionsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
- if (args.empty()) {
- return true;
- }
-
+ cmMakefile& mf = status.GetMakefile();
for (std::string const& i : args) {
- this->Makefile->AddCompileOption(i);
+ mf.AddCompileOption(i);
}
return true;
}
diff --git a/Source/cmAddCompileOptionsCommand.h b/Source/cmAddCompileOptionsCommand.h
index b34b7fc..b172412 100644
--- a/Source/cmAddCompileOptionsCommand.h
+++ b/Source/cmAddCompileOptionsCommand.h
@@ -8,29 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-class cmAddCompileOptionsCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddCompileOptionsCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAddCompileOptionsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index 6eb38bd..e502a64 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -8,6 +8,7 @@
#include "cmCustomCommand.h"
#include "cmCustomCommandLines.h"
+#include "cmExecutionStatus.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -16,21 +17,22 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
-class cmExecutionStatus;
+static bool cmAddCustomCommandCommandCheckOutputs(
+ const std::vector<std::string>& outputs, cmExecutionStatus& status);
-// cmAddCustomCommandCommand
-bool cmAddCustomCommandCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
/* Let's complain at the end of this function about the lack of a particular
arg. For the moment, let's say that COMMAND, and either TARGET or SOURCE
are required.
*/
if (args.size() < 4) {
- this->SetError("called with wrong number of arguments.");
+ status.SetError("called with wrong number of arguments.");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
std::string source, target, main_dependency, working, depfile, job_pool;
std::string comment_buffer;
const char* comment = nullptr;
@@ -167,9 +169,9 @@ bool cmAddCustomCommandCommand::InitialPass(
doing = doing_comment;
} else if (copy == keyDEPFILE) {
doing = doing_depfile;
- if (this->Makefile->GetGlobalGenerator()->GetName() != "Ninja") {
- this->SetError("Option DEPFILE not supported by " +
- this->Makefile->GetGlobalGenerator()->GetName());
+ if (mf.GetGlobalGenerator()->GetName() != "Ninja") {
+ status.SetError("Option DEPFILE not supported by " +
+ mf.GetGlobalGenerator()->GetName());
return false;
}
} else if (copy == keyJOB_POOL) {
@@ -192,7 +194,7 @@ bool cmAddCustomCommandCommand::InitialPass(
// and later references "${CMAKE_CURRENT_SOURCE_DIR}/out.txt".
// This is fairly obscure so we can wait for someone to
// complain.
- filename = this->Makefile->GetCurrentBinaryDirectory();
+ filename = mf.GetCurrentBinaryDirectory();
filename += "/";
}
filename += copy;
@@ -269,7 +271,7 @@ bool cmAddCustomCommandCommand::InitialPass(
comment = comment_buffer.c_str();
break;
default:
- this->SetError("Wrong syntax. Unknown type of argument.");
+ status.SetError("Wrong syntax. Unknown type of argument.");
return false;
}
}
@@ -284,31 +286,31 @@ bool cmAddCustomCommandCommand::InitialPass(
// At this point we could complain about the lack of arguments. For
// the moment, let's say that COMMAND, TARGET are always required.
if (output.empty() && target.empty()) {
- this->SetError("Wrong syntax. A TARGET or OUTPUT must be specified.");
+ status.SetError("Wrong syntax. A TARGET or OUTPUT must be specified.");
return false;
}
if (source.empty() && !target.empty() && !output.empty()) {
- this->SetError(
+ status.SetError(
"Wrong syntax. A TARGET and OUTPUT can not both be specified.");
return false;
}
if (append && output.empty()) {
- this->SetError("given APPEND option with no OUTPUT.");
+ status.SetError("given APPEND option with no OUTPUT.");
return false;
}
// Make sure the output names and locations are safe.
- if (!this->CheckOutputs(output) || !this->CheckOutputs(outputs) ||
- !this->CheckOutputs(byproducts)) {
+ if (!cmAddCustomCommandCommandCheckOutputs(output, status) ||
+ !cmAddCustomCommandCommandCheckOutputs(outputs, status) ||
+ !cmAddCustomCommandCommandCheckOutputs(byproducts, status)) {
return false;
}
// Check for an append request.
if (append) {
// Lookup an existing command.
- if (cmSourceFile* sf =
- this->Makefile->GetSourceFileWithOutput(output[0])) {
+ if (cmSourceFile* sf = mf.GetSourceFileWithOutput(output[0])) {
if (cmCustomCommand* cc = sf->GetCustomCommand()) {
cc->AppendCommands(commandLines);
cc->AppendDepends(depends);
@@ -321,12 +323,12 @@ bool cmAddCustomCommandCommand::InitialPass(
std::ostringstream e;
e << "given APPEND option with output\n\"" << output[0]
<< "\"\nwhich is not already a custom command output.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
if (uses_terminal && !job_pool.empty()) {
- this->SetError("JOB_POOL is shadowed by USES_TERMINAL.");
+ status.SetError("JOB_POOL is shadowed by USES_TERMINAL.");
return false;
}
@@ -335,22 +337,21 @@ bool cmAddCustomCommandCommand::InitialPass(
if (source.empty() && output.empty()) {
// Source is empty, use the target.
std::vector<std::string> no_depends;
- this->Makefile->AddCustomCommandToTarget(
- target, byproducts, no_depends, commandLines, cctype, comment,
- working.c_str(), escapeOldStyle, uses_terminal, depfile, job_pool,
- command_expand_lists);
+ mf.AddCustomCommandToTarget(target, byproducts, no_depends, commandLines,
+ cctype, comment, working.c_str(),
+ escapeOldStyle, uses_terminal, depfile,
+ job_pool, command_expand_lists);
} else if (target.empty()) {
// Target is empty, use the output.
- this->Makefile->AddCustomCommandToOutput(
- output, byproducts, depends, main_dependency, commandLines, comment,
- working.c_str(), false, escapeOldStyle, uses_terminal,
- command_expand_lists, depfile, job_pool);
+ mf.AddCustomCommandToOutput(output, byproducts, depends, main_dependency,
+ commandLines, comment, working.c_str(), false,
+ escapeOldStyle, uses_terminal,
+ command_expand_lists, depfile, job_pool);
// Add implicit dependency scanning requests if any were given.
if (!implicit_depends.empty()) {
bool okay = false;
- if (cmSourceFile* sf =
- this->Makefile->GetSourceFileWithOutput(output[0])) {
+ if (cmSourceFile* sf = mf.GetSourceFileWithOutput(output[0])) {
if (cmCustomCommand* cc = sf->GetCustomCommand()) {
okay = true;
cc->SetImplicitDepends(implicit_depends);
@@ -360,21 +361,21 @@ bool cmAddCustomCommandCommand::InitialPass(
std::ostringstream e;
e << "could not locate source file with a custom command producing \""
<< output[0] << "\" even though this command tried to create it!";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
}
} else if (!byproducts.empty()) {
- this->SetError("BYPRODUCTS may not be specified with SOURCE signatures");
+ status.SetError("BYPRODUCTS may not be specified with SOURCE signatures");
return false;
} else if (uses_terminal) {
- this->SetError("USES_TERMINAL may not be used with SOURCE signatures");
+ status.SetError("USES_TERMINAL may not be used with SOURCE signatures");
return false;
} else {
bool issueMessage = true;
std::ostringstream e;
MessageType messageType = MessageType::AUTHOR_WARNING;
- switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0050)) {
+ switch (mf.GetPolicyStatus(cmPolicies::CMP0050)) {
case cmPolicies::WARN:
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0050) << "\n";
break;
@@ -391,30 +392,31 @@ bool cmAddCustomCommandCommand::InitialPass(
if (issueMessage) {
e << "The SOURCE signatures of add_custom_command are no longer "
"supported.";
- this->Makefile->IssueMessage(messageType, e.str());
+ mf.IssueMessage(messageType, e.str());
if (messageType == MessageType::FATAL_ERROR) {
return false;
}
}
// Use the old-style mode for backward compatibility.
- this->Makefile->AddCustomCommandOldStyle(target, outputs, depends, source,
- commandLines, comment);
+ mf.AddCustomCommandOldStyle(target, outputs, depends, source, commandLines,
+ comment);
}
return true;
}
-bool cmAddCustomCommandCommand::CheckOutputs(
- const std::vector<std::string>& outputs)
+bool cmAddCustomCommandCommandCheckOutputs(
+ const std::vector<std::string>& outputs, cmExecutionStatus& status)
{
+ cmMakefile& mf = status.GetMakefile();
for (std::string const& o : outputs) {
// Make sure the file will not be generated into the source
// directory during an out of source build.
- if (!this->Makefile->CanIWriteThisFile(o)) {
+ if (!mf.CanIWriteThisFile(o)) {
std::string e = "attempted to have a file \"" + o +
"\" in a source directory as an output of custom command.";
- this->SetError(e);
+ status.SetError(e);
cmSystemTools::SetFatalErrorOccured();
return false;
}
@@ -425,7 +427,7 @@ bool cmAddCustomCommandCommand::CheckOutputs(
std::ostringstream msg;
msg << "called with OUTPUT containing a \"" << o[pos]
<< "\". This character is not allowed.";
- this->SetError(msg.str());
+ status.SetError(msg.str());
return false;
}
}
diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h
index 931aeab..4f8c58f 100644
--- a/Source/cmAddCustomCommandCommand.h
+++ b/Source/cmAddCustomCommandCommand.h
@@ -8,38 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmAddCustomCommandCommand
- * \brief cmAddCustomCommandCommand defines a new command (rule) that can
- * be executed within the build process
- *
- */
-
-class cmAddCustomCommandCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddCustomCommandCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-
-protected:
- bool CheckOutputs(const std::vector<std::string>& outputs);
-};
+bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index 0ecd5f5..f812ab5 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -6,6 +6,7 @@
#include <utility>
#include "cmCustomCommandLines.h"
+#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
@@ -14,17 +15,15 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
-class cmExecutionStatus;
-
-// cmAddCustomTargetCommand
-bool cmAddCustomTargetCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmAddCustomTargetCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
std::string const& targetName = args[0];
// Check the target name.
@@ -33,7 +32,7 @@ bool cmAddCustomTargetCommand::InitialPass(
e << "called with invalid target name \"" << targetName
<< "\". Target names may not contain a slash. "
<< "Use ADD_CUSTOM_COMMAND to generate files.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
@@ -122,7 +121,7 @@ bool cmAddCustomTargetCommand::InitialPass(
case doing_byproducts: {
std::string filename;
if (!cmSystemTools::FileIsFullPath(copy)) {
- filename = this->Makefile->GetCurrentBinaryDirectory();
+ filename = mf.GetCurrentBinaryDirectory();
filename += "/";
}
filename += copy;
@@ -145,7 +144,7 @@ bool cmAddCustomTargetCommand::InitialPass(
job_pool = copy;
break;
default:
- this->SetError("Wrong syntax. Unknown type of argument.");
+ status.SetError("Wrong syntax. Unknown type of argument.");
return false;
}
}
@@ -156,7 +155,7 @@ bool cmAddCustomTargetCommand::InitialPass(
std::ostringstream msg;
msg << "called with target name containing a \"" << targetName[pos]
<< "\". This character is not allowed.";
- this->SetError(msg.str());
+ status.SetError(msg.str());
return false;
}
@@ -168,8 +167,7 @@ bool cmAddCustomTargetCommand::InitialPass(
if (nameOk) {
nameOk = targetName.find(':') == std::string::npos;
}
- if (!nameOk &&
- !this->Makefile->CheckCMP0037(targetName, cmStateEnums::UTILITY)) {
+ if (!nameOk && !mf.CheckCMP0037(targetName, cmStateEnums::UTILITY)) {
return false;
}
@@ -182,39 +180,37 @@ bool cmAddCustomTargetCommand::InitialPass(
// Enforce name uniqueness.
{
std::string msg;
- if (!this->Makefile->EnforceUniqueName(targetName, msg, true)) {
- this->SetError(msg);
+ if (!mf.EnforceUniqueName(targetName, msg, true)) {
+ status.SetError(msg);
return false;
}
}
if (commandLines.empty() && !byproducts.empty()) {
- this->Makefile->IssueMessage(
- MessageType::FATAL_ERROR,
- "BYPRODUCTS may not be specified without any COMMAND");
+ mf.IssueMessage(MessageType::FATAL_ERROR,
+ "BYPRODUCTS may not be specified without any COMMAND");
return true;
}
if (commandLines.empty() && uses_terminal) {
- this->Makefile->IssueMessage(
- MessageType::FATAL_ERROR,
- "USES_TERMINAL may not be specified without any COMMAND");
+ mf.IssueMessage(MessageType::FATAL_ERROR,
+ "USES_TERMINAL may not be specified without any COMMAND");
return true;
}
if (commandLines.empty() && command_expand_lists) {
- this->Makefile->IssueMessage(
+ mf.IssueMessage(
MessageType::FATAL_ERROR,
"COMMAND_EXPAND_LISTS may not be specified without any COMMAND");
return true;
}
if (uses_terminal && !job_pool.empty()) {
- this->SetError("JOB_POOL is shadowed by USES_TERMINAL.");
+ status.SetError("JOB_POOL is shadowed by USES_TERMINAL.");
return false;
}
// Add the utility target to the makefile.
bool escapeOldStyle = !verbatim;
- cmTarget* target = this->Makefile->AddUtilityCommand(
+ cmTarget* target = mf.AddUtilityCommand(
targetName, cmMakefile::TargetOrigin::Project, excludeFromAll,
working_directory.c_str(), byproducts, depends, commandLines,
escapeOldStyle, comment, uses_terminal, command_expand_lists, job_pool);
diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h
index db577bc..e23ef9f 100644
--- a/Source/cmAddCustomTargetCommand.h
+++ b/Source/cmAddCustomTargetCommand.h
@@ -8,36 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmAddCustomTargetCommand
- * \brief Command that adds a target to the build system.
- *
- * cmAddCustomTargetCommand adds an extra target to the build system.
- * This is useful when you would like to add special
- * targets like "install,", "clean," and so on.
- */
-class cmAddCustomTargetCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddCustomTargetCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAddCustomTargetCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddDefinitionsCommand.cxx b/Source/cmAddDefinitionsCommand.cxx
index 62e57a3..0b10aee 100644
--- a/Source/cmAddDefinitionsCommand.cxx
+++ b/Source/cmAddDefinitionsCommand.cxx
@@ -2,21 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmAddDefinitionsCommand.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-class cmExecutionStatus;
-
-// cmAddDefinitionsCommand
-bool cmAddDefinitionsCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmAddDefinitionsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
- // it is OK to have no arguments
- if (args.empty()) {
- return true;
- }
-
+ cmMakefile& mf = status.GetMakefile();
for (std::string const& i : args) {
- this->Makefile->AddDefineFlag(i);
+ mf.AddDefineFlag(i);
}
return true;
}
diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h
index 0e32c83..a67f095 100644
--- a/Source/cmAddDefinitionsCommand.h
+++ b/Source/cmAddDefinitionsCommand.h
@@ -8,35 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmAddDefinitionsCommand
- * \brief Specify a list of compiler defines
- *
- * cmAddDefinitionsCommand specifies a list of compiler defines. These defines
- * will be added to the compile command.
- */
-class cmAddDefinitionsCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddDefinitionsCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAddDefinitionsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx
index 4956a47..0ddbda8 100644
--- a/Source/cmAddDependenciesCommand.cxx
+++ b/Source/cmAddDependenciesCommand.cxx
@@ -4,34 +4,33 @@
#include <sstream>
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmRange.h"
#include "cmTarget.h"
-class cmExecutionStatus;
-
-// cmDependenciesCommand
-bool cmAddDependenciesCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmAddDependenciesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.size() < 2) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
std::string const& target_name = args[0];
- if (this->Makefile->IsAlias(target_name)) {
+ if (mf.IsAlias(target_name)) {
std::ostringstream e;
e << "Cannot add target-level dependencies to alias target \""
<< target_name << "\".\n";
- this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf.IssueMessage(MessageType::FATAL_ERROR, e.str());
}
- if (cmTarget* target = this->Makefile->FindTargetToUse(target_name)) {
+ if (cmTarget* target = mf.FindTargetToUse(target_name)) {
// skip over target_name
for (std::string const& arg : cmMakeRange(args).advance(1)) {
- target->AddUtility(arg, this->Makefile);
+ target->AddUtility(arg, &mf);
}
} else {
std::ostringstream e;
@@ -41,7 +40,7 @@ bool cmAddDependenciesCommand::InitialPass(
<< "by the add_executable, add_library, or add_custom_target commands. "
<< "If you want to add file-level dependencies see the DEPENDS option "
<< "of the add_custom_target and add_custom_command commands.";
- this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf.IssueMessage(MessageType::FATAL_ERROR, e.str());
}
return true;
diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h
index ce912d3..0c60e3a 100644
--- a/Source/cmAddDependenciesCommand.h
+++ b/Source/cmAddDependenciesCommand.h
@@ -8,34 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmAddDependenciesCommand
- * \brief Add a dependency to a target
- *
- * cmAddDependenciesCommand adds a dependency to a target
- */
-class cmAddDependenciesCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddDependenciesCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAddDependenciesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index 5685fdf..59d6be3 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -4,22 +4,22 @@
#include <sstream>
+#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmStateTypes.h"
#include "cmTarget.h"
-class cmExecutionStatus;
-
-// cmExecutableCommand
-bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmAddExecutableCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+
+ cmMakefile& mf = status.GetMakefile();
std::vector<std::string>::const_iterator s = args.begin();
std::string const& exename = *s;
@@ -61,59 +61,58 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
if (nameOk && !importTarget && !isAlias) {
nameOk = exename.find(':') == std::string::npos;
}
- if (!nameOk &&
- !this->Makefile->CheckCMP0037(exename, cmStateEnums::EXECUTABLE)) {
+ if (!nameOk && !mf.CheckCMP0037(exename, cmStateEnums::EXECUTABLE)) {
return false;
}
// Special modifiers are not allowed with IMPORTED signature.
if (importTarget && (use_win32 || use_macbundle || excludeFromAll)) {
if (use_win32) {
- this->SetError("may not be given WIN32 for an IMPORTED target.");
+ status.SetError("may not be given WIN32 for an IMPORTED target.");
} else if (use_macbundle) {
- this->SetError("may not be given MACOSX_BUNDLE for an IMPORTED target.");
+ status.SetError(
+ "may not be given MACOSX_BUNDLE for an IMPORTED target.");
} else // if(excludeFromAll)
{
- this->SetError(
+ status.SetError(
"may not be given EXCLUDE_FROM_ALL for an IMPORTED target.");
}
return false;
}
if (isAlias) {
if (!cmGeneratorExpression::IsValidTargetName(exename)) {
- this->SetError("Invalid name for ALIAS: " + exename);
+ status.SetError("Invalid name for ALIAS: " + exename);
return false;
}
if (excludeFromAll) {
- this->SetError("EXCLUDE_FROM_ALL with ALIAS makes no sense.");
+ status.SetError("EXCLUDE_FROM_ALL with ALIAS makes no sense.");
return false;
}
if (importTarget || importGlobal) {
- this->SetError("IMPORTED with ALIAS is not allowed.");
+ status.SetError("IMPORTED with ALIAS is not allowed.");
return false;
}
if (args.size() != 3) {
std::ostringstream e;
e << "ALIAS requires exactly one target argument.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
std::string const& aliasedName = *s;
- if (this->Makefile->IsAlias(aliasedName)) {
+ if (mf.IsAlias(aliasedName)) {
std::ostringstream e;
e << "cannot create ALIAS target \"" << exename << "\" because target \""
<< aliasedName << "\" is itself an ALIAS.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
- cmTarget* aliasedTarget =
- this->Makefile->FindTargetToUse(aliasedName, true);
+ cmTarget* aliasedTarget = mf.FindTargetToUse(aliasedName, true);
if (!aliasedTarget) {
std::ostringstream e;
e << "cannot create ALIAS target \"" << exename << "\" because target \""
<< aliasedName << "\" does not already exist.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
cmStateEnums::TargetType type = aliasedTarget->GetType();
@@ -121,7 +120,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
std::ostringstream e;
e << "cannot create ALIAS target \"" << exename << "\" because target \""
<< aliasedName << "\" is not an executable.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
if (aliasedTarget->IsImported() &&
@@ -129,42 +128,40 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
std::ostringstream e;
e << "cannot create ALIAS target \"" << exename << "\" because target \""
<< aliasedName << "\" is imported but not globally visible.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
- this->Makefile->AddAlias(exename, aliasedName);
+ mf.AddAlias(exename, aliasedName);
return true;
}
// Handle imported target creation.
if (importTarget) {
// Make sure the target does not already exist.
- if (this->Makefile->FindTargetToUse(exename)) {
+ if (mf.FindTargetToUse(exename)) {
std::ostringstream e;
e << "cannot create imported target \"" << exename
<< "\" because another target with the same name already exists.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
// Create the imported target.
- this->Makefile->AddImportedTarget(exename, cmStateEnums::EXECUTABLE,
- importGlobal);
+ mf.AddImportedTarget(exename, cmStateEnums::EXECUTABLE, importGlobal);
return true;
}
// Enforce name uniqueness.
{
std::string msg;
- if (!this->Makefile->EnforceUniqueName(exename, msg)) {
- this->SetError(msg);
+ if (!mf.EnforceUniqueName(exename, msg)) {
+ status.SetError(msg);
return false;
}
}
std::vector<std::string> srclists(s, args.end());
- cmTarget* tgt =
- this->Makefile->AddExecutable(exename, srclists, excludeFromAll);
+ cmTarget* tgt = mf.AddExecutable(exename, srclists, excludeFromAll);
if (use_win32) {
tgt->SetProperty("WIN32_EXECUTABLE", "ON");
}
diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h
index ec57c3f..f7bc273 100644
--- a/Source/cmAddExecutableCommand.h
+++ b/Source/cmAddExecutableCommand.h
@@ -8,35 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmExecutablesCommand
- * \brief Defines a list of executables to build.
- *
- * cmExecutablesCommand defines a list of executable (i.e., test)
- * programs to create.
- */
-class cmAddExecutableCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddExecutableCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAddExecutableCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index ad12e89..626b7c9 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -5,6 +5,7 @@
#include <sstream>
#include "cmAlgorithms.h"
+#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
@@ -14,21 +15,19 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
-class cmExecutionStatus;
-
-// cmLibraryCommand
-bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmAddLibraryCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+
+ cmMakefile& mf = status.GetMakefile();
// Library type defaults to value of BUILD_SHARED_LIBS, if it exists,
// otherwise it defaults to static library.
cmStateEnums::TargetType type = cmStateEnums::SHARED_LIBRARY;
- if (cmSystemTools::IsOff(
- this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) {
+ if (cmSystemTools::IsOff(mf.GetDefinition("BUILD_SHARED_LIBS"))) {
type = cmStateEnums::STATIC_LIBRARY;
}
bool excludeFromAll = false;
@@ -52,7 +51,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting STATIC type.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
++s;
@@ -62,7 +61,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting SHARED type.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
++s;
@@ -72,7 +71,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting MODULE type.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
++s;
@@ -82,7 +81,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting OBJECT type.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
++s;
@@ -92,7 +91,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting UNKNOWN type.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
++s;
@@ -102,7 +101,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting ALIAS type.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
++s;
@@ -111,19 +110,19 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (haveSpecifiedType) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting/multiple types.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
if (isAlias) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting ALIAS type.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
if (excludeFromAll) {
std::ostringstream e;
e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
++s;
@@ -133,7 +132,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
++s;
@@ -147,7 +146,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
} else if (type == cmStateEnums::INTERFACE_LIBRARY && *s == "GLOBAL") {
std::ostringstream e;
e << "GLOBAL option may only be used with IMPORTED libraries.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
} else {
break;
@@ -158,13 +157,13 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (s != args.end()) {
std::ostringstream e;
e << "INTERFACE library requires no source arguments.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
if (importGlobal && !importTarget) {
std::ostringstream e;
e << "INTERFACE library specified as GLOBAL, but not as IMPORTED.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
}
@@ -175,47 +174,46 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (nameOk && !importTarget && !isAlias) {
nameOk = libName.find(':') == std::string::npos;
}
- if (!nameOk && !this->Makefile->CheckCMP0037(libName, type)) {
+ if (!nameOk && !mf.CheckCMP0037(libName, type)) {
return false;
}
if (isAlias) {
if (!cmGeneratorExpression::IsValidTargetName(libName)) {
- this->SetError("Invalid name for ALIAS: " + libName);
+ status.SetError("Invalid name for ALIAS: " + libName);
return false;
}
if (excludeFromAll) {
- this->SetError("EXCLUDE_FROM_ALL with ALIAS makes no sense.");
+ status.SetError("EXCLUDE_FROM_ALL with ALIAS makes no sense.");
return false;
}
if (importTarget || importGlobal) {
- this->SetError("IMPORTED with ALIAS is not allowed.");
+ status.SetError("IMPORTED with ALIAS is not allowed.");
return false;
}
if (args.size() != 3) {
std::ostringstream e;
e << "ALIAS requires exactly one target argument.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
std::string const& aliasedName = *s;
- if (this->Makefile->IsAlias(aliasedName)) {
+ if (mf.IsAlias(aliasedName)) {
std::ostringstream e;
e << "cannot create ALIAS target \"" << libName << "\" because target \""
<< aliasedName << "\" is itself an ALIAS.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
- cmTarget* aliasedTarget =
- this->Makefile->FindTargetToUse(aliasedName, true);
+ cmTarget* aliasedTarget = mf.FindTargetToUse(aliasedName, true);
if (!aliasedTarget) {
std::ostringstream e;
e << "cannot create ALIAS target \"" << libName << "\" because target \""
<< aliasedName
<< "\" does not already "
"exist.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
cmStateEnums::TargetType aliasedType = aliasedTarget->GetType();
@@ -229,7 +227,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
std::ostringstream e;
e << "cannot create ALIAS target \"" << libName << "\" because target \""
<< aliasedName << "\" is not a library.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
if (aliasedTarget->IsImported() &&
@@ -237,15 +235,15 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
std::ostringstream e;
e << "cannot create ALIAS target \"" << libName << "\" because target \""
<< aliasedName << "\" is imported but not globally visible.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
- this->Makefile->AddAlias(libName, aliasedName);
+ mf.AddAlias(libName, aliasedName);
return true;
}
if (importTarget && excludeFromAll) {
- this->SetError("excludeFromAll with IMPORTED target makes no sense.");
+ status.SetError("excludeFromAll with IMPORTED target makes no sense.");
return false;
}
@@ -255,14 +253,13 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
yet its linker language. */
if ((type == cmStateEnums::SHARED_LIBRARY ||
type == cmStateEnums::MODULE_LIBRARY) &&
- !this->Makefile->GetState()->GetGlobalPropertyAsBool(
- "TARGET_SUPPORTS_SHARED_LIBS")) {
+ !mf.GetState()->GetGlobalPropertyAsBool("TARGET_SUPPORTS_SHARED_LIBS")) {
std::ostringstream w;
w << "ADD_LIBRARY called with "
<< (type == cmStateEnums::SHARED_LIBRARY ? "SHARED" : "MODULE")
<< " option but the target platform does not support dynamic linking. "
"Building a STATIC library instead. This may lead to problems.";
- this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str());
+ mf.IssueMessage(MessageType::AUTHOR_WARNING, w.str());
type = cmStateEnums::STATIC_LIBRARY;
}
@@ -270,14 +267,13 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (importTarget) {
// The IMPORTED signature requires a type to be specified explicitly.
if (!haveSpecifiedType) {
- this->SetError("called with IMPORTED argument but no library type.");
+ status.SetError("called with IMPORTED argument but no library type.");
return false;
}
if (type == cmStateEnums::OBJECT_LIBRARY) {
std::string reason;
- if (!this->Makefile->GetGlobalGenerator()->HasKnownObjectFileLocation(
- &reason)) {
- this->Makefile->IssueMessage(
+ if (!mf.GetGlobalGenerator()->HasKnownObjectFileLocation(&reason)) {
+ mf.IssueMessage(
MessageType::FATAL_ERROR,
"The OBJECT library type may not be used for IMPORTED libraries" +
reason + ".");
@@ -288,28 +284,28 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (!cmGeneratorExpression::IsValidTargetName(libName)) {
std::ostringstream e;
e << "Invalid name for IMPORTED INTERFACE library target: " << libName;
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
}
// Make sure the target does not already exist.
- if (this->Makefile->FindTargetToUse(libName)) {
+ if (mf.FindTargetToUse(libName)) {
std::ostringstream e;
e << "cannot create imported target \"" << libName
<< "\" because another target with the same name already exists.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
// Create the imported target.
- this->Makefile->AddImportedTarget(libName, type, importGlobal);
+ mf.AddImportedTarget(libName, type, importGlobal);
return true;
}
// A non-imported target may not have UNKNOWN type.
if (type == cmStateEnums::UNKNOWN_LIBRARY) {
- this->Makefile->IssueMessage(
+ mf.IssueMessage(
MessageType::FATAL_ERROR,
"The UNKNOWN library type may be used only for IMPORTED libraries.");
return true;
@@ -318,8 +314,8 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
// Enforce name uniqueness.
{
std::string msg;
- if (!this->Makefile->EnforceUniqueName(libName, msg)) {
- this->SetError(msg);
+ if (!mf.EnforceUniqueName(libName, msg)) {
+ status.SetError(msg);
return false;
}
}
@@ -331,17 +327,17 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
libName.find("::") != std::string::npos) {
std::ostringstream e;
e << "Invalid name for INTERFACE library target: " << libName;
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
- this->Makefile->AddLibrary(libName, type, srclists, excludeFromAll);
+ mf.AddLibrary(libName, type, srclists, excludeFromAll);
return true;
}
cmAppend(srclists, s, args.end());
- this->Makefile->AddLibrary(libName, type, srclists, excludeFromAll);
+ mf.AddLibrary(libName, type, srclists, excludeFromAll);
return true;
}
diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h
index 56dab41..609449c 100644
--- a/Source/cmAddLibraryCommand.h
+++ b/Source/cmAddLibraryCommand.h
@@ -8,35 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmLibrarysCommand
- * \brief Defines a list of executables to build.
- *
- * cmLibrarysCommand defines a list of executable (i.e., test)
- * programs to create.
- */
-class cmAddLibraryCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddLibraryCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAddLibraryCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddLinkOptionsCommand.cxx b/Source/cmAddLinkOptionsCommand.cxx
index 10ebd12..7ed31bd 100644
--- a/Source/cmAddLinkOptionsCommand.cxx
+++ b/Source/cmAddLinkOptionsCommand.cxx
@@ -2,19 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmAddLinkOptionsCommand.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-class cmExecutionStatus;
-
-bool cmAddLinkOptionsCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmAddLinkOptionsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
- if (args.empty()) {
- return true;
- }
-
+ cmMakefile& mf = status.GetMakefile();
for (std::string const& i : args) {
- this->Makefile->AddLinkOption(i);
+ mf.AddLinkOption(i);
}
return true;
}
diff --git a/Source/cmAddLinkOptionsCommand.h b/Source/cmAddLinkOptionsCommand.h
index 8e46be6..466fc32 100644
--- a/Source/cmAddLinkOptionsCommand.h
+++ b/Source/cmAddLinkOptionsCommand.h
@@ -8,29 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-class cmAddLinkOptionsCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddLinkOptionsCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAddLinkOptionsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx
index 7947188..50c682f 100644
--- a/Source/cmAddSubDirectoryCommand.cxx
+++ b/Source/cmAddSubDirectoryCommand.cxx
@@ -5,21 +5,20 @@
#include <sstream>
#include <string.h>
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmRange.h"
#include "cmSystemTools.h"
-class cmExecutionStatus;
-
-// cmAddSubDirectoryCommand
-bool cmAddSubDirectoryCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmAddSubDirectoryCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
// store the binpath
std::string const& srcArg = args.front();
std::string binArg;
@@ -35,7 +34,7 @@ bool cmAddSubDirectoryCommand::InitialPass(
if (binArg.empty()) {
binArg = arg;
} else {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
}
@@ -46,7 +45,7 @@ bool cmAddSubDirectoryCommand::InitialPass(
if (cmSystemTools::FileIsFullPath(srcArg)) {
srcPath = srcArg;
} else {
- srcPath = this->Makefile->GetCurrentSourceDirectory();
+ srcPath = mf.GetCurrentSourceDirectory();
srcPath += "/";
srcPath += srcArg;
}
@@ -54,7 +53,7 @@ bool cmAddSubDirectoryCommand::InitialPass(
std::string error = "given source \"";
error += srcArg;
error += "\" which is not an existing directory.";
- this->SetError(error);
+ status.SetError(error);
return false;
}
srcPath = cmSystemTools::CollapseFullPath(srcPath);
@@ -65,22 +64,22 @@ bool cmAddSubDirectoryCommand::InitialPass(
// No binary directory was specified. If the source directory is
// not a subdirectory of the current directory then it is an
// error.
- if (!cmSystemTools::IsSubDirectory(
- srcPath, this->Makefile->GetCurrentSourceDirectory())) {
+ if (!cmSystemTools::IsSubDirectory(srcPath,
+ mf.GetCurrentSourceDirectory())) {
std::ostringstream e;
e << "not given a binary directory but the given source directory "
<< "\"" << srcPath << "\" is not a subdirectory of \""
- << this->Makefile->GetCurrentSourceDirectory() << "\". "
+ << mf.GetCurrentSourceDirectory() << "\". "
<< "When specifying an out-of-tree source a binary directory "
<< "must be explicitly specified.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
// Remove the CurrentDirectory from the srcPath and replace it
// with the CurrentOutputDirectory.
- const std::string& src = this->Makefile->GetCurrentSourceDirectory();
- const std::string& bin = this->Makefile->GetCurrentBinaryDirectory();
+ const std::string& src = mf.GetCurrentSourceDirectory();
+ const std::string& bin = mf.GetCurrentBinaryDirectory();
size_t srcLen = src.length();
size_t binLen = bin.length();
if (srcLen > 0 && src.back() == '/') {
@@ -96,7 +95,7 @@ bool cmAddSubDirectoryCommand::InitialPass(
if (cmSystemTools::FileIsFullPath(binArg)) {
binPath = binArg;
} else {
- binPath = this->Makefile->GetCurrentBinaryDirectory();
+ binPath = mf.GetCurrentBinaryDirectory();
binPath += "/";
binPath += binArg;
}
@@ -104,7 +103,7 @@ bool cmAddSubDirectoryCommand::InitialPass(
binPath = cmSystemTools::CollapseFullPath(binPath);
// Add the subdirectory using the computed full paths.
- this->Makefile->AddSubDirectory(srcPath, binPath, excludeFromAll, true);
+ mf.AddSubDirectory(srcPath, binPath, excludeFromAll, true);
return true;
}
diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h
index 664334e..87da840 100644
--- a/Source/cmAddSubDirectoryCommand.h
+++ b/Source/cmAddSubDirectoryCommand.h
@@ -8,36 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmAddSubDirectoryCommand
- * \brief Specify a subdirectory to build
- *
- * cmAddSubDirectoryCommand specifies a subdirectory to process
- * by CMake. CMake will descend
- * into the specified source directory and process any CMakeLists.txt found.
- */
-class cmAddSubDirectoryCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddSubDirectoryCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAddSubDirectoryCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx
index b0c462b..7904bf5 100644
--- a/Source/cmAddTestCommand.cxx
+++ b/Source/cmAddTestCommand.cxx
@@ -4,34 +4,36 @@
#include <sstream>
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmTest.h"
#include "cmTestGenerator.h"
-class cmExecutionStatus;
+static bool cmAddTestCommandHandleNameMode(
+ std::vector<std::string> const& args, cmExecutionStatus& status);
-// cmExecutableCommand
-bool cmAddTestCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmAddTestCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (!args.empty() && args[0] == "NAME") {
- return this->HandleNameMode(args);
+ return cmAddTestCommandHandleNameMode(args, status);
}
// First argument is the name of the test Second argument is the name of
// the executable to run (a target or external program) Remaining arguments
// are the arguments to pass to the executable
if (args.size() < 2) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
// Collect the command with arguments.
std::vector<std::string> command(args.begin() + 1, args.end());
// Create the test but add a generator only the first time it is
// seen. This preserves behavior from before test generators.
- cmTest* test = this->Makefile->GetTest(args[0]);
+ cmTest* test = mf.GetTest(args[0]);
if (test) {
// If the test was already added by a new-style signature do not
// allow it to be duplicated.
@@ -39,20 +41,21 @@ bool cmAddTestCommand::InitialPass(std::vector<std::string> const& args,
std::ostringstream e;
e << " given test name \"" << args[0]
<< "\" which already exists in this directory.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
} else {
- test = this->Makefile->CreateTest(args[0]);
+ test = mf.CreateTest(args[0]);
test->SetOldStyle(true);
- this->Makefile->AddTestGenerator(new cmTestGenerator(test));
+ mf.AddTestGenerator(new cmTestGenerator(test));
}
test->SetCommand(command);
return true;
}
-bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
+bool cmAddTestCommandHandleNameMode(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
std::string name;
std::vector<std::string> configurations;
@@ -73,25 +76,25 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
for (unsigned int i = 1; i < args.size(); ++i) {
if (args[i] == "COMMAND") {
if (!command.empty()) {
- this->SetError(" may be given at most one COMMAND.");
+ status.SetError(" may be given at most one COMMAND.");
return false;
}
doing = DoingCommand;
} else if (args[i] == "CONFIGURATIONS") {
if (!configurations.empty()) {
- this->SetError(" may be given at most one set of CONFIGURATIONS.");
+ status.SetError(" may be given at most one set of CONFIGURATIONS.");
return false;
}
doing = DoingConfigs;
} else if (args[i] == "WORKING_DIRECTORY") {
if (!working_directory.empty()) {
- this->SetError(" may be given at most one WORKING_DIRECTORY.");
+ status.SetError(" may be given at most one WORKING_DIRECTORY.");
return false;
}
doing = DoingWorkingDirectory;
} else if (args[i] == "COMMAND_EXPAND_LISTS") {
if (command_expand_lists) {
- this->SetError(" may be given at most one COMMAND_EXPAND_LISTS.");
+ status.SetError(" may be given at most one COMMAND_EXPAND_LISTS.");
return false;
}
command_expand_lists = true;
@@ -109,41 +112,43 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
} else {
std::ostringstream e;
e << " given unknown argument:\n " << args[i] << "\n";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
}
// Require a test name.
if (name.empty()) {
- this->SetError(" must be given non-empty NAME.");
+ status.SetError(" must be given non-empty NAME.");
return false;
}
// Require a command.
if (command.empty()) {
- this->SetError(" must be given non-empty COMMAND.");
+ status.SetError(" must be given non-empty COMMAND.");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
+
// Require a unique test name within the directory.
- if (this->Makefile->GetTest(name)) {
+ if (mf.GetTest(name)) {
std::ostringstream e;
e << " given test NAME \"" << name
<< "\" which already exists in this directory.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
// Add the test.
- cmTest* test = this->Makefile->CreateTest(name);
+ cmTest* test = mf.CreateTest(name);
test->SetOldStyle(false);
test->SetCommand(command);
if (!working_directory.empty()) {
test->SetProperty("WORKING_DIRECTORY", working_directory.c_str());
}
test->SetCommandExpandLists(command_expand_lists);
- this->Makefile->AddTestGenerator(new cmTestGenerator(test, configurations));
+ mf.AddTestGenerator(new cmTestGenerator(test, configurations));
return true;
}
diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h
index 3d37d2b..5877547 100644
--- a/Source/cmAddTestCommand.h
+++ b/Source/cmAddTestCommand.h
@@ -8,37 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmAddTestCommand
- * \brief Add a test to the lists of tests to run.
- *
- * cmAddTestCommand adds a test to the list of tests to run .
- */
-class cmAddTestCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddTestCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-
-private:
- bool HandleNameMode(std::vector<std::string> const& args);
-};
+bool cmAddTestCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h
index 9ea88d3..e90a603 100644
--- a/Source/cmArchiveWrite.h
+++ b/Source/cmArchiveWrite.h
@@ -9,7 +9,7 @@
#include <stddef.h>
#include <string>
-#if !defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(CMAKE_BOOTSTRAP)
# error "cmArchiveWrite not allowed during bootstrap build!"
#endif
diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx
index 45c6411..83199b4 100644
--- a/Source/cmAuxSourceDirectoryCommand.cxx
+++ b/Source/cmAuxSourceDirectoryCommand.cxx
@@ -7,28 +7,27 @@
#include <stddef.h>
#include <utility>
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
-class cmExecutionStatus;
-
-// cmAuxSourceDirectoryCommand
-bool cmAuxSourceDirectoryCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmAuxSourceDirectoryCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.size() != 2) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
std::string sourceListValue;
std::string const& templateDirectory = args[0];
std::string tdir;
if (!cmSystemTools::FileIsFullPath(templateDirectory)) {
- tdir = this->Makefile->GetCurrentSourceDirectory();
+ tdir = mf.GetCurrentSourceDirectory();
tdir += "/";
tdir += templateDirectory;
} else {
@@ -36,7 +35,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass(
}
// was the list already populated
- const char* def = this->Makefile->GetDefinition(args[1]);
+ const char* def = mf.GetDefinition(args[1]);
if (def) {
sourceListValue = def;
}
@@ -55,14 +54,14 @@ bool cmAuxSourceDirectoryCommand::InitialPass(
std::string ext = file.substr(dotpos + 1);
std::string base = file.substr(0, dotpos);
// Process only source files
- auto cm = this->Makefile->GetCMakeInstance();
+ auto cm = mf.GetCMakeInstance();
if (!base.empty() && cm->IsSourceExtension(ext)) {
std::string fullname = templateDirectory;
fullname += "/";
fullname += file;
// add the file as a class file so
// depends can be done
- cmSourceFile* sf = this->Makefile->GetOrCreateSource(fullname);
+ cmSourceFile* sf = mf.GetOrCreateSource(fullname);
sf->SetProperty("ABSTRACT", "0");
files.push_back(std::move(fullname));
}
@@ -74,6 +73,6 @@ bool cmAuxSourceDirectoryCommand::InitialPass(
sourceListValue += ";";
}
sourceListValue += cmJoin(files, ";");
- this->Makefile->AddDefinition(args[1], sourceListValue);
+ mf.AddDefinition(args[1], sourceListValue);
return true;
}
diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h
index 973a464..ae26092 100644
--- a/Source/cmAuxSourceDirectoryCommand.h
+++ b/Source/cmAuxSourceDirectoryCommand.h
@@ -8,38 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmAuxSourceDirectoryCommand
- * \brief Specify auxiliary source code directories.
- *
- * cmAuxSourceDirectoryCommand specifies source code directories
- * that must be built as part of this build process. This directories
- * are not recursively processed like the SUBDIR command (cmSubdirCommand).
- * A side effect of this command is to create a subdirectory in the build
- * directory structure.
- */
-class cmAuxSourceDirectoryCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAuxSourceDirectoryCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAuxSourceDirectoryCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 026250d..4a5d2ce 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -754,7 +754,7 @@ bool cmCTest::UpdateCTestConfiguration()
std::string const& testLoad = this->GetCTestConfiguration("TestLoad");
if (!testLoad.empty()) {
unsigned long load;
- if (cmSystemTools::StringToULong(testLoad.c_str(), &load)) {
+ if (cmStrToULong(testLoad, &load)) {
this->SetTestLoad(load);
} else {
cmCTestLog(this, WARNING,
@@ -1454,7 +1454,7 @@ void cmCTest::AddSiteProperties(cmXMLWriter& xml)
xml.StartElement("Labels");
std::string l = labels;
std::vector<std::string> args;
- cmSystemTools::ExpandListArgument(l, args);
+ cmExpandList(l, args);
for (std::string const& i : args) {
xml.Element("Label", i);
}
@@ -1487,7 +1487,7 @@ std::vector<std::string> cmCTest::GetLabelsForSubprojects()
std::string labelsForSubprojects =
this->GetCTestConfiguration("LabelsForSubprojects");
std::vector<std::string> subprojects;
- cmSystemTools::ExpandListArgument(labelsForSubprojects, subprojects);
+ cmExpandList(labelsForSubprojects, subprojects);
// sort the array
std::sort(subprojects.begin(), subprojects.end());
@@ -1854,7 +1854,7 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
}
i++;
long repeat = 1;
- if (!cmSystemTools::StringToLong(args[i].c_str(), &repeat)) {
+ if (!cmStrToLong(args[i], &repeat)) {
errormsg =
"'--repeat-until-fail' given non-integer value '" + args[i] + "'";
return false;
@@ -1868,7 +1868,7 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
if (this->CheckArgument(arg, "--test-load") && i < args.size() - 1) {
i++;
unsigned long load;
- if (cmSystemTools::StringToULong(args[i].c_str(), &load)) {
+ if (cmStrToULong(args[i], &load)) {
this->SetTestLoad(load);
} else {
cmCTestLog(this, WARNING,
@@ -1942,7 +1942,7 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
i < args.size() - 1) {
i++;
long outputSize;
- if (cmSystemTools::StringToLong(args[i].c_str(), &outputSize)) {
+ if (cmStrToLong(args[i], &outputSize)) {
this->Impl->TestHandler.SetTestOutputSizePassed(int(outputSize));
} else {
cmCTestLog(this, WARNING,
@@ -1954,7 +1954,7 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
i < args.size() - 1) {
i++;
long outputSize;
- if (cmSystemTools::StringToLong(args[i].c_str(), &outputSize)) {
+ if (cmStrToLong(args[i], &outputSize)) {
this->Impl->TestHandler.SetTestOutputSizeFailed(int(outputSize));
} else {
cmCTestLog(this, WARNING,
@@ -2423,7 +2423,7 @@ int cmCTest::RunCMakeAndTest(std::string* output)
cmCTestBuildAndTestHandler* handler = this->GetBuildAndTestHandler();
int retv = handler->ProcessHandler();
*output = handler->GetOutput();
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmDynamicLoader::FlushCache();
#endif
if (retv != 0) {
@@ -2565,7 +2565,7 @@ void cmCTest::PopulateCustomVector(cmMakefile* mf, const std::string& def,
cmCTestLog(this, DEBUG, "PopulateCustomVector: " << def << std::endl);
vec.clear();
- cmSystemTools::ExpandListArgument(dval, vec);
+ cmExpandList(dval, vec);
for (std::string const& it : vec) {
cmCTestLog(this, DEBUG, " -- " << it << std::endl);
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index e8fc350..8ebab0a 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -14,6 +14,7 @@
#include "cmMessageType.h"
#include "cmMessenger.h"
#include "cmState.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmVersion.h"
@@ -552,7 +553,7 @@ void cmCacheManager::AddCacheEntry(const std::string& key, const char* value,
if (type == cmStateEnums::FILEPATH || type == cmStateEnums::PATH) {
if (e.Value.find(';') != std::string::npos) {
std::vector<std::string> paths;
- cmSystemTools::ExpandListArgument(e.Value, paths);
+ cmExpandList(e.Value, paths);
const char* sep = "";
e.Value = "";
for (std::string& i : paths) {
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index a9be445..8565e1c 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -84,7 +84,7 @@
#include "cmUnsetCommand.h"
#include "cmWhileCommand.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmAddCompileOptionsCommand.h"
# include "cmAddLinkOptionsCommand.h"
# include "cmAuxSourceDirectoryCommand.h"
@@ -210,7 +210,7 @@ void GetScriptingCommands(cmState* state)
"WHILE ENDWHILE structure. Or its arguments did not "
"match the opening WHILE command.");
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
state->AddBuiltinCommand(
"cmake_host_system_information",
cm::make_unique<cmCMakeHostSystemInformationCommand>());
@@ -233,21 +233,14 @@ void GetScriptingCommands(cmState* state)
void GetProjectCommands(cmState* state)
{
- state->AddBuiltinCommand("add_custom_command",
- cm::make_unique<cmAddCustomCommandCommand>());
- state->AddBuiltinCommand("add_custom_target",
- cm::make_unique<cmAddCustomTargetCommand>());
- state->AddBuiltinCommand("add_definitions",
- cm::make_unique<cmAddDefinitionsCommand>());
- state->AddBuiltinCommand("add_dependencies",
- cm::make_unique<cmAddDependenciesCommand>());
- state->AddBuiltinCommand("add_executable",
- cm::make_unique<cmAddExecutableCommand>());
- state->AddBuiltinCommand("add_library",
- cm::make_unique<cmAddLibraryCommand>());
- state->AddBuiltinCommand("add_subdirectory",
- cm::make_unique<cmAddSubDirectoryCommand>());
- state->AddBuiltinCommand("add_test", cm::make_unique<cmAddTestCommand>());
+ state->AddBuiltinCommand("add_custom_command", cmAddCustomCommandCommand);
+ state->AddBuiltinCommand("add_custom_target", cmAddCustomTargetCommand);
+ state->AddBuiltinCommand("add_definitions", cmAddDefinitionsCommand);
+ state->AddBuiltinCommand("add_dependencies", cmAddDependenciesCommand);
+ state->AddBuiltinCommand("add_executable", cmAddExecutableCommand);
+ state->AddBuiltinCommand("add_library", cmAddLibraryCommand);
+ state->AddBuiltinCommand("add_subdirectory", cmAddSubDirectoryCommand);
+ state->AddBuiltinCommand("add_test", cmAddTestCommand);
state->AddBuiltinCommand("build_command", cm::make_unique<cmBuildCommand>());
state->AddBuiltinCommand("create_test_sourcelist",
cm::make_unique<cmCreateTestSourceList>());
@@ -301,13 +294,12 @@ void GetProjectCommands(cmState* state)
cm::make_unique<cmTryCompileCommand>());
state->AddBuiltinCommand("try_run", cm::make_unique<cmTryRunCommand>());
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
state->AddBuiltinCommand("add_compile_definitions",
- cm::make_unique<cmAddCompileDefinitionsCommand>());
- state->AddBuiltinCommand("add_compile_options",
- cm::make_unique<cmAddCompileOptionsCommand>());
+ cmAddCompileDefinitionsCommand);
+ state->AddBuiltinCommand("add_compile_options", cmAddCompileOptionsCommand);
state->AddBuiltinCommand("aux_source_directory",
- cm::make_unique<cmAuxSourceDirectoryCommand>());
+ cmAuxSourceDirectoryCommand);
state->AddBuiltinCommand("export", cm::make_unique<cmExportCommand>());
state->AddBuiltinCommand("fltk_wrap_ui",
cm::make_unique<cmFLTKWrapUICommand>());
@@ -316,8 +308,7 @@ void GetProjectCommands(cmState* state)
cm::make_unique<cmIncludeExternalMSProjectCommand>());
state->AddBuiltinCommand("install_programs",
cm::make_unique<cmInstallProgramsCommand>());
- state->AddBuiltinCommand("add_link_options",
- cm::make_unique<cmAddLinkOptionsCommand>());
+ state->AddBuiltinCommand("add_link_options", cmAddLinkOptionsCommand);
state->AddBuiltinCommand("link_libraries",
cm::make_unique<cmLinkLibrariesCommand>());
state->AddBuiltinCommand("target_link_options",
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index f8b78b4..a187f99 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -12,7 +12,6 @@
#include "cmRange.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
-#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmake.h"
@@ -439,7 +438,7 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index,
// <item>_LIB_DEPENDS. The variable contains a semicolon-separated
// list. The list contains link-type;item pairs and just items.
std::vector<std::string> deplist;
- cmSystemTools::ExpandListArgument(value, deplist);
+ cmExpandList(value, deplist);
// Look for entries meant for this configuration.
std::vector<cmLinkItem> actual_libs;
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 4aa18f2..5f5317c 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -285,8 +285,13 @@ cmComputeLinkInformation::cmComputeLinkInformation(
}
// Get options needed to link libraries.
- this->LibLinkFlag =
- this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FLAG");
+ if (const char* flag = this->Makefile->GetDefinition(
+ "CMAKE_" + this->LinkLanguage + "_LINK_LIBRARY_FLAG")) {
+ this->LibLinkFlag = flag;
+ } else {
+ this->LibLinkFlag =
+ this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FLAG");
+ }
this->LibLinkFileFlag =
this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FILE_FLAG");
this->LibLinkSuffix =
@@ -546,7 +551,7 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
libVar += "_IMPLICIT_LINK_LIBRARIES";
if (const char* libs = this->Makefile->GetDefinition(libVar)) {
std::vector<std::string> libsVec;
- cmSystemTools::ExpandListArgument(libs, libsVec);
+ cmExpandList(libs, libsVec);
for (std::string const& i : libsVec) {
if (this->ImplicitLinkLibs.find(i) == this->ImplicitLinkLibs.end()) {
this->AddItem(i, nullptr);
@@ -561,7 +566,7 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
dirVar += "_IMPLICIT_LINK_DIRECTORIES";
if (const char* dirs = this->Makefile->GetDefinition(dirVar)) {
std::vector<std::string> dirsVec;
- cmSystemTools::ExpandListArgument(dirs, dirsVec);
+ cmExpandList(dirs, dirsVec);
this->OrderLinkerSearchPath->AddLanguageDirectories(dirsVec);
}
}
@@ -806,7 +811,7 @@ void cmComputeLinkInformation::ComputeItemParserInfo()
if (const char* linkSuffixes =
mf->GetDefinition("CMAKE_EXTRA_LINK_EXTENSIONS")) {
std::vector<std::string> linkSuffixVec;
- cmSystemTools::ExpandListArgument(linkSuffixes, linkSuffixVec);
+ cmExpandList(linkSuffixes, linkSuffixVec);
for (std::string const& i : linkSuffixVec) {
this->AddLinkExtension(i.c_str(), LinkUnknown);
}
@@ -814,7 +819,7 @@ void cmComputeLinkInformation::ComputeItemParserInfo()
if (const char* sharedSuffixes =
mf->GetDefinition("CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES")) {
std::vector<std::string> sharedSuffixVec;
- cmSystemTools::ExpandListArgument(sharedSuffixes, sharedSuffixVec);
+ cmExpandList(sharedSuffixes, sharedSuffixVec);
for (std::string const& i : sharedSuffixVec) {
this->AddLinkExtension(i.c_str(), LinkShared);
}
@@ -1283,7 +1288,7 @@ void cmComputeLinkInformation::ComputeFrameworkInfo()
// Get platform-wide implicit directories.
if (const char* implicitLinks = this->Makefile->GetDefinition(
"CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES")) {
- cmSystemTools::ExpandListArgument(implicitLinks, implicitDirVec);
+ cmExpandList(implicitLinks, implicitDirVec);
}
// Get language-specific implicit directories.
@@ -1292,7 +1297,7 @@ void cmComputeLinkInformation::ComputeFrameworkInfo()
implicitDirVar += "_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES";
if (const char* implicitDirs =
this->Makefile->GetDefinition(implicitDirVar)) {
- cmSystemTools::ExpandListArgument(implicitDirs, implicitDirVec);
+ cmExpandList(implicitDirs, implicitDirVec);
}
this->FrameworkPathsEmmitted.insert(implicitDirVec.begin(),
@@ -1511,7 +1516,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo()
// Get platform-wide implicit directories.
if (const char* implicitLinks = (this->Makefile->GetDefinition(
"CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES"))) {
- cmSystemTools::ExpandListArgument(implicitLinks, implicitDirVec);
+ cmExpandList(implicitLinks, implicitDirVec);
}
// Append library architecture to all implicit platform directories
@@ -1529,7 +1534,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo()
implicitDirVar += "_IMPLICIT_LINK_DIRECTORIES";
if (const char* implicitDirs =
this->Makefile->GetDefinition(implicitDirVar)) {
- cmSystemTools::ExpandListArgument(implicitDirs, implicitDirVec);
+ cmExpandList(implicitDirs, implicitDirVec);
}
// Store implicit link directories.
@@ -1542,7 +1547,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo()
implicitLibVar += "_IMPLICIT_LINK_LIBRARIES";
if (const char* implicitLibs =
this->Makefile->GetDefinition(implicitLibVar)) {
- cmSystemTools::ExpandListArgument(implicitLibs, implicitLibVec);
+ cmExpandList(implicitLibs, implicitLibVec);
}
// Store implicit link libraries.
@@ -1557,7 +1562,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo()
// Get platform specific rpath link directories
if (const char* rpathDirs =
(this->Makefile->GetDefinition("CMAKE_PLATFORM_RUNTIME_PATH"))) {
- cmSystemTools::ExpandListArgument(rpathDirs, this->RuntimeLinkDirs);
+ cmExpandList(rpathDirs, this->RuntimeLinkDirs);
}
}
@@ -1664,7 +1669,7 @@ static void cmCLI_ExpandListUnique(const char* str,
std::set<std::string>& emitted)
{
std::vector<std::string> tmp;
- cmSystemTools::ExpandListArgument(str, tmp);
+ cmExpandList(str, tmp);
for (std::string const& i : tmp) {
if (emitted.insert(i).second) {
out.push_back(i);
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 5b88807..3a53067 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -670,7 +670,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
if (def2) {
std::vector<std::string> list;
- cmSystemTools::ExpandListArgument(def2, list, true);
+ cmExpandList(def2, list, true);
result = std::find(list.begin(), list.end(), def) != list.end();
}
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 85ff0a6..c0c4a25 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -234,7 +234,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
} else if (doing == DoingCMakeFlags) {
cmakeFlags.push_back(argv[i]);
} else if (doing == DoingCompileDefinitions) {
- cmSystemTools::ExpandListArgument(argv[i], compileDefs);
+ cmExpandList(argv[i], compileDefs);
} else if (doing == DoingLinkOptions) {
linkOptions.push_back(argv[i]);
} else if (doing == DoingLinkLibraries) {
@@ -676,7 +676,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
if (const char* varListStr = this->Makefile->GetDefinition(
kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES)) {
std::vector<std::string> varList;
- cmSystemTools::ExpandListArgument(varListStr, varList);
+ cmExpandList(varListStr, varList);
vars.insert(varList.begin(), varList.end());
}
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 758a69a..20f0ef2 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -10,6 +10,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include <memory>
@@ -35,7 +36,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
this->GE->Parse(clarg);
std::string parsed_arg = cge->Evaluate(this->LG, this->Config);
if (this->CC.GetCommandExpandLists()) {
- cmAppend(argv, cmSystemTools::ExpandedListArgument(parsed_arg));
+ cmAppend(argv, cmExpandedList(parsed_arg));
} else {
argv.push_back(std::move(parsed_arg));
}
@@ -54,8 +55,8 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
std::vector<std::string> depends = this->CC.GetDepends();
for (std::string const& d : depends) {
std::unique_ptr<cmCompiledGeneratorExpression> cge = this->GE->Parse(d);
- std::vector<std::string> result = cmSystemTools::ExpandedListArgument(
- cge->Evaluate(this->LG, this->Config));
+ std::vector<std::string> result =
+ cmExpandedList(cge->Evaluate(this->LG, this->Config));
for (std::string& it : result) {
if (cmSystemTools::FileIsFullPath(it)) {
it = cmSystemTools::CollapseFullPath(it);
@@ -108,8 +109,7 @@ void cmCustomCommandGenerator::FillEmulatorsWithArguments()
continue;
}
- cmSystemTools::ExpandListArgument(emulator_property,
- this->EmulatorsWithArguments[c]);
+ cmExpandList(emulator_property, this->EmulatorsWithArguments[c]);
}
}
}
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index ed76dbf..6623d94 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -7,6 +7,7 @@
#include "cmGeneratedFileStream.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmsys/FStream.hxx"
@@ -30,7 +31,7 @@ bool cmDepends::Write(std::ostream& makeDepends, std::ostream& internalDepends)
{
std::string const srcLang = "CMAKE_DEPENDS_CHECK_" + this->Language;
cmMakefile* mf = this->LocalGenerator->GetMakefile();
- cmSystemTools::ExpandListArgument(mf->GetSafeDefinition(srcLang), pairs);
+ cmExpandList(mf->GetSafeDefinition(srcLang), pairs);
}
for (std::vector<std::string>::iterator si = pairs.begin();
si != pairs.end();) {
@@ -241,7 +242,7 @@ void cmDepends::SetIncludePathFromLanguage(const std::string& lang)
cmMakefile* mf = this->LocalGenerator->GetMakefile();
includePath = mf->GetDefinition(includePathVar);
if (includePath) {
- cmSystemTools::ExpandListArgument(includePath, this->IncludePath);
+ cmExpandList(includePath, this->IncludePath);
} else {
// Fallback to the old directory level variable if no per-target var:
includePathVar = "CMAKE_";
@@ -249,7 +250,7 @@ void cmDepends::SetIncludePathFromLanguage(const std::string& lang)
includePathVar += "_INCLUDE_PATH";
includePath = mf->GetDefinition(includePathVar);
if (includePath) {
- cmSystemTools::ExpandListArgument(includePath, this->IncludePath);
+ cmExpandList(includePath, this->IncludePath);
}
}
}
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index dc49c18..6eefe82 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -9,6 +9,7 @@
#include "cmFileTime.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#define INCLUDE_REGEX_LINE \
@@ -391,7 +392,7 @@ void cmDependsC::SetupTransforms()
std::vector<std::string> transformRules;
cmMakefile* mf = this->LocalGenerator->GetMakefile();
if (const char* xform = mf->GetDefinition("CMAKE_INCLUDE_TRANSFORMS")) {
- cmSystemTools::ExpandListArgument(xform, transformRules, true);
+ cmExpandList(xform, transformRules, true);
}
for (std::string const& tr : transformRules) {
this->ParseTransform(tr);
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index 764ba30..63d1c4d 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -82,7 +82,7 @@ cmDependsFortran::cmDependsFortran(cmLocalGenerator* lg)
cmMakefile* mf = this->LocalGenerator->GetMakefile();
if (const char* c_defines =
mf->GetDefinition("CMAKE_TARGET_DEFINITIONS_Fortran")) {
- cmSystemTools::ExpandListArgument(c_defines, definitions);
+ cmExpandList(c_defines, definitions);
}
// translate i.e. FOO=BAR to FOO and add it to the list of defined
@@ -254,7 +254,7 @@ void cmDependsFortran::LocateModules()
std::vector<std::string> infoFiles;
if (const char* infoFilesValue =
mf->GetDefinition("CMAKE_TARGET_LINKED_INFO_FILES")) {
- cmSystemTools::ExpandListArgument(infoFilesValue, infoFiles);
+ cmExpandList(infoFilesValue, infoFiles);
}
for (std::string const& i : infoFiles) {
std::string targetDir = cmSystemTools::GetFilenamePath(i);
diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx
index 5edf7ca..22cc0bc 100644
--- a/Source/cmExportBuildAndroidMKGenerator.cxx
+++ b/Source/cmExportBuildAndroidMKGenerator.cxx
@@ -145,7 +145,7 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
} else if (property.first == "INTERFACE_INCLUDE_DIRECTORIES") {
std::string includes = property.second;
std::vector<std::string> includeList;
- cmSystemTools::ExpandListArgument(includes, includeList);
+ cmExpandList(includes, includeList);
os << "LOCAL_EXPORT_C_INCLUDES := ";
std::string end;
for (std::string const& i : includeList) {
@@ -156,7 +156,7 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
} else if (property.first == "INTERFACE_LINK_OPTIONS") {
os << "LOCAL_EXPORT_LDFLAGS := ";
std::vector<std::string> linkFlagsList;
- cmSystemTools::ExpandListArgument(property.second, linkFlagsList);
+ cmExpandList(property.second, linkFlagsList);
os << cmJoin(linkFlagsList, " ") << "\n";
} else {
os << "# " << property.first << " " << (property.second) << "\n";
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 87f9b4c..35d8668 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -500,7 +500,7 @@ void getPropertyContents(cmGeneratorTarget const* tgt, const std::string& prop,
return;
}
std::vector<std::string> content;
- cmSystemTools::ExpandListArgument(p, content);
+ cmExpandList(p, content);
ifaceProperties.insert(content.begin(), content.end());
}
@@ -1207,7 +1207,7 @@ bool cmExportFileGenerator::PopulateExportProperties(
auto& targetProperties = gte->Target->GetProperties();
if (const char* exportProperties =
targetProperties.GetPropertyValue("EXPORT_PROPERTIES")) {
- for (auto& prop : cmSystemTools::ExpandedListArgument(exportProperties)) {
+ for (auto& prop : cmExpandedList(exportProperties)) {
/* Black list reserved properties */
if (cmHasLiteralPrefix(prop, "IMPORTED_") ||
cmHasLiteralPrefix(prop, "INTERFACE_")) {
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index a3c9802..f77fd3a 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -9,7 +9,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmStateTypes.h"
-#include "cmSystemTools.h"
+#include "cmStringAlgorithms.h"
#include "cmTarget.h"
#include <map>
@@ -104,7 +104,7 @@ void cmExportTryCompileFileGenerator::PopulateProperties(
this->FindTargets(p, target, std::string(), emitted);
std::vector<std::string> depends;
- cmSystemTools::ExpandListArgument(evalResult, depends);
+ cmExpandList(evalResult, depends);
for (std::string const& li : depends) {
cmGeneratorTarget* tgt =
target->GetLocalGenerator()->FindGeneratorTargetToUse(li);
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 4146db8..d13e3ce 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -571,15 +571,13 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
std::string systemIncludeDirs = makefile->GetSafeDefinition(
"CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS");
if (!systemIncludeDirs.empty()) {
- cmAppend(allIncludeDirs,
- cmSystemTools::ExpandedListArgument(systemIncludeDirs));
+ cmAppend(allIncludeDirs, cmExpandedList(systemIncludeDirs));
}
systemIncludeDirs = makefile->GetSafeDefinition(
"CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
if (!systemIncludeDirs.empty()) {
- cmAppend(allIncludeDirs,
- cmSystemTools::ExpandedListArgument(systemIncludeDirs));
+ cmAppend(allIncludeDirs, cmExpandedList(systemIncludeDirs));
}
std::vector<std::string>::const_iterator end =
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 06709f1..9ac355c 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -21,6 +21,7 @@
#include "cmSourceGroup.h"
#include "cmState.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
#include "cmake.h"
@@ -416,7 +417,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
if (const char* extraNaturesProp =
mf->GetState()->GetGlobalProperty("ECLIPSE_EXTRA_NATURES")) {
std::vector<std::string> extraNatures;
- cmSystemTools::ExpandListArgument(extraNaturesProp, extraNatures);
+ cmExpandList(extraNaturesProp, extraNatures);
for (std::string const& n : extraNatures) {
xml.Element("nature", n);
}
@@ -803,7 +804,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
if (this->CEnabled && cDefs) {
// Expand the list.
std::vector<std::string> defs;
- cmSystemTools::ExpandListArgument(cDefs, defs, true);
+ cmExpandList(cDefs, defs, true);
// the list must contain only definition-value pairs:
if ((defs.size() % 2) == 0) {
@@ -836,7 +837,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
if (this->CXXEnabled && cxxDefs) {
// Expand the list.
std::vector<std::string> defs;
- cmSystemTools::ExpandListArgument(cxxDefs, defs, true);
+ cmExpandList(cxxDefs, defs, true);
// the list must contain only definition-value pairs:
if ((defs.size() % 2) == 0) {
@@ -887,7 +888,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
std::string systemIncludeDirs =
mf->GetSafeDefinition("CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
std::vector<std::string> dirs;
- cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
+ cmExpandList(systemIncludeDirs, dirs);
this->AppendIncludeDirectories(xml, dirs, emmited);
}
compiler = mf->GetSafeDefinition("CMAKE_CXX_COMPILER");
@@ -895,7 +896,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
std::string systemIncludeDirs =
mf->GetSafeDefinition("CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS");
std::vector<std::string> dirs;
- cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
+ cmExpandList(systemIncludeDirs, dirs);
this->AppendIncludeDirectories(xml, dirs, emmited);
}
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 67773e0..0c258f7 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -135,7 +135,7 @@ void cmExtraSublimeTextGenerator::CreateNewProjectFile(
fout << "\n\t]";
std::string systemName = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME");
std::vector<std::string> tokens;
- cmSystemTools::ExpandListArgument(this->EnvSettings, tokens);
+ cmExpandList(this->EnvSettings, tokens);
if (!this->EnvSettings.empty()) {
fout << ",";
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index ec03191..87e97dd 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -47,7 +47,7 @@
#include "cm_sys_stat.h"
#include "cmake.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmCurl.h"
# include "cmFileLockResult.h"
# include "cm_curl.h"
@@ -275,7 +275,7 @@ bool HandleReadCommand(std::vector<std::string> const& args,
bool HandleHashCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
if (args.size() != 3) {
std::ostringstream e;
e << args[0] << " requires a file name and output variable";
@@ -1356,7 +1356,7 @@ bool HandleRemoveImpl(std::vector<std::string> const& args, bool recurse,
if (cmSystemTools::FileIsDirectory(fileName) &&
!cmSystemTools::FileIsSymlink(fileName) && recurse) {
- cmSystemTools::RemoveADirectory(fileName);
+ cmSystemTools::RepeatedRemoveDirectory(fileName);
} else {
cmSystemTools::RemoveFile(fileName);
}
@@ -1426,7 +1426,7 @@ bool HandleNativePathCommand(std::vector<std::string> const& args,
return HandlePathCommand(args, ToNativePath, status);
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
// Stuff for curl download/upload
typedef std::vector<char> cmFileCommandVectorOfChar;
@@ -1592,7 +1592,7 @@ private:
bool HandleDownloadCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
std::vector<std::string>::const_iterator i = args.begin();
if (args.size() < 3) {
status.SetError("DOWNLOAD must be called with at least three arguments.");
@@ -1961,7 +1961,7 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
bool HandleUploadCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
if (args.size() < 3) {
status.SetError("UPLOAD must be called with at least three arguments.");
return false;
@@ -2292,7 +2292,7 @@ bool HandleGenerateCommand(std::vector<std::string> const& args,
bool HandleLockCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
// Default values
bool directory = false;
bool release = false;
@@ -2357,8 +2357,7 @@ bool HandleLockCommand(std::vector<std::string> const& args,
return false;
}
long scanned;
- if (!cmSystemTools::StringToLong(args[i].c_str(), &scanned) ||
- scanned < 0) {
+ if (!cmStrToLong(args[i], &scanned) || scanned < 0) {
std::ostringstream e;
e << "TIMEOUT value \"" << args[i] << "\" is not an unsigned integer.";
status.GetMakefile().IssueMessage(MessageType::FATAL_ERROR, e.str());
diff --git a/Source/cmFileCopier.cxx b/Source/cmFileCopier.cxx
index 62f132d..1d66050 100644
--- a/Source/cmFileCopier.cxx
+++ b/Source/cmFileCopier.cxx
@@ -172,7 +172,7 @@ bool cmFileCopier::GetDefaultDirectoryPermissions(mode_t** mode)
"CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS");
if (default_dir_install_permissions && *default_dir_install_permissions) {
std::vector<std::string> items;
- cmSystemTools::ExpandListArgument(default_dir_install_permissions, items);
+ cmExpandList(default_dir_install_permissions, items);
for (const auto& arg : items) {
if (!this->CheckPermissions(arg, **mode)) {
this->Status.SetError(
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index a5937a0..102ed4c 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -9,6 +9,7 @@
#include "cmAlgorithms.h"
#include "cmMakefile.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
cmFindCommon::PathGroup cmFindCommon::PathGroup::All("ALL");
@@ -195,7 +196,7 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
// Construct the list of path roots with no trailing slashes.
std::vector<std::string> roots;
if (rootPath) {
- cmSystemTools::ExpandListArgument(rootPath, roots);
+ cmExpandList(rootPath, roots);
}
if (sysrootCompile) {
roots.emplace_back(sysrootCompile);
@@ -261,7 +262,7 @@ void cmFindCommon::GetIgnoredPaths(std::vector<std::string>& ignore)
continue;
}
- cmSystemTools::ExpandListArgument(ignorePath, ignore);
+ cmExpandList(ignorePath, ignore);
}
for (std::string& i : ignore) {
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 73d602d..dc160b5 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -13,6 +13,7 @@
#include "cmMakefile.h"
#include "cmState.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
class cmExecutionStatus;
@@ -237,8 +238,8 @@ cmFindLibraryHelper::cmFindLibraryHelper(cmMakefile* mf)
this->Makefile->GetRequiredDefinition("CMAKE_FIND_LIBRARY_PREFIXES");
std::string const& suffixes_list =
this->Makefile->GetRequiredDefinition("CMAKE_FIND_LIBRARY_SUFFIXES");
- cmSystemTools::ExpandListArgument(prefixes_list, this->Prefixes, true);
- cmSystemTools::ExpandListArgument(suffixes_list, this->Suffixes, true);
+ cmExpandList(prefixes_list, this->Prefixes, true);
+ cmExpandList(suffixes_list, this->Suffixes, true);
this->RegexFromList(this->PrefixRegexStr, this->Prefixes);
this->RegexFromList(this->SuffixRegexStr, this->Suffixes);
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 0159ca5..d5207fa 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -498,7 +498,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
// NEW behavior is to honor the <pkg>_ROOT variables.
std::string const rootVar = this->Name + "_ROOT";
if (const char* pkgRoot = this->Makefile->GetDefinition(rootVar)) {
- cmSystemTools::ExpandListArgument(pkgRoot, rootPaths, false);
+ cmExpandList(pkgRoot, rootPaths, false);
}
cmSystemTools::GetPath(rootPaths, rootVar.c_str());
} break;
@@ -1099,7 +1099,7 @@ void cmFindPackageCommand::AppendToFoundProperty(bool found)
if (foundProp && *foundProp) {
std::string tmp = foundProp;
- cmSystemTools::ExpandListArgument(tmp, foundContents, false);
+ cmExpandList(tmp, foundContents, false);
std::vector<std::string>::iterator nameIt =
std::find(foundContents.begin(), foundContents.end(), this->Name);
if (nameIt != foundContents.end()) {
@@ -1113,7 +1113,7 @@ void cmFindPackageCommand::AppendToFoundProperty(bool found)
if (notFoundProp && *notFoundProp) {
std::string tmp = notFoundProp;
- cmSystemTools::ExpandListArgument(tmp, notFoundContents, false);
+ cmExpandList(tmp, notFoundContents, false);
std::vector<std::string>::iterator nameIt =
std::find(notFoundContents.begin(), notFoundContents.end(), this->Name);
if (nameIt != notFoundContents.end()) {
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index a565786..9c6f1b4 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -17,6 +17,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmRange.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
class cmForEachFunctionBlocker : public cmFunctionBlocker
@@ -195,7 +196,7 @@ bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args)
} else if (doing == DoingLists) {
const char* value = this->Makefile->GetDefinition(args[i]);
if (value && *value) {
- cmSystemTools::ExpandListArgument(value, fb->Args, true);
+ cmExpandList(value, fb->Args, true);
}
} else {
std::ostringstream e;
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx
index 2f47788..7475e9f 100644
--- a/Source/cmGeneratedFileStream.cxx
+++ b/Source/cmGeneratedFileStream.cxx
@@ -6,14 +6,14 @@
#include "cmSystemTools.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cm_codecvt.hxx"
# include "cm_zlib.h"
#endif
cmGeneratedFileStream::cmGeneratedFileStream(Encoding encoding)
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
if (encoding != codecvt::None) {
imbue(std::locale(getloc(), new codecvt(encoding)));
}
@@ -32,7 +32,7 @@ cmGeneratedFileStream::cmGeneratedFileStream(std::string const& name,
cmSystemTools::Error("Cannot open file for write: " + this->TempName);
cmSystemTools::ReportLastSystemError("");
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
if (encoding != codecvt::None) {
imbue(std::locale(getloc(), new codecvt(encoding)));
}
@@ -169,7 +169,7 @@ bool cmGeneratedFileStreamBase::Close()
return replaced;
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
int cmGeneratedFileStreamBase::CompressFile(std::string const& oldname,
std::string const& newname)
{
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 4d3a005..133a72b 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -13,6 +13,7 @@
#include "cmGeneratorExpressionEvaluator.h"
#include "cmGeneratorExpressionLexer.h"
#include "cmGeneratorExpressionParser.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
cmGeneratorExpression::cmGeneratorExpression(cmListFileBacktrace backtrace)
@@ -294,7 +295,7 @@ void cmGeneratorExpression::Split(const std::string& input,
preGenex = input.substr(startPos + 1, pos - startPos - 1);
}
if (!part.empty()) {
- cmSystemTools::ExpandListArgument(part, output);
+ cmExpandList(part, output);
}
}
pos += 2;
@@ -327,7 +328,7 @@ void cmGeneratorExpression::Split(const std::string& input,
lastPos = pos;
}
if (lastPos < input.size()) {
- cmSystemTools::ExpandListArgument(input.substr(lastPos), output);
+ cmExpandList(input.substr(lastPos), output);
}
}
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index f78c72e..53bc3cd 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -281,11 +281,11 @@ static const struct InListNode : public cmGeneratorExpressionNode
case cmPolicies::WARN:
if (parameters.front().empty()) {
check = true;
- cmSystemTools::ExpandListArgument(parameters[1], checkValues, true);
+ cmExpandList(parameters[1], checkValues, true);
}
CM_FALLTHROUGH;
case cmPolicies::OLD:
- cmSystemTools::ExpandListArgument(parameters[1], values);
+ cmExpandList(parameters[1], values);
if (check && values != checkValues) {
std::ostringstream e;
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0085)
@@ -302,7 +302,7 @@ static const struct InListNode : public cmGeneratorExpressionNode
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
- cmSystemTools::ExpandListArgument(parameters[1], values, true);
+ cmExpandList(parameters[1], values, true);
break;
}
@@ -348,7 +348,7 @@ static const struct FilterNode : public cmGeneratorExpressionNode
}
std::vector<std::string> values, result;
- cmSystemTools::ExpandListArgument(parameters.front(), values, true);
+ cmExpandList(parameters.front(), values, true);
std::copy_if(values.cbegin(), values.cend(), std::back_inserter(result),
[&re, exclude](std::string const& input) {
@@ -377,7 +377,7 @@ static const struct RemoveDuplicatesNode : public cmGeneratorExpressionNode
}
std::vector<std::string> values;
- cmSystemTools::ExpandListArgument(parameters.front(), values, true);
+ cmExpandList(parameters.front(), values, true);
auto valuesEnd = cmRemoveDuplicates(values);
auto valuesBegin = values.cbegin();
@@ -914,8 +914,7 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
mapProp += cmSystemTools::UpperCase(context->Config);
if (const char* mapValue =
context->CurrentTarget->GetProperty(mapProp)) {
- cmSystemTools::ExpandListArgument(cmSystemTools::UpperCase(mapValue),
- mappedConfigs);
+ cmExpandList(cmSystemTools::UpperCase(mapValue), mappedConfigs);
return std::find(mappedConfigs.begin(), mappedConfigs.end(),
cmSystemTools::UpperCase(parameters.front())) !=
mappedConfigs.end()
@@ -943,7 +942,7 @@ static const struct JoinNode : public cmGeneratorExpressionNode
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
std::vector<std::string> list;
- cmSystemTools::ExpandListArgument(parameters.front(), list);
+ cmExpandList(parameters.front(), list);
return cmJoin(list, parameters[1]);
}
} joinNode;
@@ -1421,7 +1420,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
const char* imp = nullptr;
std::string suffix;
if (gt->Target->GetMappedConfig(context->Config, &loc, &imp, suffix)) {
- cmSystemTools::ExpandListArgument(loc, objects);
+ cmExpandList(loc, objects);
}
context->HadContextSensitiveCondition = true;
} else {
@@ -1499,8 +1498,7 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode
reportError(context, content->GetOriginalExpression(), error);
return std::string();
}
- cmSystemTools::ExpandListArgument(featuresKnown,
- availableFeatures[lang]);
+ cmExpandList(featuresKnown, availableFeatures[lang]);
}
}
@@ -2216,7 +2214,7 @@ static const struct ShellPathNode : public cmGeneratorExpressionNode
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
std::vector<std::string> listIn;
- cmSystemTools::ExpandListArgument(parameters.front(), listIn);
+ cmExpandList(parameters.front(), listIn);
if (listIn.empty()) {
reportError(context, content->GetOriginalExpression(),
"\"\" is not an absolute path.");
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 03fc5ae..9412d82 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -241,10 +241,9 @@ EvaluatedTargetPropertyEntry EvaluateTargetPropertyEntry(
cmGeneratorTarget::TargetPropertyEntry* entry)
{
EvaluatedTargetPropertyEntry ee(entry->LinkImplItem, entry->GetBacktrace());
- cmSystemTools::ExpandListArgument(
- entry->Evaluate(thisTarget->GetLocalGenerator(), config, false, thisTarget,
- dagChecker, lang),
- ee.Values);
+ cmExpandList(entry->Evaluate(thisTarget->GetLocalGenerator(), config, false,
+ thisTarget, dagChecker, lang),
+ ee.Values);
if (entry->GetHadContextSensitiveCondition()) {
ee.ContextDependent = true;
}
@@ -723,10 +722,9 @@ void handleSystemIncludesDep(cmLocalGenerator* lg,
if (const char* dirs =
depTgt->GetProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES")) {
cmGeneratorExpression ge;
- cmSystemTools::ExpandListArgument(
- ge.Parse(dirs)->Evaluate(lg, config, false, headTarget, depTgt,
- dagChecker, language),
- result);
+ cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, false, headTarget,
+ depTgt, dagChecker, language),
+ result);
}
if (!depTgt->IsImported() || excludeImported) {
return;
@@ -735,10 +733,9 @@ void handleSystemIncludesDep(cmLocalGenerator* lg,
if (const char* dirs =
depTgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES")) {
cmGeneratorExpression ge;
- cmSystemTools::ExpandListArgument(
- ge.Parse(dirs)->Evaluate(lg, config, false, headTarget, depTgt,
- dagChecker, language),
- result);
+ cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, false, headTarget,
+ depTgt, dagChecker, language),
+ result);
}
}
}
@@ -1114,10 +1111,9 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(
std::vector<std::string> result;
for (std::string const& it : this->Target->GetSystemIncludeDirectories()) {
cmGeneratorExpression ge;
- cmSystemTools::ExpandListArgument(
- ge.Parse(it)->Evaluate(this->LocalGenerator, config, false, this,
- &dagChecker, language),
- result);
+ cmExpandList(ge.Parse(it)->Evaluate(this->LocalGenerator, config, false,
+ this, &dagChecker, language),
+ result);
}
std::vector<cmGeneratorTarget const*> const& deps =
@@ -1282,7 +1278,7 @@ void AddInterfaceEntries(cmGeneratorTarget const* headTarget,
cmGeneratorExpressionContext context(
headTarget->GetLocalGenerator(), config, false, headTarget,
headTarget, true, lib.Backtrace, lang);
- cmSystemTools::ExpandListArgument(
+ cmExpandList(
lib.Target->EvaluateInterfaceProperty(prop, &context, dagChecker),
ee.Values);
ee.ContextDependent = context.HadContextSensitiveCondition;
@@ -1311,10 +1307,9 @@ void AddObjectEntries(cmGeneratorTarget const* headTarget,
cge->SetEvaluateForBuildsystem(true);
EvaluatedTargetPropertyEntry ee(lib, lib.Backtrace);
- cmSystemTools::ExpandListArgument(
- cge->Evaluate(headTarget->GetLocalGenerator(), config, false,
- headTarget, dagChecker),
- ee.Values);
+ cmExpandList(cge->Evaluate(headTarget->GetLocalGenerator(), config,
+ false, headTarget, dagChecker),
+ ee.Values);
if (cge->GetHadContextSensitiveCondition()) {
ee.ContextDependent = true;
}
@@ -1407,7 +1402,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
cmStringRange sourceEntries = this->Target->GetSourceEntries();
for (std::string const& entry : sourceEntries) {
std::vector<std::string> items;
- cmSystemTools::ExpandListArgument(entry, items);
+ cmExpandList(entry, items);
for (std::string const& item : items) {
if (cmHasLiteralPrefix(item, "$<TARGET_OBJECTS:") &&
item.back() == '>') {
@@ -1423,7 +1418,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
const char* debugProp =
this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
if (debugProp) {
- cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+ cmExpandList(debugProp, debugProperties);
}
bool debugSources = !this->DebugSourcesDone &&
@@ -2526,7 +2521,7 @@ void cmGeneratorTarget::ComputeModuleDefinitionInfo(
info.WindowsExportAllSymbols =
this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS") &&
this->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS");
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
info.DefFileGenerated =
info.WindowsExportAllSymbols || info.Sources.size() > 1;
#else
@@ -2557,10 +2552,9 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string>& result,
cmGeneratorExpressionDAGChecker dagChecker(this, "AUTOUIC_OPTIONS", nullptr,
nullptr);
- cmSystemTools::ExpandListArgument(
- ge.Parse(prop)->Evaluate(this->LocalGenerator, config, false, this,
- &dagChecker),
- result);
+ cmExpandList(ge.Parse(prop)->Evaluate(this->LocalGenerator, config, false,
+ this, &dagChecker),
+ result);
}
void processILibs(const std::string& config,
@@ -2688,7 +2682,7 @@ void cmTargetTraceDependencies::Trace()
// Queue dependencies added explicitly by the user.
if (const char* additionalDeps = sf->GetProperty("OBJECT_DEPENDS")) {
std::vector<std::string> objDeps;
- cmSystemTools::ExpandListArgument(additionalDeps, objDeps);
+ cmExpandList(additionalDeps, objDeps);
for (std::string& objDep : objDeps) {
if (cmSystemTools::FileIsFullPath(objDep)) {
objDep = cmSystemTools::CollapseFullPath(objDep);
@@ -2909,7 +2903,7 @@ void cmGeneratorTarget::GetAppleArchs(const std::string& config,
archs = this->GetProperty("OSX_ARCHITECTURES");
}
if (archs) {
- cmSystemTools::ExpandListArgument(std::string(archs), archVec);
+ cmExpandList(std::string(archs), archVec);
}
}
@@ -3074,7 +3068,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
const char* debugProp =
this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
if (debugProp) {
- cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+ cmExpandList(debugProp, debugProperties);
}
bool debugIncludes = !this->DebugIncludesDone &&
@@ -3185,7 +3179,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileOptions(
const char* debugProp =
this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
if (debugProp) {
- cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+ cmExpandList(debugProp, debugProperties);
}
bool debugOptions = !this->DebugCompileOptionsDone &&
@@ -3232,7 +3226,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileFeatures(
const char* debugProp =
this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
if (debugProp) {
- cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+ cmExpandList(debugProp, debugProperties);
}
bool debugFeatures = !this->DebugCompileFeaturesDone &&
@@ -3281,7 +3275,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
const char* debugProp =
this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
if (debugProp) {
- cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+ cmExpandList(debugProp, debugProperties);
}
bool debugDefines = !this->DebugCompileDefinitionsDone &&
@@ -3356,7 +3350,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
const char* debugProp =
this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
if (debugProp) {
- cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+ cmExpandList(debugProp, debugProperties);
}
bool debugOptions = !this->DebugLinkOptionsDone &&
@@ -3382,7 +3376,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
const std::string wrapper(this->Makefile->GetSafeDefinition(
"CMAKE_" + language + "_LINKER_WRAPPER_FLAG"));
std::vector<std::string> wrapperFlag;
- cmSystemTools::ExpandListArgument(wrapper, wrapperFlag);
+ cmExpandList(wrapper, wrapperFlag);
const std::string wrapperSep(this->Makefile->GetSafeDefinition(
"CMAKE_" + language + "_LINKER_WRAPPER_FLAG_SEP"));
bool concatFlagAndArgs = true;
@@ -3504,7 +3498,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetStaticLibraryLinkOptions(
std::vector<EvaluatedTargetPropertyEntry> entries;
if (const char* linkOptions = this->GetProperty("STATIC_LIBRARY_OPTIONS")) {
std::vector<std::string> options;
- cmSystemTools::ExpandListArgument(linkOptions, options);
+ cmExpandList(linkOptions, options);
for (const auto& option : options) {
std::unique_ptr<TargetPropertyEntry> entry(
CreateTargetPropertyEntry(option));
@@ -3614,7 +3608,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDirectories(
const char* debugProp =
this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
if (debugProp) {
- cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+ cmExpandList(debugProp, debugProperties);
}
bool debugDirectories = !this->DebugLinkDirectoriesDone &&
@@ -3660,7 +3654,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDepends(
std::vector<EvaluatedTargetPropertyEntry> entries;
if (const char* linkDepends = this->GetProperty("LINK_DEPENDS")) {
std::vector<std::string> depends;
- cmSystemTools::ExpandListArgument(linkDepends, depends);
+ cmExpandList(linkDepends, depends);
for (const auto& depend : depends) {
std::unique_ptr<TargetPropertyEntry> entry(
CreateTargetPropertyEntry(depend));
@@ -4214,7 +4208,7 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const
// Process public headers to mark the source files.
if (const char* files = this->GetProperty("PUBLIC_HEADER")) {
std::vector<std::string> relFiles;
- cmSystemTools::ExpandListArgument(files, relFiles);
+ cmExpandList(files, relFiles);
for (std::string const& relFile : relFiles) {
if (cmSourceFile* sf = this->Makefile->GetSource(relFile)) {
SourceFileFlags& flags = this->SourceFlagsMap[sf];
@@ -4228,7 +4222,7 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const
// precedence if a file is listed in both.
if (const char* files = this->GetProperty("PRIVATE_HEADER")) {
std::vector<std::string> relFiles;
- cmSystemTools::ExpandListArgument(files, relFiles);
+ cmExpandList(files, relFiles);
for (std::string const& relFile : relFiles) {
if (cmSourceFile* sf = this->Makefile->GetSource(relFile)) {
SourceFileFlags& flags = this->SourceFlagsMap[sf];
@@ -4241,7 +4235,7 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const
// Mark sources listed as resources.
if (const char* files = this->GetProperty("RESOURCE")) {
std::vector<std::string> relFiles;
- cmSystemTools::ExpandListArgument(files, relFiles);
+ cmExpandList(files, relFiles);
for (std::string const& relFile : relFiles) {
if (cmSourceFile* sf = this->Makefile->GetSource(relFile)) {
SourceFileFlags& flags = this->SourceFlagsMap[sf];
@@ -4270,7 +4264,7 @@ cmGeneratorTarget::GetCompatibleInterfaces(std::string const& config) const
#define CM_READ_COMPATIBLE_INTERFACE(X, x) \
if (const char* prop = li->GetProperty("COMPATIBLE_INTERFACE_" #X)) { \
std::vector<std::string> props; \
- cmSystemTools::ExpandListArgument(prop, props); \
+ cmExpandList(prop, props); \
compat.Props##x.insert(props.begin(), props.end()); \
}
CM_READ_COMPATIBLE_INTERFACE(BOOL, Bool)
@@ -4384,7 +4378,7 @@ void checkPropertyConsistency(cmGeneratorTarget const* depender,
}
std::vector<std::string> props;
- cmSystemTools::ExpandListArgument(prop, props);
+ cmExpandList(prop, props);
std::string pdir = cmSystemTools::GetCMakeRoot();
pdir += "/Help/prop_tgt/";
@@ -5115,7 +5109,7 @@ void cmGeneratorTarget::ReportPropertyOrigin(
const char* debugProp = this->Target->GetMakefile()->GetDefinition(
"CMAKE_DEBUG_TARGET_PROPERTIES");
if (debugProp) {
- cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+ cmExpandList(debugProp, debugProperties);
}
bool debugOrigin = !this->DebugCompatiblePropertiesDone[p] &&
@@ -5167,10 +5161,9 @@ void cmGeneratorTarget::ExpandLinkItems(
}
std::vector<std::string> libs;
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
- cmSystemTools::ExpandListArgument(cge->Evaluate(this->LocalGenerator, config,
- false, headTarget, this,
- &dagChecker),
- libs);
+ cmExpandList(cge->Evaluate(this->LocalGenerator, config, false, headTarget,
+ this, &dagChecker),
+ libs);
this->LookupLinkItems(libs, cge->GetBacktrace(), items);
hadHeadSensitiveCondition = cge->GetHadHeadSensitiveCondition();
}
@@ -5747,12 +5740,12 @@ const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface(
if (!iface.AllDone) {
iface.AllDone = true;
iface.Multiplicity = info->Multiplicity;
- cmSystemTools::ExpandListArgument(info->Languages, iface.Languages);
+ cmExpandList(info->Languages, iface.Languages);
this->ExpandLinkItems(info->LibrariesProp, info->Libraries, config,
headTarget, usage_requirements_only, iface.Libraries,
iface.HadHeadSensitiveCondition);
std::vector<std::string> deps;
- cmSystemTools::ExpandListArgument(info->SharedDeps, deps);
+ cmExpandList(info->SharedDeps, deps);
this->LookupLinkItems(deps, cmListFileBacktrace(), iface.SharedDeps);
}
@@ -6041,7 +6034,7 @@ void cmGeneratorTarget::GetObjectLibrariesCMP0026(
cmStringRange rng = this->Target->GetSourceEntries();
for (std::string const& entry : rng) {
std::vector<std::string> files;
- cmSystemTools::ExpandListArgument(entry, files);
+ cmExpandList(entry, files);
for (std::string const& li : files) {
if (cmHasLiteralPrefix(li, "$<TARGET_OBJECTS:") && li.back() == '>') {
std::string objLibName = li.substr(17, li.size() - 18);
@@ -6255,7 +6248,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
std::unique_ptr<cmCompiledGeneratorExpression> const cge = ge.Parse(*le);
std::string const& evaluated =
cge->Evaluate(this->LocalGenerator, config, false, head, &dagChecker);
- cmSystemTools::ExpandListArgument(evaluated, llibs);
+ cmExpandList(evaluated, llibs);
if (cge->GetHadHeadSensitiveCondition()) {
impl.HadHeadSensitiveCondition = true;
}
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 00ebbb5..47c731b 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -469,7 +469,7 @@ void cmGhsMultiTargetGenerator::WriteSourceProperty(
const char* prop = sf->GetProperty(propName);
if (prop) {
std::vector<std::string> list;
- cmSystemTools::ExpandListArgument(prop, list);
+ cmExpandList(prop, list);
for (auto& p : list) {
fout << " " << propFlag << p << std::endl;
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 88da5eb..86fcae0 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -44,7 +44,7 @@
#include "cmWorkingDirectory.h"
#include "cmake.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmCryptoHash.h"
# include "cmQtAutoGenGlobalInitializer.h"
# include "cm_jsoncpp_value.h"
@@ -114,7 +114,7 @@ cmGlobalGenerator::~cmGlobalGenerator()
this->ClearGeneratorMembers();
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
Json::Value cmGlobalGenerator::GetJson() const
{
Json::Value generator = Json::objectValue;
@@ -1149,7 +1149,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l,
std::string("CMAKE_") + std::string(l) + std::string("_IGNORE_EXTENSIONS");
std::string ignoreExts = mf->GetSafeDefinition(ignoreExtensionsVar);
std::vector<std::string> extensionList;
- cmSystemTools::ExpandListArgument(ignoreExts, extensionList);
+ cmExpandList(ignoreExts, extensionList);
for (std::string const& i : extensionList) {
this->IgnoreExtensions[i] = true;
}
@@ -1162,7 +1162,7 @@ void cmGlobalGenerator::FillExtensionToLanguageMap(const std::string& l,
std::string("_SOURCE_FILE_EXTENSIONS");
const std::string& exts = mf->GetSafeDefinition(extensionsVar);
std::vector<std::string> extensionList;
- cmSystemTools::ExpandListArgument(exts, extensionList);
+ cmExpandList(exts, extensionList);
for (std::string const& i : extensionList) {
this->ExtensionToLanguage[i] = l;
}
@@ -1547,7 +1547,7 @@ bool cmGlobalGenerator::ComputeTargetDepends()
bool cmGlobalGenerator::QtAutoGen()
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmQtAutoGenGlobalInitializer initializer(this->LocalGenerators);
return initializer.generate();
#else
@@ -1622,8 +1622,7 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
std::string const& standardIncludesStr =
mf->GetSafeDefinition(standardIncludesVar);
std::vector<std::string> standardIncludesVec;
- cmSystemTools::ExpandListArgument(standardIncludesStr,
- standardIncludesVec);
+ cmExpandList(standardIncludesStr, standardIncludesVec);
standardIncludesSet.insert(standardIncludesVec.begin(),
standardIncludesVec.end());
}
@@ -1734,7 +1733,7 @@ void cmGlobalGenerator::CheckTargetProperties()
std::string incDirs = cmGeneratorExpression::Preprocess(
incDirProp, cmGeneratorExpression::StripAllGeneratorExpressions);
- cmSystemTools::ExpandListArgument(incDirs, incs);
+ cmExpandList(incDirs, incs);
for (std::string const& incDir : incs) {
if (incDir.size() > 9 && cmSystemTools::IsNOTFOUND(incDir.c_str())) {
@@ -2270,14 +2269,6 @@ bool cmGlobalGenerator::NameResolvesToFramework(
return false;
}
-inline std::string removeQuotes(const std::string& s)
-{
- if (s.front() == '\"' && s.back() == '\"') {
- return s.substr(1, s.size() - 2);
- }
- return s;
-}
-
bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName,
std::string const& reason) const
{
@@ -2829,7 +2820,7 @@ std::set<std::string> const& cmGlobalGenerator::GetDirectoryContent(
void cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs,
std::string const& content)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
// Ignore if there are no outputs.
if (outputs.empty()) {
return;
@@ -2859,7 +2850,7 @@ void cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs,
void cmGlobalGenerator::CheckRuleHashes()
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
std::string home = this->GetCMakeInstance()->GetHomeOutputDirectory();
std::string pfile = home;
pfile += "/CMakeFiles";
@@ -2963,7 +2954,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
file += "/Labels.txt";
std::string json_file = dir + "/Labels.json";
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
// Check whether labels are enabled for this target.
const char* targetLabels = target->GetProperty("LABELS");
const char* directoryLabels =
@@ -2985,7 +2976,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
// List the target-wide labels. All sources in the target get
// these labels.
if (targetLabels) {
- cmSystemTools::ExpandListArgument(targetLabels, labels);
+ cmExpandList(targetLabels, labels);
if (!labels.empty()) {
fout << "# Target labels\n";
for (std::string const& l : labels) {
@@ -3000,12 +2991,11 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
std::vector<std::string> cmakeDirectoryLabelsList;
if (directoryLabels) {
- cmSystemTools::ExpandListArgument(directoryLabels, directoryLabelsList);
+ cmExpandList(directoryLabels, directoryLabelsList);
}
if (cmakeDirectoryLabels) {
- cmSystemTools::ExpandListArgument(cmakeDirectoryLabels,
- cmakeDirectoryLabelsList);
+ cmExpandList(cmakeDirectoryLabels, cmakeDirectoryLabelsList);
}
if (!directoryLabelsList.empty() || !cmakeDirectoryLabelsList.empty()) {
@@ -3042,7 +3032,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
if (const char* svalue = sf->GetProperty("LABELS")) {
labels.clear();
Json::Value& lj_source_labels = lj_source["labels"] = Json::arrayValue;
- cmSystemTools::ExpandListArgument(svalue, labels);
+ cmExpandList(svalue, labels);
for (std::string const& label : labels) {
fout << " " << label << "\n";
lj_source_labels.append(label);
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index ea40ebc..830974d 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -25,7 +25,7 @@
#include "cmTargetDepend.h"
#include "cm_codecvt.hxx"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmFileLockPool.h"
# include "cm_jsoncpp_value.h"
#endif
@@ -109,7 +109,7 @@ public:
return codecvt::None;
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
/** Get a JSON object describing the generator. */
virtual Json::Value GetJson() const;
#endif
@@ -462,7 +462,7 @@ public:
const std::set<const cmGeneratorTarget*>& GetFilenameTargetDepends(
cmSourceFile* sf) const;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
cmFileLockPool& GetFileLockPool() { return FileLockPool; }
#endif
@@ -665,7 +665,7 @@ private:
mutable std::map<cmSourceFile*, std::set<cmGeneratorTarget const*>>
FilenameTargetDepends;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
// Pool of file locks
cmFileLockPool FileLockPool;
#endif
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 9f3dab7..4db829f 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -625,7 +625,7 @@ void cmGlobalGhsMultiGenerator::WriteMacros(std::ostream& fout,
this->GetCMakeInstance()->GetCacheDefinition("GHS_GPJ_MACROS");
if (nullptr != ghsGpjMacros) {
std::vector<std::string> expandedList;
- cmSystemTools::ExpandListArgument(std::string(ghsGpjMacros), expandedList);
+ cmExpandList(std::string(ghsGpjMacros), expandedList);
for (std::string const& arg : expandedList) {
fout << "macro " << arg << std::endl;
}
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index addb0c7..29caa16 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -560,7 +560,7 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures()
if (pos != std::string::npos) {
const char* fv = &this->NinjaVersion[pos + k_DYNDEP_.size()];
unsigned long dyndep = 0;
- cmSystemTools::StringToULong(fv, &dyndep);
+ cmStrToULong(fv, &dyndep);
if (dyndep == 1) {
this->NinjaSupportsDyndeps = true;
}
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 8e67fad..e0d86ca 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -201,7 +201,7 @@ void cmGlobalVisualStudio71Generator::WriteProjectConfigurations(
if (target.GetProperty("EXTERNAL_MSPROJECT")) {
if (const char* m = target.GetProperty("MAP_IMPORTED_CONFIG_" +
cmSystemTools::UpperCase(i))) {
- cmSystemTools::ExpandListArgument(m, mapConfig);
+ cmExpandList(m, mapConfig);
if (!mapConfig.empty()) {
dstConfig = mapConfig[0].c_str();
}
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index ca80d3b..45b66ae 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -256,7 +256,7 @@ cmLocalGenerator* cmGlobalVisualStudio7Generator::CreateLocalGenerator(
return lg;
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
Json::Value cmGlobalVisualStudio7Generator::GetJson() const
{
Json::Value generator = this->cmGlobalVisualStudioGenerator::GetJson();
@@ -512,8 +512,7 @@ void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections(
}
fout << "\tGlobalSection(" << name << ") = " << sectionType << "\n";
std::vector<std::string> keyValuePairs;
- cmSystemTools::ExpandListArgument(root->GetMakefile()->GetProperty(it),
- keyValuePairs);
+ cmExpandList(root->GetMakefile()->GetProperty(it), keyValuePairs);
for (std::string const& itPair : keyValuePairs) {
const std::string::size_type posEqual = itPair.find('=');
if (posEqual != std::string::npos) {
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index f004afb..9b84732 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -23,7 +23,7 @@ public:
//! Create a local generator appropriate to this Global Generator
cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
Json::Value GetJson() const override;
#endif
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index cc6e421..275be96 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -250,7 +250,7 @@ void cmGlobalVisualStudio8Generator::WriteProjectConfigurations(
if (target.GetProperty("EXTERNAL_MSPROJECT")) {
if (const char* m = target.GetProperty("MAP_IMPORTED_CONFIG_" +
cmSystemTools::UpperCase(i))) {
- cmSystemTools::ExpandListArgument(m, mapConfig);
+ cmExpandList(m, mapConfig);
if (!mapConfig.empty()) {
dstConfig = mapConfig[0].c_str();
}
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 029b976..19e64e4 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -38,12 +38,12 @@
struct cmLinkImplementation;
-#if defined(CMAKE_BUILD_WITH_CMAKE) && defined(__APPLE__)
+#if !defined(CMAKE_BOOTSTRAP) && defined(__APPLE__)
# define HAVE_APPLICATION_SERVICES
# include <ApplicationServices/ApplicationServices.h>
#endif
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmXMLParser.h"
// parse the xml file storing the installed version of Xcode on
@@ -188,7 +188,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(
if (name != GetActualName()) {
return nullptr;
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
cmXcodeVersionParser parser;
std::string versionFile;
{
@@ -882,7 +882,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
if (extraFileAttributes) {
// Expand the list of attributes.
std::vector<std::string> attributes;
- cmSystemTools::ExpandListArgument(extraFileAttributes, attributes);
+ cmExpandList(extraFileAttributes, attributes);
// Store the attributes.
for (const auto& attribute : attributes) {
@@ -2482,10 +2482,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget(
std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
cmGeneratorTarget* gtgt)
{
- std::vector<std::string> const configVector =
- cmSystemTools::ExpandedListArgument(
- this->CurrentMakefile->GetRequiredDefinition(
- "CMAKE_CONFIGURATION_TYPES"));
+ std::vector<std::string> const configVector = cmExpandedList(
+ this->CurrentMakefile->GetRequiredDefinition("CMAKE_CONFIGURATION_TYPES"));
cmXCodeObject* configlist =
this->CreateObject(cmXCodeObject::XCConfigurationList);
cmXCodeObject* buildConfigurations =
@@ -3223,8 +3221,7 @@ void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf)
const char* osxArch = mf->GetDefinition("CMAKE_OSX_ARCHITECTURES");
const char* sysroot = mf->GetDefinition("CMAKE_OSX_SYSROOT");
if (osxArch && sysroot) {
- cmSystemTools::ExpandListArgument(std::string(osxArch),
- this->Architectures);
+ cmExpandList(std::string(osxArch), this->Architectures);
}
if (this->Architectures.empty()) {
@@ -3627,7 +3624,7 @@ void cmGlobalXCodeGenerator::AppendDefines(BuildObjectListOrString& defs,
// Expand the list of definitions.
std::vector<std::string> defines;
- cmSystemTools::ExpandListArgument(defines_list, defines);
+ cmExpandList(defines_list, defines);
// Store the definitions in the string.
this->AppendDefines(defs, defines, dflag);
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 9befb78..7d0ef83 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -15,6 +15,7 @@
#include "cmMakefile.h"
#include "cmState.h"
#include "cmStateSnapshot.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmake.h"
@@ -234,8 +235,7 @@ void cmGraphVizWriter::ReadSettings(
this->TargetsToIgnoreRegex.clear();
if (!ignoreTargetsRegexes.empty()) {
std::vector<std::string> ignoreTargetsRegExVector;
- cmSystemTools::ExpandListArgument(ignoreTargetsRegexes,
- ignoreTargetsRegExVector);
+ cmExpandList(ignoreTargetsRegexes, ignoreTargetsRegExVector);
for (std::string const& currentRegexString : ignoreTargetsRegExVector) {
cmsys::RegularExpression currentRegex;
if (!currentRegex.compile(currentRegexString)) {
diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx
index 7b992d7..e80aa8e 100644
--- a/Source/cmIDEOptions.cxx
+++ b/Source/cmIDEOptions.cxx
@@ -8,7 +8,7 @@
#include "cmAlgorithms.h"
#include "cmIDEFlagTable.h"
-#include "cmSystemTools.h"
+#include "cmStringAlgorithms.h"
cmIDEOptions::cmIDEOptions()
{
@@ -166,7 +166,7 @@ void cmIDEOptions::AddDefines(std::string const& defines)
{
if (!defines.empty()) {
// Expand the list of definitions.
- cmSystemTools::ExpandListArgument(defines, this->Defines);
+ cmExpandList(defines, this->Defines);
}
}
void cmIDEOptions::AddDefines(const std::vector<std::string>& defines)
@@ -188,7 +188,7 @@ void cmIDEOptions::AddIncludes(std::string const& includes)
{
if (!includes.empty()) {
// Expand the list of includes.
- cmSystemTools::ExpandListArgument(includes, this->Includes);
+ cmExpandList(includes, this->Includes);
}
}
void cmIDEOptions::AddIncludes(const std::vector<std::string>& includes)
diff --git a/Source/cmIncludeGuardCommand.cxx b/Source/cmIncludeGuardCommand.cxx
index 3b126b0..e560910 100644
--- a/Source/cmIncludeGuardCommand.cxx
+++ b/Source/cmIncludeGuardCommand.cxx
@@ -21,7 +21,7 @@ enum IncludeGuardScope
std::string GetIncludeGuardVariableName(std::string const& filePath)
{
std::string result = "__INCGUARD_";
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
result += cmSystemTools::ComputeStringMD5(filePath);
#else
result += cmSystemTools::MakeCidentifier(filePath);
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 5349a9d..51689a2 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -673,7 +673,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
const char* files = target.GetProperty("PRIVATE_HEADER");
if ((files) && (*files)) {
std::vector<std::string> relFiles;
- cmSystemTools::ExpandListArgument(files, relFiles);
+ cmExpandList(files, relFiles);
std::vector<std::string> absFiles;
if (!this->MakeFilesFullPath("PRIVATE_HEADER", relFiles, absFiles)) {
return false;
@@ -688,7 +688,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
files = target.GetProperty("PUBLIC_HEADER");
if ((files) && (*files)) {
std::vector<std::string> relFiles;
- cmSystemTools::ExpandListArgument(files, relFiles);
+ cmExpandList(files, relFiles);
std::vector<std::string> absFiles;
if (!this->MakeFilesFullPath("PUBLIC_HEADER", relFiles, absFiles)) {
return false;
@@ -703,7 +703,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
files = target.GetProperty("RESOURCE");
if ((files) && (*files)) {
std::vector<std::string> relFiles;
- cmSystemTools::ExpandListArgument(files, relFiles);
+ cmExpandList(files, relFiles);
std::vector<std::string> absFiles;
if (!this->MakeFilesFullPath("RESOURCE", relFiles, absFiles)) {
return false;
@@ -1268,7 +1268,7 @@ bool cmInstallCommand::HandleDirectoryMode(
bool cmInstallCommand::HandleExportAndroidMKMode(
std::vector<std::string> const& args)
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
// This is the EXPORT mode.
cmInstallCommandArguments ica(this->DefaultComponentName);
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
index 9357a5c..1d8210c 100644
--- a/Source/cmInstallDirectoryGenerator.cxx
+++ b/Source/cmInstallDirectoryGenerator.cxx
@@ -67,8 +67,7 @@ void cmInstallDirectoryGenerator::GenerateScriptForConfig(
cmGeneratorExpression ge;
for (std::string const& d : this->Directories) {
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(d);
- cmSystemTools::ExpandListArgument(
- cge->Evaluate(this->LocalGenerator, config), dirs);
+ cmExpandList(cge->Evaluate(this->LocalGenerator, config), dirs);
}
// Make sure all dirs have absolute paths.
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index f5bedab..af06b9d 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -7,7 +7,7 @@
#include <sstream>
#include <utility>
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
# include "cmExportInstallAndroidMKGenerator.h"
#endif
#include "cmExportInstallFileGenerator.h"
@@ -31,7 +31,7 @@ cmInstallExportGenerator::cmInstallExportGenerator(
, LocalGenerator(nullptr)
{
if (android) {
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
this->EFGen = new cmExportInstallAndroidMKGenerator(this);
#endif
} else {
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index e8e82cc..c4048d4 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -4,7 +4,7 @@
#include "cmGeneratorExpression.h"
#include "cmInstallType.h"
-#include "cmSystemTools.h"
+#include "cmStringAlgorithms.h"
#include <memory>
@@ -85,8 +85,7 @@ void cmInstallFilesGenerator::GenerateScriptForConfig(
cmGeneratorExpression ge;
for (std::string const& f : this->Files) {
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(f);
- cmSystemTools::ExpandListArgument(
- cge->Evaluate(this->LocalGenerator, config), files);
+ cmExpandList(cge->Evaluate(this->LocalGenerator, config), files);
}
this->AddFilesInstallRule(os, config, indent, files);
}
diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx
index 537b4ec..9b481a2 100644
--- a/Source/cmInstalledFile.cxx
+++ b/Source/cmInstalledFile.cxx
@@ -5,6 +5,7 @@
#include "cmAlgorithms.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include <utility>
@@ -107,5 +108,5 @@ void cmInstalledFile::GetPropertyAsList(const std::string& prop,
this->GetProperty(prop, value);
list.clear();
- cmSystemTools::ExpandListArgument(value, list);
+ cmExpandList(value, list);
}
diff --git a/Source/cmLDConfigLDConfigTool.cxx b/Source/cmLDConfigLDConfigTool.cxx
index 586ea96..d5cc621 100644
--- a/Source/cmLDConfigLDConfigTool.cxx
+++ b/Source/cmLDConfigLDConfigTool.cxx
@@ -4,6 +4,7 @@
#include "cmLDConfigLDConfigTool.h"
#include "cmMakefile.h"
#include "cmRuntimeDependencyArchive.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmUVProcessChain.h"
@@ -33,7 +34,7 @@ bool cmLDConfigLDConfigTool::GetLDConfigPaths(std::vector<std::string>& paths)
}
std::vector<std::string> ldConfigCommand;
- cmSystemTools::ExpandListArgument(ldConfigPath, ldConfigCommand);
+ cmExpandList(ldConfigPath, ldConfigCommand);
ldConfigCommand.emplace_back("-v");
ldConfigCommand.emplace_back("-N"); // Don't rebuild the cache.
ldConfigCommand.emplace_back("-X"); // Don't update links.
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx
index 656907a..7cacb24 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -13,6 +13,7 @@
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
+#include "cmMakefile.h"
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
@@ -156,6 +157,10 @@ bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg,
return false;
}
+ if (!lg.GetMakefile()->IsOn("CMAKE_CUDA_COMPILER_HAS_DEVICE_LINK_PHASE")) {
+ return false;
+ }
+
if (const char* resolveDeviceSymbols =
target.GetProperty("CUDA_RESOLVE_DEVICE_SYMBOLS")) {
// If CUDA_RESOLVE_DEVICE_SYMBOLS has been explicitly set we need
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 868f564..cbb1d3a 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -119,7 +119,7 @@ bool cmListCommand::GetList(std::vector<std::string>& list,
return true;
}
// expand the variable into a list
- cmSystemTools::ExpandListArgument(listString, list, true);
+ cmExpandList(listString, list, true);
// if no empty elements then just return
if (std::find(list.begin(), list.end(), std::string()) == list.end()) {
return true;
@@ -132,7 +132,7 @@ bool cmListCommand::GetList(std::vector<std::string>& list,
// ExpandListArgument without the true which will remove
// empty values
list.clear();
- cmSystemTools::ExpandListArgument(listString, list);
+ cmExpandList(listString, list);
std::string warn = cmPolicies::GetPolicyWarning(cmPolicies::CMP0007);
warn += " List has value = [";
warn += listString;
@@ -145,7 +145,7 @@ bool cmListCommand::GetList(std::vector<std::string>& list,
// ExpandListArgument without the true which will remove
// empty values
list.clear();
- cmSystemTools::ExpandListArgument(listString, list);
+ cmExpandList(listString, list);
return true;
case cmPolicies::NEW:
return true;
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index df0d00c..7ef475a 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -7,6 +7,7 @@
#include "cmMessenger.h"
#include "cmState.h"
#include "cmStateDirectory.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include <assert.h>
@@ -483,7 +484,7 @@ std::vector<BT<std::string>> ExpandListWithBacktrace(
{
std::vector<BT<std::string>> result;
std::vector<std::string> tmp;
- cmSystemTools::ExpandListArgument(list, tmp);
+ cmExpandList(list, tmp);
result.reserve(tmp.size());
for (std::string& i : tmp) {
result.emplace_back(std::move(i), bt);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 3deaeb0..c3cfc5f 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -29,7 +29,7 @@
#include "cmake.h"
#include "cmsys/RegularExpression.hxx"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# define CM_LG_ENCODE_OBJECT_NAMES
# include "cmCryptoHash.h"
#endif
@@ -311,7 +311,7 @@ void cmLocalGenerator::GenerateTestFiles()
this->Makefile->GetProperty("TEST_INCLUDE_FILES");
if (testIncludeFiles) {
std::vector<std::string> includesList;
- cmSystemTools::ExpandListArgument(testIncludeFiles, includesList);
+ cmExpandList(testIncludeFiles, includesList);
for (std::string const& i : includesList) {
fout << "include(\"" << i << "\")" << std::endl;
}
@@ -745,12 +745,10 @@ std::string cmLocalGenerator::GetIncludeFlags(
OutputFormat shellFormat = forResponseFile ? RESPONSE : SHELL;
std::ostringstream includeFlags;
- std::string flagVar = "CMAKE_INCLUDE_FLAG_";
- flagVar += lang;
- std::string const& includeFlag = this->Makefile->GetSafeDefinition(flagVar);
- flagVar = "CMAKE_INCLUDE_FLAG_SEP_";
- flagVar += lang;
- const char* sep = this->Makefile->GetDefinition(flagVar);
+ std::string const& includeFlag =
+ this->Makefile->GetSafeDefinition(cmStrCat("CMAKE_INCLUDE_FLAG_", lang));
+ const char* sep =
+ this->Makefile->GetDefinition(cmStrCat("CMAKE_INCLUDE_FLAG_SEP_", lang));
bool quotePaths = false;
if (this->Makefile->GetDefinition("CMAKE_QUOTE_INCLUDE_PATHS")) {
quotePaths = true;
@@ -767,23 +765,16 @@ std::string cmLocalGenerator::GetIncludeFlags(
// Support special system include flag if it is available and the
// normal flag is repeated for each directory.
- std::string sysFlagVar = "CMAKE_INCLUDE_SYSTEM_FLAG_";
- sysFlagVar += lang;
const char* sysIncludeFlag = nullptr;
if (repeatFlag) {
- sysIncludeFlag = this->Makefile->GetDefinition(sysFlagVar);
+ sysIncludeFlag = this->Makefile->GetDefinition(
+ cmStrCat("CMAKE_INCLUDE_SYSTEM_FLAG_", lang));
}
- std::string fwSearchFlagVar = "CMAKE_";
- fwSearchFlagVar += lang;
- fwSearchFlagVar += "_FRAMEWORK_SEARCH_FLAG";
- const char* fwSearchFlag = this->Makefile->GetDefinition(fwSearchFlagVar);
-
- std::string sysFwSearchFlagVar = "CMAKE_";
- sysFwSearchFlagVar += lang;
- sysFwSearchFlagVar += "_SYSTEM_FRAMEWORK_SEARCH_FLAG";
- const char* sysFwSearchFlag =
- this->Makefile->GetDefinition(sysFwSearchFlagVar);
+ const char* fwSearchFlag = this->Makefile->GetDefinition(
+ cmStrCat("CMAKE_", lang, "_FRAMEWORK_SEARCH_FLAG"));
+ const char* sysFwSearchFlag = this->Makefile->GetDefinition(
+ cmStrCat("CMAKE_", lang, "_SYSTEM_FRAMEWORK_SEARCH_FLAG"));
bool flagUsed = false;
std::set<std::string> emitted;
@@ -793,9 +784,8 @@ std::string cmLocalGenerator::GetIncludeFlags(
for (std::string const& i : includes) {
if (fwSearchFlag && *fwSearchFlag && this->Makefile->IsOn("APPLE") &&
cmSystemTools::IsPathToFramework(i)) {
- std::string frameworkDir = i;
- frameworkDir += "/../";
- frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir);
+ std::string const frameworkDir =
+ cmSystemTools::CollapseFullPath(cmStrCat(i, "/../"));
if (emitted.insert(frameworkDir).second) {
if (sysFwSearchFlag && target &&
target->IsSystemIncludeDirectory(i, config, lang)) {
@@ -912,7 +902,7 @@ void cmLocalGenerator::AddCompileOptions(std::string& flags,
std::string isJMCEnabled = cge->Evaluate(this, config);
if (cmSystemTools::IsOn(isJMCEnabled)) {
std::vector<std::string> optVec;
- cmSystemTools::ExpandListArgument(jmc, optVec);
+ cmExpandList(jmc, optVec);
this->AppendCompileOptions(flags, optVec);
}
}
@@ -963,11 +953,9 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
// These are intended to simulate additional implicit include directories.
std::vector<std::string> userStandardDirs;
{
- std::string key = "CMAKE_";
- key += lang;
- key += "_STANDARD_INCLUDE_DIRECTORIES";
- std::string const value = this->Makefile->GetSafeDefinition(key);
- cmSystemTools::ExpandListArgument(value, userStandardDirs);
+ std::string const value = this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", lang, "_STANDARD_INCLUDE_DIRECTORIES"));
+ cmExpandList(value, userStandardDirs);
for (std::string& usd : userStandardDirs) {
cmSystemTools::ConvertToUnixSlashes(usd);
}
@@ -989,12 +977,11 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
// * Compilers like gfortran do not search their own implicit include
// directories for modules ('.mod' files).
if (lang != "Fortran") {
- std::string key = "CMAKE_";
- key += lang;
- key += "_IMPLICIT_INCLUDE_DIRECTORIES";
- if (const char* value = this->Makefile->GetDefinition(key)) {
+ const char* value = this->Makefile->GetDefinition(
+ cmStrCat("CMAKE_", lang, "_IMPLICIT_INCLUDE_DIRECTORIES"));
+ if (value != nullptr) {
size_t const impDirVecOldSize = impDirVec.size();
- cmSystemTools::ExpandListArgument(value, impDirVec);
+ cmExpandList(value, impDirVec);
// FIXME: Use cmRange with 'advance()' when it supports non-const.
for (size_t i = impDirVecOldSize; i < impDirVec.size(); ++i) {
cmSystemTools::ConvertToUnixSlashes(impDirVec[i]);
@@ -1210,9 +1197,8 @@ void cmLocalGenerator::GetTargetFlags(
linkFlags += " ";
}
if (!buildType.empty()) {
- std::string configLinkFlags = "LINK_FLAGS_";
- configLinkFlags += buildType;
- targetLinkFlags = target->GetProperty(configLinkFlags);
+ targetLinkFlags =
+ target->GetProperty(cmStrCat("LINK_FLAGS_", buildType));
if (targetLinkFlags) {
linkFlags += targetLinkFlags;
linkFlags += " ";
@@ -1234,9 +1220,8 @@ void cmLocalGenerator::GetTargetFlags(
this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
linkFlags += " ";
if (!buildType.empty()) {
- std::string build = "CMAKE_EXE_LINKER_FLAGS_";
- build += buildType;
- linkFlags += this->Makefile->GetSafeDefinition(build);
+ linkFlags += this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_EXE_LINKER_FLAGS_", buildType));
linkFlags += " ";
}
if (linkLanguage.empty()) {
@@ -1257,11 +1242,8 @@ void cmLocalGenerator::GetTargetFlags(
}
if (target->IsExecutableWithExports()) {
- std::string exportFlagVar = "CMAKE_EXE_EXPORTS_";
- exportFlagVar += linkLanguage;
- exportFlagVar += "_FLAG";
-
- linkFlags += this->Makefile->GetSafeDefinition(exportFlagVar);
+ linkFlags += this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_EXE_EXPORTS_", linkLanguage, "_FLAG"));
linkFlags += " ";
}
}
@@ -1293,9 +1275,8 @@ void cmLocalGenerator::GetTargetFlags(
linkFlags += " ";
}
if (!buildType.empty()) {
- std::string configLinkFlags = "LINK_FLAGS_";
- configLinkFlags += buildType;
- targetLinkFlags = target->GetProperty(configLinkFlags);
+ targetLinkFlags =
+ target->GetProperty(cmStrCat("LINK_FLAGS_", buildType));
if (targetLinkFlags) {
linkFlags += targetLinkFlags;
linkFlags += " ";
@@ -1470,20 +1451,12 @@ void cmLocalGenerator::OutputLinkLibraries(
}
// Add standard libraries for this language.
- std::string standardLibsVar = "CMAKE_";
- standardLibsVar += cli.GetLinkLanguage();
- standardLibsVar += "_STANDARD_LIBRARIES";
- std::string stdLibString;
- if (const char* stdLibs = this->Makefile->GetDefinition(standardLibsVar)) {
- stdLibString = stdLibs;
- }
+ std::string stdLibString = this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", cli.GetLinkLanguage(), "_STANDARD_LIBRARIES"));
// Append the framework search path flags.
- std::string fwSearchFlagVar = "CMAKE_";
- fwSearchFlagVar += linkLanguage;
- fwSearchFlagVar += "_FRAMEWORK_SEARCH_FLAG";
- std::string fwSearchFlag =
- this->Makefile->GetSafeDefinition(fwSearchFlagVar);
+ std::string fwSearchFlag = this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", linkLanguage, "_FRAMEWORK_SEARCH_FLAG"));
frameworkPath = linkLineComputer->ComputeFrameworkPath(cli, fwSearchFlag);
linkPath =
@@ -1538,10 +1511,8 @@ std::string cmLocalGenerator::GetLinkLibsCMP0065(
}
if (add_shlib_flags) {
- std::string linkFlagsVar = "CMAKE_SHARED_LIBRARY_LINK_";
- linkFlagsVar += linkLanguage;
- linkFlagsVar += "_FLAGS";
- linkFlags = this->Makefile->GetSafeDefinition(linkFlagsVar);
+ linkFlags = this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_SHARED_LIBRARY_LINK_", linkLanguage, "_FLAGS"));
}
}
return linkFlags;
@@ -1599,10 +1570,8 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
const std::string& config)
{
// Add language-specific flags.
- std::string flagsVar = "CMAKE_";
- flagsVar += lang;
- flagsVar += "_FLAGS";
- this->AddConfigVariableFlags(flags, flagsVar, config);
+ this->AddConfigVariableFlags(flags, cmStrCat("CMAKE_", lang, "_FLAGS"),
+ config);
// Add MSVC runtime library flags. This is activated by the presence
// of a default selection whether or not it is overridden by a property.
@@ -1773,10 +1742,9 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags,
// Add flags for dealing with shared libraries for this language.
if (shared) {
- flagsVar = "CMAKE_SHARED_LIBRARY_";
- flagsVar += lang;
- flagsVar += "_FLAGS";
- this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar));
+ this->AppendFlags(flags,
+ this->Makefile->GetDefinition(
+ cmStrCat("CMAKE_SHARED_LIBRARY_", lang, "_FLAGS")));
}
}
@@ -1810,7 +1778,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
if (const char* opt =
target->Target->GetMakefile()->GetDefinition(option_flag)) {
std::vector<std::string> optVec;
- cmSystemTools::ExpandListArgument(opt, optVec);
+ cmExpandList(opt, optVec);
for (std::string const& i : optVec) {
this->AppendFlagEscape(flags, i);
}
@@ -1839,7 +1807,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
this->IssueMessage(MessageType::FATAL_ERROR, e.str());
} else {
std::vector<std::string> optVec;
- cmSystemTools::ExpandListArgument(opt, optVec);
+ cmExpandList(opt, optVec);
for (std::string const& i : optVec) {
this->AppendFlagEscape(flags, i);
}
@@ -1900,7 +1868,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
std::string const& opt =
target->Target->GetMakefile()->GetRequiredDefinition(option_flag);
std::vector<std::string> optVec;
- cmSystemTools::ExpandListArgument(opt, optVec);
+ cmExpandList(opt, optVec);
for (std::string const& i : optVec) {
this->AppendFlagEscape(flags, i);
}
@@ -1917,7 +1885,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
if (const char* opt =
target->Target->GetMakefile()->GetDefinition(option_flag)) {
std::vector<std::string> optVec;
- cmSystemTools::ExpandListArgument(opt, optVec);
+ cmExpandList(opt, optVec);
for (std::string const& i : optVec) {
this->AppendFlagEscape(flags, i);
}
@@ -2065,9 +2033,7 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared,
std::string originalFlags =
this->GlobalGenerator->GetSharedLibFlagsForLanguage(lang);
if (shared) {
- std::string flagsVar = "CMAKE_SHARED_LIBRARY_";
- flagsVar += lang;
- flagsVar += "_FLAGS";
+ std::string flagsVar = cmStrCat("CMAKE_SHARED_LIBRARY_", lang, "_FLAGS");
std::string const& flags = this->Makefile->GetSafeDefinition(flagsVar);
if (flags != originalFlags) {
@@ -2106,20 +2072,16 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags,
std::string picFlags;
if (targetType == cmStateEnums::EXECUTABLE) {
- std::string flagsVar = "CMAKE_";
- flagsVar += lang;
- flagsVar += "_COMPILE_OPTIONS_PIE";
- picFlags = this->Makefile->GetSafeDefinition(flagsVar);
+ picFlags = this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_PIE"));
}
if (picFlags.empty()) {
- std::string flagsVar = "CMAKE_";
- flagsVar += lang;
- flagsVar += "_COMPILE_OPTIONS_PIC";
- picFlags = this->Makefile->GetSafeDefinition(flagsVar);
+ picFlags = this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_PIC"));
}
if (!picFlags.empty()) {
std::vector<std::string> options;
- cmSystemTools::ExpandListArgument(picFlags, options);
+ cmExpandList(picFlags, options);
for (std::string const& o : options) {
this->AppendFlagEscape(flags, o);
}
@@ -2191,7 +2153,7 @@ void cmLocalGenerator::AppendIPOLinkerFlags(std::string& flags,
}
std::vector<std::string> flagsList;
- cmSystemTools::ExpandListArgument(rawFlagsList, flagsList);
+ cmExpandList(rawFlagsList, flagsList);
for (std::string const& o : flagsList) {
this->AppendFlagEscape(flags, o);
}
@@ -2227,7 +2189,7 @@ void cmLocalGenerator::AppendPositionIndependentLinkerFlags(
}
std::vector<std::string> flagsList;
- cmSystemTools::ExpandListArgument(pieFlags, flagsList);
+ cmExpandList(pieFlags, flagsList);
for (const auto& flag : flagsList) {
this->AppendFlagEscape(flags, flag);
}
@@ -2244,7 +2206,7 @@ void cmLocalGenerator::AppendCompileOptions(std::string& options,
// Expand the list of options.
std::vector<std::string> options_vec;
- cmSystemTools::ExpandListArgument(options_list, options_vec);
+ cmExpandList(options_list, options_vec);
this->AppendCompileOptions(options, options_vec, regex);
}
@@ -2279,7 +2241,7 @@ void cmLocalGenerator::AppendIncludeDirectories(
// Expand the list of includes.
std::vector<std::string> includes_vec;
- cmSystemTools::ExpandListArgument(includes_list, includes_vec);
+ cmExpandList(includes_list, includes_vec);
this->AppendIncludeDirectories(includes, includes_vec, sourceFile);
}
@@ -2356,10 +2318,8 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
// Lookup the define flag for the current language.
std::string dflag = "-D";
if (!lang.empty()) {
- std::string defineFlagVar = "CMAKE_";
- defineFlagVar += lang;
- defineFlagVar += "_DEFINE_FLAG";
- const char* df = this->Makefile->GetDefinition(defineFlagVar);
+ const char* df =
+ this->Makefile->GetDefinition(cmStrCat("CMAKE_", lang, "_DEFINE_FLAG"));
if (df && *df) {
dflag = df;
}
@@ -2405,13 +2365,11 @@ void cmLocalGenerator::AppendFeatureOptions(std::string& flags,
const std::string& lang,
const char* feature)
{
- std::string optVar = "CMAKE_";
- optVar += lang;
- optVar += "_COMPILE_OPTIONS_";
- optVar += feature;
- if (const char* optionList = this->Makefile->GetDefinition(optVar)) {
+ const char* optionList = this->Makefile->GetDefinition(
+ cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_", feature));
+ if (optionList != nullptr) {
std::vector<std::string> options;
- cmSystemTools::ExpandListArgument(optionList, options);
+ cmExpandList(optionList, options);
for (std::string const& o : options) {
this->AppendFlagEscape(flags, o);
}
@@ -2762,10 +2720,8 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
if (!replaceExt) {
std::string lang = source.GetLanguage();
if (!lang.empty()) {
- std::string repVar = "CMAKE_";
- repVar += lang;
- repVar += "_OUTPUT_EXTENSION_REPLACE";
- replaceExt = this->Makefile->IsOn(repVar);
+ replaceExt = this->Makefile->IsOn(
+ cmStrCat("CMAKE_", lang, "_OUTPUT_EXTENSION_REPLACE"));
}
}
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index f0c6806..455e491 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -461,7 +461,7 @@ private:
void ComputeObjectMaxPath();
};
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
bool cmLocalGeneratorCheckObjectName(std::string& objName,
std::string::size_type dir_len,
std::string::size_type max_total_len);
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 248f4a6..ec35551 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -25,6 +25,7 @@
#include "cmSourceFile.h"
#include "cmState.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
#include "cmsys/FStream.hxx"
@@ -222,7 +223,7 @@ void cmLocalNinjaGenerator::WritePools(std::ostream& os)
cmGlobalNinjaGenerator::WriteComment(
os, "Pools defined by global property JOB_POOLS");
std::vector<std::string> pools;
- cmSystemTools::ExpandListArgument(jobpools, pools);
+ cmExpandList(jobpools, pools);
for (std::string const& pool : pools) {
const std::string::size_type eq = pool.find('=');
unsigned int jobs;
@@ -613,7 +614,7 @@ void cmLocalNinjaGenerator::AdditionalCleanFiles()
{
cmGeneratorExpression ge;
auto cge = ge.Parse(prop_value);
- cmSystemTools::ExpandListArgument(
+ cmExpandList(
cge->Evaluate(this,
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")),
cleanFiles);
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index c6b63ba..a089682 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -40,7 +40,7 @@
// Include dependency scanners for supported languages. Only the
// C/C++ scanner is needed for bootstrapping CMake.
#include "cmDependsC.h"
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
# include "cmDependsFortran.h"
# include "cmDependsJava.h"
#endif
@@ -1102,7 +1102,7 @@ void cmLocalUnixMakefileGenerator3::AppendDirectoryCleanCommand(
this->Makefile->GetProperty("ADDITIONAL_CLEAN_FILES")) {
cmGeneratorExpression ge;
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop_value);
- cmSystemTools::ExpandListArgument(
+ cmExpandList(
cge->Evaluate(this,
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")),
cleanFiles);
@@ -1466,8 +1466,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
// for each language we need to scan, scan it
std::vector<std::string> langs;
- cmSystemTools::ExpandListArgument(
- mf->GetSafeDefinition("CMAKE_DEPENDS_LANGUAGES"), langs);
+ cmExpandList(mf->GetSafeDefinition("CMAKE_DEPENDS_LANGUAGES"), langs);
for (std::string const& lang : langs) {
// construct the checker
// Create the scanner for this language
@@ -1477,7 +1476,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
// TODO: Handle RC (resource files) dependencies correctly.
scanner = cm::make_unique<cmDependsC>(this, targetDir, lang, &validDeps);
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
else if (lang == "Fortran") {
ruleFileStream << "# Note that incremental build could trigger "
<< "a call to cmake_copy_f90_mod on each re-build\n";
@@ -1512,7 +1511,7 @@ void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose)
// Convert the string to a list and preserve empty entries.
std::vector<std::string> pairs;
- cmSystemTools::ExpandListArgument(pairs_string, pairs, true);
+ cmExpandList(pairs_string, pairs, true);
for (std::vector<std::string>::const_iterator i = pairs.begin();
i != pairs.end() && (i + 1) != pairs.end();) {
const std::string& depender = *i++;
@@ -1744,7 +1743,7 @@ void cmLocalUnixMakefileGenerator3::ClearDependencies(cmMakefile* mf,
return;
}
std::vector<std::string> files;
- cmSystemTools::ExpandListArgument(infoDef, files);
+ cmExpandList(infoDef, files);
// Each depend information file corresponds to a target. Clear the
// dependencies for that target.
@@ -1912,11 +1911,11 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
std::vector<std::string> transformRules;
if (const char* xform =
this->Makefile->GetProperty("IMPLICIT_DEPENDS_INCLUDE_TRANSFORM")) {
- cmSystemTools::ExpandListArgument(xform, transformRules);
+ cmExpandList(xform, transformRules);
}
if (const char* xform =
target->GetProperty("IMPLICIT_DEPENDS_INCLUDE_TRANSFORM")) {
- cmSystemTools::ExpandListArgument(xform, transformRules);
+ cmExpandList(xform, transformRules);
}
if (!transformRules.empty()) {
cmakefileStream << "set(CMAKE_INCLUDE_TRANSFORMS\n";
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 8154f3e..3d76396 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1526,7 +1526,7 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
// Check for extra object-file dependencies.
if (const char* deps = sf.GetProperty("OBJECT_DEPENDS")) {
std::vector<std::string> depends;
- cmSystemTools::ExpandListArgument(deps, depends);
+ cmExpandList(deps, depends);
const char* sep = "";
for (std::vector<std::string>::iterator j = depends.begin();
j != depends.end(); ++j) {
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 86a002f..657c3bf 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -47,7 +47,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
# include "cmVariableWatch.h"
#endif
@@ -97,7 +97,7 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
// cmListFileCache in the top level if necessary.
this->CheckCMP0000 = false;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->AddSourceGroup("", "^.*$");
this->AddSourceGroup("Source Files", CM_SOURCE_REGEX);
this->AddSourceGroup("Header Files", CM_HEADER_REGEX);
@@ -1349,7 +1349,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
if (const char* cdefs = this->GetProperty("COMPILE_DEFINITIONS")) {
// Expand the list.
std::vector<std::string> defs;
- cmSystemTools::ExpandListArgument(cdefs, defs);
+ cmExpandList(cdefs, defs);
// Recompose the list without the definition.
std::vector<std::string>::const_iterator defEnd =
@@ -1425,7 +1425,7 @@ void cmMakefile::PushFunctionScope(std::string const& fileName,
this->PushLoopBlockBarrier();
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->GetGlobalGenerator()->GetFileLockPool().PushFunctionScope();
#endif
@@ -1442,7 +1442,7 @@ void cmMakefile::PopFunctionScope(bool reportError)
this->PopFunctionBlockerBarrier(reportError);
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->GetGlobalGenerator()->GetFileLockPool().PopFunctionScope();
#endif
@@ -1497,7 +1497,7 @@ public:
this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot();
this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot);
this->GG->SetCurrentMakefile(mf);
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->GG->GetFileLockPool().PushFileScope();
#endif
}
@@ -1506,7 +1506,7 @@ public:
{
this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
this->Makefile->PopSnapshot(this->ReportError);
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->GG->GetFileLockPool().PopFileScope();
#endif
this->GG->SetCurrentMakefile(this->CurrentMakefile);
@@ -1800,7 +1800,7 @@ void cmMakefile::AddDefinition(const std::string& name, cm::string_view value)
}
this->StateSnapshot.SetDefinition(name, value);
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmVariableWatch* vv = this->GetVariableWatch();
if (vv) {
vv->VariableAccessed(name, cmVariableWatch::VARIABLE_MODIFIED_ACCESS,
@@ -1837,7 +1837,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
std::vector<std::string> files;
nvalue = value ? value : "";
- cmSystemTools::ExpandListArgument(nvalue, files);
+ cmExpandList(nvalue, files);
nvalue.clear();
for (cc = 0; cc < files.size(); cc++) {
if (!cmSystemTools::IsOff(files[cc])) {
@@ -1921,7 +1921,7 @@ void cmMakefile::RemoveDefinition(const std::string& name)
this->LogUnused("unsetting", name);
}
this->StateSnapshot.RemoveDefinition(name);
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmVariableWatch* vv = this->GetVariableWatch();
if (vv) {
vv->VariableAccessed(name, cmVariableWatch::VARIABLE_REMOVED_ACCESS,
@@ -1953,7 +1953,7 @@ void cmMakefile::AddGlobalLinkInformation(cmTarget& target)
if (const char* linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
std::vector<std::string> linkLibs;
- cmSystemTools::ExpandListArgument(linkLibsProp, linkLibs);
+ cmExpandList(linkLibsProp, linkLibs);
for (std::vector<std::string>::iterator j = linkLibs.begin();
j != linkLibs.end(); ++j) {
@@ -2079,7 +2079,7 @@ cmSourceFile* cmMakefile::GetSourceFileWithOutput(
return nullptr;
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
cmSourceGroup* cmMakefile::GetSourceGroup(
const std::vector<std::string>& name) const
{
@@ -2281,7 +2281,7 @@ void cmMakefile::ExpandVariablesCMP0019()
if (const char* linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
std::vector<std::string> linkLibs;
- cmSystemTools::ExpandListArgument(linkLibsProp, linkLibs);
+ cmExpandList(linkLibsProp, linkLibs);
for (std::vector<std::string>::iterator l = linkLibs.begin();
l != linkLibs.end(); ++l) {
@@ -2460,7 +2460,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
if (!def) {
def = this->GetState()->GetInitializedCacheValue(name);
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
if (cmVariableWatch* vv = this->GetVariableWatch()) {
if (!def) {
vv->VariableAccessed(
@@ -2477,7 +2477,7 @@ const std::string* cmMakefile::GetDef(const std::string& name) const
if (!def) {
def = this->GetState()->GetInitializedCacheValue(name);
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmVariableWatch* vv = this->GetVariableWatch();
if (vv && !this->SuppressSideEffects) {
bool const watch_function_executed =
@@ -3050,7 +3050,7 @@ std::string cmMakefile::GetConfigurations(std::vector<std::string>& configs,
if (this->GetGlobalGenerator()->IsMultiConfig()) {
if (const char* configTypes =
this->GetDefinition("CMAKE_CONFIGURATION_TYPES")) {
- cmSystemTools::ExpandListArgument(configTypes, configs);
+ cmExpandList(configTypes, configs);
}
return "";
}
@@ -3167,7 +3167,7 @@ bool cmMakefile::ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
if (i.Delim == cmListFileArgument::Quoted) {
outArgs.push_back(value);
} else {
- cmSystemTools::ExpandListArgument(value, outArgs);
+ cmExpandList(value, outArgs);
}
}
return !cmSystemTools::GetFatalErrorOccured();
@@ -3200,7 +3200,7 @@ bool cmMakefile::ExpandArguments(
outArgs.emplace_back(value, true);
} else {
std::vector<std::string> stringArgs;
- cmSystemTools::ExpandListArgument(value, stringArgs);
+ cmExpandList(value, stringArgs);
for (std::string const& stringArg : stringArgs) {
outArgs.emplace_back(stringArg, false);
}
@@ -3327,7 +3327,7 @@ void cmMakefile::AddTargetObject(std::string const& tgtName,
cmSourceFile* sf = this->GetOrCreateSource(objFile, true);
sf->SetObjectLibrary(tgtName);
sf->SetProperty("EXTERNAL_OBJECT", "1");
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->SourceGroups[this->ObjectLibrariesSourceGroupIndex].AddGroupFile(
sf->GetFullPath());
#endif
@@ -3509,7 +3509,7 @@ cmGlobalGenerator* cmMakefile::GetGlobalGenerator() const
return this->GlobalGenerator;
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmVariableWatch* cmMakefile::GetVariableWatch() const
{
if (this->GetCMakeInstance() &&
@@ -3558,7 +3558,7 @@ std::string cmMakefile::GetModulesFile(const std::string& filename,
const char* cmakeModulePath = this->GetDefinition("CMAKE_MODULE_PATH");
if (cmakeModulePath) {
std::vector<std::string> modulePath;
- cmSystemTools::ExpandListArgument(cmakeModulePath, modulePath);
+ cmExpandList(cmakeModulePath, modulePath);
// Look through the possible module directories.
for (std::string itempl : modulePath) {
@@ -3883,7 +3883,7 @@ void cmMakefile::AddCMakeDependFilesFromUser()
{
std::vector<std::string> deps;
if (const char* deps_str = this->GetProperty("CMAKE_CONFIGURE_DEPENDS")) {
- cmSystemTools::ExpandListArgument(deps_str, deps);
+ cmExpandList(deps_str, deps);
}
for (std::string const& dep : deps) {
if (cmSystemTools::FileIsFullPath(dep)) {
@@ -3931,14 +3931,14 @@ void cmMakefile::PushScope()
this->GetState()->CreateVariableScopeSnapshot(this->StateSnapshot);
this->PushLoopBlockBarrier();
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->GetGlobalGenerator()->GetFileLockPool().PushFunctionScope();
#endif
}
void cmMakefile::PopScope()
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->GetGlobalGenerator()->GetFileLockPool().PopFunctionScope();
#endif
@@ -3962,7 +3962,7 @@ void cmMakefile::RaiseScope(const std::string& var, const char* varDef)
return;
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmVariableWatch* vv = this->GetVariableWatch();
if (vv) {
vv->VariableAccessed(var, cmVariableWatch::VARIABLE_MODIFIED_ACCESS,
@@ -4378,7 +4378,7 @@ bool cmMakefile::AddRequiredTargetFeature(cmTarget* target,
}
std::vector<std::string> availableFeatures;
- cmSystemTools::ExpandListArgument(features, availableFeatures);
+ cmExpandList(features, availableFeatures);
if (std::find(availableFeatures.begin(), availableFeatures.end(), feature) ==
availableFeatures.end()) {
std::ostringstream e;
@@ -4648,31 +4648,31 @@ void cmMakefile::CheckNeededCxxLanguage(const std::string& feature,
if (const char* propCxx98 =
this->GetDefinition("CMAKE_CXX98_COMPILE_FEATURES")) {
std::vector<std::string> props;
- cmSystemTools::ExpandListArgument(propCxx98, props);
+ cmExpandList(propCxx98, props);
needCxx98 = std::find(props.begin(), props.end(), feature) != props.end();
}
if (const char* propCxx11 =
this->GetDefinition("CMAKE_CXX11_COMPILE_FEATURES")) {
std::vector<std::string> props;
- cmSystemTools::ExpandListArgument(propCxx11, props);
+ cmExpandList(propCxx11, props);
needCxx11 = std::find(props.begin(), props.end(), feature) != props.end();
}
if (const char* propCxx14 =
this->GetDefinition("CMAKE_CXX14_COMPILE_FEATURES")) {
std::vector<std::string> props;
- cmSystemTools::ExpandListArgument(propCxx14, props);
+ cmExpandList(propCxx14, props);
needCxx14 = std::find(props.begin(), props.end(), feature) != props.end();
}
if (const char* propCxx17 =
this->GetDefinition("CMAKE_CXX17_COMPILE_FEATURES")) {
std::vector<std::string> props;
- cmSystemTools::ExpandListArgument(propCxx17, props);
+ cmExpandList(propCxx17, props);
needCxx17 = std::find(props.begin(), props.end(), feature) != props.end();
}
if (const char* propCxx20 =
this->GetDefinition("CMAKE_CXX20_COMPILE_FEATURES")) {
std::vector<std::string> props;
- cmSystemTools::ExpandListArgument(propCxx20, props);
+ cmExpandList(propCxx20, props);
needCxx20 = std::find(props.begin(), props.end(), feature) != props.end();
}
}
@@ -4772,19 +4772,19 @@ void cmMakefile::CheckNeededCLanguage(const std::string& feature,
if (const char* propC90 =
this->GetDefinition("CMAKE_C90_COMPILE_FEATURES")) {
std::vector<std::string> props;
- cmSystemTools::ExpandListArgument(propC90, props);
+ cmExpandList(propC90, props);
needC90 = std::find(props.begin(), props.end(), feature) != props.end();
}
if (const char* propC99 =
this->GetDefinition("CMAKE_C99_COMPILE_FEATURES")) {
std::vector<std::string> props;
- cmSystemTools::ExpandListArgument(propC99, props);
+ cmExpandList(propC99, props);
needC99 = std::find(props.begin(), props.end(), feature) != props.end();
}
if (const char* propC11 =
this->GetDefinition("CMAKE_C11_COMPILE_FEATURES")) {
std::vector<std::string> props;
- cmSystemTools::ExpandListArgument(propC11, props);
+ cmExpandList(propC11, props);
needC11 = std::find(props.begin(), props.end(), feature) != props.end();
}
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 4d61c05..a6d1757 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -30,7 +30,7 @@
#include "cmStringAlgorithms.h"
#include "cmTarget.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmSourceGroup.h"
#endif
@@ -503,7 +503,7 @@ public:
*/
bool CanIWriteThisFile(std::string const& fileName) const;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
/**
* Get the vector source groups.
*/
@@ -649,7 +649,7 @@ public:
* Get the variable watch. This is used to determine when certain variables
* are accessed.
*/
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmVariableWatch* GetVariableWatch() const;
#endif
@@ -945,7 +945,7 @@ protected:
// Track the value of the computed DEFINITIONS property.
std::string DefineFlagsOrig;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
std::vector<cmSourceGroup> SourceGroups;
size_t ObjectLibrariesSourceGroupIndex;
#endif
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 19c667e..1335f13 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -83,7 +83,7 @@ void cmMakefileExecutableTargetGenerator::WriteRuleFiles()
void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
bool relink)
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
const bool requiresDeviceLinking = requireDeviceLinking(
*this->GeneratorTarget, *this->LocalGenerator, this->ConfigName);
if (!requiresDeviceLinking) {
@@ -165,7 +165,7 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
const std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_EXECUTABLE";
const std::string linkRule = this->GetLinkRule(linkRuleVar);
std::vector<std::string> commands1;
- cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
+ cmExpandList(linkRule, real_link_commands);
bool useResponseFileForObjects =
this->CheckUseResponseFileForObjects(linkLanguage);
@@ -488,7 +488,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
linkLanguage, this->ConfigName);
std::string linkRule = this->GetLinkRule(linkRuleVar);
std::vector<std::string> commands1;
- cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
+ cmExpandList(linkRule, real_link_commands);
if (this->GeneratorTarget->IsExecutableWithExports()) {
// If a separate rule for creating an import library is specified
// add it now.
@@ -496,7 +496,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
implibRuleVar += linkLanguage;
implibRuleVar += "_CREATE_IMPORT_LIBRARY";
if (const char* rule = this->Makefile->GetDefinition(implibRuleVar)) {
- cmSystemTools::ExpandListArgument(rule, real_link_commands);
+ cmExpandList(rule, real_link_commands);
}
}
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 8d342f3..eb0c30c 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -236,7 +236,7 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink)
void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
const std::string& linkRuleVar, bool relink)
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
// TODO: Merge the methods that call this method to avoid
// code duplication.
std::vector<std::string> commands;
@@ -370,7 +370,7 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
// Construct the main link rule and expand placeholders.
rulePlaceholderExpander->SetTargetImpLib(targetOutputReal);
std::string linkRule = this->GetLinkRule(linkRuleVar);
- cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
+ cmExpandList(linkRule, real_link_commands);
// Expand placeholders.
for (std::string& real_link_command : real_link_commands) {
@@ -650,7 +650,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
arCreateVar, linkLanguage, this->ConfigName);
if (const char* rule = this->Makefile->GetDefinition(arCreateVar)) {
- cmSystemTools::ExpandListArgument(rule, archiveCreateCommands);
+ cmExpandList(rule, archiveCreateCommands);
}
std::string arAppendVar = "CMAKE_";
arAppendVar += linkLanguage;
@@ -660,7 +660,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
arAppendVar, linkLanguage, this->ConfigName);
if (const char* rule = this->Makefile->GetDefinition(arAppendVar)) {
- cmSystemTools::ExpandListArgument(rule, archiveAppendCommands);
+ cmExpandList(rule, archiveAppendCommands);
}
std::string arFinishVar = "CMAKE_";
arFinishVar += linkLanguage;
@@ -670,7 +670,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
arFinishVar, linkLanguage, this->ConfigName);
if (const char* rule = this->Makefile->GetDefinition(arFinishVar)) {
- cmSystemTools::ExpandListArgument(rule, archiveFinishCommands);
+ cmExpandList(rule, archiveFinishCommands);
}
}
@@ -880,7 +880,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
} else {
// Get the set of commands.
std::string linkRule = this->GetLinkRule(linkRuleVar);
- cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
+ cmExpandList(linkRule, real_link_commands);
if (this->GeneratorTarget->GetPropertyAsBool("LINK_WHAT_YOU_USE") &&
(this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY)) {
std::string cmakeCommand = this->LocalGenerator->ConvertToOutputFormat(
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 7b26324..6a79615 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -159,10 +159,9 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
std::vector<std::string> files;
cmGeneratorExpression ge;
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop_value);
- cmSystemTools::ExpandListArgument(
- cge->Evaluate(this->LocalGenerator, config, false, this->GeneratorTarget,
- nullptr, nullptr),
- files);
+ cmExpandList(cge->Evaluate(this->LocalGenerator, config, false,
+ this->GeneratorTarget, nullptr, nullptr),
+ files);
return files;
};
@@ -680,12 +679,12 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
}
const std::string& compileRule =
this->Makefile->GetRequiredDefinition(cmdVar);
- cmSystemTools::ExpandListArgument(compileRule, compileCommands);
+ cmExpandList(compileRule, compileCommands);
} else {
const std::string cmdVar = "CMAKE_" + lang + "_COMPILE_OBJECT";
const std::string& compileRule =
this->Makefile->GetRequiredDefinition(cmdVar);
- cmSystemTools::ExpandListArgument(compileRule, compileCommands);
+ cmExpandList(compileRule, compileCommands);
}
if (this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS") &&
@@ -783,7 +782,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
// goes to the beginning of the command line.
if (!compileCommands.empty() && !compilerLauncher.empty()) {
std::vector<std::string> args;
- cmSystemTools::ExpandListArgument(compilerLauncher, args, true);
+ cmExpandList(compilerLauncher, args, true);
if (!args.empty()) {
args[0] = this->LocalGenerator->ConvertToOutputFormat(
args[0], cmOutputConverter::SHELL);
@@ -822,7 +821,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
std::vector<std::string> outputs(1, relativeObj);
if (const char* extra_outputs_str = source.GetProperty("OBJECT_OUTPUTS")) {
// Register these as extra files to clean.
- cmSystemTools::ExpandListArgument(extra_outputs_str, outputs);
+ cmExpandList(extra_outputs_str, outputs);
this->CleanFiles.insert(outputs.begin() + 1, outputs.end());
}
@@ -860,7 +859,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
if (const char* preprocessRule =
this->Makefile->GetDefinition(preprocessRuleVar)) {
std::vector<std::string> preprocessCommands;
- cmSystemTools::ExpandListArgument(preprocessRule, preprocessCommands);
+ cmExpandList(preprocessRule, preprocessCommands);
std::string shellObjI = this->LocalGenerator->ConvertToOutputFormat(
objI, cmOutputConverter::SHELL);
@@ -907,7 +906,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
if (const char* assemblyRule =
this->Makefile->GetDefinition(assemblyRuleVar)) {
std::vector<std::string> assemblyCommands;
- cmSystemTools::ExpandListArgument(assemblyRule, assemblyCommands);
+ cmExpandList(assemblyRule, assemblyCommands);
std::string shellObjS = this->LocalGenerator->ConvertToOutputFormat(
objS, cmOutputConverter::SHELL);
@@ -1182,7 +1181,7 @@ void cmMakefileTargetGenerator::WriteObjectDependRules(
// shared between the object file and dependency scanning rule.
depends.push_back(source.GetFullPath());
if (const char* objectDeps = source.GetProperty("OBJECT_DEPENDS")) {
- cmSystemTools::ExpandListArgument(objectDeps, depends);
+ cmExpandList(objectDeps, depends);
}
}
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index 66d3c88..dec32fa 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -104,10 +104,9 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
// Check if any indentation has requested:
// `CMAKE_MESSAGE_INDENT` is a list of "padding" pieces
// to be joined and prepended to the message lines.
- auto indent =
- cmJoin(cmSystemTools::ExpandedListArgument(
- this->Makefile->GetSafeDefinition("CMAKE_MESSAGE_INDENT")),
- "");
+ auto indent = cmJoin(cmExpandedList(this->Makefile->GetSafeDefinition(
+ "CMAKE_MESSAGE_INDENT")),
+ "");
// Make every line of the `message` indented
// NOTE Can't reuse `cmDocumentationFormatter::PrintPreformatted`
// here cuz it appends `\n` to the EOM ;-(
diff --git a/Source/cmMessenger.cxx b/Source/cmMessenger.cxx
index 07d011e..af83478 100644
--- a/Source/cmMessenger.cxx
+++ b/Source/cmMessenger.cxx
@@ -6,7 +6,7 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmsys/SystemInformation.hxx"
#endif
@@ -106,7 +106,7 @@ void displayMessage(MessageType t, std::ostringstream& msg)
// Add a terminating blank line.
msg << "\n";
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
// Add a C++ stack trace to internal errors.
if (t == MessageType::INTERNAL_ERROR) {
std::string stack = cmsys::SystemInformation::GetProgramStack(0, 0);
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 865ae7d..4ebeb60 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -440,12 +440,12 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeDeviceLinkCmd()
case cmStateEnums::MODULE_LIBRARY: {
const std::string cudaLinkCmd(
this->GetMakefile()->GetDefinition("CMAKE_CUDA_DEVICE_LINK_LIBRARY"));
- cmSystemTools::ExpandListArgument(cudaLinkCmd, linkCmds);
+ cmExpandList(cudaLinkCmd, linkCmds);
} break;
case cmStateEnums::EXECUTABLE: {
const std::string cudaLinkCmd(this->GetMakefile()->GetDefinition(
"CMAKE_CUDA_DEVICE_LINK_EXECUTABLE"));
- cmSystemTools::ExpandListArgument(cudaLinkCmd, linkCmds);
+ cmExpandList(cudaLinkCmd, linkCmds);
} break;
default:
break;
@@ -474,7 +474,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
linkCmdStr += rule;
}
}
- cmSystemTools::ExpandListArgument(linkCmdStr, linkCmds);
+ cmExpandList(linkCmdStr, linkCmds);
if (this->GetGeneratorTarget()->GetPropertyAsBool("LINK_WHAT_YOU_USE")) {
std::string cmakeCommand =
this->GetLocalGenerator()->ConvertToOutputFormat(
@@ -510,7 +510,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
linkCmdVar, this->TargetLinkLanguage, this->GetConfigName());
std::string const& linkCmd = mf->GetRequiredDefinition(linkCmdVar);
- cmSystemTools::ExpandListArgument(linkCmd, linkCmds);
+ cmExpandList(linkCmd, linkCmds);
}
{
std::string linkCmdVar = "CMAKE_";
@@ -521,7 +521,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
linkCmdVar, this->TargetLinkLanguage, this->GetConfigName());
std::string const& linkCmd = mf->GetRequiredDefinition(linkCmdVar);
- cmSystemTools::ExpandListArgument(linkCmd, linkCmds);
+ cmExpandList(linkCmd, linkCmds);
}
#ifdef __APPLE__
// On macOS ranlib truncates the fractional part of the static archive
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index c3459be..64b2bf6 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -548,8 +548,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
// Lookup the explicit preprocessing rule.
std::string ppVar = "CMAKE_" + lang;
ppVar += "_PREPROCESS_SOURCE";
- cmSystemTools::ExpandListArgument(
- this->GetMakefile()->GetRequiredDefinition(ppVar), ppCmds);
+ cmExpandList(this->GetMakefile()->GetRequiredDefinition(ppVar), ppCmds);
}
for (std::string& i : ppCmds) {
@@ -686,11 +685,11 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
cmdVar = "CMAKE_CUDA_COMPILE_WHOLE_COMPILATION";
}
const std::string& compileCmd = mf->GetRequiredDefinition(cmdVar);
- cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
+ cmExpandList(compileCmd, compileCmds);
} else {
const std::string cmdVar = "CMAKE_" + lang + "_COMPILE_OBJECT";
const std::string& compileCmd = mf->GetRequiredDefinition(cmdVar);
- cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
+ cmExpandList(compileCmd, compileCmds);
}
// See if we need to use a compiler launcher like ccache or distcc
@@ -754,7 +753,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
// goes to the beginning of the command line.
if (!compileCmds.empty() && !compilerLauncher.empty()) {
std::vector<std::string> args;
- cmSystemTools::ExpandListArgument(compilerLauncher, args, true);
+ cmExpandList(compilerLauncher, args, true);
if (!args.empty()) {
args[0] = this->LocalGenerator->ConvertToOutputFormat(
args[0], cmOutputConverter::SHELL);
@@ -998,8 +997,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
objBuild.ExplicitDeps.push_back(sourceFileName);
if (const char* objectDeps = source->GetProperty("OBJECT_DEPENDS")) {
- std::vector<std::string> depList =
- cmSystemTools::ExpandedListArgument(objectDeps);
+ std::vector<std::string> depList = cmExpandedList(objectDeps);
for (std::string& odi : depList) {
if (cmSystemTools::FileIsFullPath(odi)) {
odi = cmSystemTools::CollapseFullPath(odi);
@@ -1152,7 +1150,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
if (const char* objectOutputs = source->GetProperty("OBJECT_OUTPUTS")) {
cmNinjaBuild build("phony");
build.Comment = "Additional output files.";
- build.Outputs = cmSystemTools::ExpandedListArgument(objectOutputs);
+ build.Outputs = cmExpandedList(objectOutputs);
std::transform(build.Outputs.begin(), build.Outputs.end(),
build.Outputs.begin(), MapToNinjaPath());
build.ExplicitDeps = objBuild.Outputs;
@@ -1301,12 +1299,12 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
}
const std::string& compileCmd =
this->GetMakefile()->GetRequiredDefinition(cmdVar);
- cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
+ cmExpandList(compileCmd, compileCmds);
} else {
const std::string cmdVar = "CMAKE_" + language + "_COMPILE_OBJECT";
const std::string& compileCmd =
this->GetMakefile()->GetRequiredDefinition(cmdVar);
- cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
+ cmExpandList(compileCmd, compileCmds);
}
std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
@@ -1333,11 +1331,10 @@ void cmNinjaTargetGenerator::AdditionalCleanFiles()
{
cmGeneratorExpression ge;
auto cge = ge.Parse(prop_value);
- cmSystemTools::ExpandListArgument(
- cge->Evaluate(lg,
- this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"),
- false, this->GeneratorTarget, nullptr, nullptr),
- cleanFiles);
+ cmExpandList(cge->Evaluate(
+ lg, this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"),
+ false, this->GeneratorTarget, nullptr, nullptr),
+ cleanFiles);
}
std::string const& binaryDir = lg->GetCurrentBinaryDirectory();
cmGlobalNinjaGenerator* gg = lg->GetGlobalNinjaGenerator();
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index da7f8bc..bf516e3 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -9,6 +9,7 @@
#include <vector>
#include "cmState.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
cmOutputConverter::cmOutputConverter(cmStateSnapshot const& snapshot)
@@ -153,7 +154,7 @@ cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat(
{
FortranFormat format = FortranFormatNone;
if (!value.empty()) {
- for (std::string const& fi : cmSystemTools::ExpandedListArgument(value)) {
+ for (std::string const& fi : cmExpandedList(value)) {
if (fi == "FIXED") {
format = FortranFormatFixed;
}
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index 587e21c..de47ce0 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -123,7 +123,7 @@ public:
incDirProp, cmGeneratorExpression::StripAllGeneratorExpressions);
std::vector<std::string> includes;
- cmSystemTools::ExpandListArgument(incDirs, includes);
+ cmExpandList(incDirs, includes);
for (std::string& path : includes) {
this->Makefile->ExpandVariablesInString(path);
diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx
index 04fa0fb..5e7e2f3 100644
--- a/Source/cmParseArgumentsCommand.cxx
+++ b/Source/cmParseArgumentsCommand.cxx
@@ -131,7 +131,7 @@ bool cmParseArgumentsCommand::InitialPass(std::vector<std::string> const& args,
}
parseFromArgV = true;
argIter++; // move past PARSE_ARGV
- if (!cmSystemTools::StringToULong(argIter->c_str(), &argvStart)) {
+ if (!cmStrToULong(*argIter, &argvStart)) {
this->Makefile->IssueMessage(MessageType::FATAL_ERROR,
"PARSE_ARGV index '" + *argIter +
"' is not an unsigned integer");
@@ -161,17 +161,17 @@ bool cmParseArgumentsCommand::InitialPass(std::vector<std::string> const& args,
// the second argument is a (cmake) list of options without argument
std::vector<std::string> list;
- cmSystemTools::ExpandListArgument(*argIter++, list);
+ cmExpandList(*argIter++, list);
parser.Bind(list, options, duplicateKey);
// the third argument is a (cmake) list of single argument options
list.clear();
- cmSystemTools::ExpandListArgument(*argIter++, list);
+ cmExpandList(*argIter++, list);
parser.Bind(list, singleValArgs, duplicateKey);
// the fourth argument is a (cmake) list of multi argument options
list.clear();
- cmSystemTools::ExpandListArgument(*argIter++, list);
+ cmExpandList(*argIter++, list);
parser.Bind(list, multiValArgs, duplicateKey);
list.clear();
@@ -179,13 +179,13 @@ bool cmParseArgumentsCommand::InitialPass(std::vector<std::string> const& args,
// Flatten ;-lists in the arguments into a single list as was done
// by the original function(CMAKE_PARSE_ARGUMENTS).
for (; argIter != argEnd; ++argIter) {
- cmSystemTools::ExpandListArgument(*argIter, list);
+ cmExpandList(*argIter, list);
}
} else {
// in the PARSE_ARGV move read the arguments from ARGC and ARGV#
std::string argc = this->Makefile->GetSafeDefinition("ARGC");
unsigned long count;
- if (!cmSystemTools::StringToULong(argc.c_str(), &count)) {
+ if (!cmStrToULong(argc, &count)) {
this->Makefile->IssueMessage(MessageType::FATAL_ERROR,
"PARSE_ARGV called with ARGC='" + argc +
"' that is not an unsigned integer");
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 51a61dc..d33cd32 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -34,7 +34,7 @@ static bool stringToId(const char* input, cmPolicies::PolicyID& pid)
}
}
long id;
- if (!cmSystemTools::StringToLong(input + 3, &id)) {
+ if (!cmStrToLong(input + 3, &id)) {
return false;
}
if (id >= cmPolicies::CMPCOUNT) {
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 360df25..3218076 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -243,7 +243,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
this->Verbosity = makefile->GetSafeDefinition("CMAKE_AUTOGEN_VERBOSE");
if (!this->Verbosity.empty()) {
unsigned long iVerb = 0;
- if (!cmSystemTools::StringToULong(this->Verbosity.c_str(), &iVerb)) {
+ if (!cmStrToULong(this->Verbosity, &iVerb)) {
// Non numeric verbosity
this->Verbosity = cmSystemTools::IsOn(this->Verbosity) ? "1" : "0";
}
@@ -392,7 +392,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
this->Target->GetSafeProperty("AUTOGEN_TARGET_DEPENDS");
if (!deps.empty()) {
std::vector<std::string> extraDeps;
- cmSystemTools::ExpandListArgument(deps, extraDeps);
+ cmExpandList(deps, extraDeps);
for (std::string const& depName : extraDeps) {
// Allow target and file dependencies
auto* depTarget = makefile->FindTargetToUse(depName);
@@ -543,7 +543,7 @@ bool cmQtAutoGenInitializer::InitUic()
std::string const usp =
this->Target->GetSafeProperty("AUTOUIC_SEARCH_PATHS");
if (!usp.empty()) {
- cmSystemTools::ExpandListArgument(usp, this->Uic.SearchPaths);
+ cmExpandList(usp, this->Uic.SearchPaths);
std::string const& srcDir = makefile->GetCurrentSourceDirectory();
for (std::string& path : this->Uic.SearchPaths) {
path = cmSystemTools::CollapseFullPath(path, srcDir);
@@ -689,7 +689,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
{
std::string const opts = sf->GetSafeProperty(kw.AUTORCC_OPTIONS);
if (!opts.empty()) {
- cmSystemTools::ExpandListArgument(opts, qrc.Options);
+ cmExpandList(opts, qrc.Options);
}
}
this->Rcc.Qrcs.push_back(std::move(qrc));
@@ -808,7 +808,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
if (!uicOpts.empty()) {
this->Uic.FileFiles.push_back(std::move(realPath));
std::vector<std::string> optsVec;
- cmSystemTools::ExpandListArgument(uicOpts, optsVec);
+ cmExpandList(uicOpts, optsVec);
this->Uic.FileOptions.push_back(std::move(optsVec));
}
} else {
@@ -862,8 +862,8 @@ bool cmQtAutoGenInitializer::InitScanFiles()
const bool modernQt = (this->QtVersion.Major >= 5);
// Target rcc options
std::vector<std::string> optionsTarget;
- cmSystemTools::ExpandListArgument(
- this->Target->GetSafeProperty(kw.AUTORCC_OPTIONS), optionsTarget);
+ cmExpandList(this->Target->GetSafeProperty(kw.AUTORCC_OPTIONS),
+ optionsTarget);
// Check if file name is unique
for (Qrc& qrc : this->Rcc.Qrcs) {
@@ -1523,7 +1523,7 @@ void cmQtAutoGenInitializer::AddCleanFile(std::string const& fileName)
static unsigned int CharPtrToUInt(const char* const input)
{
unsigned long tmp = 0;
- if (input != nullptr && cmSystemTools::StringToULong(input, &tmp)) {
+ if (input != nullptr && cmStrToULong(input, &tmp)) {
return static_cast<unsigned int>(tmp);
}
return 0;
diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx
index 0ad87b1..996b2bc 100644
--- a/Source/cmQtAutoGenerator.cxx
+++ b/Source/cmQtAutoGenerator.cxx
@@ -22,7 +22,7 @@ cmQtAutoGenerator::Logger::Logger()
std::string verbose;
if (cmSystemTools::GetEnv("VERBOSE", verbose) && !verbose.empty()) {
unsigned long iVerbose = 0;
- if (cmSystemTools::StringToULong(verbose.c_str(), &iVerbose)) {
+ if (cmStrToULong(verbose, &iVerbose)) {
SetVerbosity(static_cast<unsigned int>(iVerbose));
} else {
// Non numeric verbosity
@@ -46,7 +46,7 @@ cmQtAutoGenerator::Logger::~Logger() = default;
void cmQtAutoGenerator::Logger::RaiseVerbosity(std::string const& value)
{
unsigned long verbosity = 0;
- if (cmSystemTools::StringToULong(value.c_str(), &verbosity)) {
+ if (cmStrToULong(value, &verbosity)) {
if (this->Verbosity_ < verbosity) {
this->Verbosity_ = static_cast<unsigned int>(verbosity);
}
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index e693816..2cbf113 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -1511,7 +1511,7 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
};
auto InfoGetList = [makefile](const char* key) -> std::vector<std::string> {
std::vector<std::string> list;
- cmSystemTools::ExpandListArgument(makefile->GetSafeDefinition(key), list);
+ cmExpandList(makefile->GetSafeDefinition(key), list);
return list;
};
auto InfoGetLists =
@@ -1528,8 +1528,7 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
if (length >= 2) {
std::string::const_iterator itBeg = value.begin() + (pos + 1);
std::string::const_iterator itEnd = itBeg + (length - 2);
- lists.emplace_back(
- cmSystemTools::ExpandedListArgument(std::string(itBeg, itEnd)));
+ lists.emplace_back(cmExpandedList(std::string(itBeg, itEnd)));
}
pos += length;
pos += ListSep.size();
@@ -1551,7 +1550,7 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
auto InfoGetConfigList =
[&InfoGetConfig](const char* key) -> std::vector<std::string> {
std::vector<std::string> list;
- cmSystemTools::ExpandListArgument(InfoGetConfig(key), list);
+ cmExpandList(InfoGetConfig(key), list);
return list;
};
auto LogInfoError = [this](std::string const& msg) -> bool {
@@ -1582,7 +1581,7 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
BaseConst_.MultiConfig = InfoGetBool("AM_MULTI_CONFIG");
{
unsigned long num = 1;
- if (cmSystemTools::StringToULong(InfoGet("AM_PARALLEL").c_str(), &num)) {
+ if (cmStrToULong(InfoGet("AM_PARALLEL"), &num)) {
num = std::max<unsigned long>(num, 1);
num = std::min<unsigned long>(num, ParallelMax);
}
@@ -1630,8 +1629,7 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
// - Qt environment
{
unsigned long qtv = BaseConst_.QtVersionMajor;
- if (cmSystemTools::StringToULong(InfoGet("AM_QT_VERSION_MAJOR").c_str(),
- &qtv)) {
+ if (cmStrToULong(InfoGet("AM_QT_VERSION_MAJOR"), &qtv)) {
BaseConst_.QtVersionMajor = static_cast<unsigned int>(qtv);
}
}
diff --git a/Source/cmQtAutoRcc.cxx b/Source/cmQtAutoRcc.cxx
index c75b2ca..ea3cad9 100644
--- a/Source/cmQtAutoRcc.cxx
+++ b/Source/cmQtAutoRcc.cxx
@@ -29,7 +29,7 @@ bool cmQtAutoRcc::Init(cmMakefile* makefile)
auto InfoGetList =
[makefile](std::string const& key) -> std::vector<std::string> {
std::vector<std::string> list;
- cmSystemTools::ExpandListArgument(makefile->GetSafeDefinition(key), list);
+ cmExpandList(makefile->GetSafeDefinition(key), list);
return list;
};
auto InfoGetConfig = [makefile,
@@ -47,7 +47,7 @@ bool cmQtAutoRcc::Init(cmMakefile* makefile)
auto InfoGetConfigList =
[&InfoGetConfig](std::string const& key) -> std::vector<std::string> {
std::vector<std::string> list;
- cmSystemTools::ExpandListArgument(InfoGetConfig(key), list);
+ cmExpandList(InfoGetConfig(key), list);
return list;
};
auto LogInfoError = [this](std::string const& msg) -> bool {
diff --git a/Source/cmRemoveCommand.cxx b/Source/cmRemoveCommand.cxx
index d0ee4d4..4ba21fa 100644
--- a/Source/cmRemoveCommand.cxx
+++ b/Source/cmRemoveCommand.cxx
@@ -3,7 +3,7 @@
#include "cmRemoveCommand.h"
#include "cmMakefile.h"
-#include "cmSystemTools.h"
+#include "cmStringAlgorithms.h"
class cmExecutionStatus;
@@ -25,13 +25,12 @@ bool cmRemoveCommand::InitialPass(std::vector<std::string> const& args,
}
// expand the variable
- std::vector<std::string> const varArgsExpanded =
- cmSystemTools::ExpandedListArgument(cacheValue);
+ std::vector<std::string> const varArgsExpanded = cmExpandedList(cacheValue);
// expand the args
// check for REMOVE(VAR v1 v2 ... vn)
std::vector<std::string> const argsExpanded =
- cmSystemTools::ExpandedLists(args.begin() + 1, args.end());
+ cmExpandedLists(args.begin() + 1, args.end());
// now create the new value
std::string value;
diff --git a/Source/cmRuntimeDependencyArchive.cxx b/Source/cmRuntimeDependencyArchive.cxx
index ca85287..1b3f387 100644
--- a/Source/cmRuntimeDependencyArchive.cxx
+++ b/Source/cmRuntimeDependencyArchive.cxx
@@ -9,11 +9,12 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#if defined(_WIN32)
# include "cmGlobalGenerator.h"
-# ifdef CMAKE_BUILD_WITH_CMAKE
+# ifndef CMAKE_BOOTSTRAP
# include "cmGlobalVisualStudioVersionedGenerator.h"
# endif
# include "cmVSSetupHelper.h"
@@ -36,7 +37,7 @@ static void AddVisualStudioPath(std::vector<std::string>& paths,
// If generating for the VS IDE, use the same instance.
std::string vsloc;
bool found = false;
-# ifdef CMAKE_BUILD_WITH_CMAKE
+# ifndef CMAKE_BOOTSTRAP
if (gg->GetName().find(prefix) == 0) {
cmGlobalVisualStudioVersionedGenerator* vsgen =
static_cast<cmGlobalVisualStudioVersionedGenerator*>(gg);
@@ -217,7 +218,7 @@ bool cmRuntimeDependencyArchive::GetGetRuntimeDependenciesCommand(
std::string toolCommand = this->GetMakefile()->GetSafeDefinition(
"CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND");
if (!toolCommand.empty()) {
- cmSystemTools::ExpandListArgument(toolCommand, command);
+ cmExpandList(toolCommand, command);
return true;
}
diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx
index 879cc95..affff54 100644
--- a/Source/cmSearchPath.cxx
+++ b/Source/cmSearchPath.cxx
@@ -79,7 +79,7 @@ void cmSearchPath::AddCMakePath(const std::string& variable)
// Get a path from a CMake variable.
if (const char* value = this->FC->Makefile->GetDefinition(variable)) {
std::vector<std::string> expanded;
- cmSystemTools::ExpandListArgument(value, expanded);
+ cmExpandList(value, expanded);
for (std::string const& p : expanded) {
this->AddPathInternal(
@@ -104,7 +104,7 @@ void cmSearchPath::AddCMakePrefixPath(const std::string& variable)
// Get a path from a CMake variable.
if (const char* value = this->FC->Makefile->GetDefinition(variable)) {
std::vector<std::string> expanded;
- cmSystemTools::ExpandListArgument(value, expanded);
+ cmExpandList(value, expanded);
this->AddPrefixPaths(
expanded, this->FC->Makefile->GetCurrentSourceDirectory().c_str());
diff --git a/Source/cmStringAlgorithms.cxx b/Source/cmStringAlgorithms.cxx
index 5867a44..9f067e2 100644
--- a/Source/cmStringAlgorithms.cxx
+++ b/Source/cmStringAlgorithms.cxx
@@ -4,6 +4,8 @@
#include <algorithm>
#include <cstdio>
+#include <errno.h>
+#include <stdlib.h>
std::string cmTrimWhitespace(cm::string_view str)
{
@@ -21,6 +23,20 @@ std::string cmTrimWhitespace(cm::string_view str)
return std::string(start, stop + 1);
}
+std::string cmRemoveQuotes(cm::string_view str)
+{
+ // We process only strings that have two quotes at least.
+ // Also front() and back() are only defined behavior on non empty strings.
+ if (str.size() >= 2 && //
+ str.front() == '"' && //
+ str.back() == '"') {
+ // Remove a quote from the front and back
+ str.remove_prefix(1);
+ str.remove_suffix(1);
+ }
+ return std::string(str);
+}
+
std::string cmEscapeQuotes(cm::string_view str)
{
std::string result;
@@ -58,6 +74,77 @@ std::vector<std::string> cmTokenize(cm::string_view str, cm::string_view sep)
return tokens;
}
+void cmExpandList(cm::string_view arg, std::vector<std::string>& argsOut,
+ bool emptyArgs)
+{
+ // If argument is empty, it is an empty list.
+ if (!emptyArgs && arg.empty()) {
+ return;
+ }
+
+ // if there are no ; in the name then just copy the current string
+ if (arg.find(';') == cm::string_view::npos) {
+ argsOut.emplace_back(arg);
+ return;
+ }
+
+ std::string newArg;
+ // Break the string at non-escaped semicolons not nested in [].
+ int squareNesting = 0;
+ cm::string_view::iterator last = arg.begin();
+ cm::string_view::iterator const cend = arg.end();
+ for (cm::string_view::iterator c = last; c != cend; ++c) {
+ switch (*c) {
+ case '\\': {
+ // We only want to allow escaping of semicolons. Other
+ // escapes should not be processed here.
+ cm::string_view::iterator cnext = c + 1;
+ if ((cnext != cend) && *cnext == ';') {
+ newArg.append(last, c);
+ // Skip over the escape character
+ last = cnext;
+ c = cnext;
+ }
+ } break;
+ case '[': {
+ ++squareNesting;
+ } break;
+ case ']': {
+ --squareNesting;
+ } break;
+ case ';': {
+ // Break the string here if we are not nested inside square
+ // brackets.
+ if (squareNesting == 0) {
+ newArg.append(last, c);
+ // Skip over the semicolon
+ last = c + 1;
+ if (!newArg.empty() || emptyArgs) {
+ // Add the last argument if the string is not empty.
+ argsOut.push_back(newArg);
+ newArg.clear();
+ }
+ }
+ } break;
+ default: {
+ // Just append this character.
+ } break;
+ }
+ }
+ newArg.append(last, cend);
+ if (!newArg.empty() || emptyArgs) {
+ // Add the last argument if the string is not empty.
+ argsOut.push_back(std::move(newArg));
+ }
+}
+
+std::vector<std::string> cmExpandedList(cm::string_view arg, bool emptyArgs)
+{
+ std::vector<std::string> argsOut;
+ cmExpandList(arg, argsOut, emptyArgs);
+ return argsOut;
+}
+
namespace {
template <std::size_t N, typename T>
inline void MakeDigits(cm::string_view& view, char (&digits)[N],
@@ -124,3 +211,35 @@ std::string cmCatViews(std::initializer_list<cm::string_view> views)
}
return result;
}
+
+bool cmStrToLong(const char* str, long* value)
+{
+ errno = 0;
+ char* endp;
+ *value = strtol(str, &endp, 10);
+ return (*endp == '\0') && (endp != str) && (errno == 0);
+}
+
+bool cmStrToLong(std::string const& str, long* value)
+{
+ return cmStrToLong(str.c_str(), value);
+}
+
+bool cmStrToULong(const char* str, unsigned long* value)
+{
+ errno = 0;
+ char* endp;
+ while (cmIsSpace(*str)) {
+ ++str;
+ }
+ if (*str == '-') {
+ return false;
+ }
+ *value = strtoul(str, &endp, 10);
+ return (*endp == '\0') && (endp != str) && (errno == 0);
+}
+
+bool cmStrToULong(std::string const& str, unsigned long* value)
+{
+ return cmStrToULong(str.c_str(), value);
+}
diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h
index 1898649..223d712 100644
--- a/Source/cmStringAlgorithms.h
+++ b/Source/cmStringAlgorithms.h
@@ -41,6 +41,9 @@ inline bool cmIsSpace(char ch)
/** Returns a string that has whitespace removed from the start and the end. */
std::string cmTrimWhitespace(cm::string_view str);
+/** Returns a string that has quotes removed from the start and the end. */
+std::string cmRemoveQuotes(cm::string_view str);
+
/** Escape quotes in a string. */
std::string cmEscapeQuotes(cm::string_view str);
@@ -65,6 +68,48 @@ std::string cmJoin(Range const& rng, cm::string_view separator)
/** Extract tokens that are separated by any of the characters in @a sep. */
std::vector<std::string> cmTokenize(cm::string_view str, cm::string_view sep);
+/**
+ * Expand the ; separated string @a arg into multiple arguments.
+ * All found arguments are appended to @a argsOut.
+ */
+void cmExpandList(cm::string_view arg, std::vector<std::string>& argsOut,
+ bool emptyArgs = false);
+
+/**
+ * Expand out any arguments in the string range [@a first, @a last) that have
+ * ; separated strings into multiple arguments. All found arguments are
+ * appended to @a argsOut.
+ */
+template <class InputIt>
+void cmExpandLists(InputIt first, InputIt last,
+ std::vector<std::string>& argsOut)
+{
+ for (; first != last; ++first) {
+ ExpandList(*first, argsOut);
+ }
+}
+
+/**
+ * Same as cmExpandList but a new vector is created containing
+ * the expanded arguments from the string @a arg.
+ */
+std::vector<std::string> cmExpandedList(cm::string_view arg,
+ bool emptyArgs = false);
+
+/**
+ * Same as cmExpandList but a new vector is created containing the expanded
+ * versions of all arguments in the string range [@a first, @a last).
+ */
+template <class InputIt>
+std::vector<std::string> cmExpandedLists(InputIt first, InputIt last)
+{
+ std::vector<std::string> argsOut;
+ for (; first != last; ++first) {
+ cmExpandList(*first, argsOut);
+ }
+ return argsOut;
+}
+
/** Concatenate string pieces into a single string. */
std::string cmCatViews(std::initializer_list<cm::string_view> views);
@@ -190,4 +235,13 @@ inline void cmStripSuffixIfExists(std::string& str, cm::string_view suffix)
}
}
+/** Converts a string to long. Expects that the whole string is an integer. */
+bool cmStrToLong(const char* str, long* value);
+bool cmStrToLong(std::string const& str, long* value);
+
+/** Converts a string to unsigned long. Expects that the whole string is an
+ * integer */
+bool cmStrToULong(const char* str, unsigned long* value);
+bool cmStrToULong(std::string const& str, unsigned long* value);
+
#endif
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 8b3b1e3..41d48ed 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -113,7 +113,7 @@ bool cmStringCommand::InitialPass(std::vector<std::string> const& args,
bool cmStringCommand::HandleHashCommand(std::vector<std::string> const& args)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
if (args.size() != 3) {
std::ostringstream e;
e << args[0] << " requires an output variable and an input string";
@@ -736,7 +736,7 @@ bool cmStringCommand::HandleRepeatCommand(std::vector<std::string> const& args)
}
unsigned long times;
- if (!cmSystemTools::StringToULong(args[ArgPos::TIMES].c_str(), &times)) {
+ if (!cmStrToULong(args[ArgPos::TIMES], &times)) {
this->Makefile->IssueMessage(MessageType::FATAL_ERROR,
"repeat count is not a positive number.");
return true;
@@ -878,7 +878,7 @@ bool cmStringCommand::HandleTimestampCommand(
bool cmStringCommand::HandleUuidCommand(std::vector<std::string> const& args)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
unsigned int argsIndex = 1;
if (args.size() < 2) {
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 7baf5ed..a133459 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -9,7 +9,7 @@
#include "cmStringAlgorithms.h"
#include "cm_uv.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmArchiveWrite.h"
# include "cmLocale.h"
# include "cm_libarchive.h"
@@ -21,7 +21,7 @@
# endif
#endif
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmCryptoHash.h"
#endif
@@ -93,7 +93,7 @@ extern char** environ;
# endif
#endif
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
static std::string cm_archive_entry_pathname(struct archive_entry* entry)
{
# if cmsys_STL_HAS_WSTRING
@@ -944,7 +944,7 @@ bool cmSystemTools::RenameFile(const std::string& oldname,
std::string cmSystemTools::ComputeFileHash(const std::string& source,
cmCryptoHash::Algo algo)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
cmCryptoHash hash(algo);
return hash.HashFile(source);
#else
@@ -957,7 +957,7 @@ std::string cmSystemTools::ComputeFileHash(const std::string& source,
std::string cmSystemTools::ComputeStringMD5(const std::string& input)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
cmCryptoHash md5(cmCryptoHash::AlgoMD5);
return md5.HashString(input);
#else
@@ -973,7 +973,7 @@ std::string cmSystemTools::ComputeCertificateThumbprint(
{
std::string thumbprint;
-#if defined(CMAKE_BUILD_WITH_CMAKE) && defined(_WIN32)
+#if !defined(CMAKE_BOOTSTRAP) && defined(_WIN32)
BYTE* certData = NULL;
CRYPT_INTEGER_BLOB cryptBlob;
HCERTSTORE certStore = NULL;
@@ -1089,79 +1089,6 @@ void cmSystemTools::GlobDirs(const std::string& path,
}
}
-void cmSystemTools::ExpandListArgument(cm::string_view arg,
- std::vector<std::string>& argsOut,
- bool emptyArgs)
-{
- // If argument is empty, it is an empty list.
- if (!emptyArgs && arg.empty()) {
- return;
- }
-
- // if there are no ; in the name then just copy the current string
- if (arg.find(';') == cm::string_view::npos) {
- argsOut.emplace_back(arg);
- return;
- }
-
- std::string newArg;
- // Break the string at non-escaped semicolons not nested in [].
- int squareNesting = 0;
- cm::string_view::iterator last = arg.begin();
- cm::string_view::iterator const cend = arg.end();
- for (cm::string_view::iterator c = last; c != cend; ++c) {
- switch (*c) {
- case '\\': {
- // We only want to allow escaping of semicolons. Other
- // escapes should not be processed here.
- cm::string_view::iterator cnext = c + 1;
- if ((cnext != cend) && *cnext == ';') {
- newArg.append(last, c);
- // Skip over the escape character
- last = cnext;
- c = cnext;
- }
- } break;
- case '[': {
- ++squareNesting;
- } break;
- case ']': {
- --squareNesting;
- } break;
- case ';': {
- // Break the string here if we are not nested inside square
- // brackets.
- if (squareNesting == 0) {
- newArg.append(last, c);
- // Skip over the semicolon
- last = c + 1;
- if (!newArg.empty() || emptyArgs) {
- // Add the last argument if the string is not empty.
- argsOut.push_back(newArg);
- newArg.clear();
- }
- }
- } break;
- default: {
- // Just append this character.
- } break;
- }
- }
- newArg.append(last, cend);
- if (!newArg.empty() || emptyArgs) {
- // Add the last argument if the string is not empty.
- argsOut.push_back(std::move(newArg));
- }
-}
-
-std::vector<std::string> cmSystemTools::ExpandedListArgument(
- cm::string_view arg, bool emptyArgs)
-{
- std::vector<std::string> argsOut;
- ExpandListArgument(arg, argsOut, emptyArgs);
- return argsOut;
-}
-
bool cmSystemTools::SimpleGlob(const std::string& glob,
std::vector<std::string>& files,
int type /* = 0 */)
@@ -1331,7 +1258,7 @@ std::string cmSystemTools::ForceToRelativePath(std::string const& local_path,
return relative;
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
bool cmSystemTools::UnsetEnv(const char* value)
{
# if !defined(HAVE_UNSETENV)
@@ -1396,7 +1323,7 @@ void cmSystemTools::EnableVSConsoleOutput()
// output and allow it to be captured on the fly.
cmSystemTools::PutEnv("vsconsoleoutput=1");
-# ifdef CMAKE_BUILD_WITH_CMAKE
+# ifndef CMAKE_BOOTSTRAP
// VS sets an environment variable to tell MS tools like "cl" to report
// output through a backdoor pipe instead of stdout/stderr. Unset the
// environment variable to close this backdoor for any path of process
@@ -1418,7 +1345,7 @@ bool cmSystemTools::CreateTar(const std::string& outFileName,
std::string const& mtime,
std::string const& format)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
cmsys::ofstream fout(outFileName.c_str(), std::ios::out | std::ios::binary);
if (!fout) {
@@ -1472,7 +1399,7 @@ bool cmSystemTools::CreateTar(const std::string& outFileName,
#endif
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
namespace {
# define BSDTAR_FILESIZE_PRINTF "%lu"
# define BSDTAR_FILESIZE_TYPE unsigned long
@@ -1768,7 +1695,7 @@ bool cmSystemTools::ExtractTar(const std::string& outFileName,
const std::vector<std::string>& files,
bool verbose)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
return extract_tar(outFileName, files, verbose, true);
#else
(void)outFileName;
@@ -1782,7 +1709,7 @@ bool cmSystemTools::ListTar(const std::string& outFileName,
const std::vector<std::string>& files,
bool verbose)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
return extract_tar(outFileName, files, verbose, false);
#else
(void)outFileName;
@@ -2111,7 +2038,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
cmSystemToolsCMakeCommand = exe_dir;
cmSystemToolsCMakeCommand += "/cmake";
cmSystemToolsCMakeCommand += cmSystemTools::GetExecutableExtension();
-#ifndef CMAKE_BUILD_WITH_CMAKE
+#ifdef CMAKE_BOOTSTRAP
// The bootstrap cmake does not provide the other tools,
// so use the directory where they are about to be built.
exe_dir = CMAKE_BOOTSTRAP_BINARY_DIR "/bin";
@@ -2141,7 +2068,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
cmSystemToolsCMClDepsCommand.clear();
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
// Install tree has
// - "<prefix><CMAKE_BIN_DIR>/cmake"
// - "<prefix><CMAKE_DATA_DIR>"
@@ -2838,36 +2765,20 @@ bool cmSystemTools::CheckRPath(std::string const& file,
bool cmSystemTools::RepeatedRemoveDirectory(const std::string& dir)
{
+#ifdef _WIN32
// Windows sometimes locks files temporarily so try a few times.
- for (int i = 0; i < 10; ++i) {
+ WindowsFileRetry retry = cmSystemTools::GetWindowsFileRetry();
+
+ for (unsigned int i = 0; i < retry.Count; ++i) {
if (cmSystemTools::RemoveADirectory(dir)) {
return true;
}
- cmSystemTools::Delay(100);
+ cmSystemTools::Delay(retry.Delay);
}
return false;
-}
-
-bool cmSystemTools::StringToLong(const char* str, long* value)
-{
- errno = 0;
- char* endp;
- *value = strtol(str, &endp, 10);
- return (*endp == '\0') && (endp != str) && (errno == 0);
-}
-
-bool cmSystemTools::StringToULong(const char* str, unsigned long* value)
-{
- errno = 0;
- char* endp;
- while (isspace(*str)) {
- ++str;
- }
- if (*str == '-') {
- return false;
- }
- *value = strtoul(str, &endp, 10);
- return (*endp == '\0') && (endp != str) && (errno == 0);
+#else
+ return cmSystemTools::RemoveADirectory(dir);
+#endif
}
std::string cmSystemTools::EncodeURL(std::string const& in, bool escapeSlashes)
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index d3fcb64..9ccbbc5 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -29,49 +29,6 @@ public:
typedef cmProcessOutput::Encoding Encoding;
/**
- * Expand the ; separated string @a arg into multiple arguments.
- * All found arguments are appended to @a argsOut.
- */
- static void ExpandListArgument(cm::string_view arg,
- std::vector<std::string>& argsOut,
- bool emptyArgs = false);
-
- /**
- * Expand out any arguments in the string range [@a first, @a last) that have
- * ; separated strings into multiple arguments. All found arguments are
- * appended to @a argsOut.
- */
- template <class InputIt>
- static void ExpandLists(InputIt first, InputIt last,
- std::vector<std::string>& argsOut)
- {
- for (; first != last; ++first) {
- cmSystemTools::ExpandListArgument(*first, argsOut);
- }
- }
-
- /**
- * Same as ExpandListArgument but a new vector is created containing
- * the expanded arguments from the string @a arg.
- */
- static std::vector<std::string> ExpandedListArgument(cm::string_view arg,
- bool emptyArgs = false);
-
- /**
- * Same as ExpandList but a new vector is created containing the expanded
- * versions of all arguments in the string range [@a first, @a last).
- */
- template <class InputIt>
- static std::vector<std::string> ExpandedLists(InputIt first, InputIt last)
- {
- std::vector<std::string> argsOut;
- for (; first != last; ++first) {
- cmSystemTools::ExpandListArgument(*first, argsOut);
- }
- return argsOut;
- }
-
- /**
* Look for and replace registry values in a string
*/
static void ExpandRegistryValues(std::string& source,
@@ -387,7 +344,7 @@ public:
static std::string ForceToRelativePath(std::string const& local_path,
std::string const& remote_path);
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
/** Remove an environment variable */
static bool UnsetEnv(const char* value);
@@ -500,10 +457,6 @@ public:
/** Remove a directory; repeat a few times in case of locked files. */
static bool RepeatedRemoveDirectory(const std::string& dir);
- /** Convert string to long. Expected that the whole string is an integer */
- static bool StringToLong(const char* str, long* value);
- static bool StringToULong(const char* str, unsigned long* value);
-
/** Encode a string as a URL. */
static std::string EncodeURL(std::string const& in,
bool escapeSlashes = true);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 7ca2391..61b8702 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -89,7 +89,7 @@ const char* cmTargetPropertyComputer::GetSources<cmTarget>(
const char* sep = "";
for (std::string const& entry : entries) {
std::vector<std::string> files;
- cmSystemTools::ExpandListArgument(entry, files);
+ cmExpandList(entry, files);
for (std::string const& file : files) {
if (cmHasLiteralPrefix(file, "$<TARGET_OBJECTS:") &&
file.back() == '>') {
@@ -343,6 +343,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("CUDA_EXTENSIONS");
initProp("CUDA_COMPILER_LAUNCHER");
initProp("CUDA_SEPARABLE_COMPILATION");
+ initProp("CUDA_RESOLVE_DEVICE_SYMBOLS");
initProp("LINK_SEARCH_START_STATIC");
initProp("LINK_SEARCH_END_STATIC");
initProp("FOLDER");
@@ -500,7 +501,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
const std::string genName = mf->GetGlobalGenerator()->GetName();
if (cmHasLiteralPrefix(genName, "Visual Studio")) {
std::vector<std::string> props;
- cmSystemTools::ExpandListArgument(globals, props);
+ cmExpandList(globals, props);
const std::string vsGlobal = "VS_GLOBAL_";
for (const std::string& i : props) {
// split NAME=VALUE
@@ -743,7 +744,7 @@ public:
bool operator()(std::string const& entry)
{
std::vector<std::string> files;
- cmSystemTools::ExpandListArgument(entry, files);
+ cmExpandList(entry, files);
std::vector<cmSourceFileLocation> locations;
locations.reserve(files.size());
std::transform(files.begin(), files.end(), std::back_inserter(locations),
@@ -1898,7 +1899,7 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config,
std::string mapProp = "MAP_IMPORTED_CONFIG_";
mapProp += config_upper;
if (const char* mapValue = this->GetProperty(mapProp)) {
- cmSystemTools::ExpandListArgument(mapValue, mappedConfigs, true);
+ cmExpandList(mapValue, mappedConfigs, true);
}
}
@@ -1985,7 +1986,7 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config,
if (!*loc && !*imp) {
std::vector<std::string> availableConfigs;
if (const char* iconfigs = this->GetProperty("IMPORTED_CONFIGURATIONS")) {
- cmSystemTools::ExpandListArgument(iconfigs, availableConfigs);
+ cmExpandList(iconfigs, availableConfigs);
}
for (std::vector<std::string>::const_iterator aci =
availableConfigs.begin();
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 916784c..75cb413 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -15,6 +15,7 @@
#include "cmPropertyMap.h"
#include "cmRange.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTest.h"
@@ -83,7 +84,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
// Expand arguments if COMMAND_EXPAND_LISTS is set
if (this->Test->GetCommandExpandLists()) {
- argv = cmSystemTools::ExpandedLists(argv.begin(), argv.end());
+ argv = cmExpandedLists(argv.begin(), argv.end());
// Expanding lists on an empty command may have left it empty
if (argv.empty()) {
argv.emplace_back();
@@ -102,7 +103,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
const char* emulator = target->GetProperty("CROSSCOMPILING_EMULATOR");
if (emulator != nullptr && *emulator) {
std::vector<std::string> emulatorWithArgs;
- cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs);
+ cmExpandList(emulator, emulatorWithArgs);
std::string emulatorExe(emulatorWithArgs[0]);
cmSystemTools::ConvertToUnixSlashes(emulatorExe);
os << cmOutputConverter::EscapeForCMake(emulatorExe) << " ";
diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx
index da5d21e..0915986 100644
--- a/Source/cmTimestamp.cxx
+++ b/Source/cmTimestamp.cxx
@@ -109,7 +109,7 @@ time_t cmTimestamp::CreateUtcTimeTFromTm(struct tm& tm) const
time_t result = mktime(&tm);
-# ifdef CMAKE_BUILD_WITH_CMAKE
+# ifndef CMAKE_BOOTSTRAP
if (tz_was_set) {
cmSystemTools::PutEnv(tz_old);
} else {
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index ed944ac..5cc4795 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -11,6 +11,7 @@
#include "cmRange.h"
#include "cmState.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -170,7 +171,7 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
this->Makefile->GetSafeDefinition("CMAKE_CROSSCOMPILING_EMULATOR");
if (!emulator.empty()) {
std::vector<std::string> emulatorWithArgs;
- cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs);
+ cmExpandList(emulator, emulatorWithArgs);
finalCommand +=
cmSystemTools::ConvertToRunCommandPath(emulatorWithArgs[0]);
finalCommand += " ";
diff --git a/Source/cmUVHandlePtr.cxx b/Source/cmUVHandlePtr.cxx
index db67463..97c27cb 100644
--- a/Source/cmUVHandlePtr.cxx
+++ b/Source/cmUVHandlePtr.cxx
@@ -122,7 +122,7 @@ uv_handle_ptr_<T>::operator T*() const
return this->handle.get();
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
template <>
struct uv_handle_deleter<uv_async_t>
{
@@ -230,7 +230,7 @@ int uv_timer_ptr::start(uv_timer_cb cb, uint64_t timeout, uint64_t repeat)
return uv_timer_start(*this, cb, timeout, repeat);
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
uv_tty_ptr::operator uv_stream_t*() const
{
return reinterpret_cast<uv_stream_t*>(handle.get());
@@ -259,7 +259,7 @@ UV_HANDLE_PTR_INSTANTIATE_EXPLICIT(process)
UV_HANDLE_PTR_INSTANTIATE_EXPLICIT(timer)
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
UV_HANDLE_PTR_INSTANTIATE_EXPLICIT(async)
UV_HANDLE_PTR_INSTANTIATE_EXPLICIT(tty)
diff --git a/Source/cmUnsetCommand.cxx b/Source/cmUnsetCommand.cxx
index 0e903c7..3eb293a 100644
--- a/Source/cmUnsetCommand.cxx
+++ b/Source/cmUnsetCommand.cxx
@@ -24,7 +24,7 @@ bool cmUnsetCommand::InitialPass(std::vector<std::string> const& args,
// what is the variable name
auto const& envVarName = variable.substr(4, variable.size() - 5);
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmSystemTools::UnsetEnv(envVarName.c_str());
#endif
return true;
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index ed6e4d9..0e4b0af 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -750,7 +750,7 @@ void cmVisualStudio10TargetGenerator::WritePackageReferences(Elem& e0)
std::vector<std::string> packageReferences;
if (const char* vsPackageReferences =
this->GeneratorTarget->GetProperty("VS_PACKAGE_REFERENCES")) {
- cmSystemTools::ExpandListArgument(vsPackageReferences, packageReferences);
+ cmExpandList(vsPackageReferences, packageReferences);
}
if (!packageReferences.empty()) {
Elem e1(e0, "ItemGroup");
@@ -777,7 +777,7 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences(Elem& e0)
std::vector<std::string> references;
if (const char* vsDotNetReferences =
this->GeneratorTarget->GetProperty("VS_DOTNET_REFERENCES")) {
- cmSystemTools::ExpandListArgument(vsDotNetReferences, references);
+ cmExpandList(vsDotNetReferences, references);
}
cmPropertyMap const& props = this->GeneratorTarget->Target->GetProperties();
for (auto const& i : props.GetList()) {
@@ -854,7 +854,7 @@ void cmVisualStudio10TargetGenerator::WriteImports(Elem& e0)
this->GeneratorTarget->Target->GetProperty("VS_PROJECT_IMPORT");
if (imports) {
std::vector<std::string> argsSplit;
- cmSystemTools::ExpandListArgument(std::string(imports), argsSplit, false);
+ cmExpandList(std::string(imports), argsSplit, false);
for (auto& path : argsSplit) {
if (!cmsys::SystemTools::FileIsFullPath(path)) {
path = this->Makefile->GetCurrentSourceDirectory() + "/" + path;
@@ -1074,7 +1074,7 @@ void cmVisualStudio10TargetGenerator::WriteWinRTReferences(Elem& e0)
std::vector<std::string> references;
if (const char* vsWinRTReferences =
this->GeneratorTarget->GetProperty("VS_WINRT_REFERENCES")) {
- cmSystemTools::ExpandListArgument(vsWinRTReferences, references);
+ cmExpandList(vsWinRTReferences, references);
}
if (this->GlobalGenerator->TargetsWindowsPhone() &&
@@ -4027,7 +4027,7 @@ void cmVisualStudio10TargetGenerator::WriteSDKReferences(Elem& e0)
std::unique_ptr<Elem> spe1;
if (const char* vsSDKReferences =
this->GeneratorTarget->GetProperty("VS_SDK_REFERENCES")) {
- cmSystemTools::ExpandListArgument(vsSDKReferences, sdkReferences);
+ cmExpandList(vsSDKReferences, sdkReferences);
spe1 = cm::make_unique<Elem>(e0, "ItemGroup");
for (std::string const& ri : sdkReferences) {
Elem(*spe1, "SDKReference").Attribute("Include", ri);
diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx
index c33bb7e..a565a9c 100644
--- a/Source/cmXCodeScheme.cxx
+++ b/Source/cmXCodeScheme.cxx
@@ -218,7 +218,7 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
if (const char* argList =
this->Target->GetTarget()->GetProperty("XCODE_SCHEME_ARGUMENTS")) {
std::vector<std::string> arguments;
- cmSystemTools::ExpandListArgument(argList, arguments);
+ cmExpandList(argList, arguments);
if (!arguments.empty()) {
xout.StartElement("CommandLineArguments");
@@ -239,7 +239,7 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
if (const char* envList =
this->Target->GetTarget()->GetProperty("XCODE_SCHEME_ENVIRONMENT")) {
std::vector<std::string> envs;
- cmSystemTools::ExpandListArgument(envList, envs);
+ cmExpandList(envList, envs);
if (!envs.empty()) {
xout.StartElement("EnvironmentVariables");
diff --git a/Source/cm_codecvt.hxx b/Source/cm_codecvt.hxx
index 2df3961..2060584 100644
--- a/Source/cm_codecvt.hxx
+++ b/Source/cm_codecvt.hxx
@@ -18,7 +18,7 @@ public:
ANSI
};
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
codecvt(Encoding e);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 3cc6776..440a7b1 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -31,7 +31,7 @@
#include "cm_string_view.hxx"
#include "cm_sys_stat.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cm_jsoncpp_writer.h"
# include "cmFileAPI.h"
@@ -40,11 +40,11 @@
# include <unordered_map>
#endif
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# define CMAKE_USE_ECLIPSE
#endif
-#if defined(__MINGW32__) && !defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(__MINGW32__) && defined(CMAKE_BOOTSTRAP)
# define CMAKE_BOOT_MINGW
#endif
@@ -72,7 +72,7 @@
# include "cmGlobalWatcomWMakeGenerator.h"
#endif
#include "cmGlobalUnixMakefileGenerator3.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmGlobalNinjaGenerator.h"
#endif
#include "cmExtraCodeLiteGenerator.h"
@@ -92,7 +92,7 @@
#endif
#if defined(__APPLE__)
-# if defined(CMAKE_BUILD_WITH_CMAKE)
+# if !defined(CMAKE_BOOTSTRAP)
# include "cmGlobalXCodeGenerator.h"
# define CMAKE_USE_XCODE 1
@@ -115,7 +115,7 @@
namespace {
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
typedef std::unordered_map<std::string, Json::Value> JsonValueMapType;
#endif
@@ -134,7 +134,7 @@ static void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/,
cmake::cmake(Role role, cmState::Mode mode)
: FileTimeCache(cm::make_unique<cmFileTimeCache>())
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
, VariableWatch(cm::make_unique<cmVariableWatch>())
#endif
, State(cm::make_unique<cmState>())
@@ -203,7 +203,7 @@ cmake::~cmake()
cmDeleteAll(this->Generators);
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
Json::Value cmake::ReportVersionJson() const
{
Json::Value version = Json::objectValue;
@@ -262,7 +262,7 @@ Json::Value cmake::ReportCapabilitiesJson() const
std::string cmake::ReportCapabilities() const
{
std::string result;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
Json::FastWriter writer;
result = writer.write(this->ReportCapabilitiesJson());
#else
@@ -530,7 +530,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
} else if (mode == "COMPILE") {
std::string includes = mf->GetSafeDefinition("PACKAGE_INCLUDE_DIRS");
std::vector<std::string> includeDirs;
- cmSystemTools::ExpandListArgument(includes, includeDirs);
+ cmExpandList(includes, includeDirs);
gg->CreateGenerationObjects();
cmLocalGenerator* lg = gg->LocalGenerators[0];
@@ -547,7 +547,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
std::string libs = mf->GetSafeDefinition("PACKAGE_LIBRARIES");
std::vector<std::string> libList;
- cmSystemTools::ExpandListArgument(libs, libList);
+ cmExpandList(libs, libList);
for (std::string const& lib : libList) {
tgt->AddLinkLibrary(*mf, lib, GENERAL_LibraryType);
}
@@ -968,7 +968,7 @@ int cmake::AddCMakePaths()
this->AddCacheEntry("CMAKE_COMMAND",
cmSystemTools::GetCMakeCommand().c_str(),
"Path to CMake executable.", cmStateEnums::INTERNAL);
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
this->AddCacheEntry(
"CMAKE_CTEST_COMMAND", cmSystemTools::GetCTestCommand().c_str(),
"Path to ctest program executable.", cmStateEnums::INTERNAL);
@@ -994,7 +994,7 @@ int cmake::AddCMakePaths()
void cmake::AddDefaultExtraGenerators()
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->ExtraGenerators.push_back(cmExtraCodeBlocksGenerator::GetFactory());
this->ExtraGenerators.push_back(cmExtraCodeLiteGenerator::GetFactory());
this->ExtraGenerators.push_back(cmExtraSublimeTextGenerator::GetFactory());
@@ -1251,7 +1251,7 @@ struct SaveCacheEntry
int cmake::HandleDeleteCacheVariables(const std::string& var)
{
std::vector<std::string> argsSplit;
- cmSystemTools::ExpandListArgument(std::string(var), argsSplit, true);
+ cmExpandList(std::string(var), argsSplit, true);
// erase the property to avoid infinite recursion
this->State->SetGlobalProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_", "");
if (this->State->GetIsInTryCompile()) {
@@ -1521,7 +1521,7 @@ int cmake::ActualConfigure()
this->TruncateOutputLog("CMakeError.log");
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->FileAPI = cm::make_unique<cmFileAPI>(this);
this->FileAPI->ReadQueries();
#endif
@@ -1789,7 +1789,7 @@ int cmake::Generate()
// for the Visual Studio and Xcode generators.)
this->SaveCache(this->GetHomeOutputDirectory());
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->FileAPI->WriteReplies();
#endif
@@ -1895,7 +1895,7 @@ void cmake::AddDefaultGenerators()
this->Generators.push_back(cmGlobalMinGWMakefileGenerator::NewFactory());
#endif
this->Generators.push_back(cmGlobalUnixMakefileGenerator3::NewFactory());
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# if defined(__linux__) || defined(_WIN32)
this->Generators.push_back(cmGlobalGhsMultiGenerator::NewFactory());
# endif
@@ -2054,7 +2054,7 @@ std::vector<cmDocumentationEntry> cmake::GetGeneratorsDocumentation()
void cmake::PrintGeneratorList()
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmDocumentation doc;
auto generators = this->GetGeneratorsDocumentation();
doc.AppendSection("Generators", generators);
@@ -2159,7 +2159,7 @@ int cmake::CheckBuildSystem()
// If any byproduct of makefile generation is missing we must re-run.
std::vector<std::string> products;
if (const char* productStr = mf.GetDefinition("CMAKE_MAKEFILE_PRODUCTS")) {
- cmSystemTools::ExpandListArgument(productStr, products);
+ cmExpandList(productStr, products);
}
for (std::string const& p : products) {
if (!(cmSystemTools::FileExists(p) || cmSystemTools::FileIsSymlink(p))) {
@@ -2178,8 +2178,8 @@ int cmake::CheckBuildSystem()
const char* dependsStr = mf.GetDefinition("CMAKE_MAKEFILE_DEPENDS");
const char* outputsStr = mf.GetDefinition("CMAKE_MAKEFILE_OUTPUTS");
if (dependsStr && outputsStr) {
- cmSystemTools::ExpandListArgument(dependsStr, depends);
- cmSystemTools::ExpandListArgument(outputsStr, outputs);
+ cmExpandList(dependsStr, depends);
+ cmExpandList(outputsStr, outputs);
}
if (depends.empty() || outputs.empty()) {
// Not enough information was provided to do the test. Just rerun.
@@ -2270,14 +2270,6 @@ void cmake::TruncateOutputLog(const char* fname)
}
}
-inline std::string removeQuotes(const std::string& s)
-{
- if (s.front() == '\"' && s.back() == '\"') {
- return s.substr(1, s.size() - 2);
- }
- return s;
-}
-
void cmake::MarkCliAsUsed(const std::string& variable)
{
this->UsedCliVariables[variable] = true;
@@ -2285,7 +2277,7 @@ void cmake::MarkCliAsUsed(const std::string& variable)
void cmake::GenerateGraphViz(const std::string& fileName) const
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmGraphVizWriter gvWriter(this->GetGlobalGenerator());
std::string settingsFile = this->GetHomeOutputDirectory();
@@ -2563,7 +2555,7 @@ std::vector<std::string> cmake::GetDebugConfigs()
if (const char* config_list =
this->State->GetGlobalProperty("DEBUG_CONFIGURATIONS")) {
// Expand the specified list and convert to upper-case.
- cmSystemTools::ExpandListArgument(config_list, configs);
+ cmExpandList(config_list, configs);
std::transform(configs.begin(), configs.end(), configs.begin(),
cmSystemTools::UpperCase);
}
@@ -2744,7 +2736,7 @@ bool cmake::Open(const std::string& dir, bool dryRun)
void cmake::WatchUnusedCli(const std::string& var)
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
this->VariableWatch->AddWatch(var, cmWarnUnusedCliWarning, this);
if (this->UsedCliVariables.find(var) == this->UsedCliVariables.end()) {
this->UsedCliVariables[var] = false;
@@ -2754,7 +2746,7 @@ void cmake::WatchUnusedCli(const std::string& var)
void cmake::UnwatchUnusedCli(const std::string& var)
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
this->VariableWatch->RemoveWatch(var, cmWarnUnusedCliWarning);
this->UsedCliVariables.erase(var);
#endif
@@ -2762,7 +2754,7 @@ void cmake::UnwatchUnusedCli(const std::string& var)
void cmake::RunCheckForUnusedVariables()
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
bool haveUnused = false;
std::ostringstream msg;
msg << "Manually-specified variables were not used by the project:";
diff --git a/Source/cmake.h b/Source/cmake.h
index 92494ae..4c73519 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -20,7 +20,7 @@
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cm_jsoncpp_value.h"
#endif
@@ -145,7 +145,7 @@ public:
cmake(cmake const&) = delete;
cmake& operator=(cmake const&) = delete;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
Json::Value ReportVersionJson() const;
Json::Value ReportCapabilitiesJson() const;
#endif
@@ -334,7 +334,7 @@ public:
//! this is called by generators to update the progress
void UpdateProgress(const std::string& msg, float prog);
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
//! Get the variable watch object
cmVariableWatch* GetVariableWatch() { return this->VariableWatch.get(); }
#endif
@@ -570,7 +570,7 @@ private:
std::string GraphVizFile;
InstalledFilesMap InstalledFiles;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
std::unique_ptr<cmVariableWatch> VariableWatch;
std::unique_ptr<cmFileAPI> FileAPI;
#endif
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 10a6825..74c0d0f 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -12,7 +12,7 @@
#include "cmake.h"
#include "cmcmd.h"
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
# include "cmDocumentation.h"
# include "cmDynamicLoader.h"
#endif
@@ -20,7 +20,7 @@
#include "cm_uv.h"
#include "cmsys/Encoding.hxx"
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
# include "cmsys/ConsoleBuf.hxx"
#endif
@@ -33,7 +33,7 @@
#include <vector>
namespace {
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
const char* cmDocumentationName[][2] = {
{ nullptr, " cmake - Cross-Platform Makefile Generator." },
{ nullptr, nullptr }
@@ -156,7 +156,7 @@ int do_cmake(int ac, char const* const* av)
return 1;
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmDocumentation doc;
doc.addCMakeStandardDocSections();
if (doc.CheckOptions(ac, av)) {
@@ -321,7 +321,7 @@ int extract_job_number(int& index, char const* current, char const* next,
unsigned long numJobs = 0;
if (jobString.empty()) {
jobs = cmake::DEFAULT_BUILD_PARALLEL_LEVEL;
- } else if (cmSystemTools::StringToULong(jobString.c_str(), &numJobs)) {
+ } else if (cmStrToULong(jobString, &numJobs)) {
if (numJobs == 0) {
std::cerr
<< "The <jobs> value requires a positive integer argument.\n\n";
@@ -339,7 +339,7 @@ int extract_job_number(int& index, char const* current, char const* next,
int do_build(int ac, char const* const* av)
{
-#ifndef CMAKE_BUILD_WITH_CMAKE
+#ifdef CMAKE_BOOTSTRAP
std::cerr << "This cmake does not support --build\n";
return -1;
#else
@@ -439,7 +439,7 @@ int do_build(int ac, char const* const* av)
jobs = cmake::DEFAULT_BUILD_PARALLEL_LEVEL;
} else {
unsigned long numJobs = 0;
- if (cmSystemTools::StringToULong(parallel.c_str(), &numJobs)) {
+ if (cmStrToULong(parallel, &numJobs)) {
if (numJobs == 0) {
std::cerr << "The CMAKE_BUILD_PARALLEL_LEVEL environment variable "
"requires a positive integer argument.\n\n";
@@ -503,7 +503,7 @@ int do_build(int ac, char const* const* av)
int do_install(int ac, char const* const* av)
{
-#ifndef CMAKE_BUILD_WITH_CMAKE
+#ifdef CMAKE_BOOTSTRAP
std::cerr << "This cmake does not support --install\n";
return -1;
#else
@@ -624,7 +624,7 @@ int do_install(int ac, char const* const* av)
int do_open(int ac, char const* const* av)
{
-#ifndef CMAKE_BUILD_WITH_CMAKE
+#ifdef CMAKE_BOOTSTRAP
std::cerr << "This cmake does not support --open\n";
return -1;
#else
@@ -669,7 +669,7 @@ int do_open(int ac, char const* const* av)
int main(int ac, char const* const* av)
{
cmSystemTools::EnsureStdPipes();
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
// Replace streambuf so we can output Unicode to console
cmsys::ConsoleBuf::Manager consoleOut(std::cout);
consoleOut.SetUTF8Pipes();
@@ -699,7 +699,7 @@ int main(int ac, char const* const* av)
}
}
int ret = do_cmake(ac, av);
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmDynamicLoader::FlushCache();
#endif
uv_loop_close(uv_default_loop());
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index aecc978..ba2788e 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -19,18 +19,18 @@
#include "cmVersion.h"
#include "cmake.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback.
# include "cmServer.h"
# include "cmServerConnection.h"
#endif
-#if defined(CMAKE_BUILD_WITH_CMAKE) && defined(_WIN32)
+#if !defined(CMAKE_BOOTSTRAP) && defined(_WIN32)
# include "bindexplib.h"
# include "cmsys/ConsoleBuf.hxx"
#endif
-#if defined(CMAKE_BUILD_WITH_CMAKE) && defined(_WIN32) && !defined(__CYGWIN__)
+#if !defined(CMAKE_BOOTSTRAP) && defined(_WIN32) && !defined(__CYGWIN__)
# include "cmVisualStudioWCEPlatformParser.h"
#endif
@@ -61,7 +61,7 @@ void CMakeCommandUsage(const char* program)
{
std::ostringstream errorStream;
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
/* clang-format off */
errorStream
<< "cmake version " << cmVersion::GetCMakeVersion() << "\n";
@@ -175,7 +175,7 @@ static int HandleIWYU(const std::string& runCmd,
// Construct the iwyu command line by taking what was given
// and adding all the arguments we give to the compiler.
std::vector<std::string> iwyu_cmd;
- cmSystemTools::ExpandListArgument(runCmd, iwyu_cmd, true);
+ cmExpandList(runCmd, iwyu_cmd, true);
cmAppend(iwyu_cmd, orig_cmd.begin() + 1, orig_cmd.end());
// Run the iwyu command line. Capture its stderr and hide its stdout.
// Ignore its return code because the tool always returns non-zero.
@@ -204,8 +204,7 @@ static int HandleTidy(const std::string& runCmd, const std::string& sourceFile,
// automatically skip over the compiler itself and extract the
// options.
int ret;
- std::vector<std::string> tidy_cmd =
- cmSystemTools::ExpandedListArgument(runCmd, true);
+ std::vector<std::string> tidy_cmd = cmExpandedList(runCmd, true);
tidy_cmd.push_back(sourceFile);
tidy_cmd.emplace_back("--");
cmAppend(tidy_cmd, orig_cmd);
@@ -266,7 +265,7 @@ static int HandleCppLint(const std::string& runCmd,
{
// Construct the cpplint command line.
std::vector<std::string> cpplint_cmd;
- cmSystemTools::ExpandListArgument(runCmd, cpplint_cmd, true);
+ cmExpandList(runCmd, cpplint_cmd, true);
cpplint_cmd.push_back(sourceFile);
// Run the cpplint command line. Capture its output.
@@ -295,7 +294,7 @@ static int HandleCppCheck(const std::string& runCmd,
{
// Construct the cpplint command line.
std::vector<std::string> cppcheck_cmd;
- cmSystemTools::ExpandListArgument(runCmd, cppcheck_cmd, true);
+ cmExpandList(runCmd, cppcheck_cmd, true);
// extract all the -D, -U, and -I options from the compile line
for (auto const& opt : orig_cmd) {
if (opt.size() > 2) {
@@ -408,7 +407,7 @@ int cmcmd::HandleCoCompileCommands(std::vector<std::string> const& args)
if (cmHasLiteralPrefix(arg, "--source=")) {
sourceFile = arg.substr(9);
} else if (cmHasLiteralPrefix(arg, "--launcher=")) {
- cmSystemTools::ExpandListArgument(arg.substr(11), launchers, true);
+ cmExpandList(arg.substr(11), launchers, true);
} else {
// if it was not a co-compiler or --source/--launcher then error
std::cerr << "__run_co_compile given unknown argument: " << arg
@@ -561,7 +560,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
return 0;
}
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
else if (args[1] == "__create_def") {
if (args.size() < 4) {
std::cerr
@@ -654,7 +653,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
return 1;
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
if (args[1] == "environment") {
for (auto const& env : cmSystemTools::GetEnvironmentVariables()) {
std::cout << env << std::endl;
@@ -994,7 +993,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
return cmcmd::ExecuteLinkScript(args);
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
// Internal CMake ninja dependency scanning support.
if (args[1] == "cmake_ninja_depends") {
return cmcmd_cmake_ninja_depends(args.begin() + 2, args.end());
@@ -1029,7 +1028,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
return cmcmd::ExecuteEchoColor(args);
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
if ((args[1] == "cmake_autogen") && (args.size() >= 4)) {
cmQtAutoMocUic autoGen;
std::string const& infoDir = args[2];
@@ -1210,7 +1209,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
return 1;
}
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
cmConnection* conn;
if (isDebug) {
conn = new cmServerStdIoConnection;
@@ -1231,7 +1230,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
return 1;
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
// Internal CMake Fortran module support.
if (args[1] == "cmake_copy_f90_mod" && args.size() >= 4) {
return cmDependsFortran::CopyModule(args) ? 0 : 1;
@@ -1547,7 +1546,7 @@ int cmcmd::ExecuteLinkScript(std::vector<std::string> const& args)
int cmcmd::WindowsCEEnvironment(const char* version, const std::string& name)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE) && defined(_WIN32) && !defined(__CYGWIN__)
+#if !defined(CMAKE_BOOTSTRAP) && defined(_WIN32) && !defined(__CYGWIN__)
cmVisualStudioWCEPlatformParser parser(name.c_str());
parser.ParseVersion(version);
if (parser.Found()) {
@@ -1605,7 +1604,7 @@ private:
// still works.
int cmcmd::VisualStudioLink(std::vector<std::string> const& args, int type)
{
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
// Replace streambuf so we output in the system codepage. CMake is set up
// to output in Unicode (see SetUTF8Pipes) but the Visual Studio linker
// outputs using the system codepage so we need to change behavior when
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 3b3630f..77a84fd 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -8,7 +8,7 @@
#include "cmSystemTools.h"
#include "cmsys/Encoding.hxx"
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
# include "cmsys/ConsoleBuf.hxx"
#endif
#include <iostream>
@@ -144,7 +144,7 @@ static const char* cmDocumentationOptions[][2] = {
int main(int argc, char const* const* argv)
{
cmSystemTools::EnsureStdPipes();
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
// Replace streambuf so we can output Unicode to console
cmsys::ConsoleBuf::Manager consoleOut(std::cout);
consoleOut.SetUTF8Pipes();
diff --git a/Tests/CMakeLib/testStringAlgorithms.cxx b/Tests/CMakeLib/testStringAlgorithms.cxx
index 55d2a8f..a92a910 100644
--- a/Tests/CMakeLib/testStringAlgorithms.cxx
+++ b/Tests/CMakeLib/testStringAlgorithms.cxx
@@ -51,6 +51,29 @@ int testStringAlgorithms(int /*unused*/, char* /*unused*/ [])
}
// ----------------------------------------------------------------------
+ // Test cmRemoveQuotes
+ {
+ auto test = [&assert_string](cm::string_view source,
+ cm::string_view expected,
+ cm::string_view title) {
+ assert_string(cmRemoveQuotes(source), expected, title);
+ };
+
+ test("", "", "cmRemoveQuotes empty");
+ test("\"", "\"", "cmRemoveQuotes single quote");
+ test("\"\"", "", "cmRemoveQuotes double quote");
+ test("\"a", "\"a", "cmRemoveQuotes quote char");
+ test("\"ab", "\"ab", "cmRemoveQuotes quote char char");
+ test("a\"", "a\"", "cmRemoveQuotes char quote");
+ test("ab\"", "ab\"", "cmRemoveQuotes char char quote");
+ test("a", "a", "cmRemoveQuotes single char");
+ test("ab", "ab", "cmRemoveQuotes two chars");
+ test("abc", "abc", "cmRemoveQuotes three chars");
+ test("\"abc\"", "abc", "cmRemoveQuotes quoted chars");
+ test("\"\"abc\"\"", "\"abc\"", "cmRemoveQuotes quoted quoted chars");
+ }
+
+ // ----------------------------------------------------------------------
// Test cmEscapeQuotes
{
assert_string(cmEscapeQuotes("plain"), "plain", "cmEscapeQuotes plain");
@@ -167,5 +190,40 @@ int testStringAlgorithms(int /*unused*/, char* /*unused*/ [])
assert_ok(!cmHasLiteralSuffix(str, "ab"), "cmHasLiteralPrefix string not");
}
+ // ----------------------------------------------------------------------
+ // Test cmStrToLong
+ {
+ long value;
+ assert_ok(cmStrToLong("1", &value) && value == 1,
+ "cmStrToLong parses a positive decimal integer.");
+ assert_ok(cmStrToLong(" 1", &value) && value == 1,
+ "cmStrToLong parses a decimal integer after whitespace.");
+
+ assert_ok(cmStrToLong("-1", &value) && value == -1,
+ "cmStrToLong parses a negative decimal integer.");
+ assert_ok(
+ cmStrToLong(" -1", &value) && value == -1,
+ "cmStrToLong parses a negative decimal integer after whitespace.");
+
+ assert_ok(!cmStrToLong("1x", &value),
+ "cmStrToLong rejects trailing content.");
+ }
+
+ // ----------------------------------------------------------------------
+ // Test cmStrToULong
+ {
+ unsigned long value;
+ assert_ok(cmStrToULong("1", &value) && value == 1,
+ "cmStrToULong parses a decimal integer.");
+ assert_ok(cmStrToULong(" 1", &value) && value == 1,
+ "cmStrToULong parses a decimal integer after whitespace.");
+ assert_ok(!cmStrToULong("-1", &value),
+ "cmStrToULong rejects a negative number.");
+ assert_ok(!cmStrToULong(" -1", &value),
+ "cmStrToULong rejects a negative number after whitespace.");
+ assert_ok(!cmStrToULong("1x", &value),
+ "cmStrToULong rejects trailing content.");
+ }
+
return failed;
}
diff --git a/Tests/CMakeLib/testSystemTools.cxx b/Tests/CMakeLib/testSystemTools.cxx
index 121e639..0a757df 100644
--- a/Tests/CMakeLib/testSystemTools.cxx
+++ b/Tests/CMakeLib/testSystemTools.cxx
@@ -94,21 +94,5 @@ int testSystemTools(int /*unused*/, char* /*unused*/ [])
cmPassed("cmSystemTools::strverscmp working");
}
- // ----------------------------------------------------------------------
- // Test cmSystemTools::StringToULong
- {
- unsigned long value;
- cmAssert(cmSystemTools::StringToULong("1", &value) && value == 1,
- "StringToULong parses a decimal integer.");
- cmAssert(cmSystemTools::StringToULong(" 1", &value) && value == 1,
- "StringToULong parses a decimal integer after whitespace.");
- cmAssert(!cmSystemTools::StringToULong("-1", &value),
- "StringToULong rejects a negative number.");
- cmAssert(!cmSystemTools::StringToULong(" -1", &value),
- "StringToULong rejects a negative number after whitespace.");
- cmAssert(!cmSystemTools::StringToULong("1x", &value),
- "StringToULong rejects trailing content.");
- }
-
return failed;
}
diff --git a/Tests/CudaOnly/DontResolveDeviceSymbols/CMakeLists.txt b/Tests/CudaOnly/DontResolveDeviceSymbols/CMakeLists.txt
index 6190089..6e3697f 100644
--- a/Tests/CudaOnly/DontResolveDeviceSymbols/CMakeLists.txt
+++ b/Tests/CudaOnly/DontResolveDeviceSymbols/CMakeLists.txt
@@ -27,12 +27,12 @@ endif()
string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=[compute_30] -gencode arch=compute_50,code=\\\"compute_50\\\"")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CUDA_STANDARD 11)
+set(CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS OFF)
add_library(CUDANoDeviceResolve SHARED file1.cu)
set_target_properties(CUDANoDeviceResolve
PROPERTIES
CUDA_SEPARABLE_COMPILATION ON
- CUDA_RESOLVE_DEVICE_SYMBOLS OFF
POSITION_INDEPENDENT_CODE ON)
if(MSVC)
target_link_options(CUDANoDeviceResolve PRIVATE "/FORCE:UNRESOLVED")
diff --git a/bootstrap b/bootstrap
index c97a5d4..4581239 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1362,7 +1362,6 @@ cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_BINARY_DIR \"${CMAKE_
cmake_report cmConfigure.h${_tmp} "#define CMake_DEFAULT_RECURSION_LIMIT 400"
cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insalled\""
cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\""
-cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP"
cmake_report cmConfigure.h${_tmp} "#define CM_FALLTHROUGH"
# Regenerate configured headers
@@ -1408,7 +1407,6 @@ if ${cmake_system_mingw}; then
uv_c_flags="${uv_c_flags} -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600"
libs="${libs} -lws2_32 -lpsapi -liphlpapi -lshell32 -luserenv -lole32 -loleaut32"
else
- uv_c_flags="${uv_c_flags} -DCMAKE_BOOTSTRAP"
case "${cmake_system}" in
*AIX*)
uv_c_flags="${uv_c_flags} -D_ALL_SOURCE -D_XOPEN_SOURCE=500 -D_LINUX_SOURCE_COMPAT"
@@ -1469,11 +1467,13 @@ cmake_cxx_flags_SystemTools="
-DKWSYS_CXX_HAS_UTIMES=${KWSYS_CXX_HAS_UTIMES}
"
cmake_c_flags="${cmake_c_flags} \
+ -DCMAKE_BOOTSTRAP \
-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\"`"
cmake_cxx_flags="${cmake_cxx_flags} \
+ -DCMAKE_BOOTSTRAP \
-I`cmake_escape \"${cmake_bootstrap_dir}\"` \
-I`cmake_escape \"${cmake_source_dir}/Source\"` \
-I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \