summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy1
-rw-r--r--Help/release/3.13.rst26
-rw-r--r--Help/release/dev/FindPython-NumPy-component.rst5
-rw-r--r--Help/release/dev/findpython-script.rst6
-rw-r--r--Modules/CheckFortranSourceCompiles.cmake16
-rw-r--r--Modules/CheckFortranSourceRuns.cmake16
-rw-r--r--Modules/FindGit.cmake3
-rw-r--r--Modules/FindPython.cmake23
-rw-r--r--Modules/FindPython/Support.cmake253
-rw-r--r--Modules/FindPython2.cmake23
-rw-r--r--Modules/FindPython3.cmake23
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx50
-rw-r--r--Source/CPack/cmCPackFreeBSDGenerator.cxx9
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx5
-rw-r--r--Source/CursesDialog/cmCursesMainForm.h2
-rw-r--r--Source/QtDialog/QCMakeWidgets.cxx5
-rw-r--r--Source/QtDialog/QCMakeWidgets.h2
-rw-r--r--Source/cmAlgorithms.h4
-rw-r--r--Source/cmCPluginAPI.cxx2
-rw-r--r--Source/cmCTest.cxx2
-rw-r--r--Source/cmCacheManager.cxx4
-rw-r--r--Source/cmComputeLinkInformation.cxx2
-rw-r--r--Source/cmComputeLinkInformation.h6
-rw-r--r--Source/cmComputeTargetDepends.cxx2
-rw-r--r--Source/cmConditionEvaluator.cxx9
-rw-r--r--Source/cmConditionEvaluator.h4
-rw-r--r--Source/cmCustomCommand.cxx18
-rw-r--r--Source/cmCustomCommand.h11
-rw-r--r--Source/cmCustomCommandGenerator.cxx4
-rw-r--r--Source/cmCustomCommandGenerator.h4
-rw-r--r--Source/cmDepends.cxx4
-rw-r--r--Source/cmDepends.h2
-rw-r--r--Source/cmExpandedCommandArgument.cxx6
-rw-r--r--Source/cmExpandedCommandArgument.h2
-rw-r--r--Source/cmExportFileGenerator.cxx2
-rw-r--r--Source/cmExportInstallFileGenerator.cxx8
-rw-r--r--Source/cmExportSet.h5
-rw-r--r--Source/cmExternalMakefileProjectGenerator.cxx9
-rw-r--r--Source/cmExternalMakefileProjectGenerator.h3
-rw-r--r--Source/cmFileAPICodemodel.cxx6
-rw-r--r--Source/cmFileCommand.cxx8
-rw-r--r--Source/cmFindPackageCommand.cxx14
-rw-r--r--Source/cmFortranParser.h10
-rw-r--r--Source/cmFortranParserImpl.cxx9
-rw-r--r--Source/cmGeneratorExpression.cxx11
-rw-r--r--Source/cmGeneratorExpression.h16
-rw-r--r--Source/cmGeneratorExpressionContext.cxx14
-rw-r--r--Source/cmGeneratorExpressionContext.h6
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx12
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.h6
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.cxx4
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.h2
-rw-r--r--Source/cmGeneratorExpressionParser.cxx4
-rw-r--r--Source/cmGeneratorExpressionParser.h3
-rw-r--r--Source/cmGeneratorTarget.cxx13
-rw-r--r--Source/cmGlobVerificationManager.cxx2
-rw-r--r--Source/cmGlobVerificationManager.h8
-rw-r--r--Source/cmGlobalGenerator.cxx35
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx6
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx17
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx2
-rw-r--r--Source/cmGraphAdjacencyList.h5
-rw-r--r--Source/cmIncludeCommand.cxx2
-rw-r--r--Source/cmInstallCommandArguments.cxx4
-rw-r--r--Source/cmInstallCommandArguments.h2
-rw-r--r--Source/cmInstallExportGenerator.cxx2
-rw-r--r--Source/cmInstallTargetGenerator.cxx8
-rw-r--r--Source/cmInstallTargetGenerator.h4
-rw-r--r--Source/cmLinkItem.cxx11
-rw-r--r--Source/cmLinkItem.h4
-rw-r--r--Source/cmListCommand.cxx14
-rw-r--r--Source/cmListFileCache.cxx7
-rw-r--r--Source/cmListFileCache.h4
-rw-r--r--Source/cmLocalCommonGenerator.cxx5
-rw-r--r--Source/cmLocalCommonGenerator.h2
-rw-r--r--Source/cmLocalGenerator.cxx10
-rw-r--r--Source/cmLocalGenerator.h4
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx54
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h30
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Source/cmMakefile.h4
-rw-r--r--Source/cmMakefileTargetGenerator.cxx11
-rw-r--r--Source/cmOSXBundleGenerator.cxx5
-rw-r--r--Source/cmOSXBundleGenerator.h3
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx2
-rw-r--r--Source/cmPathLabel.cxx6
-rw-r--r--Source/cmPathLabel.h2
-rw-r--r--Source/cmPipeConnection.cxx4
-rw-r--r--Source/cmPipeConnection.h2
-rw-r--r--Source/cmQtAutoGenInitializer.cxx12
-rw-r--r--Source/cmQtAutoGeneratorMocUic.h12
-rw-r--r--Source/cmRST.cxx4
-rw-r--r--Source/cmRST.h2
-rw-r--r--Source/cmRulePlaceholderExpander.cxx14
-rw-r--r--Source/cmRulePlaceholderExpander.h6
-rw-r--r--Source/cmScriptGenerator.cxx11
-rw-r--r--Source/cmScriptGenerator.h4
-rw-r--r--Source/cmServerProtocol.cxx28
-rw-r--r--Source/cmServerProtocol.h15
-rw-r--r--Source/cmSourceGroup.cxx6
-rw-r--r--Source/cmSourceGroup.h2
-rw-r--r--Source/cmStringReplaceHelper.cxx5
-rw-r--r--Source/cmStringReplaceHelper.h8
-rw-r--r--Source/cmSystemTools.cxx19
-rw-r--r--Source/cmSystemTools.h1
-rw-r--r--Source/cmTryRunCommand.cxx4
-rw-r--r--Source/cmUnexpectedCommand.h5
-rw-r--r--Source/cmVariableRequiresCommand.cxx2
-rw-r--r--Source/cmVariableWatchCommand.cxx2
-rw-r--r--Source/cmXCodeScheme.cxx5
-rw-r--r--Source/cmXCodeScheme.h2
-rw-r--r--Source/cmake.cxx19
-rw-r--r--Source/cmakemain.cxx55
-rw-r--r--Source/cmcmd.cxx13
-rw-r--r--Source/kwsys/SystemInformation.cxx3
-rw-r--r--Tests/CMakeLists.txt2
-rw-r--r--Tests/FindPython/CMakeLists.txt151
-rw-r--r--Tests/FindPython/FindPythonScript.cmake1
-rw-r--r--Tests/FindPython/NumPy/CMakeLists.txt22
-rw-r--r--Tests/FindPython/NumPy/arraytest.c58
-rw-r--r--Tests/FindPython/NumPyOnly/CMakeLists.txt14
-rw-r--r--Tests/FindPython/Python/CMakeLists.txt12
-rw-r--r--Tests/FindPython/Python2/CMakeLists.txt12
-rw-r--r--Tests/FindPython/Python3/CMakeLists.txt12
-rw-r--r--Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-bad-number-result.txt (renamed from Tests/RunCMake/CommandLine/no-S-B-result.txt)0
-rw-r--r--Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-bad-number-stderr.txt3
-rw-r--r--Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-good-number-stderr.txt (renamed from Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-number-trailing-stderr.txt)0
-rw-r--r--Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-good-number-trailing--target-stderr.txt (renamed from Tests/RunCMake/CommandLine/BuildDir--build-jobs-good-number-trailing-stderr.txt)0
-rw-r--r--Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-bad-number-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-bad-number-stderr.txt3
-rw-r--r--Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-good-number-stderr.txt (renamed from Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-number-trailing-stderr.txt)0
-rw-r--r--Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-good-number-trailing--target-stderr.txt (renamed from Tests/RunCMake/CommandLine/BuildDir--build--parallel-good-number-trailing-stderr.txt)0
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake25
-rw-r--r--Tests/RunCMake/CommandLine/no-S-B-stderr.txt5
135 files changed, 965 insertions, 619 deletions
diff --git a/.clang-tidy b/.clang-tidy
index aef99dc..626c754 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -11,7 +11,6 @@ misc-*,\
-misc-static-assert,\
modernize-*,\
-modernize-deprecated-headers,\
--modernize-pass-by-value,\
-modernize-raw-string-literal,\
-modernize-return-braced-init-list,\
-modernize-use-auto,\
diff --git a/Help/release/3.13.rst b/Help/release/3.13.rst
index 68e05c3..1c58550 100644
--- a/Help/release/3.13.rst
+++ b/Help/release/3.13.rst
@@ -252,3 +252,29 @@ Changes made since CMake 3.13.0 include the following.
directories to the ``moc`` tool for :prop_tgt:`AUTOMOC`. This has
been reverted due to regressing existing builds and will need
further investigation before being re-introduced in a later release.
+
+3.13.3
+------
+
+* The :generator:`Visual Studio 15 2017` generator has been fixed to work
+ when VS 2019 is installed.
+
+* CMake now checks that at least one of the source or binary directory
+ is specified when running CMake and issues an error if both are missing.
+ This has always been a documented requirement, but the implementation
+ previously accidentally accepted cases in which neither are specified
+ so long as some other argument is given, and silently used the current
+ working directory as the source and build tree.
+
+3.13.4
+------
+
+* The error added by 3.13.3 in cases that neither a source or binary
+ directory is specified has been downgraded to a warning. While this
+ was never intended, documented, nor supported behavior, some projects
+ relied on it. The error has been downgraded to a warning for the
+ remainder of the 3.13.x release series to allow a transition period,
+ but it may become a fatal error again in a later release. Scripts
+ relying on the old behavior can be trivially fixed by specifying
+ the path to the source tree (even if just ``.``) explicitly and
+ continue to work with all versions of CMake.
diff --git a/Help/release/dev/FindPython-NumPy-component.rst b/Help/release/dev/FindPython-NumPy-component.rst
new file mode 100644
index 0000000..5ea6cfb
--- /dev/null
+++ b/Help/release/dev/FindPython-NumPy-component.rst
@@ -0,0 +1,5 @@
+FindPython-NumPy-component
+--------------------------
+
+* The :module:`FindPython`, :module:`FindPython2`, and :module:`FindPython3`
+ modules gained support for ``NumPy`` component.
diff --git a/Help/release/dev/findpython-script.rst b/Help/release/dev/findpython-script.rst
new file mode 100644
index 0000000..5de1ebf
--- /dev/null
+++ b/Help/release/dev/findpython-script.rst
@@ -0,0 +1,6 @@
+findpython-script
+-----------------
+
+* The :module:`FindPython2`, :module:`FindPython3`, and :module:`FindPython`
+ modules now support running in script mode by skipping the creation of
+ imported targets and helper functions.
diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake
index 1820407..f94b254 100644
--- a/Modules/CheckFortranSourceCompiles.cmake
+++ b/Modules/CheckFortranSourceCompiles.cmake
@@ -17,8 +17,20 @@ Check if given Fortran source compiles and links into an executable.
)
Checks that the source supplied in ``<code>`` can be compiled as a Fortran
- source file and linked as an executable (so it must contain at least a
- ``PROGRAM`` entry point). The result will be stored in the internal cache
+ source file and linked as an executable. The ``<code>`` must be a Fortran program
+ containing at least an ``end`` statement--for example:
+
+ .. code-block:: cmake
+
+ check_fortran_source_compiles("character :: b; error stop b; end" F2018ESTOPOK SRC_EXT F90)
+
+ This command can help avoid costly build processes when a compiler lacks support
+ for a necessary feature, or a particular vendor library is not compatible with
+ the Fortran compiler version being used. This generate-time check may advise the
+ user of such before the main build process. See also the
+ :command:`check_fortran_source_runs` command to actually run the compiled code.
+
+ The result will be stored in the internal cache
variable ``<resultVar>``, with a boolean true value for success and boolean
false for failure.
diff --git a/Modules/CheckFortranSourceRuns.cmake b/Modules/CheckFortranSourceRuns.cmake
index 58d90d7..13fdb0b 100644
--- a/Modules/CheckFortranSourceRuns.cmake
+++ b/Modules/CheckFortranSourceRuns.cmake
@@ -16,8 +16,20 @@ subsequently be run.
[SRC_EXT <extension>])
Check that the source supplied in ``<code>`` can be compiled as a Fortran source
- file, linked as an executable and then run. The ``<code>`` must contain at
- least ``program; end program`` statements. If the ``<code>`` could be built and run
+ file, linked as an executable and then run. The ``<code>`` must be a Fortran program
+ containing at least an ``end`` statement--for example:
+
+ .. code-block:: cmake
+
+ check_fortran_source_runs("real :: x[*]; call co_sum(x); end" F2018coarrayOK)
+
+ This command can help avoid costly build processes when a compiler lacks support
+ for a necessary feature, or a particular vendor library is not compatible with
+ the Fortran compiler version being used. Some of these failures only occur at runtime
+ instead of linktime, and a trivial runtime example can catch the issue before the
+ main build process.
+
+ If the ``<code>`` could be built and run
successfully, the internal cache variable specified by ``<resultVar>`` will
be set to 1, otherwise it will be set to an value that evaluates to boolean
false (e.g. an empty string or an error message).
diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake
index 900e4f5..3491cdc 100644
--- a/Modules/FindGit.cmake
+++ b/Modules/FindGit.cmake
@@ -5,7 +5,8 @@
FindGit
-------
-The module defines the following ``IMPORTED`` targets:
+The module defines the following ``IMPORTED`` targets (when
+:prop_gbl:`CMAKE_ROLE` is ``PROJECT``):
``Git::Git``
Executable of the Git command-line client.
diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake
index 8645a0d..f014916 100644
--- a/Modules/FindPython.cmake
+++ b/Modules/FindPython.cmake
@@ -14,11 +14,12 @@ Three components are supported:
* ``Compiler``: search for Python compiler. Only offered by IronPython.
* ``Development``: search for development artifacts (include directories and
libraries).
+* ``NumPy``: search for NumPy include directories.
If no ``COMPONENTS`` is specified, ``Interpreter`` is assumed.
-To ensure consistent versions between components ``Interpreter``, ``Compiler``
-and ``Development``, specify all components at the same time::
+To ensure consistent versions between components ``Interpreter``, ``Compiler``,
+``Development`` and ``NumPy``, specify all components at the same time::
find_package (Python COMPONENTS Interpreter Development)
@@ -30,7 +31,8 @@ To manage concurrent versions 3 and 2 of Python, use :module:`FindPython3` and
Imported Targets
^^^^^^^^^^^^^^^^
-This module defines the following :ref:`Imported Targets <Imported Targets>`:
+This module defines the following :ref:`Imported Targets <Imported Targets>`
+(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``):
``Python::Interpreter``
Python interpreter. Target defined if component ``Interpreter`` is found.
@@ -38,6 +40,8 @@ This module defines the following :ref:`Imported Targets <Imported Targets>`:
Python compiler. Target defined if component ``Compiler`` is found.
``Python::Python``
Python library. Target defined if component ``Development`` is found.
+``Python::NumPy``
+ NumPy Python library. Target defined if component ``NumPy`` is found.
Result Variables
^^^^^^^^^^^^^^^^
@@ -103,6 +107,12 @@ This module will set the following variables in your project
Python minor version.
``Python_VERSION_PATCH``
Python patch version.
+``Python_NumPy_FOUND``
+ System has the NumPy.
+``Python_NumPy_INCLUDE_DIRS``
+ The NumPy include directries.
+``Python_NumPy_VERSION``
+ The NumPy version.
Hints
^^^^^
@@ -144,9 +154,10 @@ Hints
Commands
^^^^^^^^
-This module defines the command ``Python_add_library`` which have the same
-semantic as :command:`add_library` but take care of Python module naming rules
-(only applied if library is of type ``MODULE``) and add dependency to target
+This module defines the command ``Python_add_library`` (when
+:prop_gbl:`CMAKE_ROLE` is ``PROJECT``), which has the same semantics as
+:command:`add_library`, but takes care of Python module naming rules
+(only applied if library is of type ``MODULE``), and adds a dependency to target
``Python::Python``::
Python_add_library (my_module MODULE src1.cpp)
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index e0ebb90..0138b04 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -24,6 +24,8 @@ else()
message (FATAL_ERROR "FindPython: INTERNAL ERROR")
endif()
+get_property(_${_PYTHON_PREFIX}_CMAKE_ROLE GLOBAL PROPERTY CMAKE_ROLE)
+
#
# helper commands
@@ -207,6 +209,10 @@ if (NOT ${_PYTHON_PREFIX}_FIND_COMPONENTS)
set (${_PYTHON_PREFIX}_FIND_COMPONENTS Interpreter)
set (${_PYTHON_PREFIX}_FIND_REQUIRED_Interpreter TRUE)
endif()
+if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
+ list (APPEND ${_PYTHON_PREFIX}_FIND_COMPONENTS "Interpreter" "Development")
+ list (REMOVE_DUPLICATES ${_PYTHON_PREFIX}_FIND_COMPONENTS)
+endif()
foreach (_${_PYTHON_PREFIX}_COMPONENT IN LISTS ${_PYTHON_PREFIX}_FIND_COMPONENTS)
set (${_PYTHON_PREFIX}_${_${_PYTHON_PREFIX}_COMPONENT}_FOUND FALSE)
endforeach()
@@ -1120,6 +1126,41 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
endif()
endif()
+if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Interpreter_FOUND)
+ if (${_PYTHON_PREFIX}_FIND_REQUIRED_NumPy)
+ list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR)
+ list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS ${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR)
+ endif()
+ execute_process(
+ COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ "from __future__ import print_function\ntry: import numpy; print(numpy.get_include(), end='')\nexcept:pass\n"
+ RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
+ OUTPUT_VARIABLE _${_PYTHON_PREFIX}_NumPy_PATH
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (NOT _${_PYTHON_PREFIX}_RESULT)
+ find_path(${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR
+ NAMES arrayobject.h numpyconfig.h
+ HINTS "${_${_PYTHON_PREFIX}_NumPy_PATH}"
+ PATH_SUFFIXES numpy
+ NO_DEFAULT_PATH)
+ endif()
+ if(${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR)
+ set(${_PYTHON_PREFIX}_NumPy_INCLUDE_DIRS "${${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR}")
+ set(${_PYTHON_PREFIX}_NumPy_FOUND TRUE)
+ endif()
+ if(${_PYTHON_PREFIX}_NumPy_FOUND)
+ execute_process(
+ COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ "from __future__ import print_function\ntry: import numpy; print(numpy.__version__, end='')\nexcept:pass\n"
+ RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
+ OUTPUT_VARIABLE _${_PYTHON_PREFIX}_NumPy_VERSION)
+ if (NOT _${_PYTHON_PREFIX}_RESULT)
+ set(${_PYTHON_PREFIX}_NumPy_VERSION "${_${_PYTHON_PREFIX}_NumPy_VERSION}")
+ endif()
+ endif()
+endif()
+
# final validation
if (${_PYTHON_PREFIX}_VERSION_MAJOR AND
NOT ${_PYTHON_PREFIX}_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
@@ -1133,118 +1174,128 @@ find_package_handle_standard_args (${_PYTHON_PREFIX}
HANDLE_COMPONENTS)
# Create imported targets and helper functions
-if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
- AND ${_PYTHON_PREFIX}_Interpreter_FOUND
- AND NOT TARGET ${_PYTHON_PREFIX}::Interpreter)
- add_executable (${_PYTHON_PREFIX}::Interpreter IMPORTED)
- set_property (TARGET ${_PYTHON_PREFIX}::Interpreter
- PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_EXECUTABLE}")
-endif()
-
-if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
- AND ${_PYTHON_PREFIX}_Compiler_FOUND
- AND NOT TARGET ${_PYTHON_PREFIX}::Compiler)
- add_executable (${_PYTHON_PREFIX}::Compiler IMPORTED)
- set_property (TARGET ${_PYTHON_PREFIX}::Compiler
- PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_COMPILER}")
-endif()
-
-if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
- AND ${_PYTHON_PREFIX}_Development_FOUND AND NOT TARGET ${_PYTHON_PREFIX}::Python)
+if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT")
+ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
+ AND ${_PYTHON_PREFIX}_Interpreter_FOUND
+ AND NOT TARGET ${_PYTHON_PREFIX}::Interpreter)
+ add_executable (${_PYTHON_PREFIX}::Interpreter IMPORTED)
+ set_property (TARGET ${_PYTHON_PREFIX}::Interpreter
+ PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_EXECUTABLE}")
+ endif()
- if (${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$"
- OR ${_PYTHON_PREFIX}_LIBRARY_DEBUG MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$"
- OR ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE OR ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG)
- set (_${_PYTHON_PREFIX}_LIBRARY_TYPE SHARED)
- else()
- set (_${_PYTHON_PREFIX}_LIBRARY_TYPE STATIC)
+ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
+ AND ${_PYTHON_PREFIX}_Compiler_FOUND
+ AND NOT TARGET ${_PYTHON_PREFIX}::Compiler)
+ add_executable (${_PYTHON_PREFIX}::Compiler IMPORTED)
+ set_property (TARGET ${_PYTHON_PREFIX}::Compiler
+ PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_COMPILER}")
endif()
- add_library (${_PYTHON_PREFIX}::Python ${_${_PYTHON_PREFIX}_LIBRARY_TYPE} IMPORTED)
-
- set_property (TARGET ${_PYTHON_PREFIX}::Python
- PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${_PYTHON_PREFIX}_INCLUDE_DIR}")
-
- if ((${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE)
- OR (${_PYTHON_PREFIX}_LIBRARY_DEBUG AND ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG))
- # System manage shared libraries in two parts: import and runtime
- if (${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_LIBRARY_DEBUG)
- set_property (TARGET ${_PYTHON_PREFIX}::Python PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG)
- set_target_properties (${_PYTHON_PREFIX}::Python
- PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
- IMPORTED_IMPLIB_RELEASE "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}"
- IMPORTED_LOCATION_RELEASE "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE}")
- set_target_properties (${_PYTHON_PREFIX}::Python
- PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
- IMPORTED_IMPLIB_DEBUG "${${_PYTHON_PREFIX}_LIBRARY_DEBUG}"
- IMPORTED_LOCATION_DEBUG "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG}")
+ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
+ AND ${_PYTHON_PREFIX}_Development_FOUND AND NOT TARGET ${_PYTHON_PREFIX}::Python)
+
+ if (${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$"
+ OR ${_PYTHON_PREFIX}_LIBRARY_DEBUG MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$"
+ OR ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE OR ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG)
+ set (_${_PYTHON_PREFIX}_LIBRARY_TYPE SHARED)
else()
- set_target_properties (${_PYTHON_PREFIX}::Python
- PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C"
- IMPORTED_IMPLIB "${${_PYTHON_PREFIX}_LIBRARY}"
- IMPORTED_LOCATION "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY}")
+ set (_${_PYTHON_PREFIX}_LIBRARY_TYPE STATIC)
endif()
- else()
- if (${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_LIBRARY_DEBUG)
- set_property (TARGET ${_PYTHON_PREFIX}::Python PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG)
- set_target_properties (${_PYTHON_PREFIX}::Python
- PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
- IMPORTED_LOCATION_RELEASE "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}")
- set_target_properties (${_PYTHON_PREFIX}::Python
- PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
- IMPORTED_LOCATION_DEBUG "${${_PYTHON_PREFIX}_LIBRARY_DEBUG}")
+
+ add_library (${_PYTHON_PREFIX}::Python ${_${_PYTHON_PREFIX}_LIBRARY_TYPE} IMPORTED)
+
+ set_property (TARGET ${_PYTHON_PREFIX}::Python
+ PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${_PYTHON_PREFIX}_INCLUDE_DIR}")
+
+ if ((${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE)
+ OR (${_PYTHON_PREFIX}_LIBRARY_DEBUG AND ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG))
+ # System manage shared libraries in two parts: import and runtime
+ if (${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_LIBRARY_DEBUG)
+ set_property (TARGET ${_PYTHON_PREFIX}::Python PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG)
+ set_target_properties (${_PYTHON_PREFIX}::Python
+ PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
+ IMPORTED_IMPLIB_RELEASE "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}"
+ IMPORTED_LOCATION_RELEASE "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE}")
+ set_target_properties (${_PYTHON_PREFIX}::Python
+ PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
+ IMPORTED_IMPLIB_DEBUG "${${_PYTHON_PREFIX}_LIBRARY_DEBUG}"
+ IMPORTED_LOCATION_DEBUG "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG}")
+ else()
+ set_target_properties (${_PYTHON_PREFIX}::Python
+ PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_IMPLIB "${${_PYTHON_PREFIX}_LIBRARY}"
+ IMPORTED_LOCATION "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY}")
+ endif()
else()
- set_target_properties (${_PYTHON_PREFIX}::Python
- PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C"
- IMPORTED_LOCATION "${${_PYTHON_PREFIX}_LIBRARY}")
+ if (${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_LIBRARY_DEBUG)
+ set_property (TARGET ${_PYTHON_PREFIX}::Python PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG)
+ set_target_properties (${_PYTHON_PREFIX}::Python
+ PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
+ IMPORTED_LOCATION_RELEASE "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}")
+ set_target_properties (${_PYTHON_PREFIX}::Python
+ PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
+ IMPORTED_LOCATION_DEBUG "${${_PYTHON_PREFIX}_LIBRARY_DEBUG}")
+ else()
+ set_target_properties (${_PYTHON_PREFIX}::Python
+ PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${${_PYTHON_PREFIX}_LIBRARY}")
+ endif()
endif()
- endif()
- if (_${_PYTHON_PREFIX}_CONFIG AND _${_PYTHON_PREFIX}_LIBRARY_TYPE STREQUAL "STATIC")
- # extend link information with dependent libraries
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --ldflags
- RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
- OUTPUT_VARIABLE _${_PYTHON_PREFIX}_FLAGS
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- if (NOT _${_PYTHON_PREFIX}_RESULT)
- string (REGEX MATCHALL "-[Ll][^ ]+" _${_PYTHON_PREFIX}_LINK_LIBRARIES "${_${_PYTHON_PREFIX}_FLAGS}")
- # remove elements relative to python library itself
- list (FILTER _${_PYTHON_PREFIX}_LINK_LIBRARIES EXCLUDE REGEX "-lpython")
- foreach (_${_PYTHON_PREFIX}_DIR IN LISTS ${_PYTHON_PREFIX}_LIBRARY_DIRS)
- list (FILTER _${_PYTHON_PREFIX}_LINK_LIBRARIES EXCLUDE REGEX "-L${${_PYTHON_PREFIX}_DIR}")
- endforeach()
- set_property (TARGET ${_PYTHON_PREFIX}::Python
- PROPERTY INTERFACE_LINK_LIBRARIES ${_${_PYTHON_PREFIX}_LINK_LIBRARIES})
+ if (_${_PYTHON_PREFIX}_CONFIG AND _${_PYTHON_PREFIX}_LIBRARY_TYPE STREQUAL "STATIC")
+ # extend link information with dependent libraries
+ execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --ldflags
+ RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
+ OUTPUT_VARIABLE _${_PYTHON_PREFIX}_FLAGS
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (NOT _${_PYTHON_PREFIX}_RESULT)
+ string (REGEX MATCHALL "-[Ll][^ ]+" _${_PYTHON_PREFIX}_LINK_LIBRARIES "${_${_PYTHON_PREFIX}_FLAGS}")
+ # remove elements relative to python library itself
+ list (FILTER _${_PYTHON_PREFIX}_LINK_LIBRARIES EXCLUDE REGEX "-lpython")
+ foreach (_${_PYTHON_PREFIX}_DIR IN LISTS ${_PYTHON_PREFIX}_LIBRARY_DIRS)
+ list (FILTER _${_PYTHON_PREFIX}_LINK_LIBRARIES EXCLUDE REGEX "-L${${_PYTHON_PREFIX}_DIR}")
+ endforeach()
+ set_property (TARGET ${_PYTHON_PREFIX}::Python
+ PROPERTY INTERFACE_LINK_LIBRARIES ${_${_PYTHON_PREFIX}_LINK_LIBRARIES})
+ endif()
endif()
- endif()
- #
- # PYTHON_ADD_LIBRARY (<name> [STATIC|SHARED|MODULE] src1 src2 ... srcN)
- # It is used to build modules for python.
- #
- function (__${_PYTHON_PREFIX}_ADD_LIBRARY prefix name)
- cmake_parse_arguments (PARSE_ARGV 2 PYTHON_ADD_LIBRARY
- "STATIC;SHARED;MODULE" "" "")
-
- unset (type)
- if (NOT (PYTHON_ADD_LIBRARY_STATIC
- OR PYTHON_ADD_LIBRARY_SHARED
- OR PYTHON_ADD_LIBRARY_MODULE))
- set (type MODULE)
- endif()
- add_library (${name} ${type} ${ARGN})
- target_link_libraries (${name} PRIVATE ${prefix}::Python)
-
- # customize library name to follow module name rules
- get_property (type TARGET ${name} PROPERTY TYPE)
- if (type STREQUAL "MODULE_LIBRARY")
- set_property (TARGET ${name} PROPERTY PREFIX "")
- if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
- set_property (TARGET ${name} PROPERTY SUFFIX ".pyd")
+ #
+ # PYTHON_ADD_LIBRARY (<name> [STATIC|SHARED|MODULE] src1 src2 ... srcN)
+ # It is used to build modules for python.
+ #
+ function (__${_PYTHON_PREFIX}_ADD_LIBRARY prefix name)
+ cmake_parse_arguments (PARSE_ARGV 2 PYTHON_ADD_LIBRARY
+ "STATIC;SHARED;MODULE" "" "")
+
+ unset (type)
+ if (NOT (PYTHON_ADD_LIBRARY_STATIC
+ OR PYTHON_ADD_LIBRARY_SHARED
+ OR PYTHON_ADD_LIBRARY_MODULE))
+ set (type MODULE)
endif()
- endif()
- endfunction()
+ add_library (${name} ${type} ${ARGN})
+ target_link_libraries (${name} PRIVATE ${prefix}::Python)
+
+ # customize library name to follow module name rules
+ get_property (type TARGET ${name} PROPERTY TYPE)
+ if (type STREQUAL "MODULE_LIBRARY")
+ set_property (TARGET ${name} PROPERTY PREFIX "")
+ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ set_property (TARGET ${name} PROPERTY SUFFIX ".pyd")
+ endif()
+ endif()
+ endfunction()
+ endif()
+
+ if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_NumPy_FOUND
+ AND NOT TARGET ${_PYTHON_PREFIX}::NumPy AND TARGET ${_PYTHON_PREFIX}::Python)
+ add_library (${_PYTHON_PREFIX}::NumPy INTERFACE IMPORTED)
+ set_property (TARGET ${_PYTHON_PREFIX}::NumPy
+ PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR}")
+ target_link_libraries (${_PYTHON_PREFIX}::NumPy INTERFACE ${_PYTHON_PREFIX}::Python)
+ endif()
endif()
# final clean-up
diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake
index 998e992..0bb7b28 100644
--- a/Modules/FindPython2.cmake
+++ b/Modules/FindPython2.cmake
@@ -14,11 +14,12 @@ Three components are supported:
* ``Compiler``: search for Python 2 compiler. Only offered by IronPython.
* ``Development``: search for development artifacts (include directories and
libraries)
+* ``NumPy``: search for NumPy include directories.
If no ``COMPONENTS`` is specified, ``Interpreter`` is assumed.
-To ensure consistent versions between components ``Interpreter``, ``Compiler``
-and ``Development``, specify all components at the same time::
+To ensure consistent versions between components ``Interpreter``, ``Compiler``,
+``Development`` and ``NumPy``, specify all components at the same time::
find_package (Python2 COMPONENTS Interpreter Development)
@@ -31,7 +32,8 @@ for you.
Imported Targets
^^^^^^^^^^^^^^^^
-This module defines the following :ref:`Imported Targets <Imported Targets>`:
+This module defines the following :ref:`Imported Targets <Imported Targets>`
+(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``):
``Python2::Interpreter``
Python 2 interpreter. Target defined if component ``Interpreter`` is found.
@@ -39,6 +41,8 @@ This module defines the following :ref:`Imported Targets <Imported Targets>`:
Python 2 compiler. Target defined if component ``Compiler`` is found.
``Python2::Python``
Python 2 library. Target defined if component ``Development`` is found.
+``Python2::NumPy``
+ NumPy library for Python 2. Target defined if component ``NumPy`` is found.
Result Variables
^^^^^^^^^^^^^^^^
@@ -104,6 +108,12 @@ This module will set the following variables in your project
Python 2 minor version.
``Python2_VERSION_PATCH``
Python 2 patch version.
+``Python2_NumPy_FOUND``
+ System has the NumPy.
+``Python2_NumPy_INCLUDE_DIRS``
+ The NumPy include directries.
+``Python2_NumPy_VERSION``
+ The NumPy version.
Hints
^^^^^
@@ -145,9 +155,10 @@ Hints
Commands
^^^^^^^^
-This module defines the command ``Python2_add_library`` which have the same
-semantic as :command:`add_library` but take care of Python module naming rules
-(only applied if library is of type ``MODULE``) and add dependency to target
+This module defines the command ``Python2_add_library`` (when
+:prop_gbl:`CMAKE_ROLE` is ``PROJECT``), which has the same semantics as
+:command:`add_library`, but takes care of Python module naming rules
+(only applied if library is of type ``MODULE``), and adds a dependency to target
``Python2::Python``::
Python2_add_library (my_module MODULE src1.cpp)
diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake
index 2176f3f..b3dfff3 100644
--- a/Modules/FindPython3.cmake
+++ b/Modules/FindPython3.cmake
@@ -14,11 +14,12 @@ Three components are supported:
* ``Compiler``: search for Python 3 compiler. Only offered by IronPython.
* ``Development``: search for development artifacts (include directories and
libraries)
+* ``NumPy``: search for NumPy include directories.
If no ``COMPONENTS`` is specified, ``Interpreter`` is assumed.
-To ensure consistent versions between components ``Interpreter``, ``Compiler``
-and ``Development``, specify all components at the same time::
+To ensure consistent versions between components ``Interpreter``, ``Compiler``,
+``Development`` and ``NumPy``, specify all components at the same time::
find_package (Python3 COMPONENTS Interpreter Development)
@@ -31,7 +32,8 @@ for you.
Imported Targets
^^^^^^^^^^^^^^^^
-This module defines the following :ref:`Imported Targets <Imported Targets>`:
+This module defines the following :ref:`Imported Targets <Imported Targets>`
+(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``):
``Python3::Interpreter``
Python 3 interpreter. Target defined if component ``Interpreter`` is found.
@@ -39,6 +41,8 @@ This module defines the following :ref:`Imported Targets <Imported Targets>`:
Python 3 compiler. Target defined if component ``Compiler`` is found.
``Python3::Python``
Python 3 library. Target defined if component ``Development`` is found.
+``Python3::NumPy``
+ NumPy library for Python 3. Target defined if component ``NumPy`` is found.
Result Variables
^^^^^^^^^^^^^^^^
@@ -104,6 +108,12 @@ This module will set the following variables in your project
Python 3 minor version.
``Python3_VERSION_PATCH``
Python 3 patch version.
+``Python3_NumPy_FOUND``
+ System has the NumPy.
+``Python3_NumPy_INCLUDE_DIRS``
+ The NumPy include directries.
+``Python3_NumPy_VERSION``
+ The NumPy version.
Hints
^^^^^
@@ -145,9 +155,10 @@ Hints
Commands
^^^^^^^^
-This module defines the command ``Python3_add_library`` which have the same
-semantic as :command:`add_library` but take care of Python module naming rules
-(only applied if library is of type ``MODULE``) and add dependency to target
+This module defines the command ``Python3_add_library`` (when
+:prop_gbl:`CMAKE_ROLE` is ``PROJECT``), which has the same semantics as
+:command:`add_library`, but takes care of Python module naming rules
+(only applied if library is of type ``MODULE``), and adds a dependency to target
``Python3::Python``::
Python3_add_library (my_module MODULE src1.cpp)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 497feed..e3a5e52 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 13)
-set(CMake_VERSION_PATCH 20190122)
+set(CMake_VERSION_PATCH 20190125)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 29968af..46a428f 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -23,17 +23,15 @@ namespace {
class DebGenerator
{
public:
- DebGenerator(cmCPackLog* logger, std::string const& outputName,
- std::string const& workDir, std::string const& topLevelDir,
- std::string const& temporaryDir,
+ DebGenerator(cmCPackLog* logger, std::string outputName, std::string workDir,
+ std::string topLevelDir, std::string temporaryDir,
const char* debianCompressionType,
const char* debianArchiveType,
- std::map<std::string, std::string> const& controlValues,
- bool genShLibs, std::string const& shLibsFilename,
- bool genPostInst, std::string const& postInst, bool genPostRm,
- std::string const& postRm, const char* controlExtra,
- bool permissionStrctPolicy,
- std::vector<std::string> const& packageFiles);
+ std::map<std::string, std::string> controlValues,
+ bool genShLibs, std::string shLibsFilename, bool genPostInst,
+ std::string postInst, bool genPostRm, std::string postRm,
+ const char* controlExtra, bool permissionStrctPolicy,
+ std::vector<std::string> packageFiles);
bool generate() const;
@@ -66,31 +64,29 @@ private:
};
DebGenerator::DebGenerator(
- cmCPackLog* logger, std::string const& outputName,
- std::string const& workDir, std::string const& topLevelDir,
- std::string const& temporaryDir, const char* debianCompressionType,
- const char* debianArchiveType,
- std::map<std::string, std::string> const& controlValues, bool genShLibs,
- std::string const& shLibsFilename, bool genPostInst,
- std::string const& postInst, bool genPostRm, std::string const& postRm,
- const char* controlExtra, bool permissionStrictPolicy,
- std::vector<std::string> const& packageFiles)
+ cmCPackLog* logger, std::string outputName, std::string workDir,
+ std::string topLevelDir, std::string temporaryDir,
+ const char* debianCompressionType, const char* debianArchiveType,
+ std::map<std::string, std::string> controlValues, bool genShLibs,
+ std::string shLibsFilename, bool genPostInst, std::string postInst,
+ bool genPostRm, std::string postRm, const char* controlExtra,
+ bool permissionStrictPolicy, std::vector<std::string> packageFiles)
: Logger(logger)
- , OutputName(outputName)
- , WorkDir(workDir)
- , TopLevelDir(topLevelDir)
- , TemporaryDir(temporaryDir)
+ , OutputName(std::move(outputName))
+ , WorkDir(std::move(workDir))
+ , TopLevelDir(std::move(topLevelDir))
+ , TemporaryDir(std::move(temporaryDir))
, DebianArchiveType(debianArchiveType ? debianArchiveType : "gnutar")
- , ControlValues(controlValues)
+ , ControlValues(std::move(controlValues))
, GenShLibs(genShLibs)
- , ShLibsFilename(shLibsFilename)
+ , ShLibsFilename(std::move(shLibsFilename))
, GenPostInst(genPostInst)
- , PostInst(postInst)
+ , PostInst(std::move(postInst))
, GenPostRm(genPostRm)
- , PostRm(postRm)
+ , PostRm(std::move(postRm))
, ControlExtra(controlExtra)
, PermissionStrictPolicy(permissionStrictPolicy)
- , PackageFiles(packageFiles)
+ , PackageFiles(std::move(packageFiles))
{
if (!debianCompressionType) {
debianCompressionType = "gzip";
diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx
index 1e6b118..0ff0054 100644
--- a/Source/CPack/cmCPackFreeBSDGenerator.cxx
+++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx
@@ -17,6 +17,7 @@
#include <pkg.h>
#include <algorithm>
+#include <utility>
cmCPackFreeBSDGenerator::cmCPackFreeBSDGenerator()
: cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, "paxr")
@@ -97,8 +98,8 @@ class ManifestKey
public:
std::string key;
- ManifestKey(const std::string& k)
- : key(k)
+ ManifestKey(std::string k)
+ : key(std::move(k))
{
}
@@ -115,9 +116,9 @@ class ManifestKeyValue : public ManifestKey
public:
std::string value;
- ManifestKeyValue(const std::string& k, const std::string& v)
+ ManifestKeyValue(const std::string& k, std::string v)
: ManifestKey(k)
- , value(v)
+ , value(std::move(v))
{
}
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 55ef375..188ad69 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -20,15 +20,16 @@
#include <algorithm>
#include <stdio.h>
#include <string.h>
+#include <utility>
inline int ctrl(int z)
{
return (z & 037);
}
-cmCursesMainForm::cmCursesMainForm(std::vector<std::string> const& args,
+cmCursesMainForm::cmCursesMainForm(std::vector<std::string> args,
int initWidth)
- : Args(args)
+ : Args(std::move(args))
, InitialWidth(initWidth)
{
this->NumberOfPages = 0;
diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h
index 2c006cf..824025b 100644
--- a/Source/CursesDialog/cmCursesMainForm.h
+++ b/Source/CursesDialog/cmCursesMainForm.h
@@ -26,7 +26,7 @@ class cmCursesMainForm : public cmCursesForm
CM_DISABLE_COPY(cmCursesMainForm)
public:
- cmCursesMainForm(std::vector<std::string> const& args, int initwidth);
+ cmCursesMainForm(std::vector<std::string> args, int initwidth);
~cmCursesMainForm() override;
/**
diff --git a/Source/QtDialog/QCMakeWidgets.cxx b/Source/QtDialog/QCMakeWidgets.cxx
index b544b86..eab418f 100644
--- a/Source/QtDialog/QCMakeWidgets.cxx
+++ b/Source/QtDialog/QCMakeWidgets.cxx
@@ -7,10 +7,11 @@
#include <QFileInfo>
#include <QResizeEvent>
#include <QToolButton>
+#include <utility>
-QCMakeFileEditor::QCMakeFileEditor(QWidget* p, const QString& var)
+QCMakeFileEditor::QCMakeFileEditor(QWidget* p, QString var)
: QLineEdit(p)
- , Variable(var)
+ , Variable(std::move(var))
{
this->ToolButton = new QToolButton(this);
this->ToolButton->setText("...");
diff --git a/Source/QtDialog/QCMakeWidgets.h b/Source/QtDialog/QCMakeWidgets.h
index e63c197..5d2368e 100644
--- a/Source/QtDialog/QCMakeWidgets.h
+++ b/Source/QtDialog/QCMakeWidgets.h
@@ -18,7 +18,7 @@ class QCMakeFileEditor : public QLineEdit
{
Q_OBJECT
public:
- QCMakeFileEditor(QWidget* p, const QString& var);
+ QCMakeFileEditor(QWidget* p, QString var);
protected slots:
virtual void chooseFile() = 0;
signals:
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index 2f8e675..9e3efd3 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -61,8 +61,8 @@ struct cmStrCmp
: m_test(test)
{
}
- cmStrCmp(const std::string& test)
- : m_test(test)
+ cmStrCmp(std::string test)
+ : m_test(std::move(test))
{
}
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index 8ed43f9..811af56 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -720,7 +720,7 @@ void CCONV cmSourceFileSetName(void* arg, const char* name, const char* dir,
ext != headerExts.end(); ++ext) {
e << " ." << *ext;
}
- cmSystemTools::Error(e.str().c_str());
+ cmSystemTools::Error(e.str());
}
void CCONV cmSourceFileSetName2(void* arg, const char* name, const char* dir,
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 4e2f275..989c7ee 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -2173,7 +2173,7 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
// handle the simple commandline arguments
std::string errormsg;
if (!this->HandleCommandLineArguments(i, args, errormsg)) {
- cmSystemTools::Error(errormsg.c_str());
+ cmSystemTools::Error(errormsg);
return 1;
}
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index e1d312b..a133914 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -123,7 +123,7 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal,
std::ostringstream error;
error << "Parse error in cache file " << cacheFile;
error << " on line " << lineno << ". Offending entry: " << realbuffer;
- cmSystemTools::Error(error.str().c_str());
+ cmSystemTools::Error(error.str());
}
}
this->CacheMajorVersion = 0;
@@ -171,7 +171,7 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal,
<< " where CMakeCache.txt was created. This may result "
"in binaries being created in the wrong place. If you "
"are not sure, reedit the CMakeCache.txt";
- cmSystemTools::Error(message.str().c_str());
+ cmSystemTools::Error(message.str());
}
}
return true;
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 87bc150..c68bb21 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1237,7 +1237,7 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item)
std::ostringstream e;
e << "Could not parse framework path \"" << item << "\" "
<< "linked by target " << this->Target->GetName() << ".";
- cmSystemTools::Error(e.str().c_str());
+ cmSystemTools::Error(e.str());
return;
}
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index db7eb96..61fcf03 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -9,6 +9,7 @@
#include <iosfwd>
#include <set>
#include <string>
+#include <utility>
#include <vector>
class cmGeneratorTarget;
@@ -31,9 +32,8 @@ public:
struct Item
{
Item() {}
- Item(std::string const& v, bool p,
- cmGeneratorTarget const* target = nullptr)
- : Value(v)
+ Item(std::string v, bool p, cmGeneratorTarget const* target = nullptr)
+ : Value(std::move(v))
, IsPath(p)
, Target(target)
{
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index fde9750..1d20cff 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -495,7 +495,7 @@ void cmComputeTargetDepends::ComplainAboutBadComponent(
e << "At least one of these targets is not a STATIC_LIBRARY. "
<< "Cyclic dependencies are allowed only among static libraries.";
}
- cmSystemTools::Error(e.str().c_str());
+ cmSystemTools::Error(e.str());
}
bool cmComputeTargetDepends::IntraComponent(std::vector<int> const& cmap,
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 33b9cf1..94ea529 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -8,6 +8,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <utility>
#include "cmAlgorithms.h"
#include "cmMakefile.h"
@@ -53,11 +54,11 @@ static std::string const keyVERSION_LESS = "VERSION_LESS";
static std::string const keyVERSION_LESS_EQUAL = "VERSION_LESS_EQUAL";
cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile,
- const cmListFileContext& context,
- const cmListFileBacktrace& bt)
+ cmListFileContext context,
+ cmListFileBacktrace bt)
: Makefile(makefile)
- , ExecutionContext(context)
- , Backtrace(bt)
+ , ExecutionContext(std::move(context))
+ , Backtrace(std::move(bt))
, Policy12Status(makefile.GetPolicyStatus(cmPolicies::CMP0012))
, Policy54Status(makefile.GetPolicyStatus(cmPolicies::CMP0054))
, Policy57Status(makefile.GetPolicyStatus(cmPolicies::CMP0057))
diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h
index fc87a2d..59e1396 100644
--- a/Source/cmConditionEvaluator.h
+++ b/Source/cmConditionEvaluator.h
@@ -21,8 +21,8 @@ class cmConditionEvaluator
public:
typedef std::list<cmExpandedCommandArgument> cmArgumentList;
- cmConditionEvaluator(cmMakefile& makefile, cmListFileContext const& context,
- cmListFileBacktrace const& bt);
+ cmConditionEvaluator(cmMakefile& makefile, cmListFileContext context,
+ cmListFileBacktrace bt);
// this is a shared function for both If and Else to determine if the
// arguments were valid, and if so, was the response true. If there is
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index 9dcec2f..242ceaa 100644
--- a/Source/cmCustomCommand.cxx
+++ b/Source/cmCustomCommand.cxx
@@ -4,17 +4,19 @@
#include "cmMakefile.h"
+#include <utility>
+
cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
- const std::vector<std::string>& outputs,
- const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends,
- const cmCustomCommandLines& commandLines,
+ std::vector<std::string> outputs,
+ std::vector<std::string> byproducts,
+ std::vector<std::string> depends,
+ cmCustomCommandLines commandLines,
const char* comment,
const char* workingDirectory)
- : Outputs(outputs)
- , Byproducts(byproducts)
- , Depends(depends)
- , CommandLines(commandLines)
+ : Outputs(std::move(outputs))
+ , Byproducts(std::move(byproducts))
+ , Depends(std::move(depends))
+ , CommandLines(std::move(commandLines))
, Comment(comment ? comment : "")
, WorkingDirectory(workingDirectory ? workingDirectory : "")
, HaveComment(comment != nullptr)
diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h
index d82160b..50f15a4 100644
--- a/Source/cmCustomCommand.h
+++ b/Source/cmCustomCommand.h
@@ -23,12 +23,11 @@ class cmCustomCommand
{
public:
/** Main constructor specifies all information for the command. */
- cmCustomCommand(cmMakefile const* mf,
- const std::vector<std::string>& outputs,
- const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends,
- const cmCustomCommandLines& commandLines,
- const char* comment, const char* workingDirectory);
+ cmCustomCommand(cmMakefile const* mf, std::vector<std::string> outputs,
+ std::vector<std::string> byproducts,
+ std::vector<std::string> depends,
+ cmCustomCommandLines commandLines, const char* comment,
+ const char* workingDirectory);
/** Get the output file produced by the command. */
const std::vector<std::string>& GetOutputs() const;
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index d1c1736..6bf9946 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -16,10 +16,10 @@
#include <utility>
cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
- const std::string& config,
+ std::string config,
cmLocalGenerator* lg)
: CC(cc)
- , Config(config)
+ , Config(std::move(config))
, LG(lg)
, OldStyle(cc.GetEscapeOldStyle())
, MakeVars(cc.GetEscapeAllowMakeVars())
diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h
index b7e2a39..9684cff 100644
--- a/Source/cmCustomCommandGenerator.h
+++ b/Source/cmCustomCommandGenerator.h
@@ -29,8 +29,8 @@ class cmCustomCommandGenerator
const char* GetArgv0Location(unsigned int c) const;
public:
- cmCustomCommandGenerator(cmCustomCommand const& cc,
- const std::string& config, cmLocalGenerator* lg);
+ cmCustomCommandGenerator(cmCustomCommand const& cc, std::string config,
+ cmLocalGenerator* lg);
~cmCustomCommandGenerator();
cmCustomCommand const& GetCC() const { return this->CC; }
unsigned int GetNumberOfCommands() const;
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index 3b3783a..976ba57 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -13,9 +13,9 @@
#include <string.h>
#include <utility>
-cmDepends::cmDepends(cmLocalGenerator* lg, const std::string& targetDir)
+cmDepends::cmDepends(cmLocalGenerator* lg, std::string targetDir)
: LocalGenerator(lg)
- , TargetDirectory(targetDir)
+ , TargetDirectory(std::move(targetDir))
, Dependee(new char[MaxPath])
, Depender(new char[MaxPath])
{
diff --git a/Source/cmDepends.h b/Source/cmDepends.h
index b0b5bb5..c5e1d5b 100644
--- a/Source/cmDepends.h
+++ b/Source/cmDepends.h
@@ -29,7 +29,7 @@ class cmDepends
public:
/** Instances need to know the build directory name and the relative
path from the build directory to the target file. */
- cmDepends(cmLocalGenerator* lg = nullptr, const std::string& targetDir = "");
+ cmDepends(cmLocalGenerator* lg = nullptr, std::string targetDir = "");
/** Set the local generator for the directory in which we are
scanning dependencies. This is not a full local generator; it
diff --git a/Source/cmExpandedCommandArgument.cxx b/Source/cmExpandedCommandArgument.cxx
index 650a5ad..00848a6 100644
--- a/Source/cmExpandedCommandArgument.cxx
+++ b/Source/cmExpandedCommandArgument.cxx
@@ -2,13 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExpandedCommandArgument.h"
+#include <utility>
+
cmExpandedCommandArgument::cmExpandedCommandArgument()
{
}
-cmExpandedCommandArgument::cmExpandedCommandArgument(std::string const& value,
+cmExpandedCommandArgument::cmExpandedCommandArgument(std::string value,
bool quoted)
- : Value(value)
+ : Value(std::move(value))
, Quoted(quoted)
{
}
diff --git a/Source/cmExpandedCommandArgument.h b/Source/cmExpandedCommandArgument.h
index d71fc92..69d35de 100644
--- a/Source/cmExpandedCommandArgument.h
+++ b/Source/cmExpandedCommandArgument.h
@@ -18,7 +18,7 @@ class cmExpandedCommandArgument
{
public:
cmExpandedCommandArgument();
- cmExpandedCommandArgument(std::string const& value, bool quoted);
+ cmExpandedCommandArgument(std::string value, bool quoted);
std::string const& GetValue() const;
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index c6b66a3..c8f743a 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -83,7 +83,7 @@ bool cmExportFileGenerator::GenerateImportFile()
std::string se = cmSystemTools::GetLastSystemError();
std::ostringstream e;
e << "cannot write to file \"" << this->MainImportFile << "\": " << se;
- cmSystemTools::Error(e.str().c_str());
+ cmSystemTools::Error(e.str());
return false;
}
std::ostream& os = *foutPtr;
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 3821144..f8bc0ab 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -54,7 +54,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
<< "\" ...) "
<< "includes target \"" << te->Target->GetName()
<< "\" more than once in the export set.";
- cmSystemTools::Error(e.str().c_str());
+ cmSystemTools::Error(e.str());
return false;
}
}
@@ -112,7 +112,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
std::string errorMessage;
if (!this->PopulateExportProperties(gt, properties, errorMessage)) {
- cmSystemTools::Error(errorMessage.c_str());
+ cmSystemTools::Error(errorMessage);
return false;
}
@@ -294,7 +294,7 @@ bool cmExportInstallFileGenerator::GenerateImportFileConfig(
std::string se = cmSystemTools::GetLastSystemError();
std::ostringstream e;
e << "cannot write to file \"" << fileName << "\": " << se;
- cmSystemTools::Error(e.str().c_str());
+ cmSystemTools::Error(e.str());
return false;
}
std::ostream& os = exportFileStream;
@@ -518,7 +518,7 @@ void cmExportInstallFileGenerator::ComplainAboutMissingTarget(
e << "that is not in this export set, but " << occurrences
<< " times in others.";
}
- cmSystemTools::Error(e.str().c_str());
+ cmSystemTools::Error(e.str());
}
std::string cmExportInstallFileGenerator::InstallNameDir(
diff --git a/Source/cmExportSet.h b/Source/cmExportSet.h
index 58ad617..0ef306f 100644
--- a/Source/cmExportSet.h
+++ b/Source/cmExportSet.h
@@ -6,6 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <string>
+#include <utility>
#include <vector>
class cmInstallExportGenerator;
@@ -17,8 +18,8 @@ class cmExportSet
{
public:
/// Construct an empty export set named \a name
- cmExportSet(const std::string& name)
- : Name(name)
+ cmExportSet(std::string name)
+ : Name(std::move(name))
{
}
/// Destructor
diff --git a/Source/cmExternalMakefileProjectGenerator.cxx b/Source/cmExternalMakefileProjectGenerator.cxx
index fecd821..150995f 100644
--- a/Source/cmExternalMakefileProjectGenerator.cxx
+++ b/Source/cmExternalMakefileProjectGenerator.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExternalMakefileProjectGenerator.h"
+#include <utility>
+
class cmMakefile;
void cmExternalMakefileProjectGenerator::EnableLanguage(
@@ -32,10 +34,9 @@ bool cmExternalMakefileProjectGenerator::Open(
}
cmExternalMakefileProjectGeneratorFactory::
- cmExternalMakefileProjectGeneratorFactory(const std::string& n,
- const std::string& doc)
- : Name(n)
- , Documentation(doc)
+ cmExternalMakefileProjectGeneratorFactory(std::string n, std::string doc)
+ : Name(std::move(n))
+ , Documentation(std::move(doc))
{
}
diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h
index d48abca..492987d 100644
--- a/Source/cmExternalMakefileProjectGenerator.h
+++ b/Source/cmExternalMakefileProjectGenerator.h
@@ -70,8 +70,7 @@ protected:
class cmExternalMakefileProjectGeneratorFactory
{
public:
- cmExternalMakefileProjectGeneratorFactory(const std::string& n,
- const std::string& doc);
+ cmExternalMakefileProjectGeneratorFactory(std::string n, std::string doc);
virtual ~cmExternalMakefileProjectGeneratorFactory();
std::string GetName() const;
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 078d1d5..3363c9b 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -166,13 +166,13 @@ class BacktraceData
}
public:
- BacktraceData(std::string const& topSource);
+ BacktraceData(std::string topSource);
bool Add(cmListFileBacktrace const& bt, Json::ArrayIndex& index);
Json::Value Dump();
};
-BacktraceData::BacktraceData(std::string const& topSource)
- : TopSource(topSource)
+BacktraceData::BacktraceData(std::string topSource)
+ : TopSource(std::move(topSource))
{
}
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index c9ae38c..164d225 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2916,10 +2916,6 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
check_curl_result(res, "DOWNLOAD cannot set url: ");
- // enable auth
- res = ::curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
- check_curl_result(res, "DOWNLOAD cannot set httpauth: ");
-
// enable HTTP ERROR parsing
res = ::curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
check_curl_result(res, "DOWNLOAD cannot set http failure option: ");
@@ -3219,10 +3215,6 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
res = ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
check_curl_result(res, "UPLOAD cannot set url: ");
- // enable auth
- res = ::curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
- check_curl_result(res, "UPLOAD cannot set httpauth: ");
-
res =
::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, cmWriteToMemoryCallback);
check_curl_result(res, "UPLOAD cannot set write function: ");
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 9ae1cb9..bec2af9 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -663,7 +663,7 @@ bool cmFindPackageCommand::FindModule(bool& found)
module += this->Name;
module += ".cmake";
bool system = false;
- std::string mfile = this->Makefile->GetModulesFile(module.c_str(), system);
+ std::string mfile = this->Makefile->GetModulesFile(module, system);
if (!mfile.empty()) {
if (system) {
auto it = this->DeprecatedFindModules.find(this->Name);
@@ -1760,8 +1760,8 @@ bool cmFileListGeneratorBase::Consider(std::string const& fullPath,
class cmFileListGeneratorFixed : public cmFileListGeneratorBase
{
public:
- cmFileListGeneratorFixed(std::string const& str)
- : String(str)
+ cmFileListGeneratorFixed(std::string str)
+ : String(std::move(str))
{
}
cmFileListGeneratorFixed(cmFileListGeneratorFixed const& r)
@@ -1940,8 +1940,8 @@ private:
class cmFileListGeneratorCaseInsensitive : public cmFileListGeneratorBase
{
public:
- cmFileListGeneratorCaseInsensitive(std::string const& str)
- : String(str)
+ cmFileListGeneratorCaseInsensitive(std::string str)
+ : String(std::move(str))
{
}
cmFileListGeneratorCaseInsensitive(
@@ -1982,8 +1982,8 @@ private:
class cmFileListGeneratorGlob : public cmFileListGeneratorBase
{
public:
- cmFileListGeneratorGlob(std::string const& str)
- : Pattern(str)
+ cmFileListGeneratorGlob(std::string str)
+ : Pattern(std::move(str))
{
}
cmFileListGeneratorGlob(cmFileListGeneratorGlob const& r)
diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h
index 132b3e6..8d4c90b 100644
--- a/Source/cmFortranParser.h
+++ b/Source/cmFortranParser.h
@@ -8,6 +8,7 @@
# include <set>
# include <string>
+# include <utility>
# include <vector>
#endif
@@ -114,10 +115,10 @@ int cmFortran_yyparse(yyscan_t);
// Define parser object internal structure.
struct cmFortranFile
{
- cmFortranFile(FILE* file, YY_BUFFER_STATE buffer, const std::string& dir)
+ cmFortranFile(FILE* file, YY_BUFFER_STATE buffer, std::string dir)
: File(file)
, Buffer(buffer)
- , Directory(dir)
+ , Directory(std::move(dir))
, LastCharWasNewline(false)
{
}
@@ -129,9 +130,8 @@ struct cmFortranFile
struct cmFortranParser_s
{
- cmFortranParser_s(std::vector<std::string> const& includes,
- std::set<std::string> const& defines,
- cmFortranSourceInfo& info);
+ cmFortranParser_s(std::vector<std::string> includes,
+ std::set<std::string> defines, cmFortranSourceInfo& info);
~cmFortranParser_s();
bool FindIncludeFile(const char* dir, const char* includeName,
diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx
index 01cbb78..45481a4 100644
--- a/Source/cmFortranParserImpl.cxx
+++ b/Source/cmFortranParserImpl.cxx
@@ -8,6 +8,7 @@
#include <stack>
#include <stdio.h>
#include <string>
+#include <utility>
#include <vector>
bool cmFortranParser_s::FindIncludeFile(const char* dir,
@@ -42,11 +43,11 @@ bool cmFortranParser_s::FindIncludeFile(const char* dir,
return false;
}
-cmFortranParser_s::cmFortranParser_s(std::vector<std::string> const& includes,
- std::set<std::string> const& defines,
+cmFortranParser_s::cmFortranParser_s(std::vector<std::string> includes,
+ std::set<std::string> defines,
cmFortranSourceInfo& info)
- : IncludePath(includes)
- , PPDefinitions(defines)
+ : IncludePath(std::move(includes))
+ , PPDefinitions(std::move(defines))
, Info(info)
{
this->InInterface = false;
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 96d4ad6..f3f9771 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -15,9 +15,8 @@
#include "cmGeneratorExpressionParser.h"
#include "cmSystemTools.h"
-cmGeneratorExpression::cmGeneratorExpression(
- const cmListFileBacktrace& backtrace)
- : Backtrace(backtrace)
+cmGeneratorExpression::cmGeneratorExpression(cmListFileBacktrace backtrace)
+ : Backtrace(std::move(backtrace))
{
}
@@ -96,9 +95,9 @@ const std::string& cmCompiledGeneratorExpression::EvaluateWithContext(
}
cmCompiledGeneratorExpression::cmCompiledGeneratorExpression(
- cmListFileBacktrace const& backtrace, const std::string& input)
- : Backtrace(backtrace)
- , Input(input)
+ cmListFileBacktrace backtrace, std::string input)
+ : Backtrace(std::move(backtrace))
+ , Input(std::move(input))
, HadContextSensitiveCondition(false)
, HadHeadSensitiveCondition(false)
, EvaluateForBuildsystem(false)
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 9c05f60..e5463a7 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -11,6 +11,7 @@
#include <memory> // IWYU pragma: keep
#include <set>
#include <string>
+#include <utility>
#include <vector>
class cmCompiledGeneratorExpression;
@@ -35,8 +36,7 @@ class cmGeneratorExpression
public:
/** Construct. */
- cmGeneratorExpression(
- cmListFileBacktrace const& backtrace = cmListFileBacktrace());
+ cmGeneratorExpression(cmListFileBacktrace backtrace = cmListFileBacktrace());
~cmGeneratorExpression();
std::unique_ptr<cmCompiledGeneratorExpression> Parse(
@@ -140,8 +140,8 @@ private:
cmGeneratorExpressionContext& context,
cmGeneratorExpressionDAGChecker* dagChecker) const;
- cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace,
- const std::string& input);
+ cmCompiledGeneratorExpression(cmListFileBacktrace backtrace,
+ std::string input);
friend class cmGeneratorExpression;
@@ -169,13 +169,13 @@ class cmGeneratorExpressionInterpreter
public:
cmGeneratorExpressionInterpreter(cmLocalGenerator* localGenerator,
- std::string const& config,
+ std::string config,
cmGeneratorTarget const* headTarget,
- std::string const& lang = std::string())
+ std::string lang = std::string())
: LocalGenerator(localGenerator)
- , Config(config)
+ , Config(std::move(config))
, HeadTarget(headTarget)
- , Language(lang)
+ , Language(std::move(lang))
{
}
diff --git a/Source/cmGeneratorExpressionContext.cxx b/Source/cmGeneratorExpressionContext.cxx
index a6dde5d..6d97331 100644
--- a/Source/cmGeneratorExpressionContext.cxx
+++ b/Source/cmGeneratorExpressionContext.cxx
@@ -2,15 +2,17 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGeneratorExpressionContext.h"
+#include <utility>
+
cmGeneratorExpressionContext::cmGeneratorExpressionContext(
- cmLocalGenerator* lg, std::string const& config, bool quiet,
+ cmLocalGenerator* lg, std::string config, bool quiet,
cmGeneratorTarget const* headTarget, const cmGeneratorTarget* currentTarget,
- bool evaluateForBuildsystem, cmListFileBacktrace const& backtrace,
- std::string const& language)
- : Backtrace(backtrace)
+ bool evaluateForBuildsystem, cmListFileBacktrace backtrace,
+ std::string language)
+ : Backtrace(std::move(backtrace))
, LG(lg)
- , Config(config)
- , Language(language)
+ , Config(std::move(config))
+ , Language(std::move(language))
, HeadTarget(headTarget)
, CurrentTarget(currentTarget)
, Quiet(quiet)
diff --git a/Source/cmGeneratorExpressionContext.h b/Source/cmGeneratorExpressionContext.h
index 5b0123e..6e076bf 100644
--- a/Source/cmGeneratorExpressionContext.h
+++ b/Source/cmGeneratorExpressionContext.h
@@ -14,12 +14,12 @@ class cmLocalGenerator;
struct cmGeneratorExpressionContext
{
- cmGeneratorExpressionContext(cmLocalGenerator* lg, std::string const& config,
+ cmGeneratorExpressionContext(cmLocalGenerator* lg, std::string config,
bool quiet, const cmGeneratorTarget* headTarget,
cmGeneratorTarget const* currentTarget,
bool evaluateForBuildsystem,
- cmListFileBacktrace const& backtrace,
- std::string const& language);
+ cmListFileBacktrace backtrace,
+ std::string language);
cmListFileBacktrace Backtrace;
std::set<cmGeneratorTarget*> DependTargets;
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index 61b798b..0f26e70 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -15,26 +15,26 @@
#include <utility>
cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
- const cmListFileBacktrace& backtrace, cmGeneratorTarget const* target,
- const std::string& property, const GeneratorExpressionContent* content,
+ cmListFileBacktrace backtrace, cmGeneratorTarget const* target,
+ std::string property, const GeneratorExpressionContent* content,
cmGeneratorExpressionDAGChecker* parent)
: Parent(parent)
, Target(target)
- , Property(property)
+ , Property(std::move(property))
, Content(content)
- , Backtrace(backtrace)
+ , Backtrace(std::move(backtrace))
, TransitivePropertiesOnly(false)
{
Initialize();
}
cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
- cmGeneratorTarget const* target, const std::string& property,
+ cmGeneratorTarget const* target, std::string property,
const GeneratorExpressionContent* content,
cmGeneratorExpressionDAGChecker* parent)
: Parent(parent)
, Target(target)
- , Property(property)
+ , Property(std::move(property))
, Content(content)
, Backtrace()
, TransitivePropertiesOnly(false)
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index 1525c39..e1fba5e 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -42,13 +42,13 @@ class cmGeneratorTarget;
struct cmGeneratorExpressionDAGChecker
{
- cmGeneratorExpressionDAGChecker(const cmListFileBacktrace& backtrace,
+ cmGeneratorExpressionDAGChecker(cmListFileBacktrace backtrace,
cmGeneratorTarget const* target,
- const std::string& property,
+ std::string property,
const GeneratorExpressionContent* content,
cmGeneratorExpressionDAGChecker* parent);
cmGeneratorExpressionDAGChecker(cmGeneratorTarget const* target,
- const std::string& property,
+ std::string property,
const GeneratorExpressionContent* content,
cmGeneratorExpressionDAGChecker* parent);
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index 1c33a6e..326cb0e 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -18,11 +18,11 @@
#include "cmSystemTools.h"
cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile(
- const std::string& input,
+ std::string input,
std::unique_ptr<cmCompiledGeneratorExpression> outputFileExpr,
std::unique_ptr<cmCompiledGeneratorExpression> condition,
bool inputIsContent, cmPolicies::PolicyStatus policyStatusCMP0070)
- : Input(input)
+ : Input(std::move(input))
, OutputFileExpr(std::move(outputFileExpr))
, Condition(std::move(condition))
, InputIsContent(inputIsContent)
diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h
index 2a79069..89a2390 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.h
+++ b/Source/cmGeneratorExpressionEvaluationFile.h
@@ -20,7 +20,7 @@ class cmGeneratorExpressionEvaluationFile
{
public:
cmGeneratorExpressionEvaluationFile(
- const std::string& input,
+ std::string input,
std::unique_ptr<cmCompiledGeneratorExpression> outputFileExpr,
std::unique_ptr<cmCompiledGeneratorExpression> condition,
bool inputIsContent, cmPolicies::PolicyStatus policyStatusCMP0070);
diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx
index 489970c..949a86d 100644
--- a/Source/cmGeneratorExpressionParser.cxx
+++ b/Source/cmGeneratorExpressionParser.cxx
@@ -9,8 +9,8 @@
#include <utility>
cmGeneratorExpressionParser::cmGeneratorExpressionParser(
- const std::vector<cmGeneratorExpressionToken>& tokens)
- : Tokens(tokens)
+ std::vector<cmGeneratorExpressionToken> tokens)
+ : Tokens(std::move(tokens))
, NestingLevel(0)
{
}
diff --git a/Source/cmGeneratorExpressionParser.h b/Source/cmGeneratorExpressionParser.h
index 633381c..e663496 100644
--- a/Source/cmGeneratorExpressionParser.h
+++ b/Source/cmGeneratorExpressionParser.h
@@ -13,8 +13,7 @@ struct cmGeneratorExpressionEvaluator;
struct cmGeneratorExpressionParser
{
- cmGeneratorExpressionParser(
- const std::vector<cmGeneratorExpressionToken>& tokens);
+ cmGeneratorExpressionParser(std::vector<cmGeneratorExpressionToken> tokens);
void Parse(std::vector<cmGeneratorExpressionEvaluator*>& result);
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index eb3d4af..e028d8d 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <string.h>
#include <unordered_set>
+#include <utility>
#include "cmAlgorithms.h"
#include "cmComputeLinkInformation.h"
@@ -202,7 +203,7 @@ std::string cmGeneratorTarget::GetExportName() const
std::ostringstream e;
e << "EXPORT_NAME property \"" << exportName << "\" for \""
<< this->GetName() << "\": is not valid.";
- cmSystemTools::Error(e.str().c_str());
+ cmSystemTools::Error(e.str());
return "";
}
return exportName;
@@ -1805,10 +1806,10 @@ class cmTargetCollectLinkLanguages
{
public:
cmTargetCollectLinkLanguages(cmGeneratorTarget const* target,
- const std::string& config,
+ std::string config,
std::unordered_set<std::string>& languages,
cmGeneratorTarget const* head)
- : Config(config)
+ : Config(std::move(config))
, Languages(languages)
, HeadTarget(head)
, Target(target)
@@ -4586,7 +4587,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
<< " property requirement\nof "
"dependency \""
<< theTarget->GetName() << "\".\n";
- cmSystemTools::Error(e.str().c_str());
+ cmSystemTools::Error(e.str());
break;
}
propContent = consistent.second;
@@ -4611,7 +4612,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
"already. The INTERFACE_"
<< p << " property on\ndependency \"" << theTarget->GetName()
<< "\" is in conflict.\n";
- cmSystemTools::Error(e.str().c_str());
+ cmSystemTools::Error(e.str());
break;
}
propContent = consistent.second;
@@ -4631,7 +4632,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
e << "The INTERFACE_" << p << " property of \""
<< theTarget->GetName() << "\" does\nnot agree with the value of "
<< p << " already determined\nfor \"" << tgt->GetName() << "\".\n";
- cmSystemTools::Error(e.str().c_str());
+ cmSystemTools::Error(e.str());
break;
}
propContent = consistent.second;
diff --git a/Source/cmGlobVerificationManager.cxx b/Source/cmGlobVerificationManager.cxx
index e8959f2..478f725 100644
--- a/Source/cmGlobVerificationManager.cxx
+++ b/Source/cmGlobVerificationManager.cxx
@@ -165,7 +165,7 @@ void cmGlobVerificationManager::AddCacheEntry(
message << "\n " << std::get<0>(bt);
std::get<1>(bt).PrintTitle(message);
}
- cmSystemTools::Error(message.str().c_str());
+ cmSystemTools::Error(message.str());
} else {
value.Backtraces.emplace_back(variable, backtrace);
}
diff --git a/Source/cmGlobVerificationManager.h b/Source/cmGlobVerificationManager.h
index cdbd275..c293a76 100644
--- a/Source/cmGlobVerificationManager.h
+++ b/Source/cmGlobVerificationManager.h
@@ -55,13 +55,13 @@ private:
const bool FollowSymlinks;
const std::string Relative;
const std::string Expression;
- CacheEntryKey(const bool rec, const bool l, const bool s,
- const std::string& rel, const std::string& e)
+ CacheEntryKey(const bool rec, const bool l, const bool s, std::string rel,
+ std::string e)
: Recurse(rec)
, ListDirectories(l)
, FollowSymlinks(s)
- , Relative(rel)
- , Expression(e)
+ , Relative(std::move(rel))
+ , Expression(std::move(e))
{
}
bool operator<(const CacheEntryKey& r) const;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 2d36315..ca96ebc 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -353,8 +353,7 @@ bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
}
if (!mf->GetDefinition("CMAKE_MAKE_PROGRAM") ||
cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) {
- std::string setMakeProgram =
- mf->GetModulesFile(this->FindMakeProgramFile.c_str());
+ std::string setMakeProgram = mf->GetModulesFile(this->FindMakeProgramFile);
if (!setMakeProgram.empty()) {
mf->ReadListFile(setMakeProgram);
}
@@ -365,7 +364,7 @@ bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
err << "CMake was unable to find a build program corresponding to \""
<< this->GetName() << "\". CMAKE_MAKE_PROGRAM is not set. You "
<< "probably need to select a different build tool.";
- cmSystemTools::Error(err.str().c_str());
+ cmSystemTools::Error(err.str());
cmSystemTools::SetFatalErrorOccured();
return false;
}
@@ -464,11 +463,10 @@ void cmGlobalGenerator::EnableLanguage(
if (this->TryCompileOuterMakefile) {
// In a try-compile we can only enable languages provided by caller.
- for (std::string const& li : languages) {
- if (li == "NONE") {
+ for (std::string const& lang : languages) {
+ if (lang == "NONE") {
this->SetLanguageEnabled("NONE", mf);
} else {
- const char* lang = li.c_str();
if (this->LanguagesReady.find(lang) == this->LanguagesReady.end()) {
std::ostringstream e;
e << "The test project needs language " << lang
@@ -616,10 +614,9 @@ void cmGlobalGenerator::EnableLanguage(
// load the CMakeDetermine(LANG)Compiler.cmake file to find
// the compiler
- for (std::string const& l : languages) {
- const char* lang = l.c_str();
+ for (std::string const& lang : languages) {
needSetLanguageEnabledMaps[lang] = false;
- if (l == "NONE") {
+ if (lang == "NONE") {
this->SetLanguageEnabled("NONE", mf);
continue;
}
@@ -661,8 +658,7 @@ void cmGlobalGenerator::EnableLanguage(
std::string determineCompiler = "CMakeDetermine";
determineCompiler += lang;
determineCompiler += "Compiler.cmake";
- std::string determineFile =
- mf->GetModulesFile(determineCompiler.c_str());
+ std::string determineFile = mf->GetModulesFile(determineCompiler);
if (!mf->ReadListFile(determineFile)) {
cmSystemTools::Error("Could not find cmake module file: ",
determineCompiler.c_str());
@@ -721,9 +717,8 @@ void cmGlobalGenerator::EnableLanguage(
}
// loop over languages again loading CMake(LANG)Information.cmake
//
- for (std::string const& l : languages) {
- const char* lang = l.c_str();
- if (l == "NONE") {
+ for (std::string const& lang : languages) {
+ if (lang == "NONE") {
this->SetLanguageEnabled("NONE", mf);
continue;
}
@@ -744,7 +739,7 @@ void cmGlobalGenerator::EnableLanguage(
"No " << compilerName << " could be found.\n"
;
/* clang-format on */
- } else if (strcmp(lang, "RC") != 0 && strcmp(lang, "ASM_MASM") != 0) {
+ } else if ((lang != "RC") && (lang != "ASM_MASM")) {
if (!cmSystemTools::FileIsFullPath(compilerFile)) {
/* clang-format off */
noCompiler <<
@@ -790,7 +785,7 @@ void cmGlobalGenerator::EnableLanguage(
fpath = "CMake";
fpath += lang;
fpath += "Information.cmake";
- std::string informationFile = mf->GetModulesFile(fpath.c_str());
+ std::string informationFile = mf->GetModulesFile(fpath);
if (informationFile.empty()) {
cmSystemTools::Error("Could not find cmake module file: ",
fpath.c_str());
@@ -814,7 +809,7 @@ void cmGlobalGenerator::EnableLanguage(
std::string testLang = "CMakeTest";
testLang += lang;
testLang += "Compiler.cmake";
- std::string ifpath = mf->GetModulesFile(testLang.c_str());
+ std::string ifpath = mf->GetModulesFile(testLang);
if (!mf->ReadListFile(ifpath)) {
cmSystemTools::Error("Could not find cmake module file: ",
testLang.c_str());
@@ -1287,7 +1282,7 @@ bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const
<< "duplicate custom targets. "
<< "Consider using a Makefiles generator or fix the project to not "
<< "use duplicate target names.";
- cmSystemTools::Error(e.str().c_str());
+ cmSystemTools::Error(e.str());
return false;
}
@@ -2861,7 +2856,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile,
if (strncmp(line.c_str(), rhi->second.Data, 32) != 0) {
// The rule has changed. Delete the output so it will be
// built again.
- fname = cmSystemTools::CollapseFullPath(fname, home.c_str());
+ fname = cmSystemTools::CollapseFullPath(fname, home);
cmSystemTools::RemoveFile(fname);
}
} else {
@@ -2871,7 +2866,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile,
// Instead, we keep the rule hash as long as the file exists so
// that if the feature is turned back on and the rule has
// changed the file is still rebuilt.
- std::string fpath = cmSystemTools::CollapseFullPath(fname, home.c_str());
+ std::string fpath = cmSystemTools::CollapseFullPath(fname, home);
if (cmSystemTools::FileExists(fpath)) {
RuleHash hash;
memcpy(hash.Data, line.c_str(), 32);
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 557efec..7963c8a 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -93,7 +93,7 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
message += prevTool;
message += "\nEither remove the CMakeCache.txt file and CMakeFiles "
"directory or choose a different binary directory.";
- cmSystemTools::Error(message.c_str());
+ cmSystemTools::Error(message);
return false;
} else {
/* store the toolset that is being used for this build */
@@ -178,7 +178,7 @@ void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd,
if (output.empty()) {
std::string msg =
"No GHS toolsets found in GHS_TOOLSET_ROOT \"" + tsd + "\".";
- cmSystemTools::Error(msg.c_str());
+ cmSystemTools::Error(msg);
tsd = "";
} else {
tsd += output.back();
@@ -189,7 +189,7 @@ void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd,
tryPath = cmSystemTools::CollapseCombinedPath(tsd, ts);
if (!cmSystemTools::FileExists(tryPath)) {
std::string msg = "GHS toolset \"" + tryPath + "\" not found.";
- cmSystemTools::Error(msg.c_str());
+ cmSystemTools::Error(msg);
tsd = "";
} else {
tsd = tryPath;
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 52bb046..b481979 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -574,7 +574,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules(
commands.clear();
std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
tmp += "Makefile2";
- commands.push_back(lg->GetRecursiveMakeCall(tmp.c_str(), name));
+ commands.push_back(lg->GetRecursiveMakeCall(tmp, name));
depends.clear();
if (regenerate) {
depends.emplace_back("cmake_check_build_system");
@@ -594,7 +594,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules(
localName = name;
localName += "/fast";
commands.push_back(
- lg->GetRecursiveMakeCall(makefileName.c_str(), makeTargetName));
+ lg->GetRecursiveMakeCall(makefileName, makeTargetName));
lg->WriteMakeRule(ruleFileStream, "fast build rule for target.",
localName, depends, commands, true);
@@ -608,7 +608,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules(
depends.clear();
commands.clear();
commands.push_back(
- lg->GetRecursiveMakeCall(makefileName.c_str(), makeTargetName));
+ lg->GetRecursiveMakeCall(makefileName, makeTargetName));
lg->WriteMakeRule(ruleFileStream,
"Manual pre-install relink rule for target.",
localName, depends, commands, true);
@@ -659,12 +659,12 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
makeTargetName = localName;
makeTargetName += "/depend";
commands.push_back(
- lg->GetRecursiveMakeCall(makefileName.c_str(), makeTargetName));
+ lg->GetRecursiveMakeCall(makefileName, makeTargetName));
makeTargetName = localName;
makeTargetName += "/build";
commands.push_back(
- lg->GetRecursiveMakeCall(makefileName.c_str(), makeTargetName));
+ lg->GetRecursiveMakeCall(makefileName, makeTargetName));
// Write the rule.
localName += "/all";
@@ -728,7 +728,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
}
std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
tmp += "Makefile2";
- commands.push_back(lg->GetRecursiveMakeCall(tmp.c_str(), localName));
+ commands.push_back(lg->GetRecursiveMakeCall(tmp, localName));
{
std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
@@ -761,8 +761,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
localName += "/preinstall";
depends.clear();
commands.clear();
- commands.push_back(
- lg->GetRecursiveMakeCall(makefileName.c_str(), localName));
+ commands.push_back(lg->GetRecursiveMakeCall(makefileName, localName));
lg->WriteMakeRule(ruleFileStream,
"Pre-install relink rule for target.", localName,
depends, commands, true);
@@ -783,7 +782,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
depends.clear();
commands.clear();
commands.push_back(
- lg->GetRecursiveMakeCall(makefileName.c_str(), makeTargetName));
+ lg->GetRecursiveMakeCall(makefileName, makeTargetName));
lg->WriteMakeRule(ruleFileStream, "clean rule for target.",
makeTargetName, depends, commands, true);
commands.clear();
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 16796cf..8e67fad 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -149,7 +149,7 @@ void cmGlobalVisualStudio71Generator::WriteProjectDepends(
m += target->GetName();
m += " depends on unknown target: ";
m += name;
- cmSystemTools::Error(m.c_str());
+ cmSystemTools::Error(m);
}
fout << "\t\t{" << guid << "} = {" << guid << "}\n";
}
diff --git a/Source/cmGraphAdjacencyList.h b/Source/cmGraphAdjacencyList.h
index fb2eee2..5ca9269 100644
--- a/Source/cmGraphAdjacencyList.h
+++ b/Source/cmGraphAdjacencyList.h
@@ -7,6 +7,7 @@
#include "cmListFileCache.h"
+#include <utility>
#include <vector>
/**
@@ -17,10 +18,10 @@
class cmGraphEdge
{
public:
- cmGraphEdge(int n, bool s, cmListFileBacktrace const& bt)
+ cmGraphEdge(int n, bool s, cmListFileBacktrace bt)
: Dest(n)
, Strong(s)
- , Backtrace(bt)
+ , Backtrace(std::move(bt))
{
}
operator int() const { return this->Dest; }
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index a67d09e..0d608bb 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -67,7 +67,7 @@ bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args,
// Not a path. Maybe module.
std::string module = fname;
module += ".cmake";
- std::string mfile = this->Makefile->GetModulesFile(module.c_str());
+ std::string mfile = this->Makefile->GetModulesFile(module);
if (!mfile.empty()) {
fname = mfile;
}
diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx
index 538aa9f..4f872f4 100644
--- a/Source/cmInstallCommandArguments.cxx
+++ b/Source/cmInstallCommandArguments.cxx
@@ -16,7 +16,7 @@ const char* cmInstallCommandArguments::PermissionsTable[] = {
const std::string cmInstallCommandArguments::EmptyString;
cmInstallCommandArguments::cmInstallCommandArguments(
- const std::string& defaultComponent)
+ std::string defaultComponent)
: Destination(&Parser, "DESTINATION", &ArgumentGroup)
, Component(&Parser, "COMPONENT", &ArgumentGroup)
, NamelinkComponent(&Parser, "NAMELINK_COMPONENT", &ArgumentGroup)
@@ -29,7 +29,7 @@ cmInstallCommandArguments::cmInstallCommandArguments(
, NamelinkSkip(&Parser, "NAMELINK_SKIP", &ArgumentGroup)
, Type(&Parser, "TYPE", &ArgumentGroup)
, GenericArguments(nullptr)
- , DefaultComponentName(defaultComponent)
+ , DefaultComponentName(std::move(defaultComponent))
{
}
diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h
index 425e58a..8e974af 100644
--- a/Source/cmInstallCommandArguments.h
+++ b/Source/cmInstallCommandArguments.h
@@ -13,7 +13,7 @@
class cmInstallCommandArguments
{
public:
- cmInstallCommandArguments(const std::string& defaultComponent);
+ cmInstallCommandArguments(std::string defaultComponent);
void SetGenericArguments(cmInstallCommandArguments* args)
{
this->GenericArguments = args;
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 4cc081c..98a895e 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -127,7 +127,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os)
std::ostringstream e;
e << "INSTALL(EXPORT) given unknown export \"" << ExportSet->GetName()
<< "\"";
- cmSystemTools::Error(e.str().c_str());
+ cmSystemTools::Error(e.str());
return;
}
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 86c6a58..08f46aa 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -22,18 +22,18 @@
#include "cmake.h"
cmInstallTargetGenerator::cmInstallTargetGenerator(
- const std::string& targetName, const char* dest, bool implib,
+ std::string targetName, const char* dest, bool implib,
const char* file_permissions, std::vector<std::string> const& configurations,
const char* component, MessageLevel message, bool exclude_from_all,
- bool optional, cmListFileBacktrace const& backtrace)
+ bool optional, cmListFileBacktrace backtrace)
: cmInstallGenerator(dest, configurations, component, message,
exclude_from_all)
- , TargetName(targetName)
+ , TargetName(std::move(targetName))
, Target(nullptr)
, FilePermissions(file_permissions)
, ImportLibrary(implib)
, Optional(optional)
- , Backtrace(backtrace)
+ , Backtrace(std::move(backtrace))
{
this->ActionsPerConfig = true;
this->NamelinkMode = NamelinkModeNone;
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index bf625d1..715b4ae 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/Source/cmInstallTargetGenerator.h
@@ -23,11 +23,11 @@ class cmInstallTargetGenerator : public cmInstallGenerator
{
public:
cmInstallTargetGenerator(
- std::string const& targetName, const char* dest, bool implib,
+ std::string targetName, const char* dest, bool implib,
const char* file_permissions,
std::vector<std::string> const& configurations, const char* component,
MessageLevel message, bool exclude_from_all, bool optional,
- cmListFileBacktrace const& backtrace = cmListFileBacktrace());
+ cmListFileBacktrace backtrace = cmListFileBacktrace());
~cmInstallTargetGenerator() override;
/** Select the policy for installing shared library linkable name
diff --git a/Source/cmLinkItem.cxx b/Source/cmLinkItem.cxx
index 12a07f6..b035c8c 100644
--- a/Source/cmLinkItem.cxx
+++ b/Source/cmLinkItem.cxx
@@ -10,16 +10,15 @@ cmLinkItem::cmLinkItem()
{
}
-cmLinkItem::cmLinkItem(std::string const& n, cmListFileBacktrace const& bt)
- : String(n)
- , Backtrace(bt)
+cmLinkItem::cmLinkItem(std::string n, cmListFileBacktrace bt)
+ : String(std::move(n))
+ , Backtrace(std::move(bt))
{
}
-cmLinkItem::cmLinkItem(cmGeneratorTarget const* t,
- cmListFileBacktrace const& bt)
+cmLinkItem::cmLinkItem(cmGeneratorTarget const* t, cmListFileBacktrace bt)
: Target(t)
- , Backtrace(bt)
+ , Backtrace(std::move(bt))
{
}
diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h
index b841509..d2459db 100644
--- a/Source/cmLinkItem.h
+++ b/Source/cmLinkItem.h
@@ -24,8 +24,8 @@ class cmLinkItem
public:
cmLinkItem();
- cmLinkItem(std::string const& s, cmListFileBacktrace const& bt);
- cmLinkItem(cmGeneratorTarget const* t, cmListFileBacktrace const& bt);
+ cmLinkItem(std::string s, cmListFileBacktrace bt);
+ cmLinkItem(cmGeneratorTarget const* t, cmListFileBacktrace bt);
std::string const& AsStr() const;
cmGeneratorTarget const* Target = nullptr;
cmListFileBacktrace Backtrace;
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index b826795..b24c5ba 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -659,15 +659,19 @@ bool cmListCommand::HandleTransformCommand(
// Transform: lambda function implementing the action
struct ActionDescriptor
{
- ActionDescriptor(const std::string& name)
- : Name(name)
+ ActionDescriptor(std::string name)
+ : Name(std::move(name))
{
}
- ActionDescriptor(const std::string& name, int arity,
- const transform_type& transform)
- : Name(name)
+ ActionDescriptor(std::string name, int arity, transform_type transform)
+ : Name(std::move(name))
, Arity(arity)
+#if defined(__GNUC__) && __GNUC__ == 6 && defined(__aarch64__)
+ // std::function move constructor miscompiles on this architecture
, Transform(transform)
+#else
+ , Transform(std::move(transform))
+#endif
{
}
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 9aa1f32..ff793f6 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -24,7 +24,7 @@ cmCommandContext::cmCommandName& cmCommandContext::cmCommandName::operator=(
struct cmListFileParser
{
- cmListFileParser(cmListFile* lf, cmListFileBacktrace const& lfbt,
+ cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt,
cmMessenger* messenger, const char* filename);
~cmListFileParser();
void IssueFileOpenError(std::string const& text) const;
@@ -47,12 +47,11 @@ struct cmListFileParser
} Separation;
};
-cmListFileParser::cmListFileParser(cmListFile* lf,
- cmListFileBacktrace const& lfbt,
+cmListFileParser::cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt,
cmMessenger* messenger,
const char* filename)
: ListFile(lf)
- , Backtrace(lfbt)
+ , Backtrace(std::move(lfbt))
, Messenger(messenger)
, FileName(filename)
, Lexer(cmListFileLexer_New())
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index 4a247ba..529c389 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -51,8 +51,8 @@ struct cmListFileArgument
Bracket
};
cmListFileArgument() {}
- cmListFileArgument(const std::string& v, Delimiter d, long line)
- : Value(v)
+ cmListFileArgument(std::string v, Delimiter d, long line)
+ : Value(std::move(v))
, Delim(d)
, Line(line)
{
diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx
index 7ce2c82..c6d2c58 100644
--- a/Source/cmLocalCommonGenerator.cxx
+++ b/Source/cmLocalCommonGenerator.cxx
@@ -12,10 +12,9 @@
class cmGlobalGenerator;
cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg,
- cmMakefile* mf,
- std::string const& wd)
+ cmMakefile* mf, std::string wd)
: cmLocalGenerator(gg, mf)
- , WorkingDirectory(wd)
+ , WorkingDirectory(std::move(wd))
{
// Store the configuration name that will be generated.
if (const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) {
diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h
index 7b8e6fe..abebbc2 100644
--- a/Source/cmLocalCommonGenerator.h
+++ b/Source/cmLocalCommonGenerator.h
@@ -22,7 +22,7 @@ class cmLocalCommonGenerator : public cmLocalGenerator
{
public:
cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf,
- std::string const& wd);
+ std::string wd);
~cmLocalCommonGenerator() override;
std::string const& GetConfigName() { return this->ConfigName; }
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 23afbd0..62aff99 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1794,7 +1794,7 @@ static void AddVisibilityCompileOption(std::string& flags,
std::ostringstream e;
e << "Target " << target->GetName() << " uses unsupported value \"" << prop
<< "\" for " << flagDefine << ".";
- cmSystemTools::Error(e.str().c_str());
+ cmSystemTools::Error(e.str());
return;
}
std::string option = std::string(opt) + prop;
@@ -2791,7 +2791,7 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target,
const char* in = target->GetProperty("MACOSX_BUNDLE_INFO_PLIST");
std::string inFile = (in && *in) ? in : "MacOSXBundleInfo.plist.in";
if (!cmSystemTools::FileIsFullPath(inFile)) {
- std::string inMod = this->Makefile->GetModulesFile(inFile.c_str());
+ std::string inMod = this->Makefile->GetModulesFile(inFile);
if (!inMod.empty()) {
inFile = inMod;
}
@@ -2800,7 +2800,7 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target,
std::ostringstream e;
e << "Target " << target->GetName() << " Info.plist template \"" << inFile
<< "\" could not be found.";
- cmSystemTools::Error(e.str().c_str());
+ cmSystemTools::Error(e.str());
return;
}
@@ -2829,7 +2829,7 @@ void cmLocalGenerator::GenerateFrameworkInfoPList(
const char* in = target->GetProperty("MACOSX_FRAMEWORK_INFO_PLIST");
std::string inFile = (in && *in) ? in : "MacOSXFrameworkInfo.plist.in";
if (!cmSystemTools::FileIsFullPath(inFile)) {
- std::string inMod = this->Makefile->GetModulesFile(inFile.c_str());
+ std::string inMod = this->Makefile->GetModulesFile(inFile);
if (!inMod.empty()) {
inFile = inMod;
}
@@ -2838,7 +2838,7 @@ void cmLocalGenerator::GenerateFrameworkInfoPList(
std::ostringstream e;
e << "Target " << target->GetName() << " Info.plist template \"" << inFile
<< "\" could not be found.";
- cmSystemTools::Error(e.str().c_str());
+ cmSystemTools::Error(e.str());
return;
}
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index dc54314..ebc613b 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -233,8 +233,8 @@ public:
virtual void ClearDependencies(cmMakefile* /* mf */, bool /* verbose */) {}
/** Called from command-line hook to update dependencies. */
- virtual bool UpdateDependencies(const char* /* tgtInfo */, bool /*verbose*/,
- bool /*color*/)
+ virtual bool UpdateDependencies(const std::string& /* tgtInfo */,
+ bool /*verbose*/, bool /*color*/)
{
return true;
}
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 5b9d108..324ea47 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -248,8 +248,8 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
for (auto& localObjectFile : localObjectFiles) {
// Add a convenience rule for building the object file.
this->WriteObjectConvenienceRule(
- ruleFileStream, "target to build an object file",
- localObjectFile.first.c_str(), localObjectFile.second);
+ ruleFileStream, "target to build an object file", localObjectFile.first,
+ localObjectFile.second);
// Check whether preprocessing and assembly rules make sense.
// They make sense only for C and C++ sources.
@@ -271,9 +271,9 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
if (lang_has_preprocessor && do_preprocess_rules) {
std::string::size_type dot_pos = localObjectFile.first.rfind(".");
std::string base = localObjectFile.first.substr(0, dot_pos);
- this->WriteObjectConvenienceRule(
- ruleFileStream, "target to preprocess a source file",
- (base + ".i").c_str(), localObjectFile.second);
+ this->WriteObjectConvenienceRule(ruleFileStream,
+ "target to preprocess a source file",
+ (base + ".i"), localObjectFile.second);
localObjectFile.second.HasPreprocessRule = true;
}
@@ -282,7 +282,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
std::string base = localObjectFile.first.substr(0, dot_pos);
this->WriteObjectConvenienceRule(
ruleFileStream, "target to generate assembly for a file",
- (base + ".s").c_str(), localObjectFile.second);
+ (base + ".s"), localObjectFile.second);
localObjectFile.second.HasAssembleRule = true;
}
}
@@ -298,7 +298,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
}
void cmLocalUnixMakefileGenerator3::WriteObjectConvenienceRule(
- std::ostream& ruleFileStream, const char* comment, const char* output,
+ std::ostream& ruleFileStream, const char* comment, const std::string& output,
LocalObjectInfo const& info)
{
// If the rule includes the source file extension then create a
@@ -334,7 +334,7 @@ void cmLocalUnixMakefileGenerator3::WriteObjectConvenienceRule(
targetName += "/";
targetName += output;
commands.push_back(
- this->GetRecursiveMakeCall(tgtMakefileName.c_str(), targetName));
+ this->GetRecursiveMakeCall(tgtMakefileName, targetName));
}
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
this->GetCurrentBinaryDirectory());
@@ -373,8 +373,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
// Build the target for this pass.
std::string makefile2 = cmake::GetCMakeFilesDirectoryPostSlash();
makefile2 += "Makefile2";
- commands.push_back(
- this->GetRecursiveMakeCall(makefile2.c_str(), localName));
+ commands.push_back(this->GetRecursiveMakeCall(makefile2, localName));
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
this->GetCurrentBinaryDirectory());
this->WriteMakeRule(ruleFileStream, "Convenience name for target.",
@@ -399,7 +398,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
depends.clear();
commands.clear();
commands.push_back(
- this->GetRecursiveMakeCall(makefileName.c_str(), makeTargetName));
+ this->GetRecursiveMakeCall(makefileName, makeTargetName));
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
this->GetCurrentBinaryDirectory());
this->WriteMakeRule(ruleFileStream, "fast build rule for target.",
@@ -415,7 +414,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
depends.clear();
commands.clear();
commands.push_back(
- this->GetRecursiveMakeCall(makefile2.c_str(), makeTargetName));
+ this->GetRecursiveMakeCall(makefile2, makeTargetName));
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
this->GetCurrentBinaryDirectory());
this->WriteMakeRule(ruleFileStream,
@@ -1254,9 +1253,8 @@ std::string cmLocalUnixMakefileGenerator3::CreateMakeVariable(
return ret;
}
-bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
- bool verbose,
- bool color)
+bool cmLocalUnixMakefileGenerator3::UpdateDependencies(
+ const std::string& tgtInfo, bool verbose, bool color)
{
// read in the target info file
if (!this->Makefile->ReadListFile(tgtInfo) ||
@@ -1280,7 +1278,8 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
this->GlobalGenerator->GetCMakeInstance()->GetFileComparison();
{
int result;
- if (!ftc->FileTimeCompare(internalDependFile.c_str(), tgtInfo, &result) ||
+ if (!ftc->FileTimeCompare(internalDependFile.c_str(), tgtInfo.c_str(),
+ &result) ||
result < 0) {
if (verbose) {
std::ostringstream msg;
@@ -1611,8 +1610,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
}
std::string mf2Dir = cmake::GetCMakeFilesDirectoryPostSlash();
mf2Dir += "Makefile2";
- commands.push_back(
- this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
+ commands.push_back(this->GetRecursiveMakeCall(mf2Dir, recursiveTarget));
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
this->GetCurrentBinaryDirectory());
{
@@ -1631,8 +1629,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
recursiveTarget += "/clean";
commands.clear();
depends.clear();
- commands.push_back(
- this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
+ commands.push_back(this->GetRecursiveMakeCall(mf2Dir, recursiveTarget));
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
this->GetCurrentBinaryDirectory());
this->WriteMakeRule(ruleFileStream, "The main clean target", "clean",
@@ -1657,8 +1654,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
// At least make sure the build system is up to date.
depends.emplace_back("cmake_check_build_system");
}
- commands.push_back(
- this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
+ commands.push_back(this->GetRecursiveMakeCall(mf2Dir, recursiveTarget));
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
this->GetCurrentBinaryDirectory());
this->WriteMakeRule(ruleFileStream, "Prepare targets for installation.",
@@ -1733,9 +1729,9 @@ class NotInProjectDir
{
public:
// Constructor with the source and binary directory's path
- NotInProjectDir(const std::string& sourceDir, const std::string& binaryDir)
- : SourceDir(sourceDir)
- , BinaryDir(binaryDir)
+ NotInProjectDir(std::string sourceDir, std::string binaryDir)
+ : SourceDir(std::move(sourceDir))
+ , BinaryDir(std::move(binaryDir))
{
}
@@ -1886,7 +1882,7 @@ void cmLocalUnixMakefileGenerator3::WriteDisclaimer(std::ostream& os)
}
std::string cmLocalUnixMakefileGenerator3::GetRecursiveMakeCall(
- const char* makefile, const std::string& tgt)
+ const std::string& makefile, const std::string& tgt)
{
// Call make on the given file.
std::string cmd;
@@ -1956,7 +1952,7 @@ void cmLocalUnixMakefileGenerator3::WriteCMakeArgument(std::ostream& os,
}
std::string cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(
- const char* p, bool useWatcomQuote)
+ const std::string& p, bool useWatcomQuote)
{
// Split the path into its components.
std::vector<std::string> components;
@@ -2040,8 +2036,8 @@ cmLocalUnixMakefileGenerator3::GetImplicitDepends(const cmGeneratorTarget* tgt)
}
void cmLocalUnixMakefileGenerator3::AddImplicitDepends(
- const cmGeneratorTarget* tgt, const std::string& lang, const char* obj,
- const char* src)
+ const cmGeneratorTarget* tgt, const std::string& lang,
+ const std::string& obj, const std::string& src)
{
this->ImplicitDepends[tgt->GetName()][lang][obj].push_back(src);
}
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index c0d0e13..1e1c59e 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -12,6 +12,7 @@
#include <map>
#include <set>
#include <string>
+#include <utility>
#include <vector>
class cmCustomCommand;
@@ -83,7 +84,7 @@ public:
void WriteDivider(std::ostream& os);
/** used to create a recursive make call */
- std::string GetRecursiveMakeCall(const char* makefile,
+ std::string GetRecursiveMakeCall(const std::string& makefile,
const std::string& tgt);
// append flags to a string
@@ -120,7 +121,7 @@ public:
std::string const& targetDir,
std::string const& relDir);
- static std::string ConvertToQuotedOutputPath(const char* p,
+ static std::string ConvertToQuotedOutputPath(const std::string& p,
bool useWatcomQuote);
std::string CreateMakeVariable(const std::string& sin,
@@ -128,7 +129,7 @@ public:
/** Called from command-line hook to bring dependencies up to date
for a target. */
- bool UpdateDependencies(const char* tgtInfo, bool verbose,
+ bool UpdateDependencies(const std::string& tgtInfo, bool verbose,
bool color) override;
/** Called from command-line hook to clear dependencies. */
@@ -158,8 +159,8 @@ public:
cmGeneratorTarget const* tgt);
void AddImplicitDepends(cmGeneratorTarget const* tgt,
- const std::string& lang, const char* obj,
- const char* src);
+ const std::string& lang, const std::string& obj,
+ const std::string& src);
// write the target rules for the local Makefile into the stream
void WriteLocalAllRules(std::ostream& ruleFileStream);
@@ -200,9 +201,6 @@ protected:
void WriteDependLanguageInfo(std::ostream& cmakefileStream,
cmGeneratorTarget* tgt);
- // write the local help rule
- void WriteHelpRule(std::ostream& ruleFileStream);
-
// this converts a file name that is relative to the StartOuputDirectory
// into a full path
std::string ConvertToFullPath(const std::string& localPath);
@@ -211,15 +209,6 @@ protected:
const std::string& realTarget,
const std::string& helpTarget);
- void WriteTargetDependRule(std::ostream& ruleFileStream,
- cmGeneratorTarget* target);
- void WriteTargetCleanRule(std::ostream& ruleFileStream,
- cmGeneratorTarget* target,
- const std::vector<std::string>& files);
- void WriteTargetRequiresRule(std::ostream& ruleFileStream,
- cmGeneratorTarget* target,
- const std::vector<std::string>& objects);
-
void AppendRuleDepend(std::vector<std::string>& depends,
const char* ruleFileName);
void AppendRuleDepends(std::vector<std::string>& depends,
@@ -267,9 +256,9 @@ private:
cmGeneratorTarget* Target = nullptr;
std::string Language;
LocalObjectEntry() {}
- LocalObjectEntry(cmGeneratorTarget* t, const std::string& lang)
+ LocalObjectEntry(cmGeneratorTarget* t, std::string lang)
: Target(t)
- , Language(lang)
+ , Language(std::move(lang))
{
}
};
@@ -284,7 +273,8 @@ private:
std::map<std::string, LocalObjectInfo>& localObjectFiles);
void WriteObjectConvenienceRule(std::ostream& ruleFileStream,
- const char* comment, const char* output,
+ const char* comment,
+ const std::string& output,
LocalObjectInfo const& info);
std::vector<std::string> LocalHelp;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 9589b7f..500776e 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3516,7 +3516,7 @@ void cmMakefile::DisplayStatus(const char* message, float s) const
cm->UpdateProgress(message, s);
}
-std::string cmMakefile::GetModulesFile(const char* filename,
+std::string cmMakefile::GetModulesFile(const std::string& filename,
bool& system) const
{
std::string result;
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index abe2cd1..e88bb0b 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -689,13 +689,13 @@ public:
/**
* Return a location of a file in cmake or custom modules directory
*/
- std::string GetModulesFile(const char* name) const
+ std::string GetModulesFile(const std::string& name) const
{
bool system;
return this->GetModulesFile(name, system);
}
- std::string GetModulesFile(const char* name, bool& system) const;
+ std::string GetModulesFile(const std::string& name, bool& system) const;
///! Set/Get a property of this directory
void SetProperty(const std::string& prop, const char* value);
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 1207646..6709b5b 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -435,8 +435,8 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
objFullPath = cmSystemTools::CollapseFullPath(objFullPath);
std::string srcFullPath =
cmSystemTools::CollapseFullPath(source.GetFullPath());
- this->LocalGenerator->AddImplicitDepends(
- this->GeneratorTarget, lang, objFullPath.c_str(), srcFullPath.c_str());
+ this->LocalGenerator->AddImplicitDepends(this->GeneratorTarget, lang,
+ objFullPath, srcFullPath);
}
void cmMakefileTargetGenerator::WriteObjectBuildFile(
@@ -1213,8 +1213,7 @@ void cmMakefileTargetGenerator::GenerateCustomRuleFile(
std::string objFullPath = cmSystemTools::CollapseFullPath(outputs[0]);
std::string srcFullPath = cmSystemTools::CollapseFullPath(idi.second);
this->LocalGenerator->AddImplicitDepends(this->GeneratorTarget, idi.first,
- objFullPath.c_str(),
- srcFullPath.c_str());
+ objFullPath, srcFullPath);
}
}
@@ -1249,7 +1248,7 @@ void cmMakefileTargetGenerator::WriteObjectsVariable(
*this->BuildFileStream << " " << lineContinue << "\n";
*this->BuildFileStream
<< cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(
- obj.c_str(), useWatcomQuote);
+ obj, useWatcomQuote);
}
*this->BuildFileStream << "\n";
@@ -1272,7 +1271,7 @@ void cmMakefileTargetGenerator::WriteObjectsVariable(
*this->BuildFileStream << " " << lineContinue << "\n";
*this->BuildFileStream
<< cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(
- obj.c_str(), useWatcomQuote);
+ obj, useWatcomQuote);
}
*this->BuildFileStream << "\n"
<< "\n";
diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index 2b96785..6857d5a 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/Source/cmOSXBundleGenerator.cxx
@@ -10,15 +10,16 @@
#include "cmTarget.h"
#include <cassert>
+#include <utility>
class cmSourceFile;
cmOSXBundleGenerator::cmOSXBundleGenerator(cmGeneratorTarget* target,
- const std::string& configName)
+ std::string configName)
: GT(target)
, Makefile(target->Target->GetMakefile())
, LocalGenerator(target->GetLocalGenerator())
- , ConfigName(configName)
+ , ConfigName(std::move(configName))
, MacContentFolders(nullptr)
{
if (this->MustSkip()) {
diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h
index be7e932..ba5bee0 100644
--- a/Source/cmOSXBundleGenerator.h
+++ b/Source/cmOSXBundleGenerator.h
@@ -17,8 +17,7 @@ class cmSourceFile;
class cmOSXBundleGenerator
{
public:
- cmOSXBundleGenerator(cmGeneratorTarget* target,
- const std::string& configName);
+ cmOSXBundleGenerator(cmGeneratorTarget* target, std::string configName);
// create an app bundle at a given root, and return
// the directory within the bundle that contains the executable
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index ab1e699..ff1e027 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -194,7 +194,7 @@ protected:
message += includeFile;
message += " for file ";
message += info->FullPath;
- cmSystemTools::Error(message.c_str(), nullptr);
+ cmSystemTools::Error(message);
}
continue;
}
diff --git a/Source/cmPathLabel.cxx b/Source/cmPathLabel.cxx
index 4793206..fb81351 100644
--- a/Source/cmPathLabel.cxx
+++ b/Source/cmPathLabel.cxx
@@ -2,8 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmPathLabel.h"
-cmPathLabel::cmPathLabel(const std::string& label)
- : Label(label)
+#include <utility>
+
+cmPathLabel::cmPathLabel(std::string label)
+ : Label(std::move(label))
, Hash(0)
{
// Use a Jenkins one-at-a-time hash with under/over-flow protection
diff --git a/Source/cmPathLabel.h b/Source/cmPathLabel.h
index 97551fb..55dffab 100644
--- a/Source/cmPathLabel.h
+++ b/Source/cmPathLabel.h
@@ -17,7 +17,7 @@
class cmPathLabel
{
public:
- cmPathLabel(const std::string& label);
+ cmPathLabel(std::string label);
// The comparison operators are only for quick sorting and searching and
// in no way imply any lexicographical order of the label
diff --git a/Source/cmPipeConnection.cxx b/Source/cmPipeConnection.cxx
index 999d6f3..1eede13 100644
--- a/Source/cmPipeConnection.cxx
+++ b/Source/cmPipeConnection.cxx
@@ -6,10 +6,10 @@
#include "cmServer.h"
-cmPipeConnection::cmPipeConnection(const std::string& name,
+cmPipeConnection::cmPipeConnection(std::string name,
cmConnectionBufferStrategy* bufferStrategy)
: cmEventBasedConnection(bufferStrategy)
- , PipeName(name)
+ , PipeName(std::move(name))
{
}
diff --git a/Source/cmPipeConnection.h b/Source/cmPipeConnection.h
index 49f9fdf..e67f15c 100644
--- a/Source/cmPipeConnection.h
+++ b/Source/cmPipeConnection.h
@@ -13,7 +13,7 @@
class cmPipeConnection : public cmEventBasedConnection
{
public:
- cmPipeConnection(const std::string& name,
+ cmPipeConnection(std::string name,
cmConnectionBufferStrategy* bufferStrategy = nullptr);
bool OnServeStart(std::string* pString) override;
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 47f7d73..d37e5f5 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -111,7 +111,7 @@ static bool AddToSourceGroup(cmMakefile* makefile, std::string const& fileName,
ost << ": " << property;
ost << ": Could not find or create the source group ";
ost << cmQtAutoGen::Quoted(groupName);
- cmSystemTools::Error(ost.str().c_str());
+ cmSystemTools::Error(ost.str());
return false;
}
}
@@ -941,7 +941,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
if (!qrc.Generated) {
std::string error;
if (!RccListInputs(qrc.QrcFile, qrc.Resources, error)) {
- cmSystemTools::Error(error.c_str());
+ cmSystemTools::Error(error);
return false;
}
}
@@ -1219,7 +1219,7 @@ bool cmQtAutoGenInitializer::SetupCustomTargets()
if (!cmSystemTools::MakeDirectory(this->Dir.Info)) {
std::string emsg = ("AutoGen: Could not create directory: ");
emsg += Quoted(this->Dir.Info);
- cmSystemTools::Error(emsg.c_str());
+ cmSystemTools::Error(emsg);
return false;
}
@@ -1307,7 +1307,7 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
} else {
std::string err = "AutoGen: Could not write file ";
err += this->AutogenTarget.InfoFile;
- cmSystemTools::Error(err.c_str());
+ cmSystemTools::Error(err);
return false;
}
@@ -1347,7 +1347,7 @@ bool cmQtAutoGenInitializer::SetupWriteRccInfo()
} else {
std::string err = "AutoRcc: Could not write file ";
err += qrc.InfoFile;
- cmSystemTools::Error(err.c_str());
+ cmSystemTools::Error(err);
return false;
}
}
@@ -1512,7 +1512,7 @@ std::pair<bool, std::string> GetQtExecutable(
msg += target->GetName();
msg += "): ";
msg += err;
- cmSystemTools::Error(msg.c_str());
+ cmSystemTools::Error(msg);
return std::make_pair(false, "");
}
diff --git a/Source/cmQtAutoGeneratorMocUic.h b/Source/cmQtAutoGeneratorMocUic.h
index 9ec1def..0df2cff 100644
--- a/Source/cmQtAutoGeneratorMocUic.h
+++ b/Source/cmQtAutoGeneratorMocUic.h
@@ -49,8 +49,8 @@ public:
{
}
- KeyExpT(std::string const& key, std::string const& exp)
- : Key(key)
+ KeyExpT(std::string key, std::string const& exp)
+ : Key(std::move(key))
, Exp(exp)
{
}
@@ -240,10 +240,10 @@ public:
class JobMocT : public JobT
{
public:
- JobMocT(std::string&& sourceFile, std::string const& includerFile,
+ JobMocT(std::string&& sourceFile, std::string includerFile,
std::string&& includeString)
: SourceFile(std::move(sourceFile))
- , IncluderFile(includerFile)
+ , IncluderFile(std::move(includerFile))
, IncludeString(std::move(includeString))
{
}
@@ -269,10 +269,10 @@ public:
class JobUicT : public JobT
{
public:
- JobUicT(std::string&& sourceFile, std::string const& includerFile,
+ JobUicT(std::string&& sourceFile, std::string includerFile,
std::string&& includeString)
: SourceFile(std::move(sourceFile))
- , IncluderFile(includerFile)
+ , IncluderFile(std::move(includerFile))
, IncludeString(std::move(includeString))
{
}
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index 2866a39..55204d7 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -13,9 +13,9 @@
#include <stddef.h>
#include <utility>
-cmRST::cmRST(std::ostream& os, std::string const& docroot)
+cmRST::cmRST(std::ostream& os, std::string docroot)
: OS(os)
- , DocRoot(docroot)
+ , DocRoot(std::move(docroot))
, IncludeDepth(0)
, OutputLinePending(false)
, LastLineEndedInColonColon(false)
diff --git a/Source/cmRST.h b/Source/cmRST.h
index ee47867..d8d2a0b 100644
--- a/Source/cmRST.h
+++ b/Source/cmRST.h
@@ -25,7 +25,7 @@
class cmRST
{
public:
- cmRST(std::ostream& os, std::string const& docroot);
+ cmRST(std::ostream& os, std::string docroot);
bool ProcessFile(std::string const& fname, bool isModule = false);
private:
diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx
index c3e8ff5..e347a2c 100644
--- a/Source/cmRulePlaceholderExpander.cxx
+++ b/Source/cmRulePlaceholderExpander.cxx
@@ -10,13 +10,13 @@
#include "cmSystemTools.h"
cmRulePlaceholderExpander::cmRulePlaceholderExpander(
- std::map<std::string, std::string> const& compilers,
- std::map<std::string, std::string> const& variableMappings,
- std::string const& compilerSysroot, std::string const& linkerSysroot)
- : Compilers(compilers)
- , VariableMappings(variableMappings)
- , CompilerSysroot(compilerSysroot)
- , LinkerSysroot(linkerSysroot)
+ std::map<std::string, std::string> compilers,
+ std::map<std::string, std::string> variableMappings,
+ std::string compilerSysroot, std::string linkerSysroot)
+ : Compilers(std::move(compilers))
+ , VariableMappings(std::move(variableMappings))
+ , CompilerSysroot(std::move(compilerSysroot))
+ , LinkerSysroot(std::move(linkerSysroot))
{
}
diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h
index 7aa63db..5c03637 100644
--- a/Source/cmRulePlaceholderExpander.h
+++ b/Source/cmRulePlaceholderExpander.h
@@ -15,9 +15,9 @@ class cmRulePlaceholderExpander
{
public:
cmRulePlaceholderExpander(
- std::map<std::string, std::string> const& compilers,
- std::map<std::string, std::string> const& variableMappings,
- std::string const& compilerSysroot, std::string const& linkerSysroot);
+ std::map<std::string, std::string> compilers,
+ std::map<std::string, std::string> variableMappings,
+ std::string compilerSysroot, std::string linkerSysroot);
void SetTargetImpLib(std::string const& targetImpLib)
{
diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx
index 2cae714..ae0a158 100644
--- a/Source/cmScriptGenerator.cxx
+++ b/Source/cmScriptGenerator.cxx
@@ -4,11 +4,12 @@
#include "cmSystemTools.h"
-cmScriptGenerator::cmScriptGenerator(
- const std::string& config_var,
- std::vector<std::string> const& configurations)
- : RuntimeConfigVariable(config_var)
- , Configurations(configurations)
+#include <utility>
+
+cmScriptGenerator::cmScriptGenerator(std::string config_var,
+ std::vector<std::string> configurations)
+ : RuntimeConfigVariable(std::move(config_var))
+ , Configurations(std::move(configurations))
, ConfigurationName("")
, ConfigurationTypes(nullptr)
, ActionsPerConfig(false)
diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h
index 0bb388e..725cbc6 100644
--- a/Source/cmScriptGenerator.h
+++ b/Source/cmScriptGenerator.h
@@ -47,8 +47,8 @@ class cmScriptGenerator
CM_DISABLE_COPY(cmScriptGenerator)
public:
- cmScriptGenerator(const std::string& config_var,
- std::vector<std::string> const& configurations);
+ cmScriptGenerator(std::string config_var,
+ std::vector<std::string> configurations);
virtual ~cmScriptGenerator();
void Generate(std::ostream& os, const std::string& config,
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 11a3f46..c3c8156 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -20,6 +20,7 @@
#include <functional>
#include <memory>
#include <string>
+#include <utility>
#include <vector>
// Get rid of some windows macros:
@@ -39,11 +40,10 @@ std::vector<std::string> toStringList(const Json::Value& in)
} // namespace
cmServerRequest::cmServerRequest(cmServer* server, cmConnection* connection,
- const std::string& t, const std::string& c,
- const Json::Value& d)
- : Type(t)
- , Cookie(c)
- , Data(d)
+ std::string t, std::string c, Json::Value d)
+ : Type(std::move(t))
+ , Cookie(std::move(c))
+ , Data(std::move(d))
, Connection(connection)
, m_Server(server)
{
@@ -707,15 +707,15 @@ cmServerResponse cmServerProtocol1::ProcessCTests(
}
cmServerProtocol1::GeneratorInformation::GeneratorInformation(
- const std::string& generatorName, const std::string& extraGeneratorName,
- const std::string& toolset, const std::string& platform,
- const std::string& sourceDirectory, const std::string& buildDirectory)
- : GeneratorName(generatorName)
- , ExtraGeneratorName(extraGeneratorName)
- , Toolset(toolset)
- , Platform(platform)
- , SourceDirectory(sourceDirectory)
- , BuildDirectory(buildDirectory)
+ std::string generatorName, std::string extraGeneratorName,
+ std::string toolset, std::string platform, std::string sourceDirectory,
+ std::string buildDirectory)
+ : GeneratorName(std::move(generatorName))
+ , ExtraGeneratorName(std::move(extraGeneratorName))
+ , Toolset(std::move(toolset))
+ , Platform(std::move(platform))
+ , SourceDirectory(std::move(sourceDirectory))
+ , BuildDirectory(std::move(buildDirectory))
{
}
diff --git a/Source/cmServerProtocol.h b/Source/cmServerProtocol.h
index df71cff..2d1507b 100644
--- a/Source/cmServerProtocol.h
+++ b/Source/cmServerProtocol.h
@@ -56,9 +56,8 @@ public:
cmConnection* Connection;
private:
- cmServerRequest(cmServer* server, cmConnection* connection,
- const std::string& t, const std::string& c,
- const Json::Value& d);
+ cmServerRequest(cmServer* server, cmConnection* connection, std::string t,
+ std::string c, Json::Value d);
void ReportProgress(int min, int current, int max,
const std::string& message) const;
@@ -140,12 +139,10 @@ private:
{
public:
GeneratorInformation() = default;
- GeneratorInformation(const std::string& generatorName,
- const std::string& extraGeneratorName,
- const std::string& toolset,
- const std::string& platform,
- const std::string& sourceDirectory,
- const std::string& buildDirectory);
+ GeneratorInformation(std::string generatorName,
+ std::string extraGeneratorName, std::string toolset,
+ std::string platform, std::string sourceDirectory,
+ std::string buildDirectory);
void SetupGenerator(cmake* cm, std::string* errorMessage);
diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx
index 12ef62b..7e1e836 100644
--- a/Source/cmSourceGroup.cxx
+++ b/Source/cmSourceGroup.cxx
@@ -2,15 +2,17 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSourceGroup.h"
+#include <utility>
+
class cmSourceGroupInternals
{
public:
std::vector<cmSourceGroup> GroupChildren;
};
-cmSourceGroup::cmSourceGroup(const std::string& name, const char* regex,
+cmSourceGroup::cmSourceGroup(std::string name, const char* regex,
const char* parentName)
- : Name(name)
+ : Name(std::move(name))
{
this->Internal = new cmSourceGroupInternals;
this->SetGroupRegex(regex);
diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h
index b39f8dd..7c65494 100644
--- a/Source/cmSourceGroup.h
+++ b/Source/cmSourceGroup.h
@@ -26,7 +26,7 @@ class cmSourceGroupInternals;
class cmSourceGroup
{
public:
- cmSourceGroup(const std::string& name, const char* regex,
+ cmSourceGroup(std::string name, const char* regex,
const char* parentName = nullptr);
cmSourceGroup(cmSourceGroup const& r);
~cmSourceGroup();
diff --git a/Source/cmStringReplaceHelper.cxx b/Source/cmStringReplaceHelper.cxx
index f50cf58..4a62987 100644
--- a/Source/cmStringReplaceHelper.cxx
+++ b/Source/cmStringReplaceHelper.cxx
@@ -5,13 +5,14 @@
#include "cmMakefile.h"
#include <sstream>
+#include <utility>
cmStringReplaceHelper::cmStringReplaceHelper(const std::string& regex,
- const std::string& replace_expr,
+ std::string replace_expr,
cmMakefile* makefile)
: RegExString(regex)
, RegularExpression(regex)
- , ReplaceExpression(replace_expr)
+ , ReplaceExpression(std::move(replace_expr))
, Makefile(makefile)
{
this->ParseReplaceExpression();
diff --git a/Source/cmStringReplaceHelper.h b/Source/cmStringReplaceHelper.h
index 3e76d86..5cebde7 100644
--- a/Source/cmStringReplaceHelper.h
+++ b/Source/cmStringReplaceHelper.h
@@ -6,6 +6,7 @@
#include "cmsys/RegularExpression.hxx"
#include <string>
+#include <utility>
#include <vector>
class cmMakefile;
@@ -13,8 +14,7 @@ class cmMakefile;
class cmStringReplaceHelper
{
public:
- cmStringReplaceHelper(const std::string& regex,
- const std::string& replace_expr,
+ cmStringReplaceHelper(const std::string& regex, std::string replace_expr,
cmMakefile* makefile = nullptr);
bool IsRegularExpressionValid() const
@@ -39,9 +39,9 @@ private:
, Value(s)
{
}
- RegexReplacement(const std::string& s)
+ RegexReplacement(std::string s)
: Number(-1)
- , Value(s)
+ , Value(std::move(s))
{
}
RegexReplacement(int n)
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 7126944..a16460f 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -270,6 +270,13 @@ void cmSystemTools::Error(const char* m1, const char* m2, const char* m3,
cmSystemTools::Message(message.c_str(), "Error");
}
+void cmSystemTools::Error(const std::string& m)
+{
+ std::string message = "CMake Error: " + m;
+ cmSystemTools::s_ErrorOccured = true;
+ cmSystemTools::Message(message.c_str(), "Error");
+}
+
void cmSystemTools::SetInterruptCallback(InterruptCallback f, void* clientData)
{
s_InterruptCallback = f;
@@ -338,7 +345,7 @@ void cmSystemTools::ReportLastSystemError(const char* msg)
std::string m = msg;
m += ": System Error: ";
m += Superclass::GetLastSystemError();
- cmSystemTools::Error(m.c_str());
+ cmSystemTools::Error(m);
}
bool cmSystemTools::IsInternallyOn(const char* val)
@@ -549,7 +556,7 @@ std::vector<std::string> cmSystemTools::HandleResponseFile(
error += cmSystemTools::GetLastSystemError();
error += "):\n ";
error += arg.substr(1);
- cmSystemTools::Error(error.c_str());
+ cmSystemTools::Error(error);
} else {
std::string line;
cmSystemTools::GetLineFromStream(responseFile, line);
@@ -1652,7 +1659,7 @@ bool cmSystemTools::CreateTar(const char* outFileName,
e += outFileName;
e += "\": ";
e += cmSystemTools::GetLastSystemError();
- cmSystemTools::Error(e.c_str());
+ cmSystemTools::Error(e);
return false;
}
cmArchiveWrite::Compress compress = cmArchiveWrite::CompressNone;
@@ -1685,7 +1692,7 @@ bool cmSystemTools::CreateTar(const char* outFileName,
}
}
if (!a) {
- cmSystemTools::Error(a.GetError().c_str());
+ cmSystemTools::Error(a.GetError());
return false;
}
return true;
@@ -3121,7 +3128,7 @@ bool cmSystemTools::CreateSymlink(const std::string& origName,
if (errorMessage) {
*errorMessage = std::move(e);
} else {
- cmSystemTools::Error(e.c_str());
+ cmSystemTools::Error(e);
}
return false;
}
@@ -3142,7 +3149,7 @@ bool cmSystemTools::CreateLink(const std::string& origName,
if (errorMessage) {
*errorMessage = std::move(e);
} else {
- cmSystemTools::Error(e.c_str());
+ cmSystemTools::Error(e);
}
return false;
}
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 4ae83d6..b30e4f7 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -70,6 +70,7 @@ public:
*/
static void Error(const char* m, const char* m2 = nullptr,
const char* m3 = nullptr, const char* m4 = nullptr);
+ static void Error(const std::string& m);
/**
* Display a message.
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 10a6d9a..0a657f7 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -121,7 +121,7 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv,
// now try running the command if it compiled
if (!res) {
if (this->OutputFile.empty()) {
- cmSystemTools::Error(this->FindErrorMessage.c_str());
+ cmSystemTools::Error(this->FindErrorMessage);
} else {
// "run" it and capture the output
std::string runOutputContents;
@@ -354,7 +354,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
errorMessage += " " + internalRunOutputName + " (advanced)\n";
}
errorMessage += detailsString;
- cmSystemTools::Error(errorMessage.c_str());
+ cmSystemTools::Error(errorMessage);
return;
}
diff --git a/Source/cmUnexpectedCommand.h b/Source/cmUnexpectedCommand.h
index 7154881..33d6bdc 100644
--- a/Source/cmUnexpectedCommand.h
+++ b/Source/cmUnexpectedCommand.h
@@ -6,6 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <string>
+#include <utility>
#include <vector>
#include "cmCommand.h"
@@ -15,8 +16,8 @@ class cmExecutionStatus;
class cmUnexpectedCommand : public cmCommand
{
public:
- cmUnexpectedCommand(std::string const& name, const char* error)
- : Name(name)
+ cmUnexpectedCommand(std::string name, const char* error)
+ : Name(std::move(name))
, Error(error)
{
}
diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx
index 06ca53c..c02157a 100644
--- a/Source/cmVariableRequiresCommand.cxx
+++ b/Source/cmVariableRequiresCommand.cxx
@@ -57,7 +57,7 @@ bool cmVariableRequiresCommand::InitialPass(
"One or more of the required variables is advanced."
" To set the variable, you must turn on advanced mode in cmake.";
}
- cmSystemTools::Error(message.c_str());
+ cmSystemTools::Error(message);
}
return true;
diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index 03e0059..975d6e4 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -60,7 +60,7 @@ static void cmVariableWatchCommandVariableAccessed(const std::string& variable,
error << "Error in cmake code at\nUnknown:0:\n"
<< "A command failed during the invocation of callback \""
<< data->Command << "\".";
- cmSystemTools::Error(error.str().c_str());
+ cmSystemTools::Error(error.str());
data->InCallback = false;
return;
}
diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx
index d301ad0..1b16198 100644
--- a/Source/cmXCodeScheme.cxx
+++ b/Source/cmXCodeScheme.cxx
@@ -5,16 +5,17 @@
#include <iomanip>
#include <iostream>
#include <sstream>
+#include <utility>
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmXMLSafe.h"
-cmXCodeScheme::cmXCodeScheme(cmXCodeObject* xcObj, const TestObjects& tests,
+cmXCodeScheme::cmXCodeScheme(cmXCodeObject* xcObj, TestObjects tests,
const std::vector<std::string>& configList,
unsigned int xcVersion)
: Target(xcObj)
- , Tests(tests)
+ , Tests(std::move(tests))
, TargetName(xcObj->GetTarget()->GetName())
, ConfigList(configList)
, XcodeVersion(xcVersion)
diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h
index 96c76e6..8c47123 100644
--- a/Source/cmXCodeScheme.h
+++ b/Source/cmXCodeScheme.h
@@ -20,7 +20,7 @@ class cmXCodeScheme
public:
typedef std::vector<const cmXCodeObject*> TestObjects;
- cmXCodeScheme(cmXCodeObject* xcObj, const TestObjects& tests,
+ cmXCodeScheme(cmXCodeObject* xcObj, TestObjects tests,
const std::vector<std::string>& configList,
unsigned int xcVersion);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index e792771..610597a 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -812,8 +812,11 @@ void cmake::SetArgs(const std::vector<std::string>& args)
if (this->CurrentWorkingMode == cmake::NORMAL_MODE && !haveSourceDir &&
!haveBinaryDir) {
- cmSystemTools::Error("No source or binary directory provided");
- return;
+ this->IssueMessage(
+ MessageType::WARNING,
+ "No source or binary directory provided. Both will be assumed to be "
+ "the same as the current working directory, but note that this "
+ "warning will become a fatal error in future CMake releases.");
}
if (!haveSourceDir) {
@@ -1171,7 +1174,7 @@ int cmake::DoPreConfigureChecks()
}
err << "Specify --help for usage, or press the help button on the CMake "
"GUI.";
- cmSystemTools::Error(err.str().c_str());
+ cmSystemTools::Error(err.str());
return -2;
}
@@ -1189,7 +1192,7 @@ int cmake::DoPreConfigureChecks()
message += cacheStart;
message += "\" used to generate cache. ";
message += "Re-run cmake with a different source directory.";
- cmSystemTools::Error(message.c_str());
+ cmSystemTools::Error(message);
return -2;
}
} else {
@@ -1399,7 +1402,7 @@ int cmake::ActualConfigure()
message += *genName;
message += "\nEither remove the CMakeCache.txt file and CMakeFiles "
"directory or choose a different binary directory.";
- cmSystemTools::Error(message.c_str());
+ cmSystemTools::Error(message);
return -2;
}
}
@@ -1423,7 +1426,7 @@ int cmake::ActualConfigure()
message += *instance;
message += "\nEither remove the CMakeCache.txt file and CMakeFiles "
"directory or choose a different binary directory.";
- cmSystemTools::Error(message.c_str());
+ cmSystemTools::Error(message);
return -2;
}
} else {
@@ -1442,7 +1445,7 @@ int cmake::ActualConfigure()
message += *platformName;
message += "\nEither remove the CMakeCache.txt file and CMakeFiles "
"directory or choose a different binary directory.";
- cmSystemTools::Error(message.c_str());
+ cmSystemTools::Error(message);
return -2;
}
} else {
@@ -1460,7 +1463,7 @@ int cmake::ActualConfigure()
message += *tsName;
message += "\nEither remove the CMakeCache.txt file and CMakeFiles "
"directory or choose a different binary directory.";
- cmSystemTools::Error(message.c_str());
+ cmSystemTools::Error(message);
return -2;
}
} else {
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 10655d5..0c25498 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -358,6 +358,31 @@ int do_cmake(int ac, char const* const* av)
return 0;
}
+namespace {
+int extract_job_number(int& index, char const* current, char const* next,
+ int len_of_flag)
+{
+ std::string command(current);
+ std::string jobString = command.substr(len_of_flag);
+ if (jobString.empty() && next && isdigit(next[0])) {
+ ++index; // skip parsing the job number
+ jobString = std::string(next);
+ }
+
+ int jobs = -1;
+ unsigned long numJobs = 0;
+ if (jobString.empty()) {
+ jobs = cmake::DEFAULT_BUILD_PARALLEL_LEVEL;
+ } else if (cmSystemTools::StringToULong(jobString.c_str(), &numJobs)) {
+ jobs = int(numJobs);
+ } else {
+ std::cerr << "'" << command.substr(0, len_of_flag) << "' invalid number '"
+ << jobString << "' given.\n\n";
+ }
+ return jobs;
+}
+}
+
static int do_build(int ac, char const* const* av)
{
#ifndef CMAKE_BUILD_WITH_CMAKE
@@ -375,7 +400,6 @@ static int do_build(int ac, char const* const* av)
enum Doing
{
DoingNone,
- DoingJobs,
DoingDir,
DoingTarget,
DoingConfig,
@@ -385,12 +409,17 @@ static int do_build(int ac, char const* const* av)
for (int i = 2; i < ac; ++i) {
if (doing == DoingNative) {
nativeOptions.emplace_back(av[i]);
- } else if ((strcmp(av[i], "-j") == 0) ||
- (strcmp(av[i], "--parallel") == 0)) {
- jobs = cmake::DEFAULT_BUILD_PARALLEL_LEVEL;
- /* does the next argument start with a number? */
- if ((i + 1 < ac) && (isdigit(*av[i + 1]))) {
- doing = DoingJobs;
+ } else if (cmHasLiteralPrefix(av[i], "-j")) {
+ const char* nextArg = ((i + 1 < ac) ? av[i + 1] : nullptr);
+ jobs = extract_job_number(i, av[i], nextArg, sizeof("-j") - 1);
+ if (jobs < 0) {
+ dir.clear();
+ }
+ } else if (cmHasLiteralPrefix(av[i], "--parallel")) {
+ const char* nextArg = ((i + 1 < ac) ? av[i + 1] : nullptr);
+ jobs = extract_job_number(i, av[i], nextArg, sizeof("--parallel") - 1);
+ if (jobs < 0) {
+ dir.clear();
}
} else if (strcmp(av[i], "--target") == 0) {
if (!hasTarget) {
@@ -412,18 +441,6 @@ static int do_build(int ac, char const* const* av)
doing = DoingNative;
} else {
switch (doing) {
- case DoingJobs: {
- unsigned long numJobs = 0;
- if (cmSystemTools::StringToULong(av[i], &numJobs)) {
- jobs = int(numJobs);
- doing = DoingNone;
- } else {
- std::cerr << "'" << av[i - 1] << "' invalid number '" << av[i]
- << "' given.\n\n";
- dir.clear();
- break;
- }
- } break;
case DoingDir:
dir = cmSystemTools::CollapseFullPath(av[i]);
doing = DoingNone;
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 6a514f5..ce3691d 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -123,7 +123,7 @@ void CMakeCommandUsage(const char* program)
;
/* clang-format on */
- cmSystemTools::Error(errorStream.str().c_str());
+ cmSystemTools::Error(errorStream.str());
}
static bool cmTarFilesFrom(std::string const& file,
@@ -132,14 +132,14 @@ static bool cmTarFilesFrom(std::string const& file,
if (cmSystemTools::FileIsDirectory(file)) {
std::ostringstream e;
e << "-E tar --files-from= file '" << file << "' is a directory";
- cmSystemTools::Error(e.str().c_str());
+ cmSystemTools::Error(e.str());
return false;
}
cmsys::ifstream fin(file.c_str());
if (!fin) {
std::ostringstream e;
e << "-E tar --files-from= file '" << file << "' not found";
- cmSystemTools::Error(e.str().c_str());
+ cmSystemTools::Error(e.str());
return false;
}
std::string line;
@@ -153,7 +153,7 @@ static bool cmTarFilesFrom(std::string const& file,
std::ostringstream e;
e << "-E tar --files-from='" << file << "' file invalid line:\n"
<< line << "\n";
- cmSystemTools::Error(e.str().c_str());
+ cmSystemTools::Error(e.str());
return false;
} else {
files.push_back(line);
@@ -964,8 +964,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
std::unique_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator(&mf));
// Actually scan dependencies.
- return lgd->UpdateDependencies(depInfo.c_str(), verbose, color) ? 0
- : 2;
+ return lgd->UpdateDependencies(depInfo, verbose, color) ? 0 : 2;
}
return 1;
}
@@ -1173,7 +1172,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
if (server.Serve(&errorMessage)) {
return 0;
}
- cmSystemTools::Error(errorMessage.c_str());
+ cmSystemTools::Error(errorMessage);
#else
static_cast<void>(supportExperimental);
static_cast<void>(isDebug);
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index d368fa2..6c12355 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -3871,7 +3871,8 @@ SystemInformation::LongLong SystemInformationImplementation::GetProcessId()
{
#if defined(_WIN32)
return GetCurrentProcessId();
-#elif defined(__linux) || defined(__APPLE__)
+#elif defined(__linux) || defined(__APPLE__) || defined(__OpenBSD__) || \
+ defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
return getpid();
#else
return -1;
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index c1703cc..0c6eabc 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1558,7 +1558,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
add_subdirectory(FindXercesC)
endif()
- if(CMake_TEST_FindPython)
+ if(CMake_TEST_FindPython OR CMake_TEST_FindPython_NumPy)
add_subdirectory(FindPython)
endif()
diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt
index 639d29c..38211a4 100644
--- a/Tests/FindPython/CMakeLists.txt
+++ b/Tests/FindPython/CMakeLists.txt
@@ -1,69 +1,94 @@
-add_test(NAME FindPython.Python2 COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/Python2"
- "${CMake_BINARY_DIR}/Tests/FindPython/Python2"
- ${build_generator_args}
- --build-project TestPython2
- --build-options ${build_options}
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
- )
+if(CMake_TEST_FindPython)
+ add_test(NAME FindPython.Python2 COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/Python2"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python2"
+ ${build_generator_args}
+ --build-project TestPython2
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
-add_test(NAME FindPython.Python2Fail COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/Python2Fail"
- "${CMake_BINARY_DIR}/Tests/FindPython/Python2Fail"
- ${build_generator_args}
- --build-project TestPython2Fail
- --build-options ${build_options}
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
- )
-set_tests_properties(FindPython.Python2Fail PROPERTIES
- PASS_REGULAR_EXPRESSION "Could NOT find Python2 \\(missing: foobar\\)")
+ add_test(NAME FindPython.Python2Fail COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/Python2Fail"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python2Fail"
+ ${build_generator_args}
+ --build-project TestPython2Fail
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ set_tests_properties(FindPython.Python2Fail PROPERTIES
+ PASS_REGULAR_EXPRESSION "Could NOT find Python2 \\(missing: foobar\\)")
-add_test(NAME FindPython.Python3 COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/Python3"
- "${CMake_BINARY_DIR}/Tests/FindPython/Python3"
- ${build_generator_args}
- --build-project TestPython3
- --build-options ${build_options}
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
- )
+ add_test(NAME FindPython.Python3 COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/Python3"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python3"
+ ${build_generator_args}
+ --build-project TestPython3
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
-add_test(NAME FindPython.Python3Fail COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/Python3Fail"
- "${CMake_BINARY_DIR}/Tests/FindPython/Python3Fail"
- ${build_generator_args}
- --build-project TestPython3Fail
- --build-options ${build_options}
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
- )
-set_tests_properties(FindPython.Python3Fail PROPERTIES
- PASS_REGULAR_EXPRESSION "Could NOT find Python3 \\(missing: foobar\\)")
+ add_test(NAME FindPython.Python3Fail COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/Python3Fail"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python3Fail"
+ ${build_generator_args}
+ --build-project TestPython3Fail
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ set_tests_properties(FindPython.Python3Fail PROPERTIES
+ PASS_REGULAR_EXPRESSION "Could NOT find Python3 \\(missing: foobar\\)")
-add_test(NAME FindPython.Python COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/Python"
- "${CMake_BINARY_DIR}/Tests/FindPython/Python"
- ${build_generator_args}
- --build-project TestPython
- --build-options ${build_options}
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
- )
+ add_test(NAME FindPython.Python COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/Python"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python"
+ ${build_generator_args}
+ --build-project TestPython
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+
+ add_test(NAME FindPython.MultiplePackages COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/MultiplePackages"
+ "${CMake_BINARY_DIR}/Tests/FindPython/MultiplePackages"
+ ${build_generator_args}
+ --build-project TestMultiplePackages
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+endif()
-add_test(NAME FindPython.MultiplePackages COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/MultiplePackages"
- "${CMake_BINARY_DIR}/Tests/FindPython/MultiplePackages"
- ${build_generator_args}
- --build-project TestMultiplePackages
- --build-options ${build_options}
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+if(CMake_TEST_FindPython_NumPy)
+ add_test(NAME FindPython.NumPy COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/NumPy"
+ "${CMake_BINARY_DIR}/Tests/FindPython/NumPy"
+ ${build_generator_args}
+ --build-project TestNumPy
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.NumPyOnly COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/NumPyOnly"
+ "${CMake_BINARY_DIR}/Tests/FindPython/NumPyOnly"
+ ${build_generator_args}
+ --build-project TestNumPyOnly
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+ endif()
diff --git a/Tests/FindPython/FindPythonScript.cmake b/Tests/FindPython/FindPythonScript.cmake
new file mode 100644
index 0000000..9450092
--- /dev/null
+++ b/Tests/FindPython/FindPythonScript.cmake
@@ -0,0 +1 @@
+find_package(${PYTHON_PACKAGE_NAME} REQUIRED QUIET)
diff --git a/Tests/FindPython/NumPy/CMakeLists.txt b/Tests/FindPython/NumPy/CMakeLists.txt
new file mode 100644
index 0000000..f557026
--- /dev/null
+++ b/Tests/FindPython/NumPy/CMakeLists.txt
@@ -0,0 +1,22 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(TestNumPy C)
+
+find_package (Python2 REQUIRED COMPONENTS Interpreter Development NumPy)
+find_package (Python3 REQUIRED COMPONENTS Interpreter Development NumPy)
+
+Python2_add_library (arraytest2 MODULE arraytest.c)
+target_compile_definitions (arraytest2 PRIVATE PYTHON2)
+target_link_libraries (arraytest2 PRIVATE Python2::NumPy)
+
+Python3_add_library (arraytest3 MODULE arraytest.c)
+target_compile_definitions (arraytest3 PRIVATE PYTHON3)
+target_link_libraries (arraytest3 PRIVATE Python3::NumPy)
+
+add_test (NAME python2_arraytest
+ COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:arraytest2>"
+ "${Python2_EXECUTABLE}" -c "import numpy; import arraytest2; arraytest2.vecsq(numpy.array([1, 2, 3]));")
+
+add_test (NAME python3_arraytest
+ COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:arraytest3>"
+ "${Python3_EXECUTABLE}" -c "import numpy; import arraytest3; arraytest3.vecsq(numpy.array([1, 2, 3]));")
diff --git a/Tests/FindPython/NumPy/arraytest.c b/Tests/FindPython/NumPy/arraytest.c
new file mode 100644
index 0000000..135877d
--- /dev/null
+++ b/Tests/FindPython/NumPy/arraytest.c
@@ -0,0 +1,58 @@
+#include "Python.h"
+
+#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
+#include "arrayobject.h"
+
+#include <math.h>
+
+static PyObject* vecsq(PyObject* self, PyObject* args);
+
+static PyMethodDef arraytestMethods[] = { { "vecsq", vecsq, METH_VARARGS },
+ { NULL, NULL } };
+
+static PyObject* vecsq(PyObject* self, PyObject* args)
+{
+ PyArrayObject *vecin, *vecout;
+ npy_intp dims[2];
+ double *cin, *cout;
+ int i, j, n, m;
+
+ if (!PyArg_ParseTuple(args, "O!", &PyArray_Type, &vecin))
+ return NULL;
+
+ n = dims[0] = PyArray_NDIM(vecin);
+ vecout = (PyArrayObject*)PyArray_SimpleNew(1, dims, NPY_DOUBLE);
+
+ cin = (double*)PyArray_DATA(vecin);
+ cout = (double*)PyArray_DATA(vecout);
+
+ for (i = 0; i < n; i++) {
+ cout[i] = cin[i] * cin[i];
+ }
+ return PyArray_Return(vecout);
+}
+
+#if defined(PYTHON2)
+PyMODINIT_FUNC init_C_arraytest(void)
+{
+ (void)Py_InitModule("arraytest2", arraytestMethods);
+ import_array();
+}
+#endif
+
+#if defined(PYTHON3)
+static struct PyModuleDef arraytestmodule = {
+ PyModuleDef_HEAD_INIT, "arraytest3", /* name of module */
+ NULL, /* module documentation, may be NULL */
+ -1, /* size of per-interpreter state of the module,
+ or -1 if the module keeps state in global variables. */
+ arraytestMethods
+};
+
+PyMODINIT_FUNC PyInit_C_arraytest(void)
+{
+ PyObject* po = PyModule_Create(&arraytestmodule);
+ import_array();
+ return po;
+}
+#endif
diff --git a/Tests/FindPython/NumPyOnly/CMakeLists.txt b/Tests/FindPython/NumPyOnly/CMakeLists.txt
new file mode 100644
index 0000000..a5db603
--- /dev/null
+++ b/Tests/FindPython/NumPyOnly/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(TestNumPyOnly C)
+
+find_package(Python2 REQUIRED COMPONENTS NumPy)
+find_package(Python3 REQUIRED COMPONENTS NumPy)
+
+Python2_add_library (arraytest2 MODULE ../NumPy/arraytest.c)
+target_compile_definitions (arraytest2 PRIVATE PYTHON2)
+target_link_libraries (arraytest2 PRIVATE Python2::NumPy)
+
+Python3_add_library (arraytest3 MODULE ../NumPy/arraytest.c)
+target_compile_definitions (arraytest3 PRIVATE PYTHON3)
+target_link_libraries (arraytest3 PRIVATE Python3::NumPy)
diff --git a/Tests/FindPython/Python/CMakeLists.txt b/Tests/FindPython/Python/CMakeLists.txt
index bebd23f..f7fc243 100644
--- a/Tests/FindPython/Python/CMakeLists.txt
+++ b/Tests/FindPython/Python/CMakeLists.txt
@@ -9,9 +9,21 @@ if (NOT Python_FOUND)
message (FATAL_ERROR "Fail to found Python 3")
endif()
+if(NOT TARGET Python::Interpreter)
+ message(SEND_ERROR "Python::Interpreter not found")
+endif()
+
+if(NOT TARGET Python::Python)
+ message(SEND_ERROR "Python::Python not found")
+endif()
+
Python_add_library (spam3 MODULE ../spam.c)
target_compile_definitions (spam3 PRIVATE PYTHON3)
add_test (NAME python_spam3
COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>"
"${Python_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")")
+
+add_test(NAME findpython_script
+ COMMAND "${CMAKE_COMMAND}" -DPYTHON_PACKAGE_NAME=Python
+ -P "${CMAKE_CURRENT_LIST_DIR}/../FindPythonScript.cmake")
diff --git a/Tests/FindPython/Python2/CMakeLists.txt b/Tests/FindPython/Python2/CMakeLists.txt
index 9622b6f..a0753f6 100644
--- a/Tests/FindPython/Python2/CMakeLists.txt
+++ b/Tests/FindPython/Python2/CMakeLists.txt
@@ -14,9 +14,21 @@ if (NOT Python2_FOUND)
message (FATAL_ERROR "Fail to found Python 2")
endif()
+if(NOT TARGET Python2::Interpreter)
+ message(SEND_ERROR "Python2::Interpreter not found")
+endif()
+
+if(NOT TARGET Python2::Python)
+ message(SEND_ERROR "Python2::Python not found")
+endif()
+
Python2_add_library (spam2 MODULE ../spam.c)
target_compile_definitions (spam2 PRIVATE PYTHON2)
add_test (NAME python2_spam2
COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam2>"
"${Python2_EXECUTABLE}" -c "import spam2; spam2.system(\"cd\")")
+
+add_test(NAME findpython2_script
+ COMMAND "${CMAKE_COMMAND}" -DPYTHON_PACKAGE_NAME=Python2
+ -P "${CMAKE_CURRENT_LIST_DIR}/../FindPythonScript.cmake")
diff --git a/Tests/FindPython/Python3/CMakeLists.txt b/Tests/FindPython/Python3/CMakeLists.txt
index cb86eae..65eea4c 100644
--- a/Tests/FindPython/Python3/CMakeLists.txt
+++ b/Tests/FindPython/Python3/CMakeLists.txt
@@ -14,9 +14,21 @@ if (NOT Python3_FOUND)
message (FATAL_ERROR "Fail to found Python 3")
endif()
+if(NOT TARGET Python3::Interpreter)
+ message(SEND_ERROR "Python2::Interpreter not found")
+endif()
+
+if(NOT TARGET Python3::Python)
+ message(SEND_ERROR "Python2::Python not found")
+endif()
+
Python3_add_library (spam3 MODULE ../spam.c)
target_compile_definitions (spam3 PRIVATE PYTHON3)
add_test (NAME python3_spam3
COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>"
"${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")")
+
+add_test(NAME findpython3_script
+ COMMAND "${CMAKE_COMMAND}" -DPYTHON_PACKAGE_NAME=Python3
+ -P "${CMAKE_CURRENT_LIST_DIR}/../FindPythonScript.cmake")
diff --git a/Tests/RunCMake/CommandLine/no-S-B-result.txt b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-bad-number-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/CommandLine/no-S-B-result.txt
+++ b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-bad-number-result.txt
diff --git a/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-bad-number-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-bad-number-stderr.txt
new file mode 100644
index 0000000..e73d760
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-bad-number-stderr.txt
@@ -0,0 +1,3 @@
+^'--parallel' invalid number '12ab' given\.
++
+Usage: cmake --build <dir> \[options\] \[-- \[native-options\]\]
diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-number-trailing-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-good-number-stderr.txt
index 3c2c808..3c2c808 100644
--- a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-number-trailing-stderr.txt
+++ b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-good-number-stderr.txt
diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-good-number-trailing-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-good-number-trailing--target-stderr.txt
index 3c2c808..3c2c808 100644
--- a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-good-number-trailing-stderr.txt
+++ b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-good-number-trailing--target-stderr.txt
diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-bad-number-result.txt b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-bad-number-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-bad-number-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-bad-number-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-bad-number-stderr.txt
new file mode 100644
index 0000000..c810087
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-bad-number-stderr.txt
@@ -0,0 +1,3 @@
+^'-j' invalid number '12ab' given\.
++
+Usage: cmake --build <dir> \[options\] \[-- \[native-options\]\]
diff --git a/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-number-trailing-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-good-number-stderr.txt
index 3c2c808..3c2c808 100644
--- a/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-number-trailing-stderr.txt
+++ b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-good-number-stderr.txt
diff --git a/Tests/RunCMake/CommandLine/BuildDir--build--parallel-good-number-trailing-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-good-number-trailing--target-stderr.txt
index 3c2c808..3c2c808 100644
--- a/Tests/RunCMake/CommandLine/BuildDir--build--parallel-good-number-trailing-stderr.txt
+++ b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-good-number-trailing--target-stderr.txt
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 0e04ad1..c1aaf0d 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -56,12 +56,22 @@ run_cmake_command(cache-empty-entry
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-empty-entry/)
function(run_ExplicitDirs)
+ set(source_dir ${RunCMake_BINARY_DIR}/ExplicitDirsMissing)
+
+ file(REMOVE_RECURSE "${source_dir}")
+ file(MAKE_DIRECTORY "${source_dir}")
+ file(WRITE ${source_dir}/CMakeLists.txt [=[
+cmake_minimum_required(VERSION 3.13)
+project(ExplicitDirsMissing LANGUAGES NONE)
+]=])
+ run_cmake_command(no-S-B ${CMAKE_COMMAND} -E chdir ${source_dir}
+ ${CMAKE_COMMAND} -DFOO=BAR)
+
set(source_dir ${RunCMake_SOURCE_DIR}/ExplicitDirs)
set(binary_dir ${RunCMake_BINARY_DIR}/ExplicitDirs-build)
file(REMOVE_RECURSE "${binary_dir}")
file(MAKE_DIRECTORY "${binary_dir}")
- run_cmake_command(no-S-B ${CMAKE_COMMAND} -DFOO=BAR)
run_cmake_command(S-arg ${CMAKE_COMMAND} -S ${source_dir} ${binary_dir})
run_cmake_command(S-arg-reverse-order ${CMAKE_COMMAND} ${binary_dir} -S${source_dir} )
run_cmake_command(S-no-arg ${CMAKE_COMMAND} -S )
@@ -105,6 +115,19 @@ function(run_BuildDir)
${CMAKE_COMMAND} --build BuildDir-build --parallel 2)
run_cmake_command(BuildDir--build--parallel-good-number-trailing--target ${CMAKE_COMMAND} -E chdir ..
${CMAKE_COMMAND} --build BuildDir-build --parallel 2 --target CustomTarget)
+ run_cmake_command(BuildDir--build-jobs-no-space-bad-number ${CMAKE_COMMAND} -E chdir ..
+ ${CMAKE_COMMAND} --build BuildDir-build -j12ab)
+ run_cmake_command(BuildDir--build-jobs-no-space-good-number ${CMAKE_COMMAND} -E chdir ..
+ ${CMAKE_COMMAND} --build BuildDir-build -j2)
+ run_cmake_command(BuildDir--build-jobs-no-space-good-number-trailing--target ${CMAKE_COMMAND} -E chdir ..
+ ${CMAKE_COMMAND} --build BuildDir-build -j2 --target CustomTarget)
+ run_cmake_command(BuildDir--build--parallel-no-space-bad-number ${CMAKE_COMMAND} -E chdir ..
+ ${CMAKE_COMMAND} --build BuildDir-build --parallel12ab)
+ run_cmake_command(BuildDir--build--parallel-no-space-good-number ${CMAKE_COMMAND} -E chdir ..
+ ${CMAKE_COMMAND} --build BuildDir-build --parallel2)
+ run_cmake_command(BuildDir--build--parallel-no-space-good-number-trailing--target ${CMAKE_COMMAND} -E chdir ..
+ ${CMAKE_COMMAND} --build BuildDir-build --parallel2 --target CustomTarget)
+
# No default jobs for Xcode and FreeBSD build command
if(NOT RunCMake_GENERATOR MATCHES "Xcode" AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
run_cmake_command(BuildDir--build-jobs-no-number ${CMAKE_COMMAND} -E chdir ..
diff --git a/Tests/RunCMake/CommandLine/no-S-B-stderr.txt b/Tests/RunCMake/CommandLine/no-S-B-stderr.txt
index 7a94307..c166dcf 100644
--- a/Tests/RunCMake/CommandLine/no-S-B-stderr.txt
+++ b/Tests/RunCMake/CommandLine/no-S-B-stderr.txt
@@ -1 +1,4 @@
-CMake Error: No source or binary directory provided
+CMake Warning:
+ No source or binary directory provided. Both will be assumed to be the
+ same as the current working directory, but note that this warning will
+ become a fatal error in future CMake releases.