summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/add_custom_command.rst3
-rw-r--r--Help/command/add_custom_target.rst3
-rw-r--r--Help/manual/cmake-properties.7.rst4
-rw-r--r--Help/prop_sf/GENERATED.rst33
-rw-r--r--Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst2
-rw-r--r--Help/prop_tgt/MACHO_COMPATIBILITY_VERSION.rst14
-rw-r--r--Help/prop_tgt/MACHO_CURRENT_VERSION.rst13
-rw-r--r--Help/prop_tgt/OSX_COMPATIBILITY_VERSION.rst14
-rw-r--r--Help/prop_tgt/OSX_CURRENT_VERSION.rst13
-rw-r--r--Help/prop_tgt/SOVERSION.rst4
-rw-r--r--Help/prop_tgt/VERSION.rst4
-rw-r--r--Help/release/3.17.rst8
-rw-r--r--Modules/CMakeCUDAInformation.cmake10
-rw-r--r--Modules/CMakeFindFrameworks.cmake26
-rw-r--r--Modules/CMakeSwiftInformation.cmake10
-rw-r--r--Modules/Compiler/AppleClang-CXX.cmake5
-rw-r--r--Modules/Compiler/AppleClang-OBJCXX.cmake5
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake2
-rw-r--r--Modules/FindCUDAToolkit.cmake9
-rw-r--r--Modules/FindPython/Support.cmake3
-rw-r--r--Modules/Platform/Windows-NVIDIA-CUDA.cmake8
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CTest/cmCTestCurl.cxx2
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx44
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.h3
-rw-r--r--Source/CTest/cmCTestRunTest.cxx61
-rw-r--r--Source/CTest/cmCTestRunTest.h13
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx2
-rw-r--r--Source/CTest/cmCTestVC.cxx2
-rw-r--r--Source/CTest/cmCTestVC.h2
-rw-r--r--Source/CTest/cmProcess.cxx28
-rw-r--r--Source/CTest/cmProcess.h11
-rw-r--r--Source/cmBuildCommand.cxx2
-rw-r--r--Source/cmBuildNameCommand.cxx4
-rw-r--r--Source/cmCommonTargetGenerator.cxx2
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx6
-rw-r--r--Source/cmFindLibraryCommand.cxx4
-rw-r--r--Source/cmFindPackageCommand.cxx4
-rw-r--r--Source/cmFindPathCommand.cxx4
-rw-r--r--Source/cmFindProgramCommand.cxx4
-rw-r--r--Source/cmGetFilenameComponentCommand.cxx4
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx34
-rw-r--r--Source/cmGlobalGenerator.cxx4
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx26
-rw-r--r--Source/cmGlobalGhsMultiGenerator.h2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx8
-rw-r--r--Source/cmInstalledFile.cxx8
-rw-r--r--Source/cmInstalledFile.h4
-rw-r--r--Source/cmLinkLineComputer.cxx8
-rw-r--r--Source/cmLocalGenerator.cxx6
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx5
-rw-r--r--Source/cmMakefile.h6
-rw-r--r--Source/cmProjectCommand.cxx8
-rw-r--r--Source/cmSetCommand.cxx4
-rw-r--r--Source/cmSetPropertyCommand.cxx13
-rw-r--r--Source/cmSiteNameCommand.cxx3
-rw-r--r--Source/cmTarget.cxx2
-rw-r--r--Source/cmUtilitySourceCommand.cxx12
-rw-r--r--Tests/RunCMake/MacOSVersions/MacOSVersions.cmake4
60 files changed, 322 insertions, 234 deletions
diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst
index 69d6e9a..9279748 100644
--- a/Help/command/add_custom_command.rst
+++ b/Help/command/add_custom_command.rst
@@ -68,6 +68,9 @@ The options are:
order-only dependencies to ensure the byproducts will be
available before their dependents build.
+ The :ref:`Makefile Generators` will remove ``BYPRODUCTS`` and other
+ :prop_sf:`GENERATED` files during ``make clean``.
+
``COMMAND``
Specify the command-line(s) to execute at build time.
If more than one ``COMMAND`` is specified they will be executed in order,
diff --git a/Help/command/add_custom_target.rst b/Help/command/add_custom_target.rst
index 2d5f5f0..56ab414 100644
--- a/Help/command/add_custom_target.rst
+++ b/Help/command/add_custom_target.rst
@@ -49,6 +49,9 @@ The options are:
order-only dependencies to ensure the byproducts will be
available before their dependents build.
+ The :ref:`Makefile Generators` will remove ``BYPRODUCTS`` and other
+ :prop_sf:`GENERATED` files during ``make clean``.
+
``COMMAND``
Specify the command-line(s) to execute at build time.
If more than one ``COMMAND`` is specified they will be executed in order,
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 5197bb6..e552377 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -286,6 +286,8 @@ Properties on Targets
/prop_tgt/LINK_WHAT_YOU_USE
/prop_tgt/LOCATION_CONFIG
/prop_tgt/LOCATION
+ /prop_tgt/MACHO_COMPATIBILITY_VERSION
+ /prop_tgt/MACHO_CURRENT_VERSION
/prop_tgt/MACOSX_BUNDLE_INFO_PLIST
/prop_tgt/MACOSX_BUNDLE
/prop_tgt/MACOSX_FRAMEWORK_INFO_PLIST
@@ -304,8 +306,6 @@ Properties on Targets
/prop_tgt/OBJCXX_STANDARD_REQUIRED
/prop_tgt/OSX_ARCHITECTURES_CONFIG
/prop_tgt/OSX_ARCHITECTURES
- /prop_tgt/OSX_CURRENT_VERSION
- /prop_tgt/OSX_COMPATIBILITY_VERSION
/prop_tgt/OUTPUT_NAME_CONFIG
/prop_tgt/OUTPUT_NAME
/prop_tgt/PDB_NAME_CONFIG
diff --git a/Help/prop_sf/GENERATED.rst b/Help/prop_sf/GENERATED.rst
index d430ee2..48ff70c 100644
--- a/Help/prop_sf/GENERATED.rst
+++ b/Help/prop_sf/GENERATED.rst
@@ -4,16 +4,29 @@ GENERATED
Is this source file generated as part of the build or CMake process.
Tells the internal CMake engine that a source file is generated by an outside
-process such as another build step, or the execution of CMake itself. This
-information is then used to exempt the file from any existence or validity
-checks. Generated files are created by the execution of commands such as
-:command:`add_custom_command` and :command:`file(GENERATE)`.
-
-When a generated file created by an :command:`add_custom_command` command
-is explicitly listed as a source file for any target in the same
-directory scope (which usually means the same ``CMakeLists.txt`` file),
-CMake will automatically create a dependency to make sure the file is
-generated before building that target.
+process such as another build step, or the execution of CMake itself.
+This information is then used to exempt the file from any existence or
+validity checks.
+
+Any file that is
+
+- created by the execution of commands such as
+ :command:`add_custom_command` and :command:`file(GENERATE)`
+- listed as one of the ``BYPRODUCTS`` of an :command:`add_custom_command`
+ or :command:`add_custom_target` command, or
+- created by a CMake ``AUTOGEN`` operation such as :prop_tgt:`AUTOMOC`,
+ :prop_tgt:`AUTORCC`, or :prop_tgt:`AUTOUIC`
+
+will be marked with the ``GENERATED`` property.
+
+When a generated file created as the ``OUTPUT`` of an
+:command:`add_custom_command` command is explicitly listed as a source file
+for any target in the same directory scope (which usually means the same
+``CMakeLists.txt`` file), CMake will automatically create a dependency to
+make sure the file is generated before building that target.
+
+The :ref:`Makefile Generators` will remove ``GENERATED`` files during
+``make clean``.
Generated sources may be hidden in some IDE tools, while in others they might
be shown. For the special case of sources generated by CMake's :prop_tgt:`AUTOMOC`
diff --git a/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst b/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst
index d5c5e14..92b52a3 100644
--- a/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst
+++ b/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst
@@ -33,4 +33,4 @@ If :prop_tgt:`AUTOMOC` or :prop_tgt:`AUTOUIC` depends on a file that is either
:prop_sf:`SKIP_AUTOUIC`, :prop_sf:`SKIP_AUTOGEN` or :policy:`CMP0071` or
- a file that isn't in the origin target's sources
-it must added to :prop_tgt:`AUTOGEN_TARGET_DEPENDS`.
+it must be added to :prop_tgt:`AUTOGEN_TARGET_DEPENDS`.
diff --git a/Help/prop_tgt/MACHO_COMPATIBILITY_VERSION.rst b/Help/prop_tgt/MACHO_COMPATIBILITY_VERSION.rst
new file mode 100644
index 0000000..f3fedba
--- /dev/null
+++ b/Help/prop_tgt/MACHO_COMPATIBILITY_VERSION.rst
@@ -0,0 +1,14 @@
+MACHO_COMPATIBILITY_VERSION
+---------------------------
+
+What compatibility version number is this target for Mach-O binaries.
+
+For shared libraries on Mach-O systems (e.g. macOS, iOS)
+the ``MACHO_COMPATIBILITY_VERSION`` property correspond to
+``compatibility version`` and :prop_tgt:`MACHO_CURRENT_VERSION` to
+``current version``.
+See the :prop_tgt:`FRAMEWORK` target property for an example.
+
+Versions of Mach-O binaries may be checked with the ``otool -L <binary>``
+command. If ``MACHO_COMPATIBILITY_VERSION`` is not set, the value of
+the :prop_tgt:`SOVERSION` property will be used.
diff --git a/Help/prop_tgt/MACHO_CURRENT_VERSION.rst b/Help/prop_tgt/MACHO_CURRENT_VERSION.rst
new file mode 100644
index 0000000..4a1d3f0
--- /dev/null
+++ b/Help/prop_tgt/MACHO_CURRENT_VERSION.rst
@@ -0,0 +1,13 @@
+MACHO_CURRENT_VERSION
+---------------------
+
+What current version number is this target for Mach-O binaries.
+
+For shared libraries on Mach-O systems (e.g. macOS, iOS)
+the :prop_tgt:`MACHO_COMPATIBILITY_VERSION` property correspond to
+``compatibility version`` and ``MACHO_CURRENT_VERSION`` to ``current version``.
+See the :prop_tgt:`FRAMEWORK` target property for an example.
+
+Versions of Mach-O binaries may be checked with the ``otool -L <binary>``
+command. If ``MACHO_CURRENT_VERSION`` is not set, the value of
+the :prop_tgt:`VERSION` property will be used.
diff --git a/Help/prop_tgt/OSX_COMPATIBILITY_VERSION.rst b/Help/prop_tgt/OSX_COMPATIBILITY_VERSION.rst
deleted file mode 100644
index 5432b9a7..0000000
--- a/Help/prop_tgt/OSX_COMPATIBILITY_VERSION.rst
+++ /dev/null
@@ -1,14 +0,0 @@
-OSX_COMPATIBILITY_VERSION
--------------------------
-
-What compatibility version number is this target for OSX.
-
-For shared libraries on Mach-O systems (e.g. macOS, iOS)
-the ``OSX_COMPATIBILITY_VERSION`` property correspond to
-``compatibility version`` and :prop_tgt:`OSX_CURRENT_VERSION` to
-``current version``.
-See the :prop_tgt:`FRAMEWORK` target property for an example.
-
-Versions of Mach-O binaries may be checked with the ``otool -L <binary>``
-command. If ``OSX_COMPATIBILITY_VERSION`` is not set, the value of
-the :prop_tgt:``SOVERSION`` property will be used.
diff --git a/Help/prop_tgt/OSX_CURRENT_VERSION.rst b/Help/prop_tgt/OSX_CURRENT_VERSION.rst
deleted file mode 100644
index 609924d..0000000
--- a/Help/prop_tgt/OSX_CURRENT_VERSION.rst
+++ /dev/null
@@ -1,13 +0,0 @@
-OSX_CURRENT_VERSION
--------------------
-
-What current version number is this target for OSX.
-
-For shared libraries on Mach-O systems (e.g. macOS, iOS)
-the :prop_tgt:`OSX_COMPATIBILITY_VERSION` property correspond to
-``compatibility version`` and ``OSX_CURRENT_VERSION`` to ``current version``.
-See the :prop_tgt:`FRAMEWORK` target property for an example.
-
-Versions of Mach-O binaries may be checked with the ``otool -L <binary>``
-command. If ``OSX_CURRENT_VERSION`` is not set, the value of
-the :prop_tgt:``VERSION`` property will be used.
diff --git a/Help/prop_tgt/SOVERSION.rst b/Help/prop_tgt/SOVERSION.rst
index 1a66c8f..d6f8a94 100644
--- a/Help/prop_tgt/SOVERSION.rst
+++ b/Help/prop_tgt/SOVERSION.rst
@@ -22,8 +22,8 @@ Mach-O Versions
For shared libraries and executables on Mach-O systems (e.g. macOS, iOS),
the ``SOVERSION`` property is a fallback to
-:prop_tgt:`OSX_COMPATIBILITY_VERSION` property which corresponds to
+:prop_tgt:`MACHO_COMPATIBILITY_VERSION` property which corresponds to
*compatiblity version* and :prop_tgt:`VERSION` is a fallback to
-:prop_tgt:`OSX_CURRENT_VERSION` which corresponds to *current version*.
+:prop_tgt:`MACHO_CURRENT_VERSION` which corresponds to *current version*.
See the :prop_tgt:`FRAMEWORK` target property for an example. Versions
of Mach-O binaries may be checked with the ``otool -L <binary>`` command.
diff --git a/Help/prop_tgt/VERSION.rst b/Help/prop_tgt/VERSION.rst
index a24b613..f592f4a 100644
--- a/Help/prop_tgt/VERSION.rst
+++ b/Help/prop_tgt/VERSION.rst
@@ -23,9 +23,9 @@ Mach-O Versions
^^^^^^^^^^^^^^^
For shared libraries and executables on Mach-O systems (e.g. macOS, iOS),
-the ``VERSION`` property is a fallback to :prop_tgt:`OSX_CURRENT_VERSION`
+the ``VERSION`` property is a fallback to :prop_tgt:`MACHO_CURRENT_VERSION`
property which corresponds to *current version* and :prop_tgt:`SOVERSION`
-is a fallback to :prop_tgt:`OSX_COMPATIBILITY_VERSION` which corresponds
+is a fallback to :prop_tgt:`MACHO_COMPATIBILITY_VERSION` which corresponds
to *compatiblity version*. See the :prop_tgt:`FRAMEWORK` target
property for an example. Versions of Mach-O binaries may be checked with the
``otool -L <binary>`` command.
diff --git a/Help/release/3.17.rst b/Help/release/3.17.rst
index f2c4d85..c2cfdf0 100644
--- a/Help/release/3.17.rst
+++ b/Help/release/3.17.rst
@@ -143,10 +143,10 @@ Properties
In particular, the ``$<INSTALL_PREFIX>`` generator expression can
be used to set the directory relative to the install-time prefix.
-* Target properties :prop_tgt:`OSX_COMPATIBILITY_VERSION` and
- :prop_tgt:`OSX_CURRENT_VERSION` were added to set the
- ``compatibility_version`` and ``curent_version`` respectively
- on macOS. For backwards compatibility, if these properties
+* Target properties :prop_tgt:`MACHO_COMPATIBILITY_VERSION` and
+ :prop_tgt:`MACHO_CURRENT_VERSION` were added to set the
+ ``compatibility_version`` and ``curent_version``, respectively,
+ for Mach-O binaries. For backwards compatibility, if these properties
are not set, :prop_tgt:`SOVERSION` and :prop_tgt:`VERSION`
are used respectively as fallbacks.
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake
index 974f5fa..f31713e 100644
--- a/Modules/CMakeCUDAInformation.cmake
+++ b/Modules/CMakeCUDAInformation.cmake
@@ -138,24 +138,24 @@ endif()
#Specify how to compile when ptx has been requested
if(NOT CMAKE_CUDA_COMPILE_PTX_COMPILATION)
set(CMAKE_CUDA_COMPILE_PTX_COMPILATION
- "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -ptx <SOURCE> -o <OBJECT>")
+ "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -ptx <SOURCE> -o <OBJECT>")
endif()
#Specify how to compile when separable compilation has been requested
if(NOT CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION)
set(CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION
- "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -dc <SOURCE> -o <OBJECT>")
+ "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -dc <SOURCE> -o <OBJECT>")
endif()
#Specify how to compile when whole compilation has been requested
if(NOT CMAKE_CUDA_COMPILE_WHOLE_COMPILATION)
set(CMAKE_CUDA_COMPILE_WHOLE_COMPILATION
- "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -c <SOURCE> -o <OBJECT>")
+ "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -c <SOURCE> -o <OBJECT>")
endif()
-if(CMAKE_GENERATOR STREQUAL "Ninja" AND NOT CMAKE_DEPFILE_FLAGS_CUDA )
+if(CMAKE_GENERATOR STREQUAL "Ninja" AND NOT CMAKE_DEPFILE_FLAGS_CUDA)
set(CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION
- "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -M <SOURCE> -MT <OBJECT> -o $DEP_FILE")
+ "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -M <SOURCE> -MT <OBJECT> -o $DEP_FILE")
#The Ninja generator uses the make file dependency files to determine what
#files need to be recompiled. Unfortunately, nvcc < 10.2 doesn't support building
#a source file and generating the dependencies of said file in a single
diff --git a/Modules/CMakeFindFrameworks.cmake b/Modules/CMakeFindFrameworks.cmake
index 06c05fb..8906f48 100644
--- a/Modules/CMakeFindFrameworks.cmake
+++ b/Modules/CMakeFindFrameworks.cmake
@@ -17,13 +17,25 @@ if(NOT CMAKE_FIND_FRAMEWORKS_INCLUDED)
macro(CMAKE_FIND_FRAMEWORKS fwk)
set(${fwk}_FRAMEWORKS)
if(APPLE)
- foreach(dir
- ~/Library/Frameworks/${fwk}.framework
- /usr/local/Frameworks/${fwk}.framework
- /Library/Frameworks/${fwk}.framework
- /System/Library/Frameworks/${fwk}.framework
- /Network/Library/Frameworks/${fwk}.framework
- ${CMAKE_FIND_FRAMEWORK_EXTRA_LOCATIONS})
+ file(TO_CMAKE_PATH "$ENV{CMAKE_FRAMEWORK_PATH}" _cmff_CMAKE_FRAMEWORK_PATH)
+ set(_cmff_search_paths
+ ${CMAKE_FRAMEWORK_PATH}
+ ${_cmff_CMAKE_FRAMEWORK_PATH}
+ ~/Library/Frameworks
+ /usr/local/Frameworks
+ /Library/Frameworks
+ /System/Library/Frameworks
+ /Network/Library/Frameworks
+ ${CMAKE_SYSTEM_FRAMEWORK_PATH})
+
+ # For backwards compatibility reasons,
+ # CMAKE_FIND_FRAMEWORK_EXTRA_LOCATIONS includes ${fwk}.framework
+ list(TRANSFORM _cmff_search_paths APPEND /${fwk}.framework)
+ list(APPEND _cmff_search_paths ${CMAKE_FIND_FRAMEWORK_EXTRA_LOCATIONS})
+
+ list(REMOVE_DUPLICATES _cmff_search_paths)
+
+ foreach(dir IN LISTS _cmff_search_paths)
if(EXISTS ${dir})
set(${fwk}_FRAMEWORKS ${${fwk}_FRAMEWORKS} ${dir})
endif()
diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake
index ba242ec..8f0909c 100644
--- a/Modules/CMakeSwiftInformation.cmake
+++ b/Modules/CMakeSwiftInformation.cmake
@@ -27,12 +27,14 @@ elseif(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
endif()
if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
+ set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ")
set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ")
- set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG_SEP ":")
-
- if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
- set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ")
+ if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+ set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG_SEP "")
+ set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG_SEP "")
+ else()
set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG_SEP ":")
+ set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG_SEP ":")
endif()
endif()
diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake
index 3fa6990..15edc21 100644
--- a/Modules/Compiler/AppleClang-CXX.cmake
+++ b/Modules/Compiler/AppleClang-CXX.cmake
@@ -25,7 +25,10 @@ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
endif()
-if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
+if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
+ set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
+ set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
+elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++1z")
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
endif()
diff --git a/Modules/Compiler/AppleClang-OBJCXX.cmake b/Modules/Compiler/AppleClang-OBJCXX.cmake
index 2c084af..409bd4a 100644
--- a/Modules/Compiler/AppleClang-OBJCXX.cmake
+++ b/Modules/Compiler/AppleClang-OBJCXX.cmake
@@ -22,7 +22,10 @@ elseif(NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 5.1)
set(CMAKE_OBJCXX14_STANDARD__HAS_FULL_SUPPORT ON)
endif()
-if (NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 6.1)
+if (NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 10.0)
+ set(CMAKE_OBJCXX17_STANDARD_COMPILE_OPTION "-std=c++17")
+ set(CMAKE_OBJCXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
+elseif (NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 6.1)
set(CMAKE_OBJCXX17_STANDARD_COMPILE_OPTION "-std=c++1z")
set(CMAKE_OBJCXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
endif()
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
index 1f4d54d..2a2564e 100644
--- a/Modules/Compiler/NVIDIA-CUDA.cmake
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -4,6 +4,8 @@ set(CMAKE_CUDA_COMPILER_HAS_DEVICE_LINK_PHASE True)
set(CMAKE_CUDA_VERBOSE_FLAG "-v")
set(CMAKE_CUDA_VERBOSE_COMPILE_FLAG "-Xcompiler=-v")
+set(_CMAKE_COMPILE_AS_CUDA_FLAG "-x cu")
+
if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89)
# The -forward-unknown-to-host-compiler flag was only
# added to nvcc in 10.2 so before that we had no good
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index f251b41..4b14ddc 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -477,6 +477,7 @@ if(CMAKE_CUDA_COMPILER_LOADED AND NOT CUDAToolkit_BIN_DIR)
get_filename_component(cuda_dir "${CMAKE_CUDA_COMPILER}" DIRECTORY)
# use the already detected cuda compiler
set(CUDAToolkit_BIN_DIR "${cuda_dir}" CACHE PATH "")
+ mark_as_advanced(CUDAToolkit_BIN_DIR)
unset(cuda_dir)
endif()
@@ -631,6 +632,7 @@ endif()
if(NOT CUDAToolkit_BIN_DIR AND CUDAToolkit_NVCC_EXECUTABLE)
get_filename_component(cuda_dir "${CUDAToolkit_NVCC_EXECUTABLE}" DIRECTORY)
set(CUDAToolkit_BIN_DIR "${cuda_dir}" CACHE PATH "" FORCE)
+ mark_as_advanced(CUDAToolkit_BIN_DIR)
unset(cuda_dir)
endif()
@@ -732,6 +734,10 @@ find_package_handle_standard_args(CUDAToolkit
VERSION_VAR
CUDAToolkit_VERSION
)
+mark_as_advanced(CUDA_CUDART
+ CUDAToolkit_INCLUDE_DIR
+ CUDAToolkit_NVCC_EXECUTABLE
+ )
#-----------------------------------------------------------------------------
# Construct result variables
@@ -749,7 +755,6 @@ if(CUDAToolkit_FOUND)
set(search_names ${lib_name} ${arg_ALT})
- message(STATUS "arg_EXTRA_PATH_SUFFIXES: ${arg_EXTRA_PATH_SUFFIXES}")
find_library(CUDA_${lib_name}_LIBRARY
NAMES ${search_names}
HINTS ${CUDAToolkit_LIBRARY_DIR}
@@ -757,6 +762,7 @@ if(CUDAToolkit_FOUND)
PATH_SUFFIXES nvidia/current lib64 lib64/stubs lib/x64 lib lib/stubs
${arg_EXTRA_PATH_SUFFIXES}
)
+ mark_as_advanced(CUDA_${lib_name}_LIBRARY)
if (NOT TARGET CUDA::${lib_name} AND CUDA_${lib_name}_LIBRARY)
add_library(CUDA::${lib_name} IMPORTED INTERFACE)
@@ -798,6 +804,7 @@ if(CUDAToolkit_FOUND)
if(UNIX AND NOT APPLE)
# On Linux, you must link against librt when using the static cuda runtime.
find_library(CUDAToolkit_rt_LIBRARY rt)
+ mark_as_advanced(CUDAToolkit_rt_LIBRARY)
if(NOT CUDAToolkit_rt_LIBRARY)
message(WARNING "Could not find librt library, needed by CUDA::cudart_static")
else()
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index e903f2a..77b6562 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -95,8 +95,9 @@ endmacro()
macro (_PYTHON_FIND_FRAMEWORKS)
set (${_PYTHON_PREFIX}_FRAMEWORKS)
if (CMAKE_HOST_APPLE OR APPLE)
+ file(TO_CMAKE_PATH "$ENV{CMAKE_FRAMEWORK_PATH}" _pff_CMAKE_FRAMEWORK_PATH)
set (_pff_frameworks ${CMAKE_FRAMEWORK_PATH}
- $ENV{CMAKE_FRAMEWORK_PATH}
+ ${_pff_CMAKE_FRAMEWORK_PATH}
~/Library/Frameworks
/usr/local/Frameworks
${CMAKE_SYSTEM_FRAMEWORK_PATH})
diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
index af43f46..2f50280 100644
--- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake
+++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
@@ -1,11 +1,11 @@
include(Platform/Windows-MSVC)
set(CMAKE_CUDA_COMPILE_PTX_COMPILATION
- "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -ptx <SOURCE> -o <OBJECT> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
+ "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -ptx <SOURCE> -o <OBJECT> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
set(CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION
- "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -dc <SOURCE> -o <OBJECT> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
+ "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -dc <SOURCE> -o <OBJECT> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
set(CMAKE_CUDA_COMPILE_WHOLE_COMPILATION
- "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -c <SOURCE> -o <OBJECT> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
+ "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -c <SOURCE> -o <OBJECT> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
set(__IMPLICT_LINKS )
foreach(dir ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES})
@@ -48,7 +48,7 @@ unset(__IMPLICT_DLINK_DIRS)
set(CMAKE_CUDA_DEVICE_LINK_LIBRARY
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICT_DLINK_FLAGS}")
set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE
- "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICT_DLINK_FLAGS}")
+ "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICT_DLINK_FLAGS}")
unset(__IMPLICT_DLINK_FLAGS)
string(REPLACE "/D" "-D" _PLATFORM_DEFINES_CUDA "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_CXX}")
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 3fce9e5..1b452f8 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 17)
-set(CMake_VERSION_PATCH 20200310)
+set(CMake_VERSION_PATCH 20200313)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx
index 3ad4749..69c5793 100644
--- a/Source/CTest/cmCTestCurl.cxx
+++ b/Source/CTest/cmCTestCurl.cxx
@@ -55,7 +55,7 @@ size_t curlDebugCallback(CURL* /*unused*/, curl_infotype /*unused*/,
char* chPtr, size_t size, void* data)
{
cm::append(*static_cast<std::vector<char>*>(data), chPtr, chPtr + size);
- return size;
+ return 0;
}
}
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 2192843..50c963d 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -12,13 +12,13 @@
#include <iomanip>
#include <iostream>
#include <list>
-#include <memory>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <utility>
#include <vector>
+#include <cm/memory>
#include <cmext/algorithm>
#include "cmsys/FStream.hxx"
@@ -172,7 +172,8 @@ bool cmCTestMultiProcessHandler::StartTestProcess(int test)
this->EraseTest(test);
this->RunningCount += GetProcessorsUsed(test);
- cmCTestRunTest* testRun = new cmCTestRunTest(*this);
+ auto testRun = cm::make_unique<cmCTestRunTest>(*this);
+
if (this->RepeatMode != cmCTest::Repeat::Never) {
testRun->SetRepeatMode(this->RepeatMode);
testRun->SetNumberOfRuns(this->RepeatCount);
@@ -229,28 +230,25 @@ bool cmCTestMultiProcessHandler::StartTestProcess(int test)
e << "\n";
}
e << "Resource spec file:\n\n " << this->TestHandler->ResourceSpecFile;
- testRun->StartFailure(e.str(), "Insufficient resources");
- this->FinishTestProcess(testRun, false);
+ cmCTestRunTest::StartFailure(std::move(testRun), e.str(),
+ "Insufficient resources");
return false;
}
cmWorkingDirectory workdir(this->Properties[test]->Directory);
if (workdir.Failed()) {
- testRun->StartFailure("Failed to change working directory to " +
- this->Properties[test]->Directory + " : " +
- std::strerror(workdir.GetLastResult()),
- "Failed to change working directory");
- } else {
- if (testRun->StartTest(this->Completed, this->Total)) {
- // Ownership of 'testRun' has moved to another structure.
- // When the test finishes, FinishTestProcess will be called.
- return true;
- }
+ cmCTestRunTest::StartFailure(std::move(testRun),
+ "Failed to change working directory to " +
+ this->Properties[test]->Directory + " : " +
+ std::strerror(workdir.GetLastResult()),
+ "Failed to change working directory");
+ return false;
}
- // Pass ownership of 'testRun'.
- this->FinishTestProcess(testRun, false);
- return false;
+ // Ownership of 'testRun' has moved to another structure.
+ // When the test finishes, FinishTestProcess will be called.
+ return cmCTestRunTest::StartTest(std::move(testRun), this->Completed,
+ this->Total);
}
bool cmCTestMultiProcessHandler::AllocateResources(int index)
@@ -540,7 +538,8 @@ void cmCTestMultiProcessHandler::StartNextTests()
if (this->SerialTestRunning) {
break;
}
- // We can only start a RUN_SERIAL test if no other tests are also running.
+ // We can only start a RUN_SERIAL test if no other tests are also
+ // running.
if (this->Properties[test]->RunSerial && this->RunningCount > 0) {
continue;
}
@@ -618,8 +617,8 @@ void cmCTestMultiProcessHandler::OnTestLoadRetryCB(uv_timer_t* timer)
self->StartNextTests();
}
-void cmCTestMultiProcessHandler::FinishTestProcess(cmCTestRunTest* runner,
- bool started)
+void cmCTestMultiProcessHandler::FinishTestProcess(
+ std::unique_ptr<cmCTestRunTest> runner, bool started)
{
this->Completed++;
@@ -631,7 +630,8 @@ void cmCTestMultiProcessHandler::FinishTestProcess(cmCTestRunTest* runner,
this->SetStopTimePassed();
}
if (started) {
- if (!this->StopTimePassed && runner->StartAgain(this->Completed)) {
+ if (!this->StopTimePassed &&
+ cmCTestRunTest::StartAgain(std::move(runner), this->Completed)) {
this->Completed--; // remove the completed test because run again
return;
}
@@ -659,7 +659,7 @@ void cmCTestMultiProcessHandler::FinishTestProcess(cmCTestRunTest* runner,
}
properties->Affinity.clear();
- delete runner;
+ runner.reset();
if (started) {
this->StartNextTests();
}
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index 5b429d4..c3686bc 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -6,6 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -124,7 +125,7 @@ protected:
// Removes the checkpoint file
void MarkFinished();
void EraseTest(int index);
- void FinishTestProcess(cmCTestRunTest* runner, bool started);
+ void FinishTestProcess(std::unique_ptr<cmCTestRunTest> runner, bool started);
static void OnTestLoadRetryCB(uv_timer_t* timer);
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index ec54960..7d0f69b 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -314,23 +314,27 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
return passed || skipped;
}
-bool cmCTestRunTest::StartAgain(size_t completed)
+bool cmCTestRunTest::StartAgain(std::unique_ptr<cmCTestRunTest> runner,
+ size_t completed)
{
- if (!this->RunAgain) {
+ auto* testRun = runner.get();
+
+ if (!testRun->RunAgain) {
return false;
}
- this->RunAgain = false; // reset
+ testRun->RunAgain = false; // reset
+ testRun->TestProcess = cm::make_unique<cmProcess>(std::move(runner));
// change to tests directory
- cmWorkingDirectory workdir(this->TestProperties->Directory);
+ cmWorkingDirectory workdir(testRun->TestProperties->Directory);
if (workdir.Failed()) {
- this->StartFailure("Failed to change working directory to " +
- this->TestProperties->Directory + " : " +
- std::strerror(workdir.GetLastResult()),
- "Failed to change working directory");
+ testRun->StartFailure("Failed to change working directory to " +
+ testRun->TestProperties->Directory + " : " +
+ std::strerror(workdir.GetLastResult()),
+ "Failed to change working directory");
return true;
}
- this->StartTest(completed, this->TotalNumberOfTests);
+ testRun->StartTest(completed, testRun->TotalNumberOfTests);
return true;
}
@@ -382,6 +386,18 @@ void cmCTestRunTest::MemCheckPostProcess()
handler->PostProcessTest(this->TestResult, this->Index);
}
+void cmCTestRunTest::StartFailure(std::unique_ptr<cmCTestRunTest> runner,
+ std::string const& output,
+ std::string const& detail)
+{
+ auto* testRun = runner.get();
+
+ testRun->TestProcess = cm::make_unique<cmProcess>(std::move(runner));
+ testRun->StartFailure(output, detail);
+
+ testRun->FinalizeTest(false);
+}
+
void cmCTestRunTest::StartFailure(std::string const& output,
std::string const& detail)
{
@@ -413,7 +429,6 @@ void cmCTestRunTest::StartFailure(std::string const& output,
this->TestResult.Path = this->TestProperties->Directory;
this->TestResult.Output = output;
this->TestResult.FullCommandLine.clear();
- this->TestProcess = cm::make_unique<cmProcess>(*this);
}
std::string cmCTestRunTest::GetTestPrefix(size_t completed, size_t total) const
@@ -437,6 +452,21 @@ std::string cmCTestRunTest::GetTestPrefix(size_t completed, size_t total) const
return outputStream.str();
}
+bool cmCTestRunTest::StartTest(std::unique_ptr<cmCTestRunTest> runner,
+ size_t completed, size_t total)
+{
+ auto* testRun = runner.get();
+
+ testRun->TestProcess = cm::make_unique<cmProcess>(std::move(runner));
+
+ if (!testRun->StartTest(completed, total)) {
+ testRun->FinalizeTest(false);
+ return false;
+ }
+
+ return true;
+}
+
// Starts the execution of a test. Returns once it has started
bool cmCTestRunTest::StartTest(size_t completed, size_t total)
{
@@ -468,7 +498,6 @@ bool cmCTestRunTest::StartTest(size_t completed, size_t total)
if (this->TestProperties->Disabled) {
this->TestResult.CompletionStatus = "Disabled";
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
- this->TestProcess = cm::make_unique<cmProcess>(*this);
this->TestResult.Output = "Disabled";
this->TestResult.FullCommandLine.clear();
return false;
@@ -482,7 +511,6 @@ bool cmCTestRunTest::StartTest(size_t completed, size_t total)
// its arguments are irrelevant. This matters for the case where a fixture
// dependency might be creating the executable we want to run.
if (!this->FailedDependencies.empty()) {
- this->TestProcess = cm::make_unique<cmProcess>(*this);
std::string msg = "Failed test dependencies:";
for (std::string const& failedDep : this->FailedDependencies) {
msg += " " + failedDep;
@@ -499,7 +527,6 @@ bool cmCTestRunTest::StartTest(size_t completed, size_t total)
this->ComputeArguments();
std::vector<std::string>& args = this->TestProperties->Args;
if (args.size() >= 2 && args[1] == "NOT_AVAILABLE") {
- this->TestProcess = cm::make_unique<cmProcess>(*this);
std::string msg;
if (this->CTest->GetConfigType().empty()) {
msg = "Test not available without configuration. (Missing \"-C "
@@ -521,7 +548,6 @@ bool cmCTestRunTest::StartTest(size_t completed, size_t total)
for (std::string const& file : this->TestProperties->RequiredFiles) {
if (!cmSystemTools::FileExists(file)) {
// Required file was not found
- this->TestProcess = cm::make_unique<cmProcess>(*this);
*this->TestHandler->LogFile << "Unable to find required file: " << file
<< std::endl;
cmCTestLog(this->CTest, ERROR_MESSAGE,
@@ -537,7 +563,6 @@ bool cmCTestRunTest::StartTest(size_t completed, size_t total)
if (this->ActualCommand.empty()) {
// if the command was not found create a TestResult object
// that has that information
- this->TestProcess = cm::make_unique<cmProcess>(*this);
*this->TestHandler->LogFile << "Unable to find executable: " << args[1]
<< std::endl;
cmCTestLog(this->CTest, ERROR_MESSAGE,
@@ -649,7 +674,6 @@ bool cmCTestRunTest::ForkProcess(cmDuration testTimeOut, bool explicitTimeout,
std::vector<std::string>* environment,
std::vector<size_t>* affinity)
{
- this->TestProcess = cm::make_unique<cmProcess>(*this);
this->TestProcess->SetId(this->Index);
this->TestProcess->SetWorkingDirectory(this->TestProperties->Directory);
this->TestProcess->SetCommand(this->ActualCommand);
@@ -816,7 +840,8 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total)
"Testing " << this->TestProperties->Name << " ... ");
}
-void cmCTestRunTest::FinalizeTest()
+void cmCTestRunTest::FinalizeTest(bool started)
{
- this->MultiTestHandler.FinishTestProcess(this, true);
+ this->MultiTestHandler.FinishTestProcess(this->TestProcess->GetRunner(),
+ started);
}
diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h
index 4988839..b1d188a 100644
--- a/Source/CTest/cmCTestRunTest.h
+++ b/Source/CTest/cmCTestRunTest.h
@@ -65,6 +65,15 @@ public:
// Read and store output. Returns true if it must be called again.
void CheckOutput(std::string const& line);
+ static bool StartTest(std::unique_ptr<cmCTestRunTest> runner,
+ size_t completed, size_t total);
+ static bool StartAgain(std::unique_ptr<cmCTestRunTest> runner,
+ size_t completed);
+
+ static void StartFailure(std::unique_ptr<cmCTestRunTest> runner,
+ std::string const& output,
+ std::string const& detail);
+
// launch the test process, return whether it started correctly
bool StartTest(size_t completed, size_t total);
// capture and report the test results
@@ -74,8 +83,6 @@ public:
void ComputeWeightedCost();
- bool StartAgain(size_t completed);
-
void StartFailure(std::string const& output, std::string const& detail);
cmCTest* GetCTest() const { return this->CTest; }
@@ -84,7 +91,7 @@ public:
const std::vector<std::string>& GetArguments() { return this->Arguments; }
- void FinalizeTest();
+ void FinalizeTest(bool started = true);
bool TimedOutForStopTime() const { return this->TimeoutIsForStopTime; }
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index a8f201a..22ab48f 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -110,7 +110,7 @@ static size_t cmCTestSubmitHandlerCurlDebugCallback(CURL* /*unused*/,
{
cm::append(*static_cast<cmCTestSubmitHandlerVectorOfChar*>(data), chPtr,
chPtr + size);
- return size;
+ return 0;
}
cmCTestSubmitHandler::cmCTestSubmitHandler()
diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx
index 6026c69..452d714 100644
--- a/Source/CTest/cmCTestVC.cxx
+++ b/Source/CTest/cmCTestVC.cxx
@@ -38,7 +38,7 @@ void cmCTestVC::SetSourceDirectory(std::string const& dir)
this->SourceDirectory = dir;
}
-bool cmCTestVC::InitialCheckout(const char* command)
+bool cmCTestVC::InitialCheckout(const std::string& command)
{
cmCTestLog(this->CTest, HANDLER_OUTPUT,
" First perform the initial checkout: " << command << "\n");
diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h
index 2a4765d..3037e01 100644
--- a/Source/CTest/cmCTestVC.h
+++ b/Source/CTest/cmCTestVC.h
@@ -36,7 +36,7 @@ public:
std::string GetNightlyTime();
/** Prepare the work tree. */
- bool InitialCheckout(const char* command);
+ bool InitialCheckout(const std::string& command);
/** Perform cleanup operations on the work tree. */
void Cleanup();
diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx
index cdf899c..76ffb20 100644
--- a/Source/CTest/cmProcess.cxx
+++ b/Source/CTest/cmProcess.cxx
@@ -5,6 +5,7 @@
#include <csignal>
#include <iostream>
#include <string>
+#include <utility>
#include <cmext/algorithm>
@@ -18,12 +19,11 @@
#if defined(_WIN32)
# include "cm_kwiml.h"
#endif
-#include <utility>
#define CM_PROCESS_BUF_SIZE 65536
-cmProcess::cmProcess(cmCTestRunTest& runner)
- : Runner(runner)
+cmProcess::cmProcess(std::unique_ptr<cmCTestRunTest> runner)
+ : Runner(std::move(runner))
, Conv(cmProcessOutput::UTF8, CM_PROCESS_BUF_SIZE)
{
this->Timeout = cmDuration::zero();
@@ -69,7 +69,7 @@ bool cmProcess::StartProcess(uv_loop_t& loop, std::vector<size_t>* affinity)
cm::uv_timer_ptr timer;
int status = timer.init(loop, this);
if (status != 0) {
- cmCTestLog(this->Runner.GetCTest(), ERROR_MESSAGE,
+ cmCTestLog(this->Runner->GetCTest(), ERROR_MESSAGE,
"Error initializing timer: " << uv_strerror(status)
<< std::endl);
return false;
@@ -84,7 +84,7 @@ bool cmProcess::StartProcess(uv_loop_t& loop, std::vector<size_t>* affinity)
int fds[2] = { -1, -1 };
status = cmGetPipes(fds);
if (status != 0) {
- cmCTestLog(this->Runner.GetCTest(), ERROR_MESSAGE,
+ cmCTestLog(this->Runner->GetCTest(), ERROR_MESSAGE,
"Error initializing pipe: " << uv_strerror(status)
<< std::endl);
return false;
@@ -127,7 +127,7 @@ bool cmProcess::StartProcess(uv_loop_t& loop, std::vector<size_t>* affinity)
uv_read_start(pipe_reader, &cmProcess::OnAllocateCB, &cmProcess::OnReadCB);
if (status != 0) {
- cmCTestLog(this->Runner.GetCTest(), ERROR_MESSAGE,
+ cmCTestLog(this->Runner->GetCTest(), ERROR_MESSAGE,
"Error starting read events: " << uv_strerror(status)
<< std::endl);
return false;
@@ -135,7 +135,7 @@ bool cmProcess::StartProcess(uv_loop_t& loop, std::vector<size_t>* affinity)
status = this->Process.spawn(loop, options, this);
if (status != 0) {
- cmCTestLog(this->Runner.GetCTest(), ERROR_MESSAGE,
+ cmCTestLog(this->Runner->GetCTest(), ERROR_MESSAGE,
"Process not started\n " << this->Command << "\n["
<< uv_strerror(status) << "]\n");
return false;
@@ -152,7 +152,7 @@ bool cmProcess::StartProcess(uv_loop_t& loop, std::vector<size_t>* affinity)
void cmProcess::StartTimer()
{
- auto properties = this->Runner.GetTestProperties();
+ auto properties = this->Runner->GetTestProperties();
auto msec =
std::chrono::duration_cast<std::chrono::milliseconds>(this->Timeout);
@@ -222,7 +222,7 @@ void cmProcess::OnRead(ssize_t nread, const uv_buf_t* buf)
cm::append(this->Output, strdata);
while (this->Output.GetLine(line)) {
- this->Runner.CheckOutput(line);
+ this->Runner->CheckOutput(line);
line.clear();
}
@@ -236,20 +236,20 @@ void cmProcess::OnRead(ssize_t nread, const uv_buf_t* buf)
// The process will provide no more data.
if (nread != UV_EOF) {
auto error = static_cast<int>(nread);
- cmCTestLog(this->Runner.GetCTest(), ERROR_MESSAGE,
+ cmCTestLog(this->Runner->GetCTest(), ERROR_MESSAGE,
"Error reading stream: " << uv_strerror(error) << std::endl);
}
// Look for partial last lines.
if (this->Output.GetLast(line)) {
- this->Runner.CheckOutput(line);
+ this->Runner->CheckOutput(line);
}
this->ReadHandleClosed = true;
this->PipeReader.reset();
if (this->ProcessHandleClosed) {
uv_timer_stop(this->Timer);
- this->Runner.FinalizeTest();
+ this->Runner->FinalizeTest();
}
}
@@ -291,7 +291,7 @@ void cmProcess::OnTimeout()
// Our on-exit handler already ran but did not finish the test
// because we were still reading output. We've just dropped
// our read handler, so we need to finish the test now.
- this->Runner.FinalizeTest();
+ this->Runner->FinalizeTest();
}
}
@@ -333,7 +333,7 @@ void cmProcess::OnExit(int64_t exit_status, int term_signal)
this->ProcessHandleClosed = true;
if (this->ReadHandleClosed) {
uv_timer_stop(this->Timer);
- this->Runner.FinalizeTest();
+ this->Runner->FinalizeTest();
}
}
diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h
index 2c24f2d..0f69f68 100644
--- a/Source/CTest/cmProcess.h
+++ b/Source/CTest/cmProcess.h
@@ -6,7 +6,9 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <chrono>
+#include <memory>
#include <string>
+#include <utility>
#include <vector>
#include <stddef.h>
@@ -28,7 +30,7 @@ class cmCTestRunTest;
class cmProcess
{
public:
- explicit cmProcess(cmCTestRunTest& runner);
+ explicit cmProcess(std::unique_ptr<cmCTestRunTest> runner);
~cmProcess();
void SetCommand(std::string const& command);
void SetCommandArguments(std::vector<std::string> const& arg);
@@ -70,6 +72,11 @@ public:
Exception GetExitException();
std::string GetExitExceptionString();
+ std::unique_ptr<cmCTestRunTest> GetRunner()
+ {
+ return std::move(this->Runner);
+ }
+
private:
cmDuration Timeout;
std::chrono::steady_clock::time_point StartTime;
@@ -82,7 +89,7 @@ private:
cm::uv_timer_ptr Timer;
std::vector<char> Buf;
- cmCTestRunTest& Runner;
+ std::unique_ptr<cmCTestRunTest> Runner;
cmProcessOutput Conv;
int Signal = 0;
cmProcess::State ProcessState = cmProcess::State::Starting;
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index 49c9439..b82fb9a 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -108,7 +108,7 @@ bool TwoArgsSignature(std::vector<std::string> const& args,
if (cacheValue) {
return true;
}
- mf.AddCacheDefinition(define, makecommand.c_str(),
+ mf.AddCacheDefinition(define, makecommand,
"Command used to build entire project "
"from the command line.",
cmStateEnums::STRING);
diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx
index 3e517dc..ad4d665 100644
--- a/Source/cmBuildNameCommand.cxx
+++ b/Source/cmBuildNameCommand.cxx
@@ -28,7 +28,7 @@ bool cmBuildNameCommand(std::vector<std::string> const& args,
std::replace(cv.begin(), cv.end(), '/', '_');
std::replace(cv.begin(), cv.end(), '(', '_');
std::replace(cv.begin(), cv.end(), ')', '_');
- mf.AddCacheDefinition(args[0], cv.c_str(), "Name of build.",
+ mf.AddCacheDefinition(args[0], cv, "Name of build.",
cmStateEnums::STRING);
}
return true;
@@ -54,7 +54,7 @@ bool cmBuildNameCommand(std::vector<std::string> const& args,
std::replace(buildname.begin(), buildname.end(), '(', '_');
std::replace(buildname.begin(), buildname.end(), ')', '_');
- mf.AddCacheDefinition(args[0], buildname.c_str(), "Name of build.",
+ mf.AddCacheDefinition(args[0], buildname, "Name of build.",
cmStateEnums::STRING);
return true;
}
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 5ff6f8c..033cb60 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -248,7 +248,7 @@ void cmCommonTargetGenerator::AppendOSXVerFlag(std::string& flags,
int major;
int minor;
int patch;
- std::string prop = cmStrCat("OSX_", name, "_VERSION");
+ std::string prop = cmStrCat("MACHO_", name, "_VERSION");
std::string fallback_prop = so ? "SOVERSION" : "VERSION";
this->GeneratorTarget->GetTargetVersionFallback(prop, fallback_prop, major,
minor, patch);
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 78cabce..8ab30c0 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -255,8 +255,8 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
// The variable is in the env, but not in the cache. Use it and put it
// in the cache
valueToUse = envVarValue;
- mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
- cacheEntryName.c_str(), cmStateEnums::STRING, true);
+ mf->AddCacheDefinition(cacheEntryName, valueToUse, cacheEntryName.c_str(),
+ cmStateEnums::STRING, true);
mf->GetCMakeInstance()->SaveCache(lg.GetBinaryDirectory());
} else if (!envVarSet && cacheValue != nullptr) {
// It is already in the cache, but not in the env, so use it from the cache
@@ -270,7 +270,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
valueToUse = *cacheValue;
if (valueToUse.find(envVarValue) == std::string::npos) {
valueToUse = envVarValue;
- mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
+ mf->AddCacheDefinition(cacheEntryName, valueToUse,
cacheEntryName.c_str(), cmStateEnums::STRING,
true);
mf->GetCMakeInstance()->SaveCache(lg.GetBinaryDirectory());
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 6f9f7a2..31f1201 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -76,13 +76,13 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
std::string const library = this->FindLibrary();
if (!library.empty()) {
// Save the value in the cache
- this->Makefile->AddCacheDefinition(this->VariableName, library.c_str(),
+ this->Makefile->AddCacheDefinition(this->VariableName, library,
this->VariableDocumentation.c_str(),
cmStateEnums::FILEPATH);
return true;
}
std::string notfound = this->VariableName + "-NOTFOUND";
- this->Makefile->AddCacheDefinition(this->VariableName, notfound.c_str(),
+ this->Makefile->AddCacheDefinition(this->VariableName, notfound,
this->VariableDocumentation.c_str(),
cmStateEnums::FILEPATH);
if (this->Required) {
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 297c72b..f606002 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1060,8 +1060,8 @@ bool cmFindPackageCommand::FindConfig()
cmStrCat("The directory containing a CMake configuration file for ",
this->Name, '.');
// We force the value since we do not get here if it was already set.
- this->Makefile->AddCacheDefinition(this->Variable, init.c_str(),
- help.c_str(), cmStateEnums::PATH, true);
+ this->Makefile->AddCacheDefinition(this->Variable, init, help.c_str(),
+ cmStateEnums::PATH, true);
return found;
}
diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx
index f5b52c2..4bab469 100644
--- a/Source/cmFindPathCommand.cxx
+++ b/Source/cmFindPathCommand.cxx
@@ -44,12 +44,12 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn)
std::string result = this->FindHeader();
if (!result.empty()) {
this->Makefile->AddCacheDefinition(
- this->VariableName, result.c_str(), this->VariableDocumentation.c_str(),
+ this->VariableName, result, this->VariableDocumentation.c_str(),
(this->IncludeFileInPath) ? cmStateEnums::FILEPATH : cmStateEnums::PATH);
return true;
}
this->Makefile->AddCacheDefinition(
- this->VariableName, (this->VariableName + "-NOTFOUND").c_str(),
+ this->VariableName, this->VariableName + "-NOTFOUND",
this->VariableDocumentation.c_str(),
(this->IncludeFileInPath) ? cmStateEnums::FILEPATH : cmStateEnums::PATH);
if (this->Required) {
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx
index cbc3c78..4b88bea 100644
--- a/Source/cmFindProgramCommand.cxx
+++ b/Source/cmFindProgramCommand.cxx
@@ -128,14 +128,14 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn)
std::string const result = FindProgram();
if (!result.empty()) {
// Save the value in the cache
- this->Makefile->AddCacheDefinition(this->VariableName, result.c_str(),
+ this->Makefile->AddCacheDefinition(this->VariableName, result,
this->VariableDocumentation.c_str(),
cmStateEnums::FILEPATH);
return true;
}
this->Makefile->AddCacheDefinition(
- this->VariableName, (this->VariableName + "-NOTFOUND").c_str(),
+ this->VariableName, this->VariableName + "-NOTFOUND",
this->VariableDocumentation.c_str(), cmStateEnums::FILEPATH);
if (this->Required) {
this->Makefile->IssueMessage(
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx
index 7d91a75..811421a 100644
--- a/Source/cmGetFilenameComponentCommand.cxx
+++ b/Source/cmGetFilenameComponentCommand.cxx
@@ -120,11 +120,11 @@ bool cmGetFilenameComponentCommand(std::vector<std::string> const& args,
if (args.size() >= 4 && args.back() == "CACHE") {
if (!programArgs.empty() && !storeArgs.empty()) {
status.GetMakefile().AddCacheDefinition(
- storeArgs, programArgs.c_str(), "",
+ storeArgs, programArgs, "",
args[2] == "PATH" ? cmStateEnums::FILEPATH : cmStateEnums::STRING);
}
status.GetMakefile().AddCacheDefinition(
- args.front(), result.c_str(), "",
+ args.front(), result, "",
args[2] == "PATH" ? cmStateEnums::FILEPATH : cmStateEnums::STRING);
} else {
if (!programArgs.empty() && !storeArgs.empty()) {
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 5e2248e..6470ea1 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -180,15 +180,12 @@ void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config,
auto i = this->FlagsByLanguage.find(language);
if (i == this->FlagsByLanguage.end()) {
std::string flags;
- const char* lang = language.c_str();
-
- this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget, lang,
- config);
-
- this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, lang,
- config);
+ this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget,
+ language, config);
+ this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget,
+ language, config);
this->LocalGenerator->AddVisibilityPresetFlags(
- flags, this->GeneratorTarget, lang);
+ flags, this->GeneratorTarget, language);
// Append old-style preprocessor definition flags.
if (this->Makefile->GetDefineFlags() != " ") {
@@ -197,8 +194,8 @@ void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config,
}
// Add target-specific flags.
- this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget, lang,
- config);
+ this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget,
+ language, config);
std::map<std::string, std::string>::value_type entry(language, flags);
i = this->FlagsByLanguage.insert(entry).first;
@@ -211,13 +208,12 @@ std::string cmGhsMultiTargetGenerator::GetDefines(const std::string& language,
auto i = this->DefinesByLanguage.find(language);
if (i == this->DefinesByLanguage.end()) {
std::set<std::string> defines;
- const char* lang = language.c_str();
// Add preprocessor definitions for this target and configuration.
this->LocalGenerator->GetTargetDefines(this->GeneratorTarget, config,
language, defines);
std::string definesString;
- this->LocalGenerator->JoinDefines(defines, definesString, lang);
+ this->LocalGenerator->JoinDefines(defines, definesString, language);
std::map<std::string, std::string>::value_type entry(language,
definesString);
@@ -235,7 +231,7 @@ void cmGhsMultiTargetGenerator::WriteCompilerFlags(std::ostream& fout,
if (!flagsByLangI->second.empty()) {
std::vector<std::string> ghsCompFlags =
cmSystemTools::ParseArguments(flagsByLangI->second);
- for (auto& f : ghsCompFlags) {
+ for (const std::string& f : ghsCompFlags) {
fout << " " << f << std::endl;
}
}
@@ -290,14 +286,14 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLine(std::ostream& fout,
// write out link options
std::vector<std::string> lopts = cmSystemTools::ParseArguments(linkFlags);
- for (auto& l : lopts) {
+ for (const std::string& l : lopts) {
fout << " " << l << std::endl;
}
// write out link search paths
// must be quoted for paths that contain spaces
std::vector<std::string> lpath = cmSystemTools::ParseArguments(linkPath);
- for (auto& l : lpath) {
+ for (const std::string& l : lpath) {
fout << " -L\"" << l << "\"" << std::endl;
}
@@ -307,7 +303,7 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLine(std::ostream& fout,
std::vector<std::string> llibs =
cmSystemTools::ParseArguments(linkLibraries);
- for (auto& l : llibs) {
+ for (const std::string& l : llibs) {
if (l.compare(0, 2, "-l") == 0) {
fout << " \"" << l << "\"" << std::endl;
} else {
@@ -463,7 +459,7 @@ void cmGhsMultiTargetGenerator::WriteSourceProperty(
const char* prop = sf->GetProperty(propName);
if (prop) {
std::vector<std::string> list = cmExpandedList(prop);
- for (auto& p : list) {
+ for (const std::string& p : list) {
fout << " " << propFlag << p << std::endl;
}
}
@@ -483,7 +479,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
/* for each source file assign it to its group */
std::map<std::string, std::vector<cmSourceFile*>> groupFiles;
std::set<std::string> groupNames;
- for (auto& sf : sources) {
+ for (cmSourceFile* sf : sources) {
cmSourceGroup* sourceGroup =
this->Makefile->FindSourceGroup(sf->ResolveFullPath(), sourceGroups);
std::string gn = sourceGroup->GetFullName();
@@ -730,7 +726,7 @@ bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp()
}
std::vector<cmSourceFile*> sources;
this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName);
- for (auto& sf : sources) {
+ for (const cmSourceFile* sf : sources) {
if ("int" == sf->GetExtension()) {
return true;
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 0404715..0b9a3e5 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -446,8 +446,8 @@ bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
cmSystemTools::GetShortPath(makeProgram, makeProgram);
cmSystemTools::SplitProgramPath(makeProgram, dir, file);
makeProgram = cmStrCat(dir, '/', saveFile);
- mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", makeProgram.c_str(),
- "make program", cmStateEnums::FILEPATH);
+ mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", makeProgram, "make program",
+ cmStateEnums::FILEPATH);
}
return true;
}
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index bb9dd37..9754fd5 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -9,6 +9,7 @@
#include <utility>
#include <cm/memory>
+#include <cm/string>
#include "cmAlgorithms.h"
#include "cmDocumentationEntry.h"
@@ -90,7 +91,7 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
/* store the full toolset for later use
* -- already done if -T<toolset> was specified
*/
- mf->AddCacheDefinition("CMAKE_GENERATOR_TOOLSET", tsp.c_str(),
+ mf->AddCacheDefinition("CMAKE_GENERATOR_TOOLSET", tsp,
"Location of generator toolset.",
cmStateEnums::INTERNAL);
}
@@ -112,8 +113,8 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
}
/* store the toolset that is being used for this build */
- mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", gbuild.c_str(),
- "build program to use", cmStateEnums::INTERNAL, true);
+ mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", gbuild, "build program to use",
+ cmStateEnums::INTERNAL, true);
mf->AddDefinition("CMAKE_SYSTEM_VERSION", tsp);
@@ -132,7 +133,7 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p,
/* store the platform name for later use
* -- already done if -A<arch> was specified
*/
- mf->AddCacheDefinition("CMAKE_GENERATOR_PLATFORM", arch.c_str(),
+ mf->AddCacheDefinition("CMAKE_GENERATOR_PLATFORM", arch,
"Name of generator platform.",
cmStateEnums::INTERNAL);
} else {
@@ -166,7 +167,7 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p,
if (cmIsOff(bspName) && platform.find("integrity") != std::string::npos) {
bspName = "sim" + arch;
/* write back the calculate name for next time */
- mf->AddCacheDefinition("GHS_BSP_NAME", bspName.c_str(),
+ mf->AddCacheDefinition("GHS_BSP_NAME", bspName,
"Name of GHS target platform.",
cmStateEnums::STRING, true);
std::string m = cmStrCat(
@@ -651,21 +652,16 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives(
char const* const customization =
this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION");
if (nullptr != customization && strlen(customization) > 0) {
- fout << "customization=" << this->TrimQuotes(customization) << std::endl;
+ fout << "customization="
+ << cmGlobalGhsMultiGenerator::TrimQuotes(customization) << std::endl;
this->GetCMakeInstance()->MarkCliAsUsed("GHS_CUSTOMIZATION");
}
}
-std::string cmGlobalGhsMultiGenerator::TrimQuotes(std::string const& str)
+std::string cmGlobalGhsMultiGenerator::TrimQuotes(std::string str)
{
- std::string result;
- result.reserve(str.size());
- for (const char* ch = str.c_str(); *ch != '\0'; ++ch) {
- if (*ch != '"') {
- result += *ch;
- }
- }
- return result;
+ cm::erase(str, '"');
+ return str;
}
bool cmGlobalGhsMultiGenerator::TargetCompare::operator()(
diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h
index b82e9f5..12ca8b6 100644
--- a/Source/cmGlobalGhsMultiGenerator.h
+++ b/Source/cmGlobalGhsMultiGenerator.h
@@ -111,7 +111,7 @@ private:
std::vector<cmLocalGenerator*>& generators,
std::string& all_target);
- std::string TrimQuotes(std::string const& str);
+ static std::string TrimQuotes(std::string str);
std::string OsDir;
static const char* DEFAULT_BUILD_PROGRAM;
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index eb33825..43d31bc 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -128,7 +128,7 @@ void cmGlobalVisualStudio7Generator::EnableLanguage(
// does not know about.
std::string extraPath;
if (cmSystemTools::GetEnv("CMAKE_MSVCIDE_RUN_PATH", extraPath)) {
- mf->AddCacheDefinition("CMAKE_MSVCIDE_RUN_PATH", extraPath.c_str(),
+ mf->AddCacheDefinition("CMAKE_MSVCIDE_RUN_PATH", extraPath,
"Saved environment variable CMAKE_MSVCIDE_RUN_PATH",
cmStateEnums::STATIC);
}
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index ac7d204..9db4817 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2369,8 +2369,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
int minor;
int patch;
- // OSX_CURRENT_VERSION or VERSION -> current_version
- gtgt->GetTargetVersionFallback("OSX_CURRENT_VERSION", "VERSION", major,
+ // MACHO_CURRENT_VERSION or VERSION -> current_version
+ gtgt->GetTargetVersionFallback("MACHO_CURRENT_VERSION", "VERSION", major,
minor, patch);
std::ostringstream v;
@@ -2381,8 +2381,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
buildSettings->AddAttribute("DYLIB_CURRENT_VERSION",
this->CreateString(v.str()));
- // OSX_COMPATIBILITY_VERSION or SOVERSION -> compatibility_version
- gtgt->GetTargetVersionFallback("OSX_COMPATIBILITY_VERSION", "SOVERSION",
+ // MACHO_COMPATIBILITY_VERSION or SOVERSION -> compatibility_version
+ gtgt->GetTargetVersionFallback("MACHO_COMPATIBILITY_VERSION", "SOVERSION",
major, minor, patch);
std::ostringstream vso;
diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx
index 8972a63..32395d1 100644
--- a/Source/cmInstalledFile.cxx
+++ b/Source/cmInstalledFile.cxx
@@ -42,7 +42,8 @@ void cmInstalledFile::RemoveProperty(const std::string& prop)
}
void cmInstalledFile::SetProperty(cmMakefile const* mf,
- const std::string& prop, const char* value)
+ const std::string& prop,
+ const std::string& value)
{
this->RemoveProperty(prop);
this->AppendProperty(mf, prop, value);
@@ -50,13 +51,14 @@ void cmInstalledFile::SetProperty(cmMakefile const* mf,
void cmInstalledFile::AppendProperty(cmMakefile const* mf,
const std::string& prop,
- const char* value, bool /*asString*/)
+ const std::string& value,
+ bool /*asString*/)
{
cmListFileBacktrace backtrace = mf->GetBacktrace();
cmGeneratorExpression ge(backtrace);
Property& property = this->Properties[prop];
- property.ValueExpressions.push_back(ge.Parse(value ? value : ""));
+ property.ValueExpressions.push_back(ge.Parse(value));
}
bool cmInstalledFile::HasProperty(const std::string& prop) const
diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h
index 698151e..07f7081 100644
--- a/Source/cmInstalledFile.h
+++ b/Source/cmInstalledFile.h
@@ -49,10 +49,10 @@ public:
void RemoveProperty(const std::string& prop);
void SetProperty(cmMakefile const* mf, const std::string& prop,
- const char* value);
+ const std::string& value);
void AppendProperty(cmMakefile const* mf, const std::string& prop,
- const char* value, bool asString = false);
+ const std::string& value, bool asString = false);
bool HasProperty(const std::string& prop) const;
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
index 86ee953..480c005 100644
--- a/Source/cmLinkLineComputer.cxx
+++ b/Source/cmLinkLineComputer.cxx
@@ -156,9 +156,11 @@ void cmLinkLineComputer::ComputeLinkPath(
type = cmStateEnums::ImportLibraryArtifact;
}
- linkPathNoBT += cmStrCat(
- " ", libPathFlag, item.Target->GetDirectory(cli.GetConfig(), type),
- libPathTerminator, " ");
+ linkPathNoBT +=
+ cmStrCat(" ", libPathFlag,
+ this->ConvertToOutputForExisting(
+ item.Target->GetDirectory(cli.GetConfig(), type)),
+ libPathTerminator, " ");
}
}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index cf6802d..a7799b6 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2914,11 +2914,11 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
// command line without any escapes. However we still have to
// get the '$' and '#' characters through WMake as '$$' and
// '$#'.
- for (const char* c = define.c_str(); *c; ++c) {
- if (*c == '$' || *c == '#') {
+ for (char c : define) {
+ if (c == '$' || c == '#') {
def += '$';
}
- def += *c;
+ def += c;
}
} else {
// Make the definition appear properly on the command line. Use
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 0572e07..74219b5 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1510,10 +1510,9 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
if (const char* deps = sf.GetProperty("OBJECT_DEPENDS")) {
std::vector<std::string> depends = cmExpandedList(deps);
const char* sep = "";
- for (std::vector<std::string>::iterator j = depends.begin();
- j != depends.end(); ++j) {
+ for (const std::string& d : depends) {
fc.AdditionalDeps += sep;
- fc.AdditionalDeps += lg->ConvertToXMLOutputPath(*j);
+ fc.AdditionalDeps += lg->ConvertToXMLOutputPath(d);
sep = ";";
needfc = true;
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 9c6dca6..081e69d 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -317,6 +317,12 @@ public:
void AddCacheDefinition(const std::string& name, const char* value,
const char* doc, cmStateEnums::CacheEntryType type,
bool force = false);
+ void AddCacheDefinition(const std::string& name, const std::string& value,
+ const char* doc, cmStateEnums::CacheEntryType type,
+ bool force = false)
+ {
+ AddCacheDefinition(name, value.c_str(), doc, type, force);
+ }
/**
* Remove a variable definition from the build. This is not valid
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index a25fd42..2ec66d9 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -47,10 +47,10 @@ bool cmProjectCommand(std::vector<std::string> const& args,
mf.SetProjectName(projectName);
mf.AddCacheDefinition(projectName + "_BINARY_DIR",
- mf.GetCurrentBinaryDirectory().c_str(),
+ mf.GetCurrentBinaryDirectory(),
"Value Computed by CMake", cmStateEnums::STATIC);
mf.AddCacheDefinition(projectName + "_SOURCE_DIR",
- mf.GetCurrentSourceDirectory().c_str(),
+ mf.GetCurrentSourceDirectory(),
"Value Computed by CMake", cmStateEnums::STATIC);
mf.AddDefinition("PROJECT_BINARY_DIR", mf.GetCurrentBinaryDirectory());
@@ -66,7 +66,7 @@ bool cmProjectCommand(std::vector<std::string> const& args,
// will work.
if (!mf.GetDefinition("CMAKE_PROJECT_NAME") || mf.IsRootMakefile()) {
mf.AddDefinition("CMAKE_PROJECT_NAME", projectName);
- mf.AddCacheDefinition("CMAKE_PROJECT_NAME", projectName.c_str(),
+ mf.AddCacheDefinition("CMAKE_PROJECT_NAME", projectName,
"Value Computed by CMake", cmStateEnums::STATIC);
}
@@ -379,7 +379,7 @@ static void TopLevelCMakeVarCondSet(cmMakefile& mf, std::string const& name,
// CMakeLists.txt file, then go with the last one.
if (!mf.GetDefinition(name) || mf.IsRootMakefile()) {
mf.AddDefinition(name, value);
- mf.AddCacheDefinition(name, value.c_str(), "Value Computed by CMake",
+ mf.AddCacheDefinition(name, value, "Value Computed by CMake",
cmStateEnums::STATIC);
}
}
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 5e2a146..d8927e8 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -149,8 +149,8 @@ bool cmSetCommand(std::vector<std::string> const& args,
// if it is meant to be in the cache then define it in the cache
if (cache) {
- status.GetMakefile().AddCacheDefinition(variable, value.c_str(), docstring,
- type, force);
+ status.GetMakefile().AddCacheDefinition(variable, value, docstring, type,
+ force);
} else {
// add the definition
status.GetMakefile().AddDefinition(variable, value);
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 3705727..ce534e1 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -307,7 +307,7 @@ bool HandleTarget(cmTarget* target, cmMakefile& makefile,
if (remove) {
target->SetProperty(propertyName, nullptr);
} else {
- target->SetProperty(propertyName, propertyValue.c_str());
+ target->SetProperty(propertyName, propertyValue);
}
}
@@ -460,16 +460,15 @@ bool HandleCacheEntry(std::string const& cacheKey, const cmMakefile& makefile,
bool appendMode, bool remove)
{
// Set or append the property.
- const char* value = propertyValue.c_str();
cmState* state = makefile.GetState();
if (remove) {
state->RemoveCacheEntryProperty(cacheKey, propertyName);
}
if (appendMode) {
- state->AppendCacheEntryProperty(cacheKey, propertyName, value,
+ state->AppendCacheEntryProperty(cacheKey, propertyName, propertyValue,
appendAsString);
} else {
- state->SetCacheEntryProperty(cacheKey, propertyName, value);
+ state->SetCacheEntryProperty(cacheKey, propertyName, propertyValue);
}
return true;
@@ -505,13 +504,13 @@ bool HandleInstall(cmInstalledFile* file, cmMakefile& makefile,
bool appendMode, bool remove)
{
// Set or append the property.
- const char* value = propertyValue.c_str();
if (remove) {
file->RemoveProperty(propertyName);
} else if (appendMode) {
- file->AppendProperty(&makefile, propertyName, value, appendAsString);
+ file->AppendProperty(&makefile, propertyName, propertyValue,
+ appendAsString);
} else {
- file->SetProperty(&makefile, propertyName, value);
+ file->SetProperty(&makefile, propertyName, propertyValue);
}
return true;
}
diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx
index d47f121..b2d905e 100644
--- a/Source/cmSiteNameCommand.cxx
+++ b/Source/cmSiteNameCommand.cxx
@@ -72,8 +72,7 @@ bool cmSiteNameCommand(std::vector<std::string> const& args,
}
#endif
status.GetMakefile().AddCacheDefinition(
- args[0], siteName.c_str(),
- "Name of the computer/site where compile is being run",
+ args[0], siteName, "Name of the computer/site where compile is being run",
cmStateEnums::STRING);
return true;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 987f526..10515c2 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1007,7 +1007,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, std::string const& lib,
dependencies += ";";
dependencies += lib;
dependencies += ";";
- mf.AddCacheDefinition(targetEntry, dependencies.c_str(),
+ mf.AddCacheDefinition(targetEntry, dependencies,
"Dependencies for the target", cmStateEnums::STATIC);
}
}
diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx
index a43165c..5865a19 100644
--- a/Source/cmUtilitySourceCommand.cxx
+++ b/Source/cmUtilitySourceCommand.cxx
@@ -102,15 +102,15 @@ bool cmUtilitySourceCommand(std::vector<std::string> const& args,
cmSystemTools::ReplaceString(utilityExecutable, "/./", "/");
// Enter the value into the cache.
- status.GetMakefile().AddCacheDefinition(
- cacheEntry, utilityExecutable.c_str(), "Path to an internal program.",
- cmStateEnums::FILEPATH);
+ status.GetMakefile().AddCacheDefinition(cacheEntry, utilityExecutable,
+ "Path to an internal program.",
+ cmStateEnums::FILEPATH);
// add a value into the cache that maps from the
// full path to the name of the project
cmSystemTools::ConvertToUnixSlashes(utilityExecutable);
- status.GetMakefile().AddCacheDefinition(
- utilityExecutable, utilityName.c_str(), "Executable to project name.",
- cmStateEnums::INTERNAL);
+ status.GetMakefile().AddCacheDefinition(utilityExecutable, utilityName,
+ "Executable to project name.",
+ cmStateEnums::INTERNAL);
return true;
}
diff --git a/Tests/RunCMake/MacOSVersions/MacOSVersions.cmake b/Tests/RunCMake/MacOSVersions/MacOSVersions.cmake
index 629e445..fc51bd8 100644
--- a/Tests/RunCMake/MacOSVersions/MacOSVersions.cmake
+++ b/Tests/RunCMake/MacOSVersions/MacOSVersions.cmake
@@ -4,6 +4,6 @@ add_library(foo SHARED foo.c)
set_target_properties(foo PROPERTIES
VERSION 1.0
SOVERSION 1
- OSX_COMPATIBILITY_VERSION 2.1.0
- OSX_CURRENT_VERSION 3.2.1
+ MACHO_COMPATIBILITY_VERSION 2.1.0
+ MACHO_CURRENT_VERSION 3.2.1
)