summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/find_package.rst15
-rw-r--r--Help/dev/maint.rst4
-rw-r--r--Help/guide/tutorial/Complete/CMakeLists.txt3
-rw-r--r--Help/guide/tutorial/Consumer/CMakeLists.txt3
-rw-r--r--Help/guide/tutorial/Step10/CMakeLists.txt3
-rw-r--r--Help/guide/tutorial/Step11/CMakeLists.txt3
-rw-r--r--Help/guide/tutorial/Step2/CMakeLists.txt3
-rw-r--r--Help/guide/tutorial/Step3/CMakeLists.txt3
-rw-r--r--Help/guide/tutorial/Step4/CMakeLists.txt3
-rw-r--r--Help/guide/tutorial/Step5/CMakeLists.txt3
-rw-r--r--Help/guide/tutorial/Step6/CMakeLists.txt3
-rw-r--r--Help/guide/tutorial/Step7/CMakeLists.txt3
-rw-r--r--Help/guide/tutorial/Step8/CMakeLists.txt3
-rw-r--r--Help/guide/tutorial/Step9/CMakeLists.txt3
-rw-r--r--Help/manual/cmake-properties.7.rst1
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/prop_tgt/INSTALL_REMOVE_ENVIRONMENT_RPATH.rst10
-rw-r--r--Help/release/3.15.rst17
-rw-r--r--Help/release/dev/add-install-remove-environment-rpath.rst6
-rw-r--r--Help/release/dev/global-controls-over-find-locations.rst4
-rw-r--r--Help/variable/CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH.rst2
-rw-r--r--Help/variable/CMAKE_FIND_USE_CMAKE_PATH.rst2
-rw-r--r--Help/variable/CMAKE_FIND_USE_CMAKE_SYSTEM_PATH.rst2
-rw-r--r--Help/variable/CMAKE_FIND_USE_PACKAGE_ROOT_PATH.rst2
-rw-r--r--Help/variable/CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH.rst2
-rw-r--r--Help/variable/CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH.rst9
-rw-r--r--Modules/Compiler/Clang-CXX.cmake7
-rw-r--r--Modules/FindMPI.cmake4
-rw-r--r--Source/CMakeVersion.cmake4
-rw-r--r--Source/CPack/cmCPackGenerator.cxx13
-rw-r--r--Source/CPack/cpack.cxx21
-rw-r--r--Source/CTest/cmCTestBuildCommand.cxx5
-rw-r--r--Source/CTest/cmCTestHandlerCommand.cxx17
-rw-r--r--Source/CTest/cmCTestMemCheckCommand.cxx4
-rw-r--r--Source/CTest/cmCTestRunScriptCommand.cxx2
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx20
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx2
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx3
-rw-r--r--Source/LexerParser/cmExprParser.cxx125
-rw-r--r--Source/LexerParser/cmExprParser.y3
-rw-r--r--Source/cmAlgorithms.h52
-rw-r--r--Source/cmAuxSourceDirectoryCommand.cxx2
-rw-r--r--Source/cmBuildCommand.cxx2
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.cxx2
-rw-r--r--Source/cmCMakeMinimumRequired.cxx3
-rw-r--r--Source/cmCMakePolicyCommand.cxx3
-rw-r--r--Source/cmCPluginAPI.cxx6
-rw-r--r--Source/cmCoreTryCompile.cxx5
-rw-r--r--Source/cmCreateTestSourceList.cxx11
-rw-r--r--Source/cmCustomCommandGenerator.cxx2
-rw-r--r--Source/cmDefinitions.cxx26
-rw-r--r--Source/cmDefinitions.h30
-rw-r--r--Source/cmExecProgramCommand.cxx2
-rw-r--r--Source/cmExecuteProcessCommand.cxx2
-rw-r--r--Source/cmFLTKWrapUICommand.cxx3
-rw-r--r--Source/cmFileCommand.cxx62
-rw-r--r--Source/cmFileInstaller.cxx2
-rw-r--r--Source/cmFindPackageCommand.cxx23
-rw-r--r--Source/cmForEachCommand.cxx8
-rw-r--r--Source/cmFunctionCommand.cxx10
-rw-r--r--Source/cmGeneratorExpressionNode.cxx208
-rw-r--r--Source/cmGeneratorTarget.cxx144
-rw-r--r--Source/cmGeneratorTarget.h12
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx2
-rw-r--r--Source/cmGetDirectoryPropertyCommand.cxx8
-rw-r--r--Source/cmGetFilenameComponentCommand.cxx4
-rw-r--r--Source/cmGetPropertyCommand.cxx4
-rw-r--r--Source/cmGetSourceFilePropertyCommand.cxx2
-rw-r--r--Source/cmGetTargetPropertyCommand.cxx4
-rw-r--r--Source/cmGlobalGenerator.cxx7
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx2
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.cxx6
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.cxx6
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx5
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx5
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx3
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx6
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx8
-rw-r--r--Source/cmIncludeGuardCommand.cxx2
-rw-r--r--Source/cmInstallTargetGenerator.cxx10
-rw-r--r--Source/cmLinkItem.h4
-rw-r--r--Source/cmListCommand.cxx38
-rw-r--r--Source/cmLoadCacheCommand.cxx2
-rw-r--r--Source/cmLoadCommandCommand.cxx2
-rw-r--r--Source/cmLocalGenerator.cxx4
-rw-r--r--Source/cmMakefile.cxx60
-rw-r--r--Source/cmMakefile.h13
-rw-r--r--Source/cmNinjaTargetGenerator.cxx4
-rw-r--r--Source/cmParseArgumentsCommand.cxx11
-rw-r--r--Source/cmProjectCommand.cxx42
-rw-r--r--Source/cmQTWrapCPPCommand.cxx2
-rw-r--r--Source/cmQTWrapUICommand.cxx4
-rw-r--r--Source/cmRemoveCommand.cxx2
-rw-r--r--Source/cmSeparateArgumentsCommand.cxx4
-rw-r--r--Source/cmSetCommand.cxx2
-rw-r--r--Source/cmSourceFileLocation.cxx3
-rw-r--r--Source/cmState.cxx4
-rw-r--r--Source/cmStateSnapshot.cxx12
-rw-r--r--Source/cmStateSnapshot.h4
-rw-r--r--Source/cmStringCommand.cxx41
-rw-r--r--Source/cmSystemTools.cxx168
-rw-r--r--Source/cmSystemTools.h39
-rw-r--r--Source/cmTarget.cxx1
-rw-r--r--Source/cmTryRunCommand.cxx5
-rw-r--r--Source/cmVariableRequiresCommand.cxx2
-rw-r--r--Source/kwsys/CommandLineArguments.cxx6
-rw-r--r--Source/kwsys/RegularExpression.cxx3
-rw-r--r--Source/kwsys/RegularExpression.hxx.in18
-rw-r--r--Source/kwsys/SystemTools.cxx17
-rw-r--r--Source/kwsys/testSystemTools.cxx8
-rw-r--r--Tests/AliasTarget/CMakeLists.txt2
-rw-r--r--Tests/CMakeTests/ELFTest.cmake.in29
-rw-r--r--Tests/Complex/CMakeLists.txt5
-rw-r--r--Tests/ComplexOneConfig/CMakeLists.txt5
-rw-r--r--Tests/MathTest/CMakeLists.txt2
-rw-r--r--Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt4
-rw-r--r--Tests/Plugin/CMakeLists.txt17
-rw-r--r--Tests/RunCMake/BuildDepends/BuildUnderSource.c5
-rw-r--r--Tests/RunCMake/BuildDepends/BuildUnderSource.cmake9
-rw-r--r--Tests/RunCMake/BuildDepends/BuildUnderSource.step1.cmake3
-rw-r--r--Tests/RunCMake/BuildDepends/BuildUnderSource.step2.cmake3
-rw-r--r--Tests/RunCMake/BuildDepends/RunCMakeTest.cmake16
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake3
-rw-r--r--Tests/RunCMake/GenerateExportHeader/GEH.cmake5
-rw-r--r--Tests/RunCMake/find_file/FromPrefixPath.cmake2
-rw-r--r--Tests/RunCMake/find_package/FromPATHEnv-stdout.txt9
-rw-r--r--Tests/RunCMake/find_package/FromPATHEnv.cmake27
-rw-r--r--Tests/RunCMake/find_package/FromPrefixPath-stdout.txt9
-rw-r--r--Tests/RunCMake/find_package/FromPrefixPath.cmake29
-rw-r--r--Tests/RunCMake/find_package/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt4
132 files changed, 1013 insertions, 751 deletions
diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst
index 6e1d232..2186bd8 100644
--- a/Help/command/find_package.rst
+++ b/Help/command/find_package.rst
@@ -293,13 +293,15 @@ enabled.
The package root variables are maintained as a stack so if
called from within a find module, root paths from the parent's find
module will also be searched after paths for the current package.
- This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed.
+ This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed or by setting
+ the :variable:`CMAKE_FIND_USE_PACKAGE_ROOT_PATH` to ``FALSE``.
See policy :policy:`CMP0074`.
2. Search paths specified in cmake-specific cache variables. These
are intended to be used on the command line with a ``-DVAR=value``.
The values are interpreted as :ref:`semicolon-separated lists <CMake Language Lists>`.
- This can be skipped if ``NO_CMAKE_PATH`` is passed::
+ This can be skipped if ``NO_CMAKE_PATH`` is passed or by setting the
+ :variable:`CMAKE_FIND_USE_CMAKE_PATH` to ``FALSE``::
CMAKE_PREFIX_PATH
CMAKE_FRAMEWORK_PATH
@@ -309,7 +311,8 @@ enabled.
These are intended to be set in the user's shell configuration,
and therefore use the host's native path separator
(``;`` on Windows and ``:`` on UNIX).
- This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed::
+ This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed or by setting
+ the :variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH` to ``FALSE``::
<PackageName>_DIR
CMAKE_PREFIX_PATH
@@ -322,7 +325,8 @@ enabled.
be specified with the ``PATHS`` option.
5. Search the standard system environment variables. This can be
- skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is passed. Path entries
+ skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is passed or by setting the
+ :variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH` to ``FALSE``. Path entries
ending in ``/bin`` or ``/sbin`` are automatically converted to their
parent directories::
@@ -339,7 +343,8 @@ enabled.
7. Search cmake variables defined in the Platform files for the
current system. This can be skipped if ``NO_CMAKE_SYSTEM_PATH`` is
- passed::
+ passed or by setting the :variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH`
+ to ``FALSE``::
CMAKE_SYSTEM_PREFIX_PATH
CMAKE_SYSTEM_FRAMEWORK_PATH
diff --git a/Help/dev/maint.rst b/Help/dev/maint.rst
index 1153a09..a1732c8 100644
--- a/Help/dev/maint.rst
+++ b/Help/dev/maint.rst
@@ -217,7 +217,7 @@ note infrastructure and the version date from ``origin/master``:
sed -i $'/^Releases/ i\\\n.. include:: dev.txt\\\n' Help/release/index.rst
Update ``Source/CMakeVersion.cmake`` to set the version to
-``$major.$minor.$date``:
+``$major.$minor.$date`` (and RC ``0`` to disable the suffix):
.. code-block:: cmake
@@ -225,7 +225,7 @@ Update ``Source/CMakeVersion.cmake`` to set the version to
set(CMake_VERSION_MAJOR $major)
set(CMake_VERSION_MINOR $minor)
set(CMake_VERSION_PATCH $date)
- #set(CMake_VERSION_RC 1)
+ set(CMake_VERSION_RC 0)
Commit with a message such as::
diff --git a/Help/guide/tutorial/Complete/CMakeLists.txt b/Help/guide/tutorial/Complete/CMakeLists.txt
index e84f932..bea611c 100644
--- a/Help/guide/tutorial/Complete/CMakeLists.txt
+++ b/Help/guide/tutorial/Complete/CMakeLists.txt
@@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.3)
project(Tutorial)
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED True)
# set the version number
set(Tutorial_VERSION_MAJOR 1)
diff --git a/Help/guide/tutorial/Consumer/CMakeLists.txt b/Help/guide/tutorial/Consumer/CMakeLists.txt
index 5097917..4033b4d 100644
--- a/Help/guide/tutorial/Consumer/CMakeLists.txt
+++ b/Help/guide/tutorial/Consumer/CMakeLists.txt
@@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.3)
if(NOT DEFINED CMAKE_CXX_STANDARD)
- set(CMAKE_CXX_STANDARD 14)
+ set(CMAKE_CXX_STANDARD 11)
+ set(CMAKE_CXX_STANDARD_REQUIRED True)
endif()
diff --git a/Help/guide/tutorial/Step10/CMakeLists.txt b/Help/guide/tutorial/Step10/CMakeLists.txt
index 5819272..25bc0c1 100644
--- a/Help/guide/tutorial/Step10/CMakeLists.txt
+++ b/Help/guide/tutorial/Step10/CMakeLists.txt
@@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.3)
project(Tutorial)
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED True)
# Set the version number
set(Tutorial_VERSION_MAJOR 1)
diff --git a/Help/guide/tutorial/Step11/CMakeLists.txt b/Help/guide/tutorial/Step11/CMakeLists.txt
index 2e5cb15..8f29fe2 100644
--- a/Help/guide/tutorial/Step11/CMakeLists.txt
+++ b/Help/guide/tutorial/Step11/CMakeLists.txt
@@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.3)
project(Tutorial)
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED True)
# set the version number
set(Tutorial_VERSION_MAJOR 1)
diff --git a/Help/guide/tutorial/Step2/CMakeLists.txt b/Help/guide/tutorial/Step2/CMakeLists.txt
index 1f43b2b..059b89a 100644
--- a/Help/guide/tutorial/Step2/CMakeLists.txt
+++ b/Help/guide/tutorial/Step2/CMakeLists.txt
@@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.3)
project(Tutorial)
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED True)
# set the version number
set(Tutorial_VERSION_MAJOR 1)
diff --git a/Help/guide/tutorial/Step3/CMakeLists.txt b/Help/guide/tutorial/Step3/CMakeLists.txt
index 966c38a..9804abf 100644
--- a/Help/guide/tutorial/Step3/CMakeLists.txt
+++ b/Help/guide/tutorial/Step3/CMakeLists.txt
@@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.3)
project(Tutorial)
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED True)
# should we use our own math functions
option(USE_MYMATH "Use tutorial provided math implementation" ON)
diff --git a/Help/guide/tutorial/Step4/CMakeLists.txt b/Help/guide/tutorial/Step4/CMakeLists.txt
index a157bda..0ae2648 100644
--- a/Help/guide/tutorial/Step4/CMakeLists.txt
+++ b/Help/guide/tutorial/Step4/CMakeLists.txt
@@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.3)
project(Tutorial)
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED True)
# should we use our own math functions
option(USE_MYMATH "Use tutorial provided math implementation" ON)
diff --git a/Help/guide/tutorial/Step5/CMakeLists.txt b/Help/guide/tutorial/Step5/CMakeLists.txt
index 76b9179..dac9b45 100644
--- a/Help/guide/tutorial/Step5/CMakeLists.txt
+++ b/Help/guide/tutorial/Step5/CMakeLists.txt
@@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.3)
project(Tutorial)
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED True)
# should we use our own math functions
option(USE_MYMATH "Use tutorial provided math implementation" ON)
diff --git a/Help/guide/tutorial/Step6/CMakeLists.txt b/Help/guide/tutorial/Step6/CMakeLists.txt
index 5829891..1465e46 100644
--- a/Help/guide/tutorial/Step6/CMakeLists.txt
+++ b/Help/guide/tutorial/Step6/CMakeLists.txt
@@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.3)
project(Tutorial)
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED True)
# set the version number
set(Tutorial_VERSION_MAJOR 1)
diff --git a/Help/guide/tutorial/Step7/CMakeLists.txt b/Help/guide/tutorial/Step7/CMakeLists.txt
index 17e6a60..a1efa77 100644
--- a/Help/guide/tutorial/Step7/CMakeLists.txt
+++ b/Help/guide/tutorial/Step7/CMakeLists.txt
@@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.3)
project(Tutorial)
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED True)
# set the version number
set(Tutorial_VERSION_MAJOR 1)
diff --git a/Help/guide/tutorial/Step8/CMakeLists.txt b/Help/guide/tutorial/Step8/CMakeLists.txt
index 86725e8..a0316a0 100644
--- a/Help/guide/tutorial/Step8/CMakeLists.txt
+++ b/Help/guide/tutorial/Step8/CMakeLists.txt
@@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.3)
project(Tutorial)
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED True)
# set the version number
set(Tutorial_VERSION_MAJOR 1)
diff --git a/Help/guide/tutorial/Step9/CMakeLists.txt b/Help/guide/tutorial/Step9/CMakeLists.txt
index 07ab90a..e610b99 100644
--- a/Help/guide/tutorial/Step9/CMakeLists.txt
+++ b/Help/guide/tutorial/Step9/CMakeLists.txt
@@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.3)
project(Tutorial)
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED True)
# set the version number
set(Tutorial_VERSION_MAJOR 1)
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index ae4be3e..62d23c7 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -228,6 +228,7 @@ Properties on Targets
/prop_tgt/IMPORT_SUFFIX
/prop_tgt/INCLUDE_DIRECTORIES
/prop_tgt/INSTALL_NAME_DIR
+ /prop_tgt/INSTALL_REMOVE_ENVIRONMENT_RPATH
/prop_tgt/INSTALL_RPATH
/prop_tgt/INSTALL_RPATH_USE_LINK_PATH
/prop_tgt/INTERFACE_AUTOUIC_OPTIONS
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index c3f6f8a..432d7fc 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -372,6 +372,7 @@ Variables that Control the Build
/variable/CMAKE_INCLUDE_CURRENT_DIR
/variable/CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE
/variable/CMAKE_INSTALL_NAME_DIR
+ /variable/CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH
/variable/CMAKE_INSTALL_RPATH
/variable/CMAKE_INSTALL_RPATH_USE_LINK_PATH
/variable/CMAKE_INTERPROCEDURAL_OPTIMIZATION
diff --git a/Help/prop_tgt/INSTALL_REMOVE_ENVIRONMENT_RPATH.rst b/Help/prop_tgt/INSTALL_REMOVE_ENVIRONMENT_RPATH.rst
new file mode 100644
index 0000000..a474fc6
--- /dev/null
+++ b/Help/prop_tgt/INSTALL_REMOVE_ENVIRONMENT_RPATH.rst
@@ -0,0 +1,10 @@
+INSTALL_REMOVE_ENVIRONMENT_RPATH
+--------------------------------
+
+Removes compiler defined rpaths durimg installation.
+
+``INSTALL_REMOVE_ENVIRONMENT_RPATH`` is a boolean that if set to ``True`` will
+remove compiler defined rpaths from the project if the user also defines rpath
+with :prop_tgt:`INSTALL_RPATH`. This property is initialized by whether the
+value of :variable:`CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH` is set when a
+target is created.
diff --git a/Help/release/3.15.rst b/Help/release/3.15.rst
index 2cff419..4f53466 100644
--- a/Help/release/3.15.rst
+++ b/Help/release/3.15.rst
@@ -345,3 +345,20 @@ Other Changes
* The :command:`file(REMOVE)` and :command:`file(REMOVE_RECURSE)` commands
were changed to ignore empty arguments with a warning instead of treating
them as a relative path and removing the contents of the current directory.
+
+Updates
+=======
+
+Changes made since CMake 3.15.0 include the following.
+
+3.15.1
+------
+
+* In CMake 3.15.0 support for the GNU-like ``Clang`` compiler targeting the
+ MSVC ABI implemented :variable:`CMAKE_CXX_STANDARD` values 98 and 11 using
+ the corresponding ``-std=`` flags. However, these modes do not work with
+ the MSVC standard library. Therefore CMake 3.15.1 passes C++14 standard
+ flags even for C++98 and C++11. This is consistent with MSVC itself which
+ always runs in a mode aware of C++14.
+
+* Preliminary Swift support added in 3.15.0 has been updated.
diff --git a/Help/release/dev/add-install-remove-environment-rpath.rst b/Help/release/dev/add-install-remove-environment-rpath.rst
new file mode 100644
index 0000000..156106c
--- /dev/null
+++ b/Help/release/dev/add-install-remove-environment-rpath.rst
@@ -0,0 +1,6 @@
+add-install-remove-environment-rpath
+------------------------------------
+
+* A new target property, :prop_tgt:`INSTALL_REMOVE_ENVIRONMENT_RPATH`, was
+ added which removes compiler-defined rpaths from a target. This property is
+ initialized by :variable:`CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH`.
diff --git a/Help/release/dev/global-controls-over-find-locations.rst b/Help/release/dev/global-controls-over-find-locations.rst
index 79bc869..1c0b226 100644
--- a/Help/release/dev/global-controls-over-find-locations.rst
+++ b/Help/release/dev/global-controls-over-find-locations.rst
@@ -2,8 +2,8 @@ global-controls-over-find-locations
-----------------------------------
* The :command:`find_file`, :command:`find_library`, :command:`find_path`,
- and :command:`find_program` commands have learned to check the following
- variables to control searching
+ :command:`find_package`, and :command:`find_program` commands have learned to
+ check the following variables to control searching
* :variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH` - Controls the searching
the cmake-specific environment variables.
diff --git a/Help/variable/CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH.rst b/Help/variable/CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH.rst
index 33514a0..2db5081 100644
--- a/Help/variable/CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH.rst
+++ b/Help/variable/CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH.rst
@@ -3,7 +3,7 @@ CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH
Controls the searching the cmake-specific environment variables by the
:command:`find_program`, :command:`find_library`, :command:`find_file`,
-and :command:`find_path` commands.
+:command:`find_path`, and command:`find_package` commands.
This is useful in cross-compiling environments.
By default this variable is not set, which is equivalent to it having
diff --git a/Help/variable/CMAKE_FIND_USE_CMAKE_PATH.rst b/Help/variable/CMAKE_FIND_USE_CMAKE_PATH.rst
index cefc645..4ca7ad1 100644
--- a/Help/variable/CMAKE_FIND_USE_CMAKE_PATH.rst
+++ b/Help/variable/CMAKE_FIND_USE_CMAKE_PATH.rst
@@ -3,7 +3,7 @@ CMAKE_FIND_USE_CMAKE_PATH
Controls the searching the cmake-specific cache variables by the
:command:`find_program`, :command:`find_library`, :command:`find_file`,
-and :command:`find_path` commands.
+:command:`find_path`, and command:`find_package` commands.
This is useful in cross-compiling environments.
By default this variable is not set, which is equivalent to it having
diff --git a/Help/variable/CMAKE_FIND_USE_CMAKE_SYSTEM_PATH.rst b/Help/variable/CMAKE_FIND_USE_CMAKE_SYSTEM_PATH.rst
index 2aa544d..d3259ae 100644
--- a/Help/variable/CMAKE_FIND_USE_CMAKE_SYSTEM_PATH.rst
+++ b/Help/variable/CMAKE_FIND_USE_CMAKE_SYSTEM_PATH.rst
@@ -3,7 +3,7 @@ CMAKE_FIND_USE_CMAKE_SYSTEM_PATH
Controls the searching cmake platform specific variables by the
:command:`find_program`, :command:`find_library`, :command:`find_file`,
-and :command:`find_path` commands.
+:command:`find_path`, and command:`find_package` commands.
This is useful in cross-compiling environments.
By default this variable is not set, which is equivalent to it having
diff --git a/Help/variable/CMAKE_FIND_USE_PACKAGE_ROOT_PATH.rst b/Help/variable/CMAKE_FIND_USE_PACKAGE_ROOT_PATH.rst
index 899e62e..e17fdcc 100644
--- a/Help/variable/CMAKE_FIND_USE_PACKAGE_ROOT_PATH.rst
+++ b/Help/variable/CMAKE_FIND_USE_PACKAGE_ROOT_PATH.rst
@@ -3,7 +3,7 @@ CMAKE_FIND_USE_PACKAGE_ROOT_PATH
Controls the searching of :variable:`<PackageName>_ROOT` variables by the
:command:`find_program`, :command:`find_library`, :command:`find_file`,
-and :command:`find_path` commands.
+:command:`find_path`, and command:`find_package` commands.
This is useful in cross-compiling environments.
By default this variable is not set, which is equivalent to it having
diff --git a/Help/variable/CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH.rst b/Help/variable/CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH.rst
index 604c710..71432f6 100644
--- a/Help/variable/CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH.rst
+++ b/Help/variable/CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH.rst
@@ -3,7 +3,7 @@ CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH
Controls the searching the standard system environment variables by the
:command:`find_program`, :command:`find_library`, :command:`find_file`,
-and :command:`find_path` commands.
+:command:`find_path`, and command:`find_package` commands.
This is useful in cross-compiling environments.
By default this variable is not set, which is equivalent to it having
diff --git a/Help/variable/CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH.rst b/Help/variable/CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH.rst
new file mode 100644
index 0000000..19ae5f3
--- /dev/null
+++ b/Help/variable/CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH.rst
@@ -0,0 +1,9 @@
+CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH
+--------------------------------------
+
+Removes compiler defined rpaths durimg installation.
+
+``CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH`` is a boolean that if set to ``true``
+removes compiler defined rpaths from the project if the user also defines rpath
+with :prop_tgt:`INSTALL_RPATH`. This is used to initialize the target property
+:prop_tgt:`INSTALL_REMOVE_ENVIRONMENT_RPATH` for all targets.
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 17f3917..61709f8 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -58,6 +58,13 @@ if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
unset(_clang_version_std17)
if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+ # The MSVC standard library requires C++14, and MSVC itself has no
+ # notion of operating in a mode not aware of at least that standard.
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++14")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++14")
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++14")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++14")
+
# This clang++ is missing some features because of MSVC compatibility.
unset(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT)
unset(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT)
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 2ff6afe..a79758f 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -1147,9 +1147,7 @@ macro(_MPI_create_imported_target LANG)
set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}")
if(MPI_${LANG}_LINK_FLAGS)
- separate_arguments(_MPI_${LANG}_LINK_FLAGS NATIVE_COMMAND "${MPI_${LANG}_LINK_FLAGS}")
- set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_OPTIONS "${_MPI_${LANG}_LINK_FLAGS}")
- unset(_MPI_${LANG}_LINK_FLAGS)
+ set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_OPTIONS "SHELL:${MPI_${LANG}_LINK_FLAGS}")
endif()
# If the compiler links MPI implicitly, no libraries will be found as they're contained within
# CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES already.
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 5833058..942ead0 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 15)
-set(CMake_VERSION_PATCH 20190723)
-#set(CMake_VERSION_RC 1)
+set(CMake_VERSION_PATCH 20190726)
+set(CMake_VERSION_RC 0)
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 350ebed..512ac7a 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -759,7 +759,7 @@ int cmCPackGenerator::InstallCMakeProject(
if (this->GetOption("CPACK_INSTALL_PREFIX")) {
dir += this->GetOption("CPACK_INSTALL_PREFIX");
}
- mf.AddDefinition("CMAKE_INSTALL_PREFIX", dir.c_str());
+ mf.AddDefinition("CMAKE_INSTALL_PREFIX", dir);
cmCPackLogger(
cmCPackLog::LOG_DEBUG,
@@ -799,7 +799,7 @@ int cmCPackGenerator::InstallCMakeProject(
return 0;
}
} else {
- mf.AddDefinition("CMAKE_INSTALL_PREFIX", tempInstallDirectory.c_str());
+ mf.AddDefinition("CMAKE_INSTALL_PREFIX", tempInstallDirectory);
if (!cmsys::SystemTools::MakeDirectory(tempInstallDirectory,
default_dir_mode)) {
@@ -818,11 +818,11 @@ int cmCPackGenerator::InstallCMakeProject(
}
if (!buildConfig.empty()) {
- mf.AddDefinition("BUILD_TYPE", buildConfig.c_str());
+ mf.AddDefinition("BUILD_TYPE", buildConfig);
}
std::string installComponentLowerCase = cmSystemTools::LowerCase(component);
if (installComponentLowerCase != "all") {
- mf.AddDefinition("CMAKE_INSTALL_COMPONENT", component.c_str());
+ mf.AddDefinition("CMAKE_INSTALL_COMPONENT", component);
}
// strip on TRUE, ON, 1, one or several file names, but not on
@@ -863,9 +863,8 @@ int cmCPackGenerator::InstallCMakeProject(
// forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES
// to CPack (may be used by generators like CPack RPM or DEB)
// in order to transparently handle ABSOLUTE PATH
- if (mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")) {
- mf.AddDefinition("CPACK_ABSOLUTE_DESTINATION_FILES",
- mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES"));
+ if (const char* def = mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")) {
+ mf.AddDefinition("CPACK_ABSOLUTE_DESTINATION_FILES", def);
}
// Now rebuild the list of files after installation
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index c6018cf..89c3b1c 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -270,7 +270,7 @@ int main(int argc, char const* const* argv)
}
if (!cpackBuildConfig.empty()) {
- globalMF.AddDefinition("CPACK_BUILD_CONFIG", cpackBuildConfig.c_str());
+ globalMF.AddDefinition("CPACK_BUILD_CONFIG", cpackBuildConfig);
}
if (cmSystemTools::FileExists(cpackConfigFile)) {
@@ -292,24 +292,21 @@ int main(int argc, char const* const* argv)
}
if (!generator.empty()) {
- globalMF.AddDefinition("CPACK_GENERATOR", generator.c_str());
+ globalMF.AddDefinition("CPACK_GENERATOR", generator);
}
if (!cpackProjectName.empty()) {
- globalMF.AddDefinition("CPACK_PACKAGE_NAME", cpackProjectName.c_str());
+ globalMF.AddDefinition("CPACK_PACKAGE_NAME", cpackProjectName);
}
if (!cpackProjectVersion.empty()) {
- globalMF.AddDefinition("CPACK_PACKAGE_VERSION",
- cpackProjectVersion.c_str());
+ globalMF.AddDefinition("CPACK_PACKAGE_VERSION", cpackProjectVersion);
}
if (!cpackProjectVendor.empty()) {
- globalMF.AddDefinition("CPACK_PACKAGE_VENDOR",
- cpackProjectVendor.c_str());
+ globalMF.AddDefinition("CPACK_PACKAGE_VENDOR", cpackProjectVendor);
}
// if this is not empty it has been set on the command line
// go for it. Command line override values set in config file.
if (!cpackProjectDirectory.empty()) {
- globalMF.AddDefinition("CPACK_PACKAGE_DIRECTORY",
- cpackProjectDirectory.c_str());
+ globalMF.AddDefinition("CPACK_PACKAGE_DIRECTORY", cpackProjectDirectory);
}
// The value has not been set on the command line
else {
@@ -318,11 +315,11 @@ int main(int argc, char const* const* argv)
// use default value iff no value has been provided by the config file
if (!globalMF.IsSet("CPACK_PACKAGE_DIRECTORY")) {
globalMF.AddDefinition("CPACK_PACKAGE_DIRECTORY",
- cpackProjectDirectory.c_str());
+ cpackProjectDirectory);
}
}
for (auto const& cd : definitions.Map) {
- globalMF.AddDefinition(cd.first, cd.second.c_str());
+ globalMF.AddDefinition(cd.first, cd.second);
}
const char* cpackModulesPath = globalMF.GetDefinition("CPACK_MODULE_PATH");
@@ -426,7 +423,7 @@ int main(int argc, char const* const* argv)
std::ostringstream ostr;
ostr << projVersionMajor << "." << projVersionMinor << "."
<< projVersionPatch;
- mf->AddDefinition("CPACK_PACKAGE_VERSION", ostr.str().c_str());
+ mf->AddDefinition("CPACK_PACKAGE_VERSION", ostr.str());
}
int res = cpackGenerator->DoPackage();
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx
index 2eacaf1..e71eafe 100644
--- a/Source/CTest/cmCTestBuildCommand.cxx
+++ b/Source/CTest/cmCTestBuildCommand.cxx
@@ -156,15 +156,14 @@ bool cmCTestBuildCommand::InitialPass(std::vector<std::string> const& args,
if (this->Values[ctb_NUMBER_ERRORS] && *this->Values[ctb_NUMBER_ERRORS]) {
std::ostringstream str;
str << this->Handler->GetTotalErrors();
- this->Makefile->AddDefinition(this->Values[ctb_NUMBER_ERRORS],
- str.str().c_str());
+ this->Makefile->AddDefinition(this->Values[ctb_NUMBER_ERRORS], str.str());
}
if (this->Values[ctb_NUMBER_WARNINGS] &&
*this->Values[ctb_NUMBER_WARNINGS]) {
std::ostringstream str;
str << this->Handler->GetTotalWarnings();
this->Makefile->AddDefinition(this->Values[ctb_NUMBER_WARNINGS],
- str.str().c_str());
+ str.str());
}
return ret;
}
diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx
index 2b73d40..8ceca08 100644
--- a/Source/CTest/cmCTestHandlerCommand.cxx
+++ b/Source/CTest/cmCTestHandlerCommand.cxx
@@ -112,17 +112,17 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
foundBadArgument = true;
}
}
- bool capureCMakeError = (this->Values[ct_CAPTURE_CMAKE_ERROR] &&
- *this->Values[ct_CAPTURE_CMAKE_ERROR]);
+ bool captureCMakeError = (this->Values[ct_CAPTURE_CMAKE_ERROR] &&
+ *this->Values[ct_CAPTURE_CMAKE_ERROR]);
// now that arguments are parsed check to see if there is a
// CAPTURE_CMAKE_ERROR specified let the errorState object know.
- if (capureCMakeError) {
+ if (captureCMakeError) {
errorState.CaptureCMakeError();
}
// if we found a bad argument then exit before running command
if (foundBadArgument) {
// store the cmake error
- if (capureCMakeError) {
+ if (captureCMakeError) {
this->Makefile->AddDefinition(this->Values[ct_CAPTURE_CMAKE_ERROR],
"-1");
std::string const err = this->GetName() + " " + status.GetError();
@@ -191,7 +191,7 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot instantiate test handler " << this->GetName()
<< std::endl);
- if (capureCMakeError) {
+ if (captureCMakeError) {
this->Makefile->AddDefinition(this->Values[ct_CAPTURE_CMAKE_ERROR],
"-1");
std::string const& err = status.GetError();
@@ -215,7 +215,7 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
this->SetError("failed to change directory to " +
this->CTest->GetCTestConfiguration("BuildDirectory") +
" : " + std::strerror(workdir.GetLastResult()));
- if (capureCMakeError) {
+ if (captureCMakeError) {
this->Makefile->AddDefinition(this->Values[ct_CAPTURE_CMAKE_ERROR],
"-1");
cmCTestLog(this->CTest, ERROR_MESSAGE,
@@ -230,12 +230,11 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
if (this->Values[ct_RETURN_VALUE] && *this->Values[ct_RETURN_VALUE]) {
std::ostringstream str;
str << res;
- this->Makefile->AddDefinition(this->Values[ct_RETURN_VALUE],
- str.str().c_str());
+ this->Makefile->AddDefinition(this->Values[ct_RETURN_VALUE], str.str());
}
this->ProcessAdditionalValues(handler);
// log the error message if there was an error
- if (capureCMakeError) {
+ if (captureCMakeError) {
const char* returnString = "0";
if (cmSystemTools::GetErrorOccuredFlag()) {
returnString = "-1";
diff --git a/Source/CTest/cmCTestMemCheckCommand.cxx b/Source/CTest/cmCTestMemCheckCommand.cxx
index 7dad1ce..d7d42bf 100644
--- a/Source/CTest/cmCTestMemCheckCommand.cxx
+++ b/Source/CTest/cmCTestMemCheckCommand.cxx
@@ -3,7 +3,6 @@
#include "cmCTestMemCheckCommand.h"
#include <sstream>
-#include <string>
#include <vector>
#include "cmCTest.h"
@@ -47,7 +46,6 @@ void cmCTestMemCheckCommand::ProcessAdditionalValues(
if (this->Values[ctm_DEFECT_COUNT] && *this->Values[ctm_DEFECT_COUNT]) {
std::ostringstream str;
str << static_cast<cmCTestMemCheckHandler*>(handler)->GetDefectCount();
- this->Makefile->AddDefinition(this->Values[ctm_DEFECT_COUNT],
- str.str().c_str());
+ this->Makefile->AddDefinition(this->Values[ctm_DEFECT_COUNT], str.str());
}
}
diff --git a/Source/CTest/cmCTestRunScriptCommand.cxx b/Source/CTest/cmCTestRunScriptCommand.cxx
index a7e47d3..c03cffd 100644
--- a/Source/CTest/cmCTestRunScriptCommand.cxx
+++ b/Source/CTest/cmCTestRunScriptCommand.cxx
@@ -43,7 +43,7 @@ bool cmCTestRunScriptCommand::InitialPass(std::vector<std::string> const& args,
args[i].c_str(), !np, &ret);
std::ostringstream str;
str << ret;
- this->Makefile->AddDefinition(returnVariable, str.str().c_str());
+ this->Makefile->AddDefinition(returnVariable, str.str());
}
}
return true;
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 85040dd..7a5b8d1 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -168,7 +168,7 @@ void cmCTestScriptHandler::UpdateElapsedTime()
auto itime = cmDurationTo<unsigned int>(std::chrono::steady_clock::now() -
this->ScriptStartTime);
auto timeString = std::to_string(itime);
- this->Makefile->AddDefinition("CTEST_ELAPSED_TIME", timeString.c_str());
+ this->Makefile->AddDefinition("CTEST_ELAPSED_TIME", timeString);
}
}
@@ -352,21 +352,21 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
this->CreateCMake();
// set a variable with the path to the current script
- this->Makefile->AddDefinition(
- "CTEST_SCRIPT_DIRECTORY", cmSystemTools::GetFilenamePath(script).c_str());
- this->Makefile->AddDefinition(
- "CTEST_SCRIPT_NAME", cmSystemTools::GetFilenameName(script).c_str());
+ this->Makefile->AddDefinition("CTEST_SCRIPT_DIRECTORY",
+ cmSystemTools::GetFilenamePath(script));
+ this->Makefile->AddDefinition("CTEST_SCRIPT_NAME",
+ cmSystemTools::GetFilenameName(script));
this->Makefile->AddDefinition("CTEST_EXECUTABLE_NAME",
- cmSystemTools::GetCTestCommand().c_str());
+ cmSystemTools::GetCTestCommand());
this->Makefile->AddDefinition("CMAKE_EXECUTABLE_NAME",
- cmSystemTools::GetCMakeCommand().c_str());
- this->Makefile->AddDefinition("CTEST_RUN_CURRENT_SCRIPT", true);
+ cmSystemTools::GetCMakeCommand());
+ this->Makefile->AddDefinitionBool("CTEST_RUN_CURRENT_SCRIPT", true);
this->SetRunCurrentScript(true);
this->UpdateElapsedTime();
// add the script arg if defined
if (!script_arg.empty()) {
- this->Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg.c_str());
+ this->Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg);
}
#if defined(__CYGWIN__)
@@ -398,7 +398,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
const std::map<std::string, std::string>& defs =
this->CTest->GetDefinitions();
for (auto const& d : defs) {
- this->Makefile->AddDefinition(d.first, d.second.c_str());
+ this->Makefile->AddDefinition(d.first, d.second);
}
// finally read in the script
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index bf43d88..58c0a1b 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -143,7 +143,7 @@ bool cmCTestSubmitCommand::InitialPass(std::vector<std::string> const& args,
if (this->Values[cts_BUILD_ID] && *this->Values[cts_BUILD_ID]) {
this->Makefile->AddDefinition(this->Values[cts_BUILD_ID],
- this->CTest->GetBuildID().c_str());
+ this->CTest->GetBuildID());
}
return ret;
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index cfbdad0..5134407 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -1714,8 +1714,7 @@ void cmCTestTestHandler::GetListOfTests()
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm);
cmMakefile mf(&gg, cm.GetCurrentSnapshot());
- mf.AddDefinition("CTEST_CONFIGURATION_TYPE",
- this->CTest->GetConfigType().c_str());
+ mf.AddDefinition("CTEST_CONFIGURATION_TYPE", this->CTest->GetConfigType());
// Add handler for ADD_TEST
auto newCom1 = cm::make_unique<cmCTestAddTestCommand>();
diff --git a/Source/LexerParser/cmExprParser.cxx b/Source/LexerParser/cmExprParser.cxx
index d2c65dc..8416e72 100644
--- a/Source/LexerParser/cmExprParser.cxx
+++ b/Source/LexerParser/cmExprParser.cxx
@@ -425,18 +425,18 @@ union yyalloc
#endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 17
+#define YYFINAL 19
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 30
+#define YYLAST 34
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 17
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 10
/* YYNRULES -- Number of rules. */
-#define YYNRULES 23
+#define YYNRULES 24
/* YYNSTATES -- Number of states. */
-#define YYNSTATES 39
+#define YYNSTATES 41
#define YYUNDEFTOK 2
#define YYMAXUTOK 271
@@ -486,7 +486,7 @@ static const yytype_uint8 yyrline[] =
{
0, 77, 77, 82, 85, 90, 93, 98, 101, 106,
109, 112, 117, 120, 123, 128, 131, 134, 140, 145,
- 148, 151, 156, 159
+ 148, 151, 154, 159, 162
};
#endif
@@ -513,10 +513,10 @@ static const yytype_uint16 yytoknum[] =
};
# endif
-#define YYPACT_NINF -8
+#define YYPACT_NINF -11
#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-8)))
+ (!!((Yystate) == (-11)))
#define YYTABLE_NINF -1
@@ -527,10 +527,11 @@ static const yytype_uint16 yytoknum[] =
STATE-NUM. */
static const yytype_int8 yypact[] =
{
- 0, 0, 0, 0, -8, 2, -7, -5, 8, 3,
- 10, 1, -8, -8, -8, -8, 6, -8, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, -8, -5,
- 8, 3, 10, 10, 1, 1, -8, -8, -8
+ 1, 1, 1, 1, 1, -11, 6, -10, -4, 9,
+ 4, 11, 2, -11, -11, -11, -11, 7, -11, -11,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ -11, -4, 9, 4, 11, 11, 2, 2, -11, -11,
+ -11
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@@ -538,22 +539,23 @@ static const yytype_int8 yypact[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 0, 0, 0, 22, 0, 2, 3, 5, 7,
- 9, 12, 15, 19, 20, 21, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 23, 4,
- 6, 8, 10, 11, 13, 14, 16, 17, 18
+ 0, 0, 0, 0, 0, 23, 0, 2, 3, 5,
+ 7, 9, 12, 15, 19, 20, 21, 0, 22, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 24, 4, 6, 8, 10, 11, 13, 14, 16, 17,
+ 18
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -8, -8, 12, 5, 11, 9, -2, 4, -1, -8
+ -11, -11, 22, 10, 8, 12, -3, -2, -1, -11
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 5, 6, 7, 8, 9, 10, 11, 12, 13
+ -1, 6, 7, 8, 9, 10, 11, 12, 13, 14
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@@ -561,28 +563,29 @@ static const yytype_int8 yydefgoto[] =
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_uint8 yytable[] =
{
- 14, 15, 17, 1, 2, 18, 25, 26, 27, 19,
- 3, 21, 22, 23, 24, 16, 4, 28, 18, 32,
- 33, 20, 0, 29, 36, 37, 38, 34, 35, 31,
- 30
+ 15, 16, 20, 18, 1, 2, 19, 27, 28, 29,
+ 21, 3, 23, 24, 25, 26, 4, 5, 30, 20,
+ 34, 35, 22, 36, 37, 17, 38, 39, 40, 32,
+ 31, 0, 0, 0, 33
};
static const yytype_int8 yycheck[] =
{
- 1, 2, 0, 3, 4, 12, 5, 6, 7, 14,
- 10, 8, 9, 3, 4, 3, 16, 11, 12, 21,
- 22, 13, -1, 18, 25, 26, 27, 23, 24, 20,
- 19
+ 1, 2, 12, 4, 3, 4, 0, 5, 6, 7,
+ 14, 10, 8, 9, 3, 4, 15, 16, 11, 12,
+ 23, 24, 13, 25, 26, 3, 27, 28, 29, 21,
+ 20, -1, -1, -1, 22
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 3, 4, 10, 16, 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 25, 25, 19, 0, 12, 14,
- 13, 8, 9, 3, 4, 5, 6, 7, 11, 20,
- 21, 22, 23, 23, 24, 24, 25, 25, 25
+ 0, 3, 4, 10, 15, 16, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 25, 25, 19, 25, 0,
+ 12, 14, 13, 8, 9, 3, 4, 5, 6, 7,
+ 11, 20, 21, 22, 23, 23, 24, 24, 25, 25,
+ 25
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
@@ -590,7 +593,7 @@ static const yytype_uint8 yyr1[] =
{
0, 17, 18, 19, 19, 20, 20, 21, 21, 22,
22, 22, 23, 23, 23, 24, 24, 24, 24, 25,
- 25, 25, 26, 26
+ 25, 25, 25, 26, 26
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
@@ -598,7 +601,7 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 1, 1, 3, 1, 3, 1, 3, 1,
3, 3, 1, 3, 3, 1, 3, 3, 3, 1,
- 2, 2, 1, 3
+ 2, 2, 2, 1, 3
};
@@ -1294,7 +1297,7 @@ yyreduce:
{
cmExpr_yyget_extra(yyscanner)->SetResult((yyvsp[0].Number));
}
-#line 1298 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1301 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 3:
@@ -1302,7 +1305,7 @@ yyreduce:
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1306 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1309 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 4:
@@ -1310,7 +1313,7 @@ yyreduce:
{
(yyval.Number) = (yyvsp[-2].Number) | (yyvsp[0].Number);
}
-#line 1314 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1317 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 5:
@@ -1318,7 +1321,7 @@ yyreduce:
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1322 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1325 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 6:
@@ -1326,7 +1329,7 @@ yyreduce:
{
(yyval.Number) = (yyvsp[-2].Number) ^ (yyvsp[0].Number);
}
-#line 1330 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1333 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 7:
@@ -1334,7 +1337,7 @@ yyreduce:
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1338 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1341 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 8:
@@ -1342,7 +1345,7 @@ yyreduce:
{
(yyval.Number) = (yyvsp[-2].Number) & (yyvsp[0].Number);
}
-#line 1346 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1349 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 9:
@@ -1350,7 +1353,7 @@ yyreduce:
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1354 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1357 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 10:
@@ -1358,7 +1361,7 @@ yyreduce:
{
(yyval.Number) = (yyvsp[-2].Number) << (yyvsp[0].Number);
}
-#line 1362 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1365 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 11:
@@ -1366,7 +1369,7 @@ yyreduce:
{
(yyval.Number) = (yyvsp[-2].Number) >> (yyvsp[0].Number);
}
-#line 1370 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1373 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 12:
@@ -1374,7 +1377,7 @@ yyreduce:
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1378 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1381 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 13:
@@ -1382,7 +1385,7 @@ yyreduce:
{
(yyval.Number) = (yyvsp[-2].Number) + (yyvsp[0].Number);
}
-#line 1386 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1389 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 14:
@@ -1390,7 +1393,7 @@ yyreduce:
{
(yyval.Number) = (yyvsp[-2].Number) - (yyvsp[0].Number);
}
-#line 1394 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1397 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 15:
@@ -1398,7 +1401,7 @@ yyreduce:
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1402 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1405 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 16:
@@ -1406,7 +1409,7 @@ yyreduce:
{
(yyval.Number) = (yyvsp[-2].Number) * (yyvsp[0].Number);
}
-#line 1410 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1413 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 17:
@@ -1417,7 +1420,7 @@ yyreduce:
}
(yyval.Number) = (yyvsp[-2].Number) / (yyvsp[0].Number);
}
-#line 1421 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1424 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 18:
@@ -1425,7 +1428,7 @@ yyreduce:
{
(yyval.Number) = (yyvsp[-2].Number) % (yyvsp[0].Number);
}
-#line 1429 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1432 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 19:
@@ -1433,7 +1436,7 @@ yyreduce:
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1437 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1440 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 20:
@@ -1441,7 +1444,7 @@ yyreduce:
{
(yyval.Number) = + (yyvsp[0].Number);
}
-#line 1445 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1448 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 21:
@@ -1449,27 +1452,35 @@ yyreduce:
{
(yyval.Number) = - (yyvsp[0].Number);
}
-#line 1453 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1456 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 22:
-#line 156 "cmExprParser.y" /* yacc.c:1652 */
+#line 154 "cmExprParser.y" /* yacc.c:1652 */
{
- (yyval.Number) = (yyvsp[0].Number);
+ (yyval.Number) = ~ (yyvsp[0].Number);
}
-#line 1461 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1464 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 23:
#line 159 "cmExprParser.y" /* yacc.c:1652 */
{
+ (yyval.Number) = (yyvsp[0].Number);
+ }
+#line 1472 "cmExprParser.cxx" /* yacc.c:1652 */
+ break;
+
+ case 24:
+#line 162 "cmExprParser.y" /* yacc.c:1652 */
+ {
(yyval.Number) = (yyvsp[-1].Number);
}
-#line 1469 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1480 "cmExprParser.cxx" /* yacc.c:1652 */
break;
-#line 1473 "cmExprParser.cxx" /* yacc.c:1652 */
+#line 1484 "cmExprParser.cxx" /* yacc.c:1652 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -1702,7 +1713,7 @@ yyreturn:
#endif
return yyresult;
}
-#line 164 "cmExprParser.y" /* yacc.c:1918 */
+#line 167 "cmExprParser.y" /* yacc.c:1918 */
/* End of grammar */
diff --git a/Source/LexerParser/cmExprParser.y b/Source/LexerParser/cmExprParser.y
index 2137473..7ae2118 100644
--- a/Source/LexerParser/cmExprParser.y
+++ b/Source/LexerParser/cmExprParser.y
@@ -151,6 +151,9 @@ unary:
| exp_MINUS unary {
$<Number>$ = - $<Number>2;
}
+| exp_NOT unary {
+ $<Number>$ = ~ $<Number>2;
+ }
factor:
exp_NUMBER {
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index b4b480b..cf71052 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -19,44 +19,6 @@
#include <utility>
#include <vector>
-inline bool cmHasLiteralPrefixImpl(const std::string& str1, const char* str2,
- size_t N)
-{
- return strncmp(str1.c_str(), str2, N) == 0;
-}
-
-inline bool cmHasLiteralPrefixImpl(const char* str1, const char* str2,
- size_t N)
-{
- return strncmp(str1, str2, N) == 0;
-}
-
-inline bool cmHasLiteralSuffixImpl(const std::string& str1, const char* str2,
- size_t N)
-{
- size_t len = str1.size();
- return len >= N && strcmp(str1.c_str() + len - N, str2) == 0;
-}
-
-inline bool cmHasLiteralSuffixImpl(const char* str1, const char* str2,
- size_t N)
-{
- size_t len = strlen(str1);
- return len >= N && strcmp(str1 + len - N, str2) == 0;
-}
-
-template <typename T, size_t N>
-bool cmHasLiteralPrefix(const T& str1, const char (&str2)[N])
-{
- return cmHasLiteralPrefixImpl(str1, str2, N - 1);
-}
-
-template <typename T, size_t N>
-bool cmHasLiteralSuffix(const T& str1, const char (&str2)[N])
-{
- return cmHasLiteralSuffixImpl(str1, str2, N - 1);
-}
-
struct cmStrCmp
{
cmStrCmp(const char* test)
@@ -327,6 +289,13 @@ inline bool cmHasPrefix(cm::string_view str, cm::string_view prefix)
return str.compare(0, prefix.size(), prefix) == 0;
}
+/** Returns true if string @a str starts with string @a prefix. **/
+template <size_t N>
+inline bool cmHasLiteralPrefix(cm::string_view str, const char (&prefix)[N])
+{
+ return cmHasPrefix(str, cm::string_view(prefix, N - 1));
+}
+
/** Returns true if string @a str ends with the character @a suffix. **/
inline bool cmHasSuffix(cm::string_view str, char suffix)
{
@@ -340,6 +309,13 @@ inline bool cmHasSuffix(cm::string_view str, cm::string_view suffix)
str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0;
}
+/** Returns true if string @a str ends with string @a suffix. **/
+template <size_t N>
+inline bool cmHasLiteralSuffix(cm::string_view str, const char (&suffix)[N])
+{
+ return cmHasSuffix(str, cm::string_view(suffix, N - 1));
+}
+
/** Removes an existing suffix character of from the string @a str. **/
inline void cmStripSuffixIfExists(std::string& str, char suffix)
{
diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx
index 106e7a7..c1a6e7f 100644
--- a/Source/cmAuxSourceDirectoryCommand.cxx
+++ b/Source/cmAuxSourceDirectoryCommand.cxx
@@ -74,6 +74,6 @@ bool cmAuxSourceDirectoryCommand::InitialPass(
sourceListValue += ";";
}
sourceListValue += cmJoin(files, ";");
- this->Makefile->AddDefinition(args[1], sourceListValue.c_str());
+ this->Makefile->AddDefinition(args[1], sourceListValue);
return true;
}
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index 428a0b2..e9e1d49 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -92,7 +92,7 @@ bool cmBuildCommand::MainSignature(std::vector<std::string> const& args)
this->Makefile->GetGlobalGenerator()->GenerateCMakeBuildCommand(
target, configuration, "", this->Makefile->IgnoreErrorsCMP0061());
- this->Makefile->AddDefinition(variable, makecommand.c_str());
+ this->Makefile->AddDefinition(variable, makecommand);
return true;
}
diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx
index 54f08bb..b4cd2a5 100644
--- a/Source/cmCMakeHostSystemInformationCommand.cxx
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -55,7 +55,7 @@ bool cmCMakeHostSystemInformationCommand::InitialPass(
result_list += value;
}
- this->Makefile->AddDefinition(variable, result_list.c_str());
+ this->Makefile->AddDefinition(variable, result_list);
return true;
}
diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx
index 4b4bca2..f2eae38 100644
--- a/Source/cmCMakeMinimumRequired.cxx
+++ b/Source/cmCMakeMinimumRequired.cxx
@@ -61,8 +61,7 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector<std::string> const& args,
}
// Save the required version string.
- this->Makefile->AddDefinition("CMAKE_MINIMUM_REQUIRED_VERSION",
- version_min.c_str());
+ this->Makefile->AddDefinition("CMAKE_MINIMUM_REQUIRED_VERSION", version_min);
// Get the current version number.
unsigned int current_major = cmVersion::GetMajorVersion();
diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx
index 8da5ef7..ce046fc 100644
--- a/Source/cmCMakePolicyCommand.cxx
+++ b/Source/cmCMakePolicyCommand.cxx
@@ -209,8 +209,7 @@ bool cmCMakePolicyCommand::HandleGetWarningMode(
}
// Lookup the policy warning.
- this->Makefile->AddDefinition(var,
- cmPolicies::GetPolicyWarning(pid).c_str());
+ this->Makefile->AddDefinition(var, cmPolicies::GetPolicyWarning(pid));
return true;
}
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index 8c2d987..80ca898 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -65,8 +65,10 @@ unsigned int CCONV cmGetMinorVersion(void*)
void CCONV cmAddDefinition(void* arg, const char* name, const char* value)
{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- mf->AddDefinition(name, value);
+ if (value) {
+ cmMakefile* mf = static_cast<cmMakefile*>(arg);
+ mf->AddDefinition(name, value);
+ }
}
/* Add a definition to this makefile and the global cmake cache. */
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index f12ef0b..d780af6 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -932,7 +932,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
cmStateEnums::INTERNAL);
if (!outputVariable.empty()) {
- this->Makefile->AddDefinition(outputVariable, output.c_str());
+ this->Makefile->AddDefinition(outputVariable, output);
}
if (this->SrcFileSignature) {
@@ -961,8 +961,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
}
if (!copyFileError.empty()) {
- this->Makefile->AddDefinition(copyFileError,
- copyFileErrorMessage.c_str());
+ this->Makefile->AddDefinition(copyFileError, copyFileErrorMessage);
}
}
return res;
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx
index b78493f..427db72 100644
--- a/Source/cmCreateTestSourceList.cxx
+++ b/Source/cmCreateTestSourceList.cxx
@@ -125,16 +125,15 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args,
}
if (!extraInclude.empty()) {
this->Makefile->AddDefinition("CMAKE_TESTDRIVER_EXTRA_INCLUDES",
- extraInclude.c_str());
+ extraInclude);
}
if (!function.empty()) {
- this->Makefile->AddDefinition("CMAKE_TESTDRIVER_ARGVC_FUNCTION",
- function.c_str());
+ this->Makefile->AddDefinition("CMAKE_TESTDRIVER_ARGVC_FUNCTION", function);
}
this->Makefile->AddDefinition("CMAKE_FORWARD_DECLARE_TESTS",
- forwardDeclareCode.c_str());
+ forwardDeclareCode);
this->Makefile->AddDefinition("CMAKE_FUNCTION_TABLE_ENTIRES",
- functionMapCode.c_str());
+ functionMapCode);
bool res = true;
if (!this->Makefile->ConfigureFile(configFile, driver, false, true, false)) {
res = false;
@@ -154,6 +153,6 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args,
sourceListValue += *i;
}
- this->Makefile->AddDefinition(sourceList, sourceListValue.c_str());
+ this->Makefile->AddDefinition(sourceList, sourceListValue);
return res;
}
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 5e8731a..758a69a 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -25,6 +25,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
, OldStyle(cc.GetEscapeOldStyle())
, MakeVars(cc.GetEscapeAllowMakeVars())
, GE(new cmGeneratorExpression(cc.GetBacktrace()))
+ , EmulatorsWithArguments(cc.GetCommandLines().size())
{
const cmCustomCommandLines& cmdlines = this->CC.GetCommandLines();
for (cmCustomCommandLine const& cmdline : cmdlines) {
@@ -107,7 +108,6 @@ void cmCustomCommandGenerator::FillEmulatorsWithArguments()
continue;
}
- this->EmulatorsWithArguments.emplace_back();
cmSystemTools::ExpandListArgument(emulator_property,
this->EmulatorsWithArguments[c]);
}
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index 894447c..42e70d6 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -13,10 +13,12 @@ cmDefinitions::Def const& cmDefinitions::GetInternal(const std::string& key,
StackIter end, bool raise)
{
assert(begin != end);
- MapType::iterator i = begin->Map.find(key);
- if (i != begin->Map.end()) {
- i->second.Used = true;
- return i->second;
+ {
+ MapType::iterator it = begin->Map.find(key);
+ if (it != begin->Map.end()) {
+ it->second.Used = true;
+ return it->second;
+ }
}
StackIter it = begin;
++it;
@@ -27,14 +29,14 @@ cmDefinitions::Def const& cmDefinitions::GetInternal(const std::string& key,
if (!raise) {
return def;
}
- return begin->Map.insert(MapType::value_type(key, def)).first->second;
+ return begin->Map.emplace(key, def).first->second;
}
const std::string* cmDefinitions::Get(const std::string& key, StackIter begin,
StackIter end)
{
Def const& def = cmDefinitions::GetInternal(key, begin, end, false);
- return def.Exists ? &def : nullptr;
+ return def.Exists ? &def.Value : nullptr;
}
void cmDefinitions::Raise(const std::string& key, StackIter begin,
@@ -47,19 +49,23 @@ bool cmDefinitions::HasKey(const std::string& key, StackIter begin,
StackIter end)
{
for (StackIter it = begin; it != end; ++it) {
- MapType::const_iterator i = it->Map.find(key);
- if (i != it->Map.end()) {
+ if (it->Map.find(key) != it->Map.end()) {
return true;
}
}
return false;
}
-void cmDefinitions::Set(const std::string& key, const char* value)
+void cmDefinitions::Set(const std::string& key, cm::string_view value)
{
this->Map[key] = Def(value);
}
+void cmDefinitions::Unset(const std::string& key)
+{
+ this->Map[key] = Def();
+}
+
std::vector<std::string> cmDefinitions::UnusedKeys() const
{
std::vector<std::string> keys;
@@ -97,8 +103,8 @@ cmDefinitions cmDefinitions::MakeClosure(StackIter begin, StackIter end)
std::vector<std::string> cmDefinitions::ClosureKeys(StackIter begin,
StackIter end)
{
- std::set<std::string> bound;
std::vector<std::string> defined;
+ std::set<std::string> bound;
for (StackIter it = begin; it != end; ++it) {
defined.reserve(defined.size() + it->Map.size());
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index 6c252be..4d8810a 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -5,12 +5,14 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include "cm_string_view.hxx"
+
+#include "cmLinkedTree.h"
+
#include <string>
#include <unordered_map>
#include <vector>
-#include "cmLinkedTree.h"
-
/** \class cmDefinitions
* \brief Store a scope of variable definitions for CMake language.
*
@@ -30,8 +32,11 @@ public:
static bool HasKey(const std::string& key, StackIter begin, StackIter end);
- /** Set (or unset if null) a value associated with a key. */
- void Set(const std::string& key, const char* value);
+ /** Set a value associated with a key. */
+ void Set(const std::string& key, cm::string_view value);
+
+ /** Unset a definition. */
+ void Unset(const std::string& key);
std::vector<std::string> UnusedKeys() const;
@@ -40,24 +45,17 @@ public:
static cmDefinitions MakeClosure(StackIter begin, StackIter end);
private:
- // String with existence boolean.
- struct Def : public std::string
+ /** String with existence boolean. */
+ struct Def
{
- private:
- typedef std::string std_string;
-
public:
Def() = default;
- Def(const char* v)
- : std_string(v ? v : "")
- , Exists(v ? true : false)
- {
- }
- Def(const std_string& v)
- : std_string(v)
+ Def(cm::string_view value)
+ : Value(value)
, Exists(true)
{
}
+ std::string Value;
bool Exists = false;
bool Used = false;
};
diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx
index 4b559e7..bc1d173 100644
--- a/Source/cmExecProgramCommand.cxx
+++ b/Source/cmExecProgramCommand.cxx
@@ -103,7 +103,7 @@ bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args,
}
std::string coutput = std::string(output, first, last - first + 1);
- this->Makefile->AddDefinition(output_variable, coutput.c_str());
+ this->Makefile->AddDefinition(output_variable, coutput);
}
if (!return_variable.empty()) {
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index 689fc20..8d91f43 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -332,7 +332,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
}
}
this->Makefile->AddDefinition(arguments.ResultsVariable,
- cmJoin(res, ";").c_str());
+ cmJoin(res, ";"));
} break;
case cmsysProcess_State_Exception:
this->Makefile->AddDefinition(arguments.ResultsVariable,
diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index 70800b4..b7a2b27 100644
--- a/Source/cmFLTKWrapUICommand.cxx
+++ b/Source/cmFLTKWrapUICommand.cxx
@@ -117,8 +117,9 @@ bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args,
}
sourceListValue += generatedSourcesClasses[classNum]->GetFullPath();
}
+
std::string const varName = target + "_FLTK_UI_SRCS";
- this->Makefile->AddDefinition(varName, sourceListValue.c_str());
+ this->Makefile->AddDefinition(varName, sourceListValue);
this->Makefile->AddFinalAction(
[target](cmMakefile& makefile) { FinalAction(makefile, target); });
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 9871f49..a8ee6a8 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -365,7 +365,7 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args)
}
}
}
- this->Makefile->AddDefinition(variable, output.c_str());
+ this->Makefile->AddDefinition(variable, output);
return true;
}
@@ -383,7 +383,7 @@ bool cmFileCommand::HandleHashCommand(std::vector<std::string> const& args)
if (hash) {
std::string out = hash->HashFile(args[1]);
if (!out.empty()) {
- this->Makefile->AddDefinition(args[2], out.c_str());
+ this->Makefile->AddDefinition(args[2], out);
return true;
}
std::ostringstream e;
@@ -751,7 +751,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
}
// Save the output in a makefile variable.
- this->Makefile->AddDefinition(outVar, output.c_str());
+ this->Makefile->AddDefinition(outVar, output);
return true;
}
@@ -938,7 +938,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
std::sort(files.begin(), files.end());
files.erase(std::unique(files.begin(), files.end()), files.end());
- this->Makefile->AddDefinition(variable, cmJoin(files, ";").c_str());
+ this->Makefile->AddDefinition(variable, cmJoin(files, ";"));
return true;
}
@@ -1071,6 +1071,7 @@ bool cmFileCommand::HandleRPathChangeCommand(
std::string file;
const char* oldRPath = nullptr;
const char* newRPath = nullptr;
+ bool removeEnvironmentRPath = false;
enum Doing
{
DoingNone,
@@ -1086,6 +1087,8 @@ bool cmFileCommand::HandleRPathChangeCommand(
doing = DoingNew;
} else if (args[i] == "FILE") {
doing = DoingFile;
+ } else if (args[i] == "INSTALL_REMOVE_ENVIRONMENT_RPATH") {
+ removeEnvironmentRPath = true;
} else if (doing == DoingFile) {
file = args[i];
doing = DoingNone;
@@ -1124,7 +1127,9 @@ bool cmFileCommand::HandleRPathChangeCommand(
cmFileTimes const ft(file);
std::string emsg;
bool changed;
- if (!cmSystemTools::ChangeRPath(file, oldRPath, newRPath, &emsg, &changed)) {
+
+ if (!cmSystemTools::ChangeRPath(file, oldRPath, newRPath,
+ removeEnvironmentRPath, &emsg, &changed)) {
std::ostringstream e;
/* clang-format off */
e << "RPATH_CHANGE could not write new RPATH:\n"
@@ -1298,14 +1303,14 @@ bool cmFileCommand::HandleReadElfCommand(std::vector<std::string> const& args)
if (cmELF::StringEntry const* se_rpath = elf.GetRPath()) {
std::string rpath(se_rpath->Value);
std::replace(rpath.begin(), rpath.end(), ':', ';');
- this->Makefile->AddDefinition(arguments.RPath, rpath.c_str());
+ this->Makefile->AddDefinition(arguments.RPath, rpath);
}
}
if (!arguments.RunPath.empty()) {
if (cmELF::StringEntry const* se_runpath = elf.GetRunPath()) {
std::string runpath(se_runpath->Value);
std::replace(runpath.begin(), runpath.end(), ':', ';');
- this->Makefile->AddDefinition(arguments.RunPath, runpath.c_str());
+ this->Makefile->AddDefinition(arguments.RunPath, runpath);
}
}
@@ -1316,7 +1321,7 @@ bool cmFileCommand::HandleReadElfCommand(std::vector<std::string> const& args)
this->SetError(error);
return false;
}
- this->Makefile->AddDefinition(arguments.Error, error.c_str());
+ this->Makefile->AddDefinition(arguments.Error, error);
return true;
#endif
}
@@ -1354,7 +1359,7 @@ bool cmFileCommand::HandleRelativePathCommand(
}
std::string res = cmSystemTools::RelativePath(directoryName, fileName);
- this->Makefile->AddDefinition(outVar, res.c_str());
+ this->Makefile->AddDefinition(outVar, res);
return true;
}
@@ -1460,7 +1465,7 @@ bool cmFileCommand::HandleCMakePathCommand(
std::string value = cmJoin(
cmMakeRange(path).transform(nativePath ? ToNativePath : ToCMakePath), ";");
- this->Makefile->AddDefinition(args[2], value.c_str());
+ this->Makefile->AddDefinition(args[2], value);
return true;
}
@@ -1800,7 +1805,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
if (!statusVar.empty()) {
std::ostringstream result;
result << 0 << ";\"" << msg;
- this->Makefile->AddDefinition(statusVar, result.str().c_str());
+ this->Makefile->AddDefinition(statusVar, result.str());
}
return true;
}
@@ -1949,7 +1954,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
std::ostringstream result;
result << static_cast<int>(res) << ";\"" << ::curl_easy_strerror(res)
<< "\"";
- this->Makefile->AddDefinition(statusVar, result.str().c_str());
+ this->Makefile->AddDefinition(statusVar, result.str());
}
::curl_global_cleanup();
@@ -1981,7 +1986,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
std::string status = "1;HASH mismatch: "
"expected: " +
expectedHash + " actual: " + actualHash;
- this->Makefile->AddDefinition(statusVar, status.c_str());
+ this->Makefile->AddDefinition(statusVar, status);
}
this->SetError(oss.str());
@@ -2236,7 +2241,7 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
std::ostringstream result;
result << static_cast<int>(res) << ";\"" << ::curl_easy_strerror(res)
<< "\"";
- this->Makefile->AddDefinition(statusVar, result.str().c_str());
+ this->Makefile->AddDefinition(statusVar, result.str());
}
::curl_global_cleanup();
@@ -2261,7 +2266,7 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
log += "\n";
}
- this->Makefile->AddDefinition(logVar, log.c_str());
+ this->Makefile->AddDefinition(logVar, log);
}
return true;
@@ -2479,7 +2484,7 @@ bool cmFileCommand::HandleLockCommand(std::vector<std::string> const& args)
}
if (!resultVariable.empty()) {
- this->Makefile->AddDefinition(resultVariable, result.c_str());
+ this->Makefile->AddDefinition(resultVariable, result);
}
return true;
@@ -2528,7 +2533,7 @@ bool cmFileCommand::HandleTimestampCommand(
cmTimestamp timestamp;
std::string result =
timestamp.FileModificationTime(filename.c_str(), formatString, utcFlag);
- this->Makefile->AddDefinition(outputVariable, result.c_str());
+ this->Makefile->AddDefinition(outputVariable, result);
return true;
}
@@ -2556,8 +2561,7 @@ bool cmFileCommand::HandleSizeCommand(std::vector<std::string> const& args)
}
this->Makefile->AddDefinition(
- outputVariable,
- std::to_string(cmSystemTools::FileLength(filename)).c_str());
+ outputVariable, std::to_string(cmSystemTools::FileLength(filename)));
return true;
}
@@ -2584,7 +2588,7 @@ bool cmFileCommand::HandleReadSymlinkCommand(
return false;
}
- this->Makefile->AddDefinition(outputVariable, result.c_str());
+ this->Makefile->AddDefinition(outputVariable, result);
return true;
}
@@ -2630,7 +2634,7 @@ bool cmFileCommand::HandleCreateLinkCommand(
if (fileName == newFileName) {
result = "CREATE_LINK cannot use same file and newfile";
if (!arguments.Result.empty()) {
- this->Makefile->AddDefinition(arguments.Result, result.c_str());
+ this->Makefile->AddDefinition(arguments.Result, result);
return true;
}
this->SetError(result);
@@ -2641,7 +2645,7 @@ bool cmFileCommand::HandleCreateLinkCommand(
if (!arguments.Symbolic && !cmSystemTools::FileExists(fileName)) {
result = "Cannot hard link \'" + fileName + "\' as it does not exist.";
if (!arguments.Result.empty()) {
- this->Makefile->AddDefinition(arguments.Result, result.c_str());
+ this->Makefile->AddDefinition(arguments.Result, result);
return true;
}
this->SetError(result);
@@ -2658,7 +2662,7 @@ bool cmFileCommand::HandleCreateLinkCommand(
<< cmSystemTools::GetLastSystemError() << "\n";
if (!arguments.Result.empty()) {
- this->Makefile->AddDefinition(arguments.Result, e.str().c_str());
+ this->Makefile->AddDefinition(arguments.Result, e.str());
return true;
}
this->SetError(e.str());
@@ -2693,7 +2697,7 @@ bool cmFileCommand::HandleCreateLinkCommand(
}
if (!arguments.Result.empty()) {
- this->Makefile->AddDefinition(arguments.Result, result.c_str());
+ this->Makefile->AddDefinition(arguments.Result, result);
}
return true;
@@ -2821,7 +2825,7 @@ bool cmFileCommand::HandleGetRuntimeDependenciesCommand(
std::string varName =
parsedArgs.ConflictingDependenciesPrefix + "_" + val.first;
std::string pathsStr = cmJoin(paths, ";");
- this->Makefile->AddDefinition(varName, pathsStr.c_str());
+ this->Makefile->AddDefinition(varName, pathsStr);
} else {
std::ostringstream e;
e << "Multiple conflicting paths found for " << val.first << ":";
@@ -2851,18 +2855,16 @@ bool cmFileCommand::HandleGetRuntimeDependenciesCommand(
if (!parsedArgs.ResolvedDependenciesVar.empty()) {
std::string val = cmJoin(deps, ";");
- this->Makefile->AddDefinition(parsedArgs.ResolvedDependenciesVar,
- val.c_str());
+ this->Makefile->AddDefinition(parsedArgs.ResolvedDependenciesVar, val);
}
if (!parsedArgs.UnresolvedDependenciesVar.empty()) {
std::string val = cmJoin(unresolvedDeps, ";");
- this->Makefile->AddDefinition(parsedArgs.UnresolvedDependenciesVar,
- val.c_str());
+ this->Makefile->AddDefinition(parsedArgs.UnresolvedDependenciesVar, val);
}
if (!parsedArgs.ConflictingDependenciesPrefix.empty()) {
std::string val = cmJoin(conflictingDeps, ";");
this->Makefile->AddDefinition(
- parsedArgs.ConflictingDependenciesPrefix + "_FILENAMES", val.c_str());
+ parsedArgs.ConflictingDependenciesPrefix + "_FILENAMES", val);
}
return true;
}
diff --git a/Source/cmFileInstaller.cxx b/Source/cmFileInstaller.cxx
index d4f76fd..9378439 100644
--- a/Source/cmFileInstaller.cxx
+++ b/Source/cmFileInstaller.cxx
@@ -38,7 +38,7 @@ cmFileInstaller::~cmFileInstaller()
{
// Save the updated install manifest.
this->Makefile->AddDefinition("CMAKE_INSTALL_MANIFEST_FILES",
- this->Manifest.c_str());
+ this->Manifest);
}
void cmFileInstaller::ManifestAppend(std::string const& file)
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index c6d599e..db3f4ef 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -225,6 +225,9 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
this->SortDirection = strcmp(sd, "ASC") == 0 ? Asc : Dec;
}
+ // Find what search path locations have been enabled/disable
+ this->SelectDefaultSearchModes();
+
// Find the current root path mode.
this->SelectDefaultRootPathMode();
@@ -675,7 +678,9 @@ void cmFindPackageCommand::AddFindDefinition(const std::string& var,
} else {
this->OriginalDefs[var].exists = false;
}
- this->Makefile->AddDefinition(var, val);
+ if (val) {
+ this->Makefile->AddDefinition(var, val);
+ }
}
void cmFindPackageCommand::RestoreFindDefinitions()
@@ -683,7 +688,7 @@ void cmFindPackageCommand::RestoreFindDefinitions()
for (auto const& i : this->OriginalDefs) {
OriginalDef const& od = i.second;
if (od.exists) {
- this->Makefile->AddDefinition(i.first, od.value.c_str());
+ this->Makefile->AddDefinition(i.first, od.value);
} else {
this->Makefile->RemoveDefinition(i.first);
}
@@ -957,7 +962,7 @@ bool cmFindPackageCommand::HandlePackageMode(
std::string fileVar = this->Name;
fileVar += "_CONFIG";
if (found) {
- this->Makefile->AddDefinition(fileVar, this->FileFound.c_str());
+ this->Makefile->AddDefinition(fileVar, this->FileFound);
} else {
this->Makefile->RemoveDefinition(fileVar);
}
@@ -979,11 +984,9 @@ bool cmFindPackageCommand::HandlePackageMode(
sep = ";";
}
- this->Makefile->AddDefinition(consideredConfigsVar,
- consideredConfigFiles.c_str());
+ this->Makefile->AddDefinition(consideredConfigsVar, consideredConfigFiles);
- this->Makefile->AddDefinition(consideredVersionsVar,
- consideredVersions.c_str());
+ this->Makefile->AddDefinition(consideredVersionsVar, consideredVersions);
return result;
}
@@ -1612,8 +1615,8 @@ bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file,
this->Makefile->RemoveDefinition("PACKAGE_VERSION_EXACT");
// Set the input variables.
- this->Makefile->AddDefinition("PACKAGE_FIND_NAME", this->Name.c_str());
- this->Makefile->AddDefinition("PACKAGE_FIND_VERSION", this->Version.c_str());
+ this->Makefile->AddDefinition("PACKAGE_FIND_NAME", this->Name);
+ this->Makefile->AddDefinition("PACKAGE_FIND_VERSION", this->Version);
char buf[64];
sprintf(buf, "%u", this->VersionMajor);
this->Makefile->AddDefinition("PACKAGE_FIND_VERSION_MAJOR", buf);
@@ -1690,7 +1693,7 @@ void cmFindPackageCommand::StoreVersionFound()
if (this->VersionFound.empty()) {
this->Makefile->RemoveDefinition(ver);
} else {
- this->Makefile->AddDefinition(ver, this->VersionFound.c_str());
+ this->Makefile->AddDefinition(ver, this->VersionFound);
}
// Store the version components.
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index e3918b5..06dce2c 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -53,7 +53,7 @@ bool cmForEachFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
for (std::string const& arg : cmMakeRange(this->Args).advance(1)) {
// set the variable to the loop value
- mf.AddDefinition(this->Args[0], arg.c_str());
+ mf.AddDefinition(this->Args[0], arg);
// Invoke all the functions that were collected in the block.
cmExecutionStatus status(mf);
for (cmListFileFunction const& func : this->Functions) {
@@ -62,12 +62,12 @@ bool cmForEachFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
if (status.GetReturnInvoked()) {
inStatus.SetReturnInvoked();
// restore the variable to its prior value
- mf.AddDefinition(this->Args[0], oldDef.c_str());
+ mf.AddDefinition(this->Args[0], oldDef);
return true;
}
if (status.GetBreakInvoked()) {
// restore the variable to its prior value
- mf.AddDefinition(this->Args[0], oldDef.c_str());
+ mf.AddDefinition(this->Args[0], oldDef);
return true;
}
if (status.GetContinueInvoked()) {
@@ -80,7 +80,7 @@ bool cmForEachFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
}
// restore the variable to its prior value
- mf.AddDefinition(this->Args[0], oldDef.c_str());
+ mf.AddDefinition(this->Args[0], oldDef);
return true;
}
// close out a nested foreach
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 8b664ad..6afd31a 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -55,20 +55,20 @@ bool cmFunctionHelperCommand::operator()(
// set the value of argc
std::ostringstream strStream;
strStream << expandedArgs.size();
- makefile.AddDefinition("ARGC", strStream.str().c_str());
+ makefile.AddDefinition("ARGC", strStream.str());
makefile.MarkVariableAsUsed("ARGC");
// set the values for ARGV0 ARGV1 ...
for (unsigned int t = 0; t < expandedArgs.size(); ++t) {
std::ostringstream tmpStream;
tmpStream << "ARGV" << t;
- makefile.AddDefinition(tmpStream.str(), expandedArgs[t].c_str());
+ makefile.AddDefinition(tmpStream.str(), expandedArgs[t]);
makefile.MarkVariableAsUsed(tmpStream.str());
}
// define the formal arguments
for (unsigned int j = 1; j < this->Args.size(); ++j) {
- makefile.AddDefinition(this->Args[j], expandedArgs[j - 1].c_str());
+ makefile.AddDefinition(this->Args[j], expandedArgs[j - 1]);
}
// define ARGV and ARGN
@@ -76,9 +76,9 @@ bool cmFunctionHelperCommand::operator()(
std::vector<std::string>::const_iterator eit =
expandedArgs.begin() + (this->Args.size() - 1);
std::string argnDef = cmJoin(cmMakeRange(eit, expandedArgs.end()), ";");
- makefile.AddDefinition("ARGV", argvDef.c_str());
+ makefile.AddDefinition("ARGV", argvDef);
makefile.MarkVariableAsUsed("ARGV");
- makefile.AddDefinition("ARGN", argnDef.c_str());
+ makefile.AddDefinition("ARGN", argnDef);
makefile.MarkVariableAsUsed("ARGN");
// Invoke all the functions that were collected in the block.
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index d828dac..49d0c47 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -1038,45 +1038,38 @@ static const struct CompileLanguageAndIdNode : public cmGeneratorExpressionNode
}
} languageAndIdNode;
-#define TRANSITIVE_PROPERTY_NAME(PROPERTY) , "INTERFACE_" #PROPERTY
-
-static const char* targetPropertyTransitiveWhitelist[] = {
- nullptr CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_NAME)
-};
-
-#undef TRANSITIVE_PROPERTY_NAME
-
-template <typename T>
std::string getLinkedTargetsContent(
- std::vector<T> const& libraries, cmGeneratorTarget const* target,
- cmGeneratorTarget const* headTarget, cmGeneratorExpressionContext* context,
- cmGeneratorExpressionDAGChecker* dagChecker,
- const std::string& interfacePropertyName)
-{
- std::string linkedTargetsContent;
- std::string sep;
- std::string depString;
- for (T const& l : libraries) {
- // Broken code can have a target in its own link interface.
- // Don't follow such link interface entries so as not to create a
- // self-referencing loop.
- if (l.Target && l.Target != target) {
- std::string uniqueName =
- target->GetGlobalGenerator()->IndexGeneratorTargetUniquely(l.Target);
- depString += sep + "$<TARGET_PROPERTY:" + std::move(uniqueName) + "," +
- interfacePropertyName + ">";
- sep = ";";
- }
- }
- if (!depString.empty()) {
- linkedTargetsContent =
- cmGeneratorExpressionNode::EvaluateDependentExpression(
- depString, target->GetLocalGenerator(), context, headTarget, target,
- dagChecker);
- }
- linkedTargetsContent =
- cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent);
- return linkedTargetsContent;
+ cmGeneratorTarget const* target, std::string const& prop,
+ cmGeneratorExpressionContext* context,
+ cmGeneratorExpressionDAGChecker* dagChecker)
+{
+ std::string result;
+ if (cmLinkImplementationLibraries const* impl =
+ target->GetLinkImplementationLibraries(context->Config)) {
+ for (cmLinkImplItem const& lib : impl->Libraries) {
+ if (lib.Target) {
+ // Pretend $<TARGET_PROPERTY:lib.Target,prop> appeared in our
+ // caller's property and hand-evaluate it as if it were compiled.
+ // Create a context as cmCompiledGeneratorExpression::Evaluate does.
+ cmGeneratorExpressionContext libContext(
+ target->GetLocalGenerator(), context->Config, context->Quiet, target,
+ target, context->EvaluateForBuildsystem, lib.Backtrace,
+ context->Language);
+ std::string libResult =
+ lib.Target->EvaluateInterfaceProperty(prop, &libContext, dagChecker);
+ if (!libResult.empty()) {
+ if (result.empty()) {
+ result = std::move(libResult);
+ } else {
+ result.reserve(result.size() + 1 + libResult.size());
+ result += ";";
+ result += libResult;
+ }
+ }
+ }
+ }
+ }
+ return result;
}
static const struct TargetPropertyNode : public cmGeneratorExpressionNode
@@ -1205,44 +1198,37 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
return target->GetLinkerLanguage(context->Config);
}
- cmGeneratorExpressionDAGChecker dagChecker(
- context->Backtrace, target, propertyName, content, dagCheckerParent);
+ std::string interfacePropertyName;
+ bool isInterfaceProperty = false;
- switch (dagChecker.Check()) {
- case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
- dagChecker.ReportError(context, content->GetOriginalExpression());
- return std::string();
- case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE:
- // No error. We just skip cyclic references.
- return std::string();
- case cmGeneratorExpressionDAGChecker::ALREADY_SEEN:
- for (size_t i = 1; i < cm::size(targetPropertyTransitiveWhitelist);
- ++i) {
- if (targetPropertyTransitiveWhitelist[i] == propertyName) {
- // No error. We're not going to find anything new here.
- return std::string();
- }
- }
- case cmGeneratorExpressionDAGChecker::DAG:
- break;
- }
+#define POPULATE_INTERFACE_PROPERTY_NAME(prop) \
+ if (propertyName == #prop) { \
+ interfacePropertyName = "INTERFACE_" #prop; \
+ } else if (propertyName == "INTERFACE_" #prop) { \
+ interfacePropertyName = "INTERFACE_" #prop; \
+ isInterfaceProperty = true; \
+ } else
- std::string prop;
- bool haveProp = false;
- if (const char* p = target->GetProperty(propertyName)) {
- prop = p;
- haveProp = true;
+ CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(POPULATE_INTERFACE_PROPERTY_NAME)
+ // Note that the above macro terminates with an else
+ /* else */ if (cmHasLiteralPrefix(propertyName, "COMPILE_DEFINITIONS_")) {
+ cmPolicies::PolicyStatus polSt =
+ context->LG->GetPolicyStatus(cmPolicies::CMP0043);
+ if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) {
+ interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS";
+ }
}
+#undef POPULATE_INTERFACE_PROPERTY_NAME
+
+ bool evaluatingLinkLibraries = false;
if (dagCheckerParent) {
if (dagCheckerParent->EvaluatingGenexExpression() ||
dagCheckerParent->EvaluatingPICExpression()) {
// No check required.
} else if (dagCheckerParent->EvaluatingLinkLibraries()) {
-#define TRANSITIVE_PROPERTY_COMPARE(PROPERTY) \
- (#PROPERTY == propertyName || "INTERFACE_" #PROPERTY == propertyName) ||
- if (CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(
- TRANSITIVE_PROPERTY_COMPARE) false) { // NOLINT(*)
+ evaluatingLinkLibraries = true;
+ if (!interfacePropertyName.empty()) {
reportError(
context, content->GetOriginalExpression(),
"$<TARGET_PROPERTY:...> expression in link libraries "
@@ -1250,69 +1236,47 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
"over the link libraries, creating a recursion.");
return std::string();
}
-#undef TRANSITIVE_PROPERTY_COMPARE
-
- if (!haveProp) {
- return std::string();
- }
} else {
#define ASSERT_TRANSITIVE_PROPERTY_METHOD(METHOD) dagCheckerParent->METHOD() ||
-
assert(CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(
ASSERT_TRANSITIVE_PROPERTY_METHOD) false); // NOLINT(clang-tidy)
#undef ASSERT_TRANSITIVE_PROPERTY_METHOD
}
}
- std::string linkedTargetsContent;
-
- std::string interfacePropertyName;
- bool isInterfaceProperty = false;
+ if (isInterfaceProperty) {
+ return target->EvaluateInterfaceProperty(propertyName, context,
+ dagCheckerParent);
+ }
-#define POPULATE_INTERFACE_PROPERTY_NAME(prop) \
- if (propertyName == #prop) { \
- interfacePropertyName = "INTERFACE_" #prop; \
- } else if (propertyName == "INTERFACE_" #prop) { \
- interfacePropertyName = "INTERFACE_" #prop; \
- isInterfaceProperty = true; \
- } else
+ cmGeneratorExpressionDAGChecker dagChecker(
+ context->Backtrace, target, propertyName, content, dagCheckerParent);
- CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(POPULATE_INTERFACE_PROPERTY_NAME)
- // Note that the above macro terminates with an else
- /* else */ if (cmHasLiteralPrefix(propertyName, "COMPILE_DEFINITIONS_")) {
- cmPolicies::PolicyStatus polSt =
- context->LG->GetPolicyStatus(cmPolicies::CMP0043);
- if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) {
- interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS";
- }
+ switch (dagChecker.Check()) {
+ case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
+ dagChecker.ReportError(context, content->GetOriginalExpression());
+ return std::string();
+ case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE:
+ // No error. We just skip cyclic references.
+ return std::string();
+ case cmGeneratorExpressionDAGChecker::ALREADY_SEEN:
+ // We handle transitive properties above. For non-transitive
+ // properties we accept repeats anyway.
+ case cmGeneratorExpressionDAGChecker::DAG:
+ break;
}
-#undef POPULATE_INTERFACE_PROPERTY_NAME
- cmGeneratorTarget const* headTarget =
- context->HeadTarget && isInterfaceProperty ? context->HeadTarget
- : target;
- if (isInterfaceProperty) {
- if (cmLinkInterfaceLibraries const* iface =
- target->GetLinkInterfaceLibraries(context->Config, headTarget,
- true)) {
- linkedTargetsContent =
- getLinkedTargetsContent(iface->Libraries, target, headTarget,
- context, &dagChecker, interfacePropertyName);
- }
- } else if (!interfacePropertyName.empty()) {
- if (cmLinkImplementationLibraries const* impl =
- target->GetLinkImplementationLibraries(context->Config)) {
- linkedTargetsContent =
- getLinkedTargetsContent(impl->Libraries, target, target, context,
- &dagChecker, interfacePropertyName);
- }
+ std::string result;
+ bool haveProp = false;
+ if (const char* p = target->GetProperty(propertyName)) {
+ result = p;
+ haveProp = true;
+ } else if (evaluatingLinkLibraries) {
+ return std::string();
}
- if (!haveProp) {
- if (target->IsImported() ||
- target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
- return linkedTargetsContent;
- }
+ if (!haveProp && !target->IsImported() &&
+ target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
if (target->IsLinkInterfaceDependentBoolProperty(propertyName,
context->Config)) {
context->HadContextSensitiveCondition = true;
@@ -1345,8 +1309,6 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
context->Config);
return propContent ? propContent : "";
}
-
- return linkedTargetsContent;
}
if (!target->IsImported() && dagCheckerParent &&
@@ -1368,15 +1330,17 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
return propContent ? propContent : "";
}
}
+
if (!interfacePropertyName.empty()) {
- std::string result = this->EvaluateDependentExpression(
- prop, context->LG, context, headTarget, target, &dagChecker);
+ result = this->EvaluateDependentExpression(result, context->LG, context,
+ target, target, &dagChecker);
+ std::string linkedTargetsContent = getLinkedTargetsContent(
+ target, interfacePropertyName, context, &dagChecker);
if (!linkedTargetsContent.empty()) {
result += (result.empty() ? "" : ";") + linkedTargetsContent;
}
- return result;
}
- return prop;
+ return result;
}
} targetPropertyNode;
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 6e6c917..7c41045 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -22,7 +22,9 @@
#include "cmCustomCommandGenerator.h"
#include "cmCustomCommandLines.h"
#include "cmGeneratorExpression.h"
+#include "cmGeneratorExpressionContext.h"
#include "cmGeneratorExpressionDAGChecker.h"
+#include "cmGeneratorExpressionNode.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
@@ -1141,6 +1143,126 @@ bool cmGeneratorTarget::GetPropertyAsBool(const std::string& prop) const
return this->Target->GetPropertyAsBool(prop);
}
+bool cmGeneratorTarget::MaybeHaveInterfaceProperty(
+ std::string const& prop, cmGeneratorExpressionContext* context) const
+{
+ std::string const key = prop + '@' + context->Config;
+ auto i = this->MaybeInterfacePropertyExists.find(key);
+ if (i == this->MaybeInterfacePropertyExists.end()) {
+ // Insert an entry now in case there is a cycle.
+ i = this->MaybeInterfacePropertyExists.emplace(key, false).first;
+ bool& maybeInterfaceProp = i->second;
+
+ // If this target itself has a non-empty property value, we are done.
+ const char* p = this->GetProperty(prop);
+ maybeInterfaceProp = p && *p;
+
+ // Otherwise, recurse to interface dependencies.
+ if (!maybeInterfaceProp) {
+ cmGeneratorTarget const* headTarget =
+ context->HeadTarget ? context->HeadTarget : this;
+ if (cmLinkInterfaceLibraries const* iface =
+ this->GetLinkInterfaceLibraries(context->Config, headTarget,
+ true)) {
+ if (iface->HadHeadSensitiveCondition) {
+ // With a different head target we may get to a library with
+ // this interface property.
+ maybeInterfaceProp = true;
+ } else {
+ // The transitive interface libraries do not depend on the
+ // head target, so we can follow them.
+ for (cmLinkItem const& lib : iface->Libraries) {
+ if (lib.Target &&
+ lib.Target->MaybeHaveInterfaceProperty(prop, context)) {
+ maybeInterfaceProp = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ return i->second;
+}
+
+std::string cmGeneratorTarget::EvaluateInterfaceProperty(
+ std::string const& prop, cmGeneratorExpressionContext* context,
+ cmGeneratorExpressionDAGChecker* dagCheckerParent) const
+{
+ std::string result;
+
+ // If the property does not appear transitively at all, we are done.
+ if (!this->MaybeHaveInterfaceProperty(prop, context)) {
+ return result;
+ }
+
+ // Evaluate $<TARGET_PROPERTY:this,prop> as if it were compiled. This is
+ // a subset of TargetPropertyNode::Evaluate without stringify/parse steps
+ // but sufficient for transitive interface properties.
+ cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace, this, prop,
+ nullptr, dagCheckerParent);
+ switch (dagChecker.Check()) {
+ case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
+ dagChecker.ReportError(
+ context, "$<TARGET_PROPERTY:" + this->GetName() + "," + prop + ">");
+ return result;
+ case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE:
+ // No error. We just skip cyclic references.
+ return result;
+ case cmGeneratorExpressionDAGChecker::ALREADY_SEEN:
+ // No error. We have already seen this transitive property.
+ return result;
+ case cmGeneratorExpressionDAGChecker::DAG:
+ break;
+ }
+
+ cmGeneratorTarget const* headTarget =
+ context->HeadTarget ? context->HeadTarget : this;
+
+ if (const char* p = this->GetProperty(prop)) {
+ result = cmGeneratorExpressionNode::EvaluateDependentExpression(
+ p, context->LG, context, headTarget, this, &dagChecker);
+ }
+
+ if (cmLinkInterfaceLibraries const* iface =
+ this->GetLinkInterfaceLibraries(context->Config, headTarget, true)) {
+ for (cmLinkItem const& lib : iface->Libraries) {
+ // Broken code can have a target in its own link interface.
+ // Don't follow such link interface entries so as not to create a
+ // self-referencing loop.
+ if (lib.Target && lib.Target != this) {
+ // Pretend $<TARGET_PROPERTY:lib.Target,prop> appeared in the
+ // above property and hand-evaluate it as if it were compiled.
+ // Create a context as cmCompiledGeneratorExpression::Evaluate does.
+ cmGeneratorExpressionContext libContext(
+ context->LG, context->Config, context->Quiet, headTarget, this,
+ context->EvaluateForBuildsystem, context->Backtrace,
+ context->Language);
+ std::string libResult = cmGeneratorExpression::StripEmptyListElements(
+ lib.Target->EvaluateInterfaceProperty(prop, &libContext,
+ &dagChecker));
+ if (!libResult.empty()) {
+ if (result.empty()) {
+ result = std::move(libResult);
+ } else {
+ result.reserve(result.size() + 1 + libResult.size());
+ result += ";";
+ result += libResult;
+ }
+ }
+ context->HadContextSensitiveCondition =
+ context->HadContextSensitiveCondition ||
+ libContext.HadContextSensitiveCondition;
+ context->HadHeadSensitiveCondition =
+ context->HadHeadSensitiveCondition ||
+ libContext.HadHeadSensitiveCondition;
+ }
+ }
+ }
+
+ return result;
+}
+
namespace {
void AddInterfaceEntries(cmGeneratorTarget const* headTarget,
std::string const& config, std::string const& prop,
@@ -1152,23 +1274,17 @@ void AddInterfaceEntries(cmGeneratorTarget const* headTarget,
headTarget->GetLinkImplementationLibraries(config)) {
for (cmLinkImplItem const& lib : impl->Libraries) {
if (lib.Target) {
- std::string uniqueName =
- headTarget->GetGlobalGenerator()->IndexGeneratorTargetUniquely(
- lib.Target);
- std::string genex =
- "$<TARGET_PROPERTY:" + std::move(uniqueName) + "," + prop + ">";
- cmGeneratorExpression ge(lib.Backtrace);
- std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex);
- cge->SetEvaluateForBuildsystem(true);
-
EvaluatedTargetPropertyEntry ee(lib, lib.Backtrace);
+ // Pretend $<TARGET_PROPERTY:lib.Target,prop> appeared in our
+ // caller's property and hand-evaluate it as if it were compiled.
+ // Create a context as cmCompiledGeneratorExpression::Evaluate does.
+ cmGeneratorExpressionContext context(
+ headTarget->GetLocalGenerator(), config, false, headTarget,
+ headTarget, true, lib.Backtrace, lang);
cmSystemTools::ExpandListArgument(
- cge->Evaluate(headTarget->GetLocalGenerator(), config, false,
- headTarget, dagChecker, lang),
+ lib.Target->EvaluateInterfaceProperty(prop, &context, dagChecker),
ee.Values);
- if (cge->GetHadContextSensitiveCondition()) {
- ee.ContextDependent = true;
- }
+ ee.ContextDependent = context.HadContextSensitiveCondition;
entries.emplace_back(std::move(ee));
}
}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index e86535d..3874738 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -14,6 +14,7 @@
#include <set>
#include <stddef.h>
#include <string>
+#include <unordered_map>
#include <utility>
#include <vector>
@@ -25,6 +26,9 @@ class cmMakefile;
class cmSourceFile;
class cmTarget;
+struct cmGeneratorExpressionContext;
+struct cmGeneratorExpressionDAGChecker;
+
class cmGeneratorTarget
{
public:
@@ -674,6 +678,10 @@ public:
class TargetPropertyEntry;
+ std::string EvaluateInterfaceProperty(
+ std::string const& prop, cmGeneratorExpressionContext* context,
+ cmGeneratorExpressionDAGChecker* dagCheckerParent) const;
+
bool HaveInstallTreeRPATH(const std::string& config) const;
bool GetBuildRPATH(const std::string& config, std::string& rpath) const;
@@ -849,6 +857,10 @@ private:
mutable std::vector<AllConfigSource> AllConfigSources;
void ComputeAllConfigSources() const;
+ mutable std::unordered_map<std::string, bool> MaybeInterfacePropertyExists;
+ bool MaybeHaveInterfaceProperty(std::string const& prop,
+ cmGeneratorExpressionContext* context) const;
+
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
std::vector<TargetPropertyEntry*> CompileFeaturesEntries;
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index fc82fee..8538944 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -46,7 +46,7 @@ bool cmGetCMakePropertyCommand::InitialPass(
}
}
- this->Makefile->AddDefinition(variable, output.c_str());
+ this->Makefile->AddDefinition(variable, output);
return true;
}
diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx
index a92eb71..98ccb0a 100644
--- a/Source/cmGetDirectoryPropertyCommand.cxx
+++ b/Source/cmGetDirectoryPropertyCommand.cxx
@@ -66,7 +66,7 @@ bool cmGetDirectoryPropertyCommand::InitialPass(
return false;
}
std::string const& output = dir->GetSafeDefinition(*i);
- this->Makefile->AddDefinition(variable, output.c_str());
+ this->Makefile->AddDefinition(variable, output);
return true;
}
@@ -97,9 +97,5 @@ bool cmGetDirectoryPropertyCommand::InitialPass(
void cmGetDirectoryPropertyCommand::StoreResult(std::string const& variable,
const char* prop)
{
- if (prop) {
- this->Makefile->AddDefinition(variable, prop);
- return;
- }
- this->Makefile->AddDefinition(variable, "");
+ this->Makefile->AddDefinition(variable, prop ? prop : "");
}
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx
index 163b4c8..fc82535 100644
--- a/Source/cmGetFilenameComponentCommand.cxx
+++ b/Source/cmGetFilenameComponentCommand.cxx
@@ -128,9 +128,9 @@ bool cmGetFilenameComponentCommand::InitialPass(
args[2] == "PATH" ? cmStateEnums::FILEPATH : cmStateEnums::STRING);
} else {
if (!programArgs.empty() && !storeArgs.empty()) {
- this->Makefile->AddDefinition(storeArgs, programArgs.c_str());
+ this->Makefile->AddDefinition(storeArgs, programArgs);
}
- this->Makefile->AddDefinition(args.front(), result.c_str());
+ this->Makefile->AddDefinition(args.front(), result);
}
return true;
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 039f439..de462ed 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -121,7 +121,7 @@ bool cmGetPropertyCommand::InitialPass(std::vector<std::string> const& args,
} else {
output = "NOTFOUND";
}
- this->Makefile->AddDefinition(this->Variable, output.c_str());
+ this->Makefile->AddDefinition(this->Variable, output);
} else if (this->InfoType == OutFullDoc) {
// Lookup full documentation.
std::string output;
@@ -132,7 +132,7 @@ bool cmGetPropertyCommand::InitialPass(std::vector<std::string> const& args,
} else {
output = "NOTFOUND";
}
- this->Makefile->AddDefinition(this->Variable, output.c_str());
+ this->Makefile->AddDefinition(this->Variable, output);
} else if (this->InfoType == OutDefined) {
// Lookup if the property is defined
if (this->Makefile->GetState()->GetPropertyDefinition(this->PropertyName,
diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx
index 75879a5..a16076d 100644
--- a/Source/cmGetSourceFilePropertyCommand.cxx
+++ b/Source/cmGetSourceFilePropertyCommand.cxx
@@ -25,7 +25,7 @@ bool cmGetSourceFilePropertyCommand::InitialPass(
}
if (sf) {
if (args[2] == "LANGUAGE") {
- this->Makefile->AddDefinition(var, sf->GetLanguage().c_str());
+ this->Makefile->AddDefinition(var, sf->GetLanguage());
return true;
}
const char* prop = nullptr;
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index fc0e9c6..07aaf02 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -75,9 +75,9 @@ bool cmGetTargetPropertyCommand::InitialPass(
}
}
if (prop_exists) {
- this->Makefile->AddDefinition(var, prop.c_str());
+ this->Makefile->AddDefinition(var, prop);
return true;
}
- this->Makefile->AddDefinition(var, (var + "-NOTFOUND").c_str());
+ this->Makefile->AddDefinition(var, var + "-NOTFOUND");
return true;
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index ec4107b..7b8ffc5 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -511,7 +511,7 @@ void cmGlobalGenerator::EnableLanguage(
bool fatalError = false;
- mf->AddDefinition("RUN_CONFIGURE", true);
+ mf->AddDefinitionBool("RUN_CONFIGURE", true);
std::string rootBin = this->CMakeInstance->GetHomeOutputDirectory();
rootBin += "/CMakeFiles";
@@ -525,7 +525,7 @@ void cmGlobalGenerator::EnableLanguage(
rootBin += cmVersion::GetCMakeVersion();
// set the dir for parent files so they can be used by modules
- mf->AddDefinition("CMAKE_PLATFORM_INFO_DIR", rootBin.c_str());
+ mf->AddDefinition("CMAKE_PLATFORM_INFO_DIR", rootBin);
if (!this->CMakeInstance->GetIsInTryCompile()) {
// Keep a mark in the cache to indicate that we've initialized the
@@ -585,8 +585,7 @@ void cmGlobalGenerator::EnableLanguage(
windowsVersionString << osviex.dwMajorVersion << "."
<< osviex.dwMinorVersion << "."
<< osviex.dwBuildNumber;
- mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION",
- windowsVersionString.str().c_str());
+ mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION", windowsVersionString.str());
#endif
// Read the DetermineSystem file
std::string systemFile = mf->GetModulesFile("CMakeDetermineSystem.cmake");
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index b69dea0..7cfbea6 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -111,7 +111,7 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", gbuild.c_str(),
"build program to use", cmStateEnums::INTERNAL, true);
- mf->AddDefinition("CMAKE_SYSTEM_VERSION", tsp.c_str());
+ mf->AddDefinition("CMAKE_SYSTEM_VERSION", tsp);
return true;
}
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx
index 7b58389..483d4ab 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.cxx
+++ b/Source/cmGlobalMSYSMakefileGenerator.cxx
@@ -69,9 +69,9 @@ void cmGlobalMSYSMakefileGenerator::EnableLanguage(
rc = trc;
}
mf->AddDefinition("MSYS", "1");
- mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str());
- mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str());
- mf->AddDefinition("CMAKE_GENERATOR_RC", rc.c_str());
+ mf->AddDefinition("CMAKE_GENERATOR_CC", gcc);
+ mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx);
+ mf->AddDefinition("CMAKE_GENERATOR_RC", rc);
this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
if (!mf->IsSet("CMAKE_AR") && !this->CMakeInstance->GetIsInTryCompile() &&
diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx
index e218b4b..d9fc505 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.cxx
+++ b/Source/cmGlobalMinGWMakefileGenerator.cxx
@@ -44,9 +44,9 @@ void cmGlobalMinGWMakefileGenerator::EnableLanguage(
if (!trc.empty()) {
rc = trc;
}
- mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str());
- mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str());
- mf->AddDefinition("CMAKE_GENERATOR_RC", rc.c_str());
+ mf->AddDefinition("CMAKE_GENERATOR_CC", gcc);
+ mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx);
+ mf->AddDefinition("CMAKE_GENERATOR_RC", rc);
this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
}
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 55374a4..4a3cadd 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -445,7 +445,7 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf)
this->DefaultPlatformName = "Tegra-Android";
this->DefaultPlatformToolset = "Default";
this->NsightTegraVersion = v;
- mf->AddDefinition("CMAKE_VS_NsightTegra_VERSION", v.c_str());
+ mf->AddDefinition("CMAKE_VS_NsightTegra_VERSION", v);
}
return true;
@@ -659,8 +659,7 @@ bool cmGlobalVisualStudio10Generator::FindMakeProgram(cmMakefile* mf)
if (!this->cmGlobalVisualStudio8Generator::FindMakeProgram(mf)) {
return false;
}
- mf->AddDefinition("CMAKE_VS_MSBUILD_COMMAND",
- this->GetMSBuildCommand().c_str());
+ mf->AddDefinition("CMAKE_VS_MSBUILD_COMMAND", this->GetMSBuildCommand());
return true;
}
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index 6509b56..cd48474 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -182,7 +182,7 @@ void cmGlobalVisualStudio14Generator::SetWindowsTargetPlatformVersion(
mf->DisplayStatus(e.str(), -1);
}
mf->AddDefinition("CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION",
- this->WindowsTargetPlatformVersion.c_str());
+ this->WindowsTargetPlatformVersion);
}
bool cmGlobalVisualStudio14Generator::SelectWindowsStoreToolset(
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 8764ee4..8401efb 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -121,8 +121,7 @@ bool cmGlobalVisualStudio7Generator::FindMakeProgram(cmMakefile* mf)
if (!this->cmGlobalVisualStudioGenerator::FindMakeProgram(mf)) {
return false;
}
- mf->AddDefinition("CMAKE_VS_DEVENV_COMMAND",
- this->GetDevEnvCommand().c_str());
+ mf->AddDefinition("CMAKE_VS_DEVENV_COMMAND", this->GetDevEnvCommand());
return true;
}
@@ -268,7 +267,7 @@ bool cmGlobalVisualStudio7Generator::SetSystemName(std::string const& s,
cmMakefile* mf)
{
mf->AddDefinition("CMAKE_VS_INTEL_Fortran_PROJECT_VERSION",
- this->GetIntelProjectVersion().c_str());
+ this->GetIntelProjectVersion());
return this->cmGlobalVisualStudioGenerator::SetSystemName(s, mf);
}
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 85ddc85..cc6e421 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -54,8 +54,7 @@ void cmGlobalVisualStudio8Generator::EnableLanguage(
void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf)
{
if (this->TargetsWindowsCE()) {
- mf->AddDefinition("CMAKE_VS_WINCE_VERSION",
- this->WindowsCEVersion.c_str());
+ mf->AddDefinition("CMAKE_VS_WINCE_VERSION", this->WindowsCEVersion);
}
}
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index cd0355f..ba541a9 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -57,7 +57,7 @@ void cmGlobalVisualStudioGenerator::EnableLanguage(
std::vector<std::string> const& lang, cmMakefile* mf, bool optional)
{
mf->AddDefinition("CMAKE_VS_PLATFORM_NAME_DEFAULT",
- this->DefaultPlatformName.c_str());
+ this->DefaultPlatformName);
this->cmGlobalGenerator::EnableLanguage(lang, mf, optional);
}
@@ -69,7 +69,7 @@ bool cmGlobalVisualStudioGenerator::SetGeneratorPlatform(std::string const& p,
} else if (this->GetPlatformName() == "Itanium") {
mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE");
}
- mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName().c_str());
+ mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName());
return this->cmGlobalGenerator::SetGeneratorPlatform(p, mf);
}
@@ -488,7 +488,7 @@ bool cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf)
// directly instead of needing a helper module to do it, so we
// do not actually need to put CMAKE_MAKE_PROGRAM into the cache.
if (cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) {
- mf->AddDefinition("CMAKE_MAKE_PROGRAM", this->GetVSMakeProgram().c_str());
+ mf->AddDefinition("CMAKE_MAKE_PROGRAM", this->GetVSMakeProgram());
}
return true;
}
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index d99a906..8f4ae62 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -241,8 +241,7 @@ bool cmGlobalXCodeGenerator::FindMakeProgram(cmMakefile* mf)
// directly instead of needing a helper module to do it, so we
// do not actually need to put CMAKE_MAKE_PROGRAM into the cache.
if (cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) {
- mf->AddDefinition("CMAKE_MAKE_PROGRAM",
- this->GetXcodeBuildCommand().c_str());
+ mf->AddDefinition("CMAKE_MAKE_PROGRAM", this->GetXcodeBuildCommand());
}
return true;
}
@@ -283,8 +282,7 @@ bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts,
}
this->GeneratorToolset = ts;
if (!this->GeneratorToolset.empty()) {
- mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET",
- this->GeneratorToolset.c_str());
+ mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET", this->GeneratorToolset);
}
return true;
}
@@ -293,7 +291,7 @@ void cmGlobalXCodeGenerator::EnableLanguage(
std::vector<std::string> const& lang, cmMakefile* mf, bool optional)
{
mf->AddDefinition("XCODE", "1");
- mf->AddDefinition("XCODE_VERSION", this->VersionString.c_str());
+ mf->AddDefinition("XCODE_VERSION", this->VersionString);
if (!mf->GetDefinition("CMAKE_CONFIGURATION_TYPES")) {
mf->AddCacheDefinition(
"CMAKE_CONFIGURATION_TYPES", "Debug;Release;MinSizeRel;RelWithDebInfo",
diff --git a/Source/cmIncludeGuardCommand.cxx b/Source/cmIncludeGuardCommand.cxx
index 505b07c..3b126b0 100644
--- a/Source/cmIncludeGuardCommand.cxx
+++ b/Source/cmIncludeGuardCommand.cxx
@@ -85,7 +85,7 @@ bool cmIncludeGuardCommand::InitialPass(std::vector<std::string> const& args,
status.SetReturnInvoked();
return true;
}
- mf->AddDefinition(includeGuardVar, true);
+ mf->AddDefinitionBool(includeGuardVar, true);
break;
case DIRECTORY:
if (CheckIncludeGuardIsSet(mf, includeGuardVar)) {
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index d891ad8..a61239e 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -767,12 +767,18 @@ void cmInstallTargetGenerator::AddChrpathPatchRule(
this->IssueCMP0095Warning(newRpath);
CM_FALLTHROUGH;
case cmPolicies::OLD:
- os << indent << " NEW_RPATH \"" << newRpath << "\")\n";
+ os << indent << " NEW_RPATH \"" << newRpath << "\"";
break;
default:
- os << indent << " NEW_RPATH " << escapedNewRpath << ")\n";
+ os << indent << " NEW_RPATH " << escapedNewRpath;
break;
}
+
+ if (this->Target->GetPropertyAsBool("INSTALL_REMOVE_ENVIRONMENT_RPATH")) {
+ os << "\n" << indent << " INSTALL_REMOVE_ENVIRONMENT_RPATH)\n";
+ } else {
+ os << indent << ")\n";
+ }
}
}
diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h
index 5b635b5..6450c62 100644
--- a/Source/cmLinkItem.h
+++ b/Source/cmLinkItem.h
@@ -58,6 +58,9 @@ struct cmLinkInterfaceLibraries
{
// Libraries listed in the interface.
std::vector<cmLinkItem> Libraries;
+
+ // Whether the list depends on a genex referencing the head target.
+ bool HadHeadSensitiveCondition = false;
};
struct cmLinkInterface : public cmLinkInterfaceLibraries
@@ -84,7 +87,6 @@ struct cmOptionalLinkInterface : public cmLinkInterface
bool LibrariesDone = false;
bool AllDone = false;
bool Exists = false;
- bool HadHeadSensitiveCondition = false;
const char* ExplicitLibraries = nullptr;
};
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index a2e665f..d024256 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -222,7 +222,7 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args)
value += varArgsExpanded[item];
}
- this->Makefile->AddDefinition(variableName, value.c_str());
+ this->Makefile->AddDefinition(variableName, value);
return true;
}
@@ -246,7 +246,7 @@ bool cmListCommand::HandleAppendCommand(std::vector<std::string> const& args)
std::string::size_type(listString.empty() || args.empty());
listString += &";"[offset] + cmJoin(cmMakeRange(args).advance(2), ";");
- this->Makefile->AddDefinition(listName, listString.c_str());
+ this->Makefile->AddDefinition(listName, listString);
return true;
}
@@ -271,7 +271,7 @@ bool cmListCommand::HandlePrependCommand(std::vector<std::string> const& args)
listString.insert(0,
cmJoin(cmMakeRange(args).advance(2), ";") + &";"[offset]);
- this->Makefile->AddDefinition(listName, listString.c_str());
+ this->Makefile->AddDefinition(listName, listString);
return true;
}
@@ -299,7 +299,7 @@ bool cmListCommand::HandlePopBackCommand(std::vector<std::string> const& args)
// Ok, assign elements to be removed to the given variables
for (; !varArgsExpanded.empty() && ai != args.cend(); ++ai) {
assert(!ai->empty());
- this->Makefile->AddDefinition(*ai, varArgsExpanded.back().c_str());
+ this->Makefile->AddDefinition(*ai, varArgsExpanded.back());
varArgsExpanded.pop_back();
}
// Undefine the rest variables if the list gets empty earlier...
@@ -308,8 +308,7 @@ bool cmListCommand::HandlePopBackCommand(std::vector<std::string> const& args)
}
}
- this->Makefile->AddDefinition(listName,
- cmJoin(varArgsExpanded, ";").c_str());
+ this->Makefile->AddDefinition(listName, cmJoin(varArgsExpanded, ";"));
} else if (ai !=
args.cend()) { // The list is empty, but some args were given
@@ -347,7 +346,7 @@ bool cmListCommand::HandlePopFrontCommand(std::vector<std::string> const& args)
auto vi = varArgsExpanded.begin();
for (; vi != varArgsExpanded.end() && ai != args.cend(); ++ai, ++vi) {
assert(!ai->empty());
- this->Makefile->AddDefinition(*ai, vi->c_str());
+ this->Makefile->AddDefinition(*ai, *vi);
}
varArgsExpanded.erase(varArgsExpanded.begin(), vi);
// Undefine the rest variables if the list gets empty earlier...
@@ -356,8 +355,7 @@ bool cmListCommand::HandlePopFrontCommand(std::vector<std::string> const& args)
}
}
- this->Makefile->AddDefinition(listName,
- cmJoin(varArgsExpanded, ";").c_str());
+ this->Makefile->AddDefinition(listName, cmJoin(varArgsExpanded, ";"));
} else if (ai !=
args.cend()) { // The list is empty, but some args were given
@@ -391,7 +389,7 @@ bool cmListCommand::HandleFindCommand(std::vector<std::string> const& args)
if (it != varArgsExpanded.end()) {
std::ostringstream indexStream;
indexStream << std::distance(varArgsExpanded.begin(), it);
- this->Makefile->AddDefinition(variableName, indexStream.str().c_str());
+ this->Makefile->AddDefinition(variableName, indexStream.str());
return true;
}
@@ -437,7 +435,7 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args)
args.end());
std::string value = cmJoin(varArgsExpanded, ";");
- this->Makefile->AddDefinition(listName, value.c_str());
+ this->Makefile->AddDefinition(listName, value);
return true;
}
@@ -465,7 +463,7 @@ bool cmListCommand::HandleJoinCommand(std::vector<std::string> const& args)
std::string value =
cmJoin(cmMakeRange(varArgsExpanded.begin(), varArgsExpanded.end()), glue);
- this->Makefile->AddDefinition(variableName, value.c_str());
+ this->Makefile->AddDefinition(variableName, value);
return true;
}
@@ -494,7 +492,7 @@ bool cmListCommand::HandleRemoveItemCommand(
cmRemoveMatching(varArgsExpanded, cmMakeRange(remBegin, remEnd));
std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";");
- this->Makefile->AddDefinition(listName, value.c_str());
+ this->Makefile->AddDefinition(listName, value);
return true;
}
@@ -515,7 +513,7 @@ bool cmListCommand::HandleReverseCommand(std::vector<std::string> const& args)
std::string value = cmJoin(cmReverseRange(varArgsExpanded), ";");
- this->Makefile->AddDefinition(listName, value.c_str());
+ this->Makefile->AddDefinition(listName, value);
return true;
}
@@ -540,7 +538,7 @@ bool cmListCommand::HandleRemoveDuplicatesCommand(
std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";");
- this->Makefile->AddDefinition(listName, value.c_str());
+ this->Makefile->AddDefinition(listName, value);
return true;
}
@@ -1091,7 +1089,7 @@ bool cmListCommand::HandleTransformCommand(
}
this->Makefile->AddDefinition(command.OutputName,
- cmJoin(varArgsExpanded, ";").c_str());
+ cmJoin(varArgsExpanded, ";"));
return true;
}
@@ -1300,7 +1298,7 @@ bool cmListCommand::HandleSortCommand(std::vector<std::string> const& args)
}
std::string value = cmJoin(varArgsExpanded, ";");
- this->Makefile->AddDefinition(listName, value.c_str());
+ this->Makefile->AddDefinition(listName, value);
return true;
}
@@ -1349,7 +1347,7 @@ bool cmListCommand::HandleSublistCommand(std::vector<std::string> const& args)
: size_type(start + length);
std::vector<std::string> sublist(varArgsExpanded.begin() + start,
varArgsExpanded.begin() + end);
- this->Makefile->AddDefinition(variableName, cmJoin(sublist, ";").c_str());
+ this->Makefile->AddDefinition(variableName, cmJoin(sublist, ";"));
return true;
}
@@ -1406,7 +1404,7 @@ bool cmListCommand::HandleRemoveAtCommand(std::vector<std::string> const& args)
std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";");
- this->Makefile->AddDefinition(listName, value.c_str());
+ this->Makefile->AddDefinition(listName, value);
return true;
}
@@ -1500,6 +1498,6 @@ bool cmListCommand::FilterRegex(std::vector<std::string> const& args,
std::remove_if(argsBegin, argsEnd, MatchesRegex(regex, includeMatches));
std::string value = cmJoin(cmMakeRange(argsBegin, newArgsEnd), ";");
- this->Makefile->AddDefinition(listName, value.c_str());
+ this->Makefile->AddDefinition(listName, value);
return true;
}
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index b1fee8d..3fd7343 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -153,7 +153,7 @@ void cmLoadCacheCommand::CheckLine(const char* line)
// prefix.
var = this->Prefix + var;
if (!value.empty()) {
- this->Makefile->AddDefinition(var, value.c_str());
+ this->Makefile->AddDefinition(var, value);
} else {
this->Makefile->RemoveDefinition(var);
}
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index 78f4f83..5ae660a 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -230,7 +230,7 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args,
}
// Report what file was loaded for this command.
- this->Makefile->AddDefinition(reportVar, fullPath.c_str());
+ this->Makefile->AddDefinition(reportVar, fullPath);
// find the init function
std::string initFuncName = args[0] + "Init";
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index d177278..242ffe3 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2973,7 +2973,7 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target,
// back to the directory-level values set by the user.
cmMakefile* mf = this->Makefile;
cmMakefile::ScopePushPop varScope(mf);
- mf->AddDefinition("MACOSX_BUNDLE_EXECUTABLE_NAME", targetName.c_str());
+ mf->AddDefinition("MACOSX_BUNDLE_EXECUTABLE_NAME", targetName);
cmLGInfoProp(mf, target, "MACOSX_BUNDLE_INFO_STRING");
cmLGInfoProp(mf, target, "MACOSX_BUNDLE_ICON_FILE");
cmLGInfoProp(mf, target, "MACOSX_BUNDLE_GUI_IDENTIFIER");
@@ -3012,7 +3012,7 @@ void cmLocalGenerator::GenerateFrameworkInfoPList(
// back to the directory-level values set by the user.
cmMakefile* mf = this->Makefile;
cmMakefile::ScopePushPop varScope(mf);
- mf->AddDefinition("MACOSX_FRAMEWORK_NAME", targetName.c_str());
+ mf->AddDefinition("MACOSX_FRAMEWORK_NAME", targetName);
cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_ICON_FILE");
cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_IDENTIFIER");
cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_SHORT_VERSION_STRING");
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 3177adc..0fb3237 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -557,8 +557,9 @@ void cmMakefile::IncludeScope::EnforceCMP0011()
bool cmMakefile::ReadDependentFile(const std::string& filename,
bool noPolicyScope)
{
- this->AddDefinition("CMAKE_PARENT_LIST_FILE",
- this->GetDefinition("CMAKE_CURRENT_LIST_FILE"));
+ if (const char* def = this->GetDefinition("CMAKE_CURRENT_LIST_FILE")) {
+ this->AddDefinition("CMAKE_PARENT_LIST_FILE", def);
+ }
std::string filenametoread = cmSystemTools::CollapseFullPath(
filename, this->GetCurrentSourceDirectory());
@@ -641,9 +642,9 @@ void cmMakefile::ReadListFile(cmListFile const& listFile,
this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE");
std::string currentFile = this->GetSafeDefinition("CMAKE_CURRENT_LIST_FILE");
- this->AddDefinition("CMAKE_CURRENT_LIST_FILE", filenametoread.c_str());
+ this->AddDefinition("CMAKE_CURRENT_LIST_FILE", filenametoread);
this->AddDefinition("CMAKE_CURRENT_LIST_DIR",
- cmSystemTools::GetFilenamePath(filenametoread).c_str());
+ cmSystemTools::GetFilenamePath(filenametoread));
this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE");
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE");
@@ -664,10 +665,10 @@ void cmMakefile::ReadListFile(cmListFile const& listFile,
}
this->CheckForUnusedVariables();
- this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str());
- this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str());
+ this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile);
+ this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile);
this->AddDefinition("CMAKE_CURRENT_LIST_DIR",
- cmSystemTools::GetFilenamePath(currentFile).c_str());
+ cmSystemTools::GetFilenamePath(currentFile));
this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE");
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE");
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR");
@@ -1535,7 +1536,7 @@ void cmMakefile::Configure()
cmSystemTools::MakeDirectory(filesDir);
assert(cmSystemTools::FileExists(currentStart, true));
- this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart.c_str());
+ this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart);
cmListFile listFile;
if (!listFile.ParseFile(currentStart.c_str(), this->GetMessenger(),
@@ -1783,12 +1784,8 @@ void cmMakefile::AddSystemIncludeDirectories(const std::set<std::string>& incs)
}
}
-void cmMakefile::AddDefinition(const std::string& name, const char* value)
+void cmMakefile::AddDefinition(const std::string& name, cm::string_view value)
{
- if (!value) {
- return;
- }
-
if (this->VariableInitialized(name)) {
this->LogUnused("changing definition", name);
}
@@ -1798,11 +1795,16 @@ void cmMakefile::AddDefinition(const std::string& name, const char* value)
cmVariableWatch* vv = this->GetVariableWatch();
if (vv) {
vv->VariableAccessed(name, cmVariableWatch::VARIABLE_MODIFIED_ACCESS,
- value, this);
+ value.data(), this);
}
#endif
}
+void cmMakefile::AddDefinitionBool(const std::string& name, bool value)
+{
+ this->AddDefinition(name, value ? "ON" : "OFF");
+}
+
void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
const char* doc,
cmStateEnums::CacheEntryType type,
@@ -1848,23 +1850,6 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
this->StateSnapshot.RemoveDefinition(name);
}
-void cmMakefile::AddDefinition(const std::string& name, bool value)
-{
- if (this->VariableInitialized(name)) {
- this->LogUnused("changing definition", name);
- }
-
- this->StateSnapshot.SetDefinition(name, value ? "ON" : "OFF");
-
-#ifdef CMAKE_BUILD_WITH_CMAKE
- cmVariableWatch* vv = this->GetVariableWatch();
- if (vv) {
- vv->VariableAccessed(name, cmVariableWatch::VARIABLE_MODIFIED_ACCESS,
- value ? "ON" : "OFF", this);
- }
-#endif
-}
-
void cmMakefile::CheckForUnusedVariables() const
{
if (!this->WarnUnused) {
@@ -3285,20 +3270,20 @@ std::string const& cmMakefile::GetHomeOutputDirectory() const
void cmMakefile::SetScriptModeFile(std::string const& scriptfile)
{
- this->AddDefinition("CMAKE_SCRIPT_MODE_FILE", scriptfile.c_str());
+ this->AddDefinition("CMAKE_SCRIPT_MODE_FILE", scriptfile);
}
void cmMakefile::SetArgcArgv(const std::vector<std::string>& args)
{
std::ostringstream strStream;
strStream << args.size();
- this->AddDefinition("CMAKE_ARGC", strStream.str().c_str());
+ this->AddDefinition("CMAKE_ARGC", strStream.str());
// this->MarkVariableAsUsed("CMAKE_ARGC");
for (unsigned int t = 0; t < args.size(); ++t) {
std::ostringstream tmpStream;
tmpStream << "CMAKE_ARGV" << t;
- this->AddDefinition(tmpStream.str(), args[t].c_str());
+ this->AddDefinition(tmpStream.str(), args[t]);
// this->MarkVariableAsUsed(tmpStream.str().c_str());
}
}
@@ -3379,8 +3364,9 @@ void cmMakefile::AddTargetObject(std::string const& tgtName,
void cmMakefile::EnableLanguage(std::vector<std::string> const& lang,
bool optional)
{
- this->AddDefinition("CMAKE_CFG_INTDIR",
- this->GetGlobalGenerator()->GetCMakeCFGIntDir());
+ if (const char* def = this->GetGlobalGenerator()->GetCMakeCFGIntDir()) {
+ this->AddDefinition("CMAKE_CFG_INTDIR", def);
+ }
// If RC is explicitly listed we need to do it after other languages.
// On some platforms we enable RC implicitly while enabling others.
// Do not let that look like recursive enable_language(RC).
@@ -4232,7 +4218,7 @@ void cmMakefile::StoreMatches(cmsys::RegularExpression& re)
std::string const& m = re.match(i);
if (!m.empty()) {
std::string const& var = matchVariables[i];
- this->AddDefinition(var, m.c_str());
+ this->AddDefinition(var, m);
this->MarkVariableAsUsed(var);
highest = static_cast<char>('0' + i);
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 1eca18c..18b81d4 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -17,6 +17,8 @@
#include <unordered_map>
#include <vector>
+#include "cm_string_view.hxx"
+
#include "cmAlgorithms.h"
#include "cmFunctionBlocker.h"
#include "cmListFileCache.h"
@@ -263,18 +265,17 @@ public:
* Add a variable definition to the build. This variable
* can be used in CMake to refer to lists, directories, etc.
*/
- void AddDefinition(const std::string& name, const char* value);
+ void AddDefinition(const std::string& name, cm::string_view value);
+ /**
+ * Add bool variable definition to the build.
+ */
+ void AddDefinitionBool(const std::string& name, bool);
//! Add a definition to this makefile and the global cmake cache.
void AddCacheDefinition(const std::string& name, const char* value,
const char* doc, cmStateEnums::CacheEntryType type,
bool force = false);
/**
- * Add bool variable definition to the build.
- */
- void AddDefinition(const std::string& name, bool);
-
- /**
* Remove a variable definition from the build. This is not valid
* for cache entries, and will only affect the current makefile.
*/
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index de79817..08c92ff 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -910,8 +910,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements()
this->GetBuildFileStream() << "\n";
if (!this->SwiftOutputMap.empty()) {
- std::string const mapFilePath = this->ConvertToNinjaPath(
- this->GeneratorTarget->GetSupportDirectory() + "/output-file-map.json");
+ std::string const mapFilePath =
+ this->GeneratorTarget->GetSupportDirectory() + "/output-file-map.json";
std::string const targetSwiftDepsPath = [this]() -> std::string {
cmGeneratorTarget const* target = this->GeneratorTarget;
if (const char* name = target->GetProperty("Swift_DEPENDENCIES_FILE")) {
diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx
index 5213432..0f8aef7 100644
--- a/Source/cmParseArgumentsCommand.cxx
+++ b/Source/cmParseArgumentsCommand.cxx
@@ -75,7 +75,7 @@ static void PassParsedArguments(
for (auto const& iter : singleValArgs) {
if (!iter.second.empty()) {
- makefile.AddDefinition(prefix + iter.first, iter.second.c_str());
+ makefile.AddDefinition(prefix + iter.first, iter.second);
} else {
makefile.RemoveDefinition(prefix + iter.first);
}
@@ -84,7 +84,7 @@ static void PassParsedArguments(
for (auto const& iter : multiValArgs) {
if (!iter.second.empty()) {
makefile.AddDefinition(prefix + iter.first,
- JoinList(iter.second, parseFromArgV).c_str());
+ JoinList(iter.second, parseFromArgV));
} else {
makefile.RemoveDefinition(prefix + iter.first);
}
@@ -92,15 +92,14 @@ static void PassParsedArguments(
if (!unparsed.empty()) {
makefile.AddDefinition(prefix + "UNPARSED_ARGUMENTS",
- JoinList(unparsed, parseFromArgV).c_str());
+ JoinList(unparsed, parseFromArgV));
} else {
makefile.RemoveDefinition(prefix + "UNPARSED_ARGUMENTS");
}
if (!keywordsMissingValues.empty()) {
- makefile.AddDefinition(
- prefix + "KEYWORDS_MISSING_VALUES",
- cmJoin(cmMakeRange(keywordsMissingValues), ";").c_str());
+ makefile.AddDefinition(prefix + "KEYWORDS_MISSING_VALUES",
+ cmJoin(cmMakeRange(keywordsMissingValues), ";"));
} else {
makefile.RemoveDefinition(prefix + "KEYWORDS_MISSING_VALUES");
}
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index e3d3bd8..1159ef7 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -45,12 +45,12 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
this->Makefile->GetCurrentSourceDirectory().c_str(),
"Value Computed by CMake", cmStateEnums::STATIC);
- this->Makefile->AddDefinition(
- "PROJECT_BINARY_DIR", this->Makefile->GetCurrentBinaryDirectory().c_str());
- this->Makefile->AddDefinition(
- "PROJECT_SOURCE_DIR", this->Makefile->GetCurrentSourceDirectory().c_str());
+ this->Makefile->AddDefinition("PROJECT_BINARY_DIR",
+ this->Makefile->GetCurrentBinaryDirectory());
+ this->Makefile->AddDefinition("PROJECT_SOURCE_DIR",
+ this->Makefile->GetCurrentSourceDirectory());
- this->Makefile->AddDefinition("PROJECT_NAME", projectName.c_str());
+ this->Makefile->AddDefinition("PROJECT_NAME", projectName);
// Set the CMAKE_PROJECT_NAME variable to be the highest-level
// project name in the tree. If there are two project commands
@@ -60,7 +60,7 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
// will work.
if (!this->Makefile->GetDefinition("CMAKE_PROJECT_NAME") ||
(this->Makefile->IsRootMakefile())) {
- this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", projectName.c_str());
+ this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", projectName);
this->Makefile->AddCacheDefinition(
"CMAKE_PROJECT_NAME", projectName.c_str(), "Value Computed by CMake",
cmStateEnums::STATIC);
@@ -258,24 +258,24 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
std::string vv;
vv = projectName + "_VERSION";
- this->Makefile->AddDefinition("PROJECT_VERSION", version_string.c_str());
- this->Makefile->AddDefinition(vv, version_string.c_str());
+ this->Makefile->AddDefinition("PROJECT_VERSION", version_string);
+ this->Makefile->AddDefinition(vv, version_string);
vv = projectName + "_VERSION_MAJOR";
this->Makefile->AddDefinition("PROJECT_VERSION_MAJOR",
- version_components[0].c_str());
- this->Makefile->AddDefinition(vv, version_components[0].c_str());
+ version_components[0]);
+ this->Makefile->AddDefinition(vv, version_components[0]);
vv = projectName + "_VERSION_MINOR";
this->Makefile->AddDefinition("PROJECT_VERSION_MINOR",
- version_components[1].c_str());
- this->Makefile->AddDefinition(vv, version_components[1].c_str());
+ version_components[1]);
+ this->Makefile->AddDefinition(vv, version_components[1]);
vv = projectName + "_VERSION_PATCH";
this->Makefile->AddDefinition("PROJECT_VERSION_PATCH",
- version_components[2].c_str());
- this->Makefile->AddDefinition(vv, version_components[2].c_str());
+ version_components[2]);
+ this->Makefile->AddDefinition(vv, version_components[2]);
vv = projectName + "_VERSION_TWEAK";
this->Makefile->AddDefinition("PROJECT_VERSION_TWEAK",
- version_components[3].c_str());
- this->Makefile->AddDefinition(vv, version_components[3].c_str());
+ version_components[3]);
+ this->Makefile->AddDefinition(vv, version_components[3]);
// Also, try set top level variables
TopLevelCMakeVarCondSet("CMAKE_PROJECT_VERSION", version_string.c_str());
TopLevelCMakeVarCondSet("CMAKE_PROJECT_VERSION_MAJOR",
@@ -327,14 +327,12 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
}
}
- this->Makefile->AddDefinition("PROJECT_DESCRIPTION", description.c_str());
- this->Makefile->AddDefinition(projectName + "_DESCRIPTION",
- description.c_str());
+ this->Makefile->AddDefinition("PROJECT_DESCRIPTION", description);
+ this->Makefile->AddDefinition(projectName + "_DESCRIPTION", description);
TopLevelCMakeVarCondSet("CMAKE_PROJECT_DESCRIPTION", description.c_str());
- this->Makefile->AddDefinition("PROJECT_HOMEPAGE_URL", homepage.c_str());
- this->Makefile->AddDefinition(projectName + "_HOMEPAGE_URL",
- homepage.c_str());
+ this->Makefile->AddDefinition("PROJECT_HOMEPAGE_URL", homepage);
+ this->Makefile->AddDefinition(projectName + "_HOMEPAGE_URL", homepage);
TopLevelCMakeVarCondSet("CMAKE_PROJECT_HOMEPAGE_URL", homepage.c_str());
if (languages.empty()) {
diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx
index 9a764c6..f5852a9 100644
--- a/Source/cmQTWrapCPPCommand.cxx
+++ b/Source/cmQTWrapCPPCommand.cxx
@@ -89,6 +89,6 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& args,
}
// Store the final list of source files.
- this->Makefile->AddDefinition(sourceList, sourceListValue.c_str());
+ this->Makefile->AddDefinition(sourceList, sourceListValue);
return true;
}
diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx
index 2223e2d..361d7b3 100644
--- a/Source/cmQTWrapUICommand.cxx
+++ b/Source/cmQTWrapUICommand.cxx
@@ -132,7 +132,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& args,
}
// Store the final list of source files and headers.
- this->Makefile->AddDefinition(sourceList, sourceListValue.c_str());
- this->Makefile->AddDefinition(headerList, headerListValue.c_str());
+ this->Makefile->AddDefinition(sourceList, sourceListValue);
+ this->Makefile->AddDefinition(headerList, headerListValue);
return true;
}
diff --git a/Source/cmRemoveCommand.cxx b/Source/cmRemoveCommand.cxx
index a64ad8c..d0ee4d4 100644
--- a/Source/cmRemoveCommand.cxx
+++ b/Source/cmRemoveCommand.cxx
@@ -52,7 +52,7 @@ bool cmRemoveCommand::InitialPass(std::vector<std::string> const& args,
}
// add the definition
- this->Makefile->AddDefinition(variable, value.c_str());
+ this->Makefile->AddDefinition(variable, value);
return true;
}
diff --git a/Source/cmSeparateArgumentsCommand.cxx b/Source/cmSeparateArgumentsCommand.cxx
index 28cbdc0..ab4a0c7 100644
--- a/Source/cmSeparateArgumentsCommand.cxx
+++ b/Source/cmSeparateArgumentsCommand.cxx
@@ -69,7 +69,7 @@ bool cmSeparateArgumentsCommand::InitialPass(
if (const char* def = this->Makefile->GetDefinition(var)) {
std::string value = def;
std::replace(value.begin(), value.end(), ' ', ';');
- this->Makefile->AddDefinition(var, value.c_str());
+ this->Makefile->AddDefinition(var, value);
}
} else {
// Parse the command line.
@@ -97,7 +97,7 @@ bool cmSeparateArgumentsCommand::InitialPass(
value += si;
}
}
- this->Makefile->AddDefinition(var, value.c_str());
+ this->Makefile->AddDefinition(var, value);
}
return true;
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 41555e8..b36878c 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -154,7 +154,7 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
type, force);
} else {
// add the definition
- this->Makefile->AddDefinition(variable, value.c_str());
+ this->Makefile->AddDefinition(variable, value);
}
return true;
}
diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index acacba2..d887627 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -146,8 +146,7 @@ bool cmSourceFileLocation::MatchesAmbiguousExtension(
// adding an extension.
if (!(this->Name.size() > loc.Name.size() &&
this->Name[loc.Name.size()] == '.' &&
- cmHasLiteralPrefixImpl(this->Name.c_str(), loc.Name.c_str(),
- loc.Name.size()))) {
+ cmHasPrefix(this->Name, loc.Name))) {
return false;
}
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 0b12a65..6f9c935 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -308,8 +308,8 @@ cmStateSnapshot cmState::Reset()
pos->Parent = this->VarTree.Root();
pos->Root = this->VarTree.Root();
- pos->Vars->Set("CMAKE_SOURCE_DIR", srcDir.c_str());
- pos->Vars->Set("CMAKE_BINARY_DIR", binDir.c_str());
+ pos->Vars->Set("CMAKE_SOURCE_DIR", srcDir);
+ pos->Vars->Set("CMAKE_BINARY_DIR", binDir);
}
this->DefineProperty("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY, "", "",
diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx
index 63bec71..110ec56 100644
--- a/Source/cmStateSnapshot.cxx
+++ b/Source/cmStateSnapshot.cxx
@@ -222,14 +222,14 @@ bool cmStateSnapshot::IsInitialized(std::string const& name) const
}
void cmStateSnapshot::SetDefinition(std::string const& name,
- std::string const& value)
+ cm::string_view value)
{
- this->Position->Vars->Set(name, value.c_str());
+ this->Position->Vars->Set(name, value);
}
void cmStateSnapshot::RemoveDefinition(std::string const& name)
{
- this->Position->Vars->Set(name, nullptr);
+ this->Position->Vars->Unset(name);
}
std::vector<std::string> cmStateSnapshot::UnusedKeys() const
@@ -264,7 +264,11 @@ bool cmStateSnapshot::RaiseScope(std::string const& var, const char* varDef)
cmDefinitions::Raise(var, this->Position->Vars, this->Position->Root);
// Now update the definition in the parent scope.
- this->Position->Parent->Set(var, varDef);
+ if (varDef) {
+ this->Position->Parent->Set(var, varDef);
+ } else {
+ this->Position->Parent->Unset(var);
+ }
return true;
}
diff --git a/Source/cmStateSnapshot.h b/Source/cmStateSnapshot.h
index c315f48..da39127 100644
--- a/Source/cmStateSnapshot.h
+++ b/Source/cmStateSnapshot.h
@@ -9,6 +9,8 @@
#include <string>
#include <vector>
+#include "cm_string_view.hxx"
+
#include "cmLinkedTree.h"
#include "cmPolicies.h"
#include "cmStateTypes.h"
@@ -24,7 +26,7 @@ public:
std::string const* GetDefinition(std::string const& name) const;
bool IsInitialized(std::string const& name) const;
- void SetDefinition(std::string const& name, std::string const& value);
+ void SetDefinition(std::string const& name, cm::string_view value);
void RemoveDefinition(std::string const& name);
std::vector<std::string> UnusedKeys() const;
std::vector<std::string> ClosureKeys() const;
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 4ad0870..259d92a 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -123,7 +123,7 @@ bool cmStringCommand::HandleHashCommand(std::vector<std::string> const& args)
std::unique_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str()));
if (hash) {
std::string out = hash->HashString(args[2]);
- this->Makefile->AddDefinition(args[1], out.c_str());
+ this->Makefile->AddDefinition(args[1], out);
return true;
}
return false;
@@ -153,7 +153,7 @@ bool cmStringCommand::HandleToUpperLowerCommand(
}
// Store the output in the provided variable.
- this->Makefile->AddDefinition(outvar, output.c_str());
+ this->Makefile->AddDefinition(outvar, output);
return true;
}
@@ -179,7 +179,7 @@ bool cmStringCommand::HandleAsciiCommand(std::vector<std::string> const& args)
}
}
// Store the output in the provided variable.
- this->Makefile->AddDefinition(outvar, output.c_str());
+ this->Makefile->AddDefinition(outvar, output);
return true;
}
@@ -216,7 +216,7 @@ bool cmStringCommand::HandleConfigureCommand(
this->Makefile->ConfigureString(args[1], output, atOnly, escapeQuotes);
// Store the output in the provided variable.
- this->Makefile->AddDefinition(args[2], output.c_str());
+ this->Makefile->AddDefinition(args[2], output);
return true;
}
@@ -295,7 +295,7 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
}
// Store the output in the provided variable.
- this->Makefile->AddDefinition(outvar, output.c_str());
+ this->Makefile->AddDefinition(outvar, output);
return true;
}
@@ -342,7 +342,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
}
// Store the output in the provided variable.
- this->Makefile->AddDefinition(outvar, output.c_str());
+ this->Makefile->AddDefinition(outvar, output);
return true;
}
@@ -383,7 +383,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
}
// Store the output in the provided variable.
- this->Makefile->AddDefinition(outvar, output.c_str());
+ this->Makefile->AddDefinition(outvar, output);
return true;
}
@@ -430,7 +430,7 @@ bool cmStringCommand::HandleFindCommand(std::vector<std::string> const& args)
if (std::string::npos != pos) {
std::ostringstream s;
s << pos;
- this->Makefile->AddDefinition(outvar, s.str().c_str());
+ this->Makefile->AddDefinition(outvar, s.str());
return true;
}
@@ -505,7 +505,7 @@ bool cmStringCommand::HandleReplaceCommand(
cmsys::SystemTools::ReplaceString(input, matchExpression.c_str(),
replaceExpression.c_str());
- this->Makefile->AddDefinition(variableName, input.c_str());
+ this->Makefile->AddDefinition(variableName, input);
return true;
}
@@ -538,8 +538,7 @@ bool cmStringCommand::HandleSubstringCommand(
return false;
}
- this->Makefile->AddDefinition(variableName,
- stringValue.substr(begin, end).c_str());
+ this->Makefile->AddDefinition(variableName, stringValue.substr(begin, end));
return true;
}
@@ -581,7 +580,7 @@ bool cmStringCommand::HandleAppendCommand(std::vector<std::string> const& args)
value = oldValue;
}
value += cmJoin(cmMakeRange(args).advance(2), std::string());
- this->Makefile->AddDefinition(variable, value.c_str());
+ this->Makefile->AddDefinition(variable, value);
return true;
}
@@ -605,7 +604,7 @@ bool cmStringCommand::HandlePrependCommand(
if (oldValue) {
value += oldValue;
}
- this->Makefile->AddDefinition(variable, value.c_str());
+ this->Makefile->AddDefinition(variable, value);
return true;
}
@@ -637,7 +636,7 @@ bool cmStringCommand::joinImpl(std::vector<std::string> const& args,
// both `CONCAT` and `JOIN` sub-commands.
std::string value = cmJoin(cmMakeRange(args).advance(varIdx + 1), glue);
- this->Makefile->AddDefinition(variableName, value.c_str());
+ this->Makefile->AddDefinition(variableName, value);
return true;
}
@@ -653,7 +652,7 @@ bool cmStringCommand::HandleMakeCIdentifierCommand(
const std::string& variableName = args[2];
this->Makefile->AddDefinition(variableName,
- cmSystemTools::MakeCidentifier(input).c_str());
+ cmSystemTools::MakeCidentifier(input));
return true;
}
@@ -672,7 +671,7 @@ bool cmStringCommand::HandleGenexStripCommand(
const std::string& variableName = args[2];
- this->Makefile->AddDefinition(variableName, result.c_str());
+ this->Makefile->AddDefinition(variableName, result);
return true;
}
@@ -711,8 +710,8 @@ bool cmStringCommand::HandleStripCommand(std::vector<std::string> const& args)
outLength = endPos - startPos + 1;
}
- this->Makefile->AddDefinition(
- variableName, stringValue.substr(startPos, outLength).c_str());
+ this->Makefile->AddDefinition(variableName,
+ stringValue.substr(startPos, outLength));
return true;
}
@@ -765,7 +764,7 @@ bool cmStringCommand::HandleRepeatCommand(std::vector<std::string> const& args)
break;
}
- this->Makefile->AddDefinition(variableName, result.c_str());
+ this->Makefile->AddDefinition(variableName, result);
return true;
}
@@ -871,7 +870,7 @@ bool cmStringCommand::HandleTimestampCommand(
cmTimestamp timestamp;
std::string result = timestamp.CurrentTime(formatString, utcFlag);
- this->Makefile->AddDefinition(outputVariable, result.c_str());
+ this->Makefile->AddDefinition(outputVariable, result);
return true;
}
@@ -954,7 +953,7 @@ bool cmStringCommand::HandleUuidCommand(std::vector<std::string> const& args)
uuid = cmSystemTools::UpperCase(uuid);
}
- this->Makefile->AddDefinition(outputVariable, uuid.c_str());
+ this->Makefile->AddDefinition(outputVariable, uuid);
return true;
#else
std::ostringstream e;
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 723f280..3ba3640 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -282,115 +282,85 @@ void cmSystemTools::ReportLastSystemError(const char* msg)
cmSystemTools::Error(m);
}
-bool cmSystemTools::IsInternallyOn(const char* val)
-{
- if (!val) {
- return false;
- }
- std::string v = val;
- if (v.size() > 4) {
- return false;
- }
-
- for (char& c : v) {
- c = static_cast<char>(toupper(c));
+bool cmSystemTools::IsInternallyOn(cm::string_view val)
+{
+ return (val.size() == 4) && //
+ (val[0] == 'I' || val[0] == 'i') && //
+ (val[1] == '_') && //
+ (val[2] == 'O' || val[2] == 'o') && //
+ (val[3] == 'N' || val[3] == 'n');
+}
+
+bool cmSystemTools::IsOn(cm::string_view val)
+{
+ switch (val.size()) {
+ case 1:
+ return val[0] == '1' || val[0] == 'Y' || val[0] == 'y';
+ case 2:
+ return //
+ (val[0] == 'O' || val[0] == 'o') && //
+ (val[1] == 'N' || val[1] == 'n');
+ case 3:
+ return //
+ (val[0] == 'Y' || val[0] == 'y') && //
+ (val[1] == 'E' || val[1] == 'e') && //
+ (val[2] == 'S' || val[2] == 's');
+ case 4:
+ return //
+ (val[0] == 'T' || val[0] == 't') && //
+ (val[1] == 'R' || val[1] == 'r') && //
+ (val[2] == 'U' || val[2] == 'u') && //
+ (val[3] == 'E' || val[3] == 'e');
+ default:
+ break;
}
- return v == "I_ON";
-}
-bool cmSystemTools::IsOn(const char* val)
-{
- if (!val) {
- return false;
- }
- /* clang-format off */
- // "1"
- if (val[0] == '1' && val[1] == '\0') {
- return true;
- }
- // "ON"
- if ((val[0] == 'O' || val[0] == 'o') &&
- (val[1] == 'N' || val[1] == 'n') && val[2] == '\0') {
- return true;
- }
- // "Y", "YES"
- if ((val[0] == 'Y' || val[0] == 'y') && (val[1] == '\0' || (
- (val[1] == 'E' || val[1] == 'e') &&
- (val[2] == 'S' || val[2] == 's') && val[3] == '\0'))) {
- return true;
- }
- // "TRUE"
- if ((val[0] == 'T' || val[0] == 't') &&
- (val[1] == 'R' || val[1] == 'r') &&
- (val[2] == 'U' || val[2] == 'u') &&
- (val[3] == 'E' || val[3] == 'e') && val[4] == '\0') {
- return true;
- }
- /* clang-format on */
return false;
}
-bool cmSystemTools::IsOn(const std::string& val)
+bool cmSystemTools::IsNOTFOUND(cm::string_view val)
{
- return cmSystemTools::IsOn(val.c_str());
+ return (val == "NOTFOUND") || cmHasLiteralSuffix(val, "-NOTFOUND");
}
-bool cmSystemTools::IsNOTFOUND(const char* val)
+bool cmSystemTools::IsOff(cm::string_view val)
{
- if (strcmp(val, "NOTFOUND") == 0) {
- return true;
+ switch (val.size()) {
+ case 0:
+ return true;
+ case 1:
+ return val[0] == '0' || val[0] == 'N' || val[0] == 'n';
+ case 2:
+ return //
+ (val[0] == 'N' || val[0] == 'n') && //
+ (val[1] == 'O' || val[1] == 'o');
+ case 3:
+ return //
+ (val[0] == 'O' || val[0] == 'o') && //
+ (val[1] == 'F' || val[1] == 'f') && //
+ (val[2] == 'F' || val[2] == 'f');
+ case 5:
+ return //
+ (val[0] == 'F' || val[0] == 'f') && //
+ (val[1] == 'A' || val[1] == 'a') && //
+ (val[2] == 'L' || val[2] == 'l') && //
+ (val[3] == 'S' || val[3] == 's') && //
+ (val[4] == 'E' || val[4] == 'e');
+ case 6:
+ return //
+ (val[0] == 'I' || val[0] == 'i') && //
+ (val[1] == 'G' || val[1] == 'g') && //
+ (val[2] == 'N' || val[2] == 'n') && //
+ (val[3] == 'O' || val[3] == 'o') && //
+ (val[4] == 'R' || val[4] == 'r') && //
+ (val[5] == 'E' || val[5] == 'e');
+ default:
+ break;
}
- return cmHasLiteralSuffix(val, "-NOTFOUND");
-}
-bool cmSystemTools::IsOff(const char* val)
-{
- // ""
- if (!val || val[0] == '\0') {
- return true;
- }
- /* clang-format off */
- // "0"
- if (val[0] == '0' && val[1] == '\0') {
- return true;
- }
- // "OFF"
- if ((val[0] == 'O' || val[0] == 'o') &&
- (val[1] == 'F' || val[1] == 'f') &&
- (val[2] == 'F' || val[2] == 'f') && val[3] == '\0') {
- return true;
- }
- // "N", "NO"
- if ((val[0] == 'N' || val[0] == 'n') && (val[1] == '\0' || (
- (val[1] == 'O' || val[1] == 'o') && val[2] == '\0'))) {
- return true;
- }
- // "FALSE"
- if ((val[0] == 'F' || val[0] == 'f') &&
- (val[1] == 'A' || val[1] == 'a') &&
- (val[2] == 'L' || val[2] == 'l') &&
- (val[3] == 'S' || val[3] == 's') &&
- (val[4] == 'E' || val[4] == 'e') && val[5] == '\0') {
- return true;
- }
- // "IGNORE"
- if ((val[0] == 'I' || val[0] == 'i') &&
- (val[1] == 'G' || val[1] == 'g') &&
- (val[2] == 'N' || val[2] == 'n') &&
- (val[3] == 'O' || val[3] == 'o') &&
- (val[4] == 'R' || val[4] == 'r') &&
- (val[5] == 'E' || val[5] == 'e') && val[6] == '\0') {
- return true;
- }
- /* clang-format on */
return cmSystemTools::IsNOTFOUND(val);
}
-bool cmSystemTools::IsOff(const std::string& val)
-{
- return cmSystemTools::IsOff(val.c_str());
-}
-
void cmSystemTools::ParseWindowsCommandLine(const char* command,
std::vector<std::string>& args)
{
@@ -2397,7 +2367,8 @@ struct cmSystemToolsRPathInfo
#if defined(CMAKE_USE_ELF_PARSER)
bool cmSystemTools::ChangeRPath(std::string const& file,
std::string const& oldRPath,
- std::string const& newRPath, std::string* emsg,
+ std::string const& newRPath,
+ bool removeEnvironmentRPath, std::string* emsg,
bool* changed)
{
if (changed) {
@@ -2484,7 +2455,9 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
// Construct the new value which preserves the part of the path
// not being changed.
- rp[rp_count].Value = se[i]->Value.substr(0, prefix_len);
+ if (!removeEnvironmentRPath) {
+ rp[rp_count].Value = se[i]->Value.substr(0, prefix_len);
+ }
rp[rp_count].Value += newRPath;
rp[rp_count].Value += se[i]->Value.substr(pos + oldRPath.length());
@@ -2570,6 +2543,7 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
bool cmSystemTools::ChangeRPath(std::string const& /*file*/,
std::string const& /*oldRPath*/,
std::string const& /*newRPath*/,
+ bool /*removeEnvironmentRPath*/,
std::string* /*emsg*/, bool* /*changed*/)
{
return false;
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index a9c03bd..1962389 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -8,6 +8,7 @@
#include "cmCryptoHash.h"
#include "cmDuration.h"
#include "cmProcessOutput.h"
+#include "cm_string_view.hxx"
#include "cmsys/Process.h"
#include "cmsys/SystemTools.hxx" // IWYU pragma: export
#include <functional>
@@ -149,26 +150,45 @@ public:
* forced this value. This is not the same as On, but this
* may be considered as "internally switched on".
*/
- static bool IsInternallyOn(const char* val);
+ static bool IsInternallyOn(cm::string_view val);
+ static inline bool IsInternallyOn(const char* val)
+ {
+ if (!val) {
+ return false;
+ }
+ return IsInternallyOn(cm::string_view(val));
+ }
+
/**
- * does a string indicate a true or on value ? This is not the same
- * as ifdef.
+ * Does a string indicate a true or on value? This is not the same as ifdef.
*/
- static bool IsOn(const char* val);
- static bool IsOn(const std::string& val);
+ static bool IsOn(cm::string_view val);
+ inline static bool IsOn(const char* val)
+ {
+ if (!val) {
+ return false;
+ }
+ return IsOn(cm::string_view(val));
+ }
/**
- * does a string indicate a false or off value ? Note that this is
+ * Does a string indicate a false or off value ? Note that this is
* not the same as !IsOn(...) because there are a number of
* ambiguous values such as "/usr/local/bin" a path will result in
* IsON and IsOff both returning false. Note that the special path
* NOTFOUND, *-NOTFOUND or IGNORE will cause IsOff to return true.
*/
- static bool IsOff(const char* val);
- static bool IsOff(const std::string& val);
+ static bool IsOff(cm::string_view val);
+ inline static bool IsOff(const char* val)
+ {
+ if (!val) {
+ return true;
+ }
+ return IsOff(cm::string_view(val));
+ }
//! Return true if value is NOTFOUND or ends in -NOTFOUND.
- static bool IsNOTFOUND(const char* value);
+ static bool IsNOTFOUND(cm::string_view val);
//! Return true if the path is a framework
static bool IsPathToFramework(const std::string& value);
@@ -473,6 +493,7 @@ public:
/** Try to set the RPATH in an ELF binary. */
static bool ChangeRPath(std::string const& file, std::string const& oldRPath,
std::string const& newRPath,
+ bool removeEnvironmentRPath,
std::string* emsg = nullptr,
bool* changed = nullptr);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index b1a0127..beccfce 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -282,6 +282,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("BUILD_RPATH");
initProp("BUILD_RPATH_USE_ORIGIN");
initProp("INSTALL_NAME_DIR");
+ initProp("INSTALL_REMOVE_ENVIRONMENT_RPATH");
initPropValue("INSTALL_RPATH", "");
initPropValue("INSTALL_RPATH_USE_LINK_PATH", "OFF");
initProp("INTERPROCEDURAL_OPTIMIZATION");
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index a92c2a0..ed944ac 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -137,7 +137,7 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv,
// now put the output into the variables
if (!this->RunOutputVariable.empty()) {
this->Makefile->AddDefinition(this->RunOutputVariable,
- runOutputContents.c_str());
+ runOutputContents);
}
if (!this->OutputVariable.empty()) {
@@ -148,8 +148,7 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv,
if (compileOutput) {
runOutputContents = compileOutput + runOutputContents;
}
- this->Makefile->AddDefinition(this->OutputVariable,
- runOutputContents.c_str());
+ this->Makefile->AddDefinition(this->OutputVariable, runOutputContents);
}
}
}
diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx
index c02157a..9878ff1 100644
--- a/Source/cmVariableRequiresCommand.cxx
+++ b/Source/cmVariableRequiresCommand.cxx
@@ -42,7 +42,7 @@ bool cmVariableRequiresCommand::InitialPass(
// if reqVar is set to true, but requirementsMet is false , then
// set reqVar to false.
if (!reqVar || (!requirementsMet && this->Makefile->IsOn(reqVar))) {
- this->Makefile->AddDefinition(resultVariable, requirementsMet);
+ this->Makefile->AddDefinitionBool(resultVariable, requirementsMet);
}
if (!requirementsMet) {
diff --git a/Source/kwsys/CommandLineArguments.cxx b/Source/kwsys/CommandLineArguments.cxx
index a97f7a8..dc9f01d 100644
--- a/Source/kwsys/CommandLineArguments.cxx
+++ b/Source/kwsys/CommandLineArguments.cxx
@@ -67,10 +67,10 @@ class CommandLineArgumentsInternal
{
public:
CommandLineArgumentsInternal()
+ : UnknownArgumentCallback{ KWSYS_NULLPTR }
+ , ClientData{ KWSYS_NULLPTR }
+ , LastArgument{ 0 }
{
- this->UnknownArgumentCallback = KWSYS_NULLPTR;
- this->ClientData = KWSYS_NULLPTR;
- this->LastArgument = 0;
}
typedef CommandLineArgumentsVectorOfStrings VectorOfStrings;
diff --git a/Source/kwsys/RegularExpression.cxx b/Source/kwsys/RegularExpression.cxx
index 5f84b19..3e10765 100644
--- a/Source/kwsys/RegularExpression.cxx
+++ b/Source/kwsys/RegularExpression.cxx
@@ -337,7 +337,6 @@ bool RegularExpression::compile(const char* exp)
{
const char* scan;
const char* longest;
- size_t len;
int flags;
if (exp == KWSYS_NULLPTR) {
@@ -412,7 +411,7 @@ bool RegularExpression::compile(const char* exp)
//
if (flags & SPSTART) {
longest = KWSYS_NULLPTR;
- len = 0;
+ size_t len = 0;
for (; scan != KWSYS_NULLPTR; scan = regnext(scan))
if (OP(scan) == EXACTLY && strlen(OPERAND(scan)) >= len) {
longest = OPERAND(scan);
diff --git a/Source/kwsys/RegularExpression.hxx.in b/Source/kwsys/RegularExpression.hxx.in
index b7b93f9..ed86418 100644
--- a/Source/kwsys/RegularExpression.hxx.in
+++ b/Source/kwsys/RegularExpression.hxx.in
@@ -407,8 +407,12 @@ private:
* Create an empty regular expression.
*/
inline RegularExpression::RegularExpression()
+ : regstart{}
+ , reganch{}
+ , regmust{}
+ , program{ 0 }
+ , progsize{}
{
- this->program = 0;
}
/**
@@ -416,8 +420,12 @@ inline RegularExpression::RegularExpression()
* compiles s.
*/
inline RegularExpression::RegularExpression(const char* s)
+ : regstart{}
+ , reganch{}
+ , regmust{}
+ , program{ 0 }
+ , progsize{}
{
- this->program = 0;
if (s) {
this->compile(s);
}
@@ -428,8 +436,12 @@ inline RegularExpression::RegularExpression(const char* s)
* compiles s.
*/
inline RegularExpression::RegularExpression(const std::string& s)
+ : regstart{}
+ , reganch{}
+ , regmust{}
+ , program{ 0 }
+ , progsize{}
{
- this->program = 0;
this->compile(s);
}
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 2135913..36f24c7 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -3394,15 +3394,16 @@ static void SystemToolsAppendComponents(
static const std::string cur = ".";
for (std::vector<std::string>::const_iterator i = first; i != last; ++i) {
if (*i == up) {
- if (out_components.size() > 1) {
+ // Remove the previous component if possible. Ignore ../ components
+ // that try to go above the root. Keep ../ components if they are
+ // at the beginning of a relative path (base path is relative).
+ if (out_components.size() > 1 && out_components.back() != up) {
out_components.resize(out_components.size() - 1);
+ } else if (!out_components.empty() && out_components[0].empty()) {
+ out_components.emplace_back(std::move(*i));
}
} else if (!i->empty() && *i != cur) {
-#if __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L)
- out_components.push_back(std::move(*i));
-#else
- out_components.push_back(*i);
-#endif
+ out_components.emplace_back(std::move(*i));
}
}
}
@@ -4738,7 +4739,7 @@ void SystemTools::ClassInitialize()
// Test progressively shorter logical-to-physical mappings.
std::string cwd_str = cwd;
std::string pwd_path;
- Realpath(pwd_str.c_str(), pwd_path);
+ Realpath(pwd_str, pwd_path);
while (cwd_str == pwd_path && cwd_str != pwd_str) {
// The current pair of paths is a working logical mapping.
cwd_changed = cwd_str;
@@ -4748,7 +4749,7 @@ void SystemTools::ClassInitialize()
// mapping still works.
pwd_str = SystemTools::GetFilenamePath(pwd_str);
cwd_str = SystemTools::GetFilenamePath(cwd_str);
- Realpath(pwd_str.c_str(), pwd_path);
+ Realpath(pwd_str, pwd_path);
}
// Add the translation to keep the logical path name.
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index 9a40b53..ffa6a29 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -684,9 +684,10 @@ static bool CheckRelativePaths()
}
static bool CheckCollapsePath(const std::string& path,
- const std::string& expected)
+ const std::string& expected,
+ const char* base = nullptr)
{
- std::string result = kwsys::SystemTools::CollapseFullPath(path);
+ std::string result = kwsys::SystemTools::CollapseFullPath(path, base);
if (!kwsys::SystemTools::ComparePath(expected, result)) {
std::cerr << "CollapseFullPath(" << path << ") yielded " << result
<< " instead of " << expected << std::endl;
@@ -710,6 +711,9 @@ static bool CheckCollapsePath()
res &= CheckCollapsePath("C:/", "C:/");
res &= CheckCollapsePath("C:/../", "C:/");
res &= CheckCollapsePath("C:/../../", "C:/");
+ res &= CheckCollapsePath("../b", "../../b", "../");
+ res &= CheckCollapsePath("../a/../b", "../b", "../rel");
+ res &= CheckCollapsePath("a/../b", "../rel/b", "../rel");
return res;
}
diff --git a/Tests/AliasTarget/CMakeLists.txt b/Tests/AliasTarget/CMakeLists.txt
index 6271988..fc70135 100644
--- a/Tests/AliasTarget/CMakeLists.txt
+++ b/Tests/AliasTarget/CMakeLists.txt
@@ -7,7 +7,7 @@ set(CMAKE_CXX_STANDARD 98)
# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
- set(CMAKE_CXX_STANDARD 14)
+ set(CMAKE_CXX_STANDARD 11)
endif()
add_library(foo SHARED empty.cpp)
diff --git a/Tests/CMakeTests/ELFTest.cmake.in b/Tests/CMakeTests/ELFTest.cmake.in
index 4635778..85c2360 100644
--- a/Tests/CMakeTests/ELFTest.cmake.in
+++ b/Tests/CMakeTests/ELFTest.cmake.in
@@ -25,13 +25,38 @@ foreach(f ${files})
# Change the RPATH.
file(RPATH_CHANGE FILE "${f}"
OLD_RPATH "/sample/rpath"
- NEW_RPATH "/rpath/sample")
+ NEW_RPATH "/path1:/path2")
set(rpath)
- file(STRINGS "${f}" rpath REGEX "/rpath/sample" LIMIT_COUNT 1)
+ file(STRINGS "${f}" rpath REGEX "/path1:/path2" LIMIT_COUNT 1)
if(NOT rpath)
message(FATAL_ERROR "RPATH not changed in ${f}")
endif()
+ # Change the RPATH without compiler defined rpath removed
+ file(RPATH_CHANGE FILE "${f}"
+ OLD_RPATH "/path2"
+ NEW_RPATH "/path3")
+ set(rpath)
+ file(STRINGS "${f}" rpath REGEX "/path1:/path3" LIMIT_COUNT 1)
+ if(NOT rpath)
+ message(FATAL_ERROR "RPATH not updated in ${f}")
+ endif()
+
+ # Change the RPATH with compiler defined rpath removed
+ file(RPATH_CHANGE FILE "${f}"
+ OLD_RPATH "/path3"
+ NEW_RPATH "/rpath/sample"
+ INSTALL_REMOVE_ENVIRONMENT_RPATH)
+ set(rpath)
+ file(STRINGS "${f}" rpath REGEX "/rpath/sample" LIMIT_COUNT 1)
+ if(NOT rpath)
+ message(FATAL_ERROR "RPATH not updated in ${f}")
+ endif()
+ file(STRINGS "${f}" rpath REGEX "/path1" LIMIT_COUNT 1)
+ if(rpath)
+ message(FATAL_ERROR "RPATH not removed in ${f}")
+ endif()
+
# Remove the RPATH.
file(RPATH_REMOVE FILE "${f}")
set(rpath)
diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt
index fef83f6..2e41754 100644
--- a/Tests/Complex/CMakeLists.txt
+++ b/Tests/Complex/CMakeLists.txt
@@ -446,11 +446,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
set(CMAKE_CXX_STANDARD 11)
endif()
-if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
- CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
- set(CMAKE_CXX_STANDARD 14)
-endif()
-
#
# Create the libs and the main exe
#
diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt
index 77baa4c..628cd4e 100644
--- a/Tests/ComplexOneConfig/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/CMakeLists.txt
@@ -403,11 +403,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
set(CMAKE_CXX_STANDARD 11)
endif()
-if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
- CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
- set(CMAKE_CXX_STANDARD 14)
-endif()
-
#
# Create the libs and the main exe
#
diff --git a/Tests/MathTest/CMakeLists.txt b/Tests/MathTest/CMakeLists.txt
index 5403d29..396f633 100644
--- a/Tests/MathTest/CMakeLists.txt
+++ b/Tests/MathTest/CMakeLists.txt
@@ -16,6 +16,8 @@ set(expressions
"1000 -12*5"
"1000 +12*-5"
"1000 -12*-5"
+ "~~1"
+ "1000 & ~0"
)
set(FILE_EXPRESSIONS "extern void test_expression(int x, int y, const char * text);\n")
diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
index b30928d..cffef5a 100644
--- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
+++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
@@ -133,9 +133,7 @@ endif()
# for msvc the compiler version determines which c++11 features are available.
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"
- OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
- AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"
- AND "x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC" ))
+ OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"))
if(";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_delegating_constructors;")
list(APPEND true_defs EXPECTED_COMPILER_CXX_DELEGATING_CONSTRUCTORS)
list(APPEND true_defs EXPECTED_COMPILER_CXX_VARIADIC_TEMPLATES)
diff --git a/Tests/Plugin/CMakeLists.txt b/Tests/Plugin/CMakeLists.txt
index c4540db..8e8fa07 100644
--- a/Tests/Plugin/CMakeLists.txt
+++ b/Tests/Plugin/CMakeLists.txt
@@ -5,17 +5,6 @@ project(Plugin)
# We need proper C++98 support from the compiler
set(CMAKE_CXX_STANDARD 98)
-# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers
-if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
- CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
- set(CMAKE_CXX_STANDARD 11)
-endif()
-
-if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
- CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
- set(CMAKE_CXX_STANDARD 14)
-endif()
-
# Test per-target output directory properties.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${Plugin_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${Plugin_BINARY_DIR}/lib/plugin)
@@ -40,6 +29,12 @@ include_directories(
${Plugin_SOURCE_DIR}/include
)
+# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers
+if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
+ CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
+ set(CMAKE_CXX_STANDARD 11)
+endif()
+
# Create an executable that exports an API for use by plugins.
add_executable(example_exe src/example_exe.cxx)
set_target_properties(example_exe PROPERTIES
diff --git a/Tests/RunCMake/BuildDepends/BuildUnderSource.c b/Tests/RunCMake/BuildDepends/BuildUnderSource.c
new file mode 100644
index 0000000..688a040
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/BuildUnderSource.c
@@ -0,0 +1,5 @@
+#include "BuildUnderSource.h"
+int main(void)
+{
+ return BUILD_UNDER_SOURCE;
+}
diff --git a/Tests/RunCMake/BuildDepends/BuildUnderSource.cmake b/Tests/RunCMake/BuildDepends/BuildUnderSource.cmake
new file mode 100644
index 0000000..aa2a44f
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/BuildUnderSource.cmake
@@ -0,0 +1,9 @@
+enable_language(C)
+include_directories(include)
+add_executable(BuildUnderSource BuildUnderSource.c)
+
+file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT "
+set(check_pairs
+ \"$<TARGET_FILE:BuildUnderSource>|${CMAKE_CURRENT_SOURCE_DIR}/include/BuildUnderSource.h\"
+ )
+")
diff --git a/Tests/RunCMake/BuildDepends/BuildUnderSource.step1.cmake b/Tests/RunCMake/BuildDepends/BuildUnderSource.step1.cmake
new file mode 100644
index 0000000..2cdd32b
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/BuildUnderSource.step1.cmake
@@ -0,0 +1,3 @@
+file(WRITE "${RunCMake_TEST_SOURCE_DIR}/include/BuildUnderSource.h" [[
+#define BUILD_UNDER_SOURCE 1
+]])
diff --git a/Tests/RunCMake/BuildDepends/BuildUnderSource.step2.cmake b/Tests/RunCMake/BuildDepends/BuildUnderSource.step2.cmake
new file mode 100644
index 0000000..8e4b858
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/BuildUnderSource.step2.cmake
@@ -0,0 +1,3 @@
+file(WRITE "${RunCMake_TEST_SOURCE_DIR}/include/BuildUnderSource.h" [[
+#define BUILD_UNDER_SOURCE 2
+]])
diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
index 3445beb..14ae243 100644
--- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
+++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
@@ -9,7 +9,9 @@ endif()
function(run_BuildDepends CASE)
# Use a single build tree for a few tests without cleaning.
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${CASE}-build)
+ if(NOT RunCMake_TEST_BINARY_DIR)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${CASE}-build)
+ endif()
set(RunCMake_TEST_NO_CLEAN 1)
if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug)
@@ -44,6 +46,18 @@ endif()
run_BuildDepends(Custom-Symbolic-and-Byproduct)
run_BuildDepends(Custom-Always)
+# Test header dependencies with a build tree underneath a source tree.
+set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/BuildUnderSource")
+set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/BuildUnderSource/build")
+file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}")
+file(MAKE_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}/include")
+foreach(f CMakeLists.txt BuildUnderSource.cmake BuildUnderSource.c)
+ configure_file("${RunCMake_SOURCE_DIR}/${f}" "${RunCMake_TEST_SOURCE_DIR}/${f}" COPYONLY)
+endforeach()
+run_BuildDepends(BuildUnderSource)
+unset(RunCMake_TEST_BINARY_DIR)
+unset(RunCMake_TEST_SOURCE_DIR)
+
if(RunCMake_GENERATOR MATCHES "Make")
run_BuildDepends(MakeCustomIncludes)
if(NOT "${RunCMake_BINARY_DIR}" STREQUAL "${RunCMake_SOURCE_DIR}")
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake
index c4db11b..9fcc5bc 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake
@@ -26,12 +26,14 @@ add_custom_command(OUTPUT output2
# DoesNotUseEmulator: The command will fail if emulator is prepended
add_custom_command(OUTPUT output3
+ COMMAND ${CMAKE_COMMAND} -E echo generated_exe_emulator_unexpected
COMMAND $<TARGET_FILE:generated_exe_emulator_unexpected>
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output3
DEPENDS generated_exe_emulator_unexpected)
# DoesNotUseEmulator: The command will fail if emulator is prepended
add_custom_command(OUTPUT outputImp
+ COMMAND ${CMAKE_COMMAND} -E echo generated_exe_emulator_unexpected_imported
COMMAND generated_exe_emulator_unexpected_imported
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/outputImp
)
@@ -39,6 +41,7 @@ add_custom_command(OUTPUT outputImp
# UsesEmulator: The command only succeeds if the emulator is prepended
# to the command.
add_custom_command(OUTPUT output4
+ COMMAND ${CMAKE_COMMAND} -E echo generated_exe_emulator_expected
COMMAND generated_exe_emulator_expected
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/output4
DEPENDS generated_exe_emulator_expected)
diff --git a/Tests/RunCMake/GenerateExportHeader/GEH.cmake b/Tests/RunCMake/GenerateExportHeader/GEH.cmake
index b3f1c7f..ae9a84c 100644
--- a/Tests/RunCMake/GenerateExportHeader/GEH.cmake
+++ b/Tests/RunCMake/GenerateExportHeader/GEH.cmake
@@ -51,11 +51,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
set(CMAKE_CXX_STANDARD 11)
endif()
-if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
- CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
- set(CMAKE_CXX_STANDARD 14)
-endif()
-
add_subdirectory(lib_shared_and_static)
if(CMAKE_SYSTEM_NAME MATCHES "AIX" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
diff --git a/Tests/RunCMake/find_file/FromPrefixPath.cmake b/Tests/RunCMake/find_file/FromPrefixPath.cmake
index 1bf8409..63c6a07 100644
--- a/Tests/RunCMake/find_file/FromPrefixPath.cmake
+++ b/Tests/RunCMake/find_file/FromPrefixPath.cmake
@@ -1,3 +1,4 @@
+set(ENV_PATH "$ENV{PATH}")
set(ENV{PATH} "")
foreach(path "/does_not_exist" "/include" "")
unset(PrefixInPATH_File CACHE)
@@ -15,3 +16,4 @@ foreach(path "/does_not_exist" "/include" "")
message(STATUS "PrefixInPATH_File='${PrefixInPATH_File}'")
endforeach()
set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH ON)
+set(ENV{PATH} "${ENV_PATH}")
diff --git a/Tests/RunCMake/find_package/FromPATHEnv-stdout.txt b/Tests/RunCMake/find_package/FromPATHEnv-stdout.txt
new file mode 100644
index 0000000..2ead349
--- /dev/null
+++ b/Tests/RunCMake/find_package/FromPATHEnv-stdout.txt
@@ -0,0 +1,9 @@
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='1'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
diff --git a/Tests/RunCMake/find_package/FromPATHEnv.cmake b/Tests/RunCMake/find_package/FromPATHEnv.cmake
new file mode 100644
index 0000000..4822b13
--- /dev/null
+++ b/Tests/RunCMake/find_package/FromPATHEnv.cmake
@@ -0,0 +1,27 @@
+set(ENV_PATH "$ENV{PATH}")
+foreach(path "/does_not_exist" "/PackageRoot" "")
+ unset(Resolved_FOUND CACHE)
+ set(Resolved_DIR "")
+ set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}")
+ find_package(Resolved QUIET)
+ message(STATUS "Resolved_FOUND='${Resolved_FOUND}'")
+endforeach()
+
+set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF)
+foreach(path "/does_not_exist" "/PackageRoot" "")
+ unset(Resolved_FOUND CACHE)
+ set(Resolved_DIR "")
+ set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}")
+ find_package(Resolved QUIET)
+ message(STATUS "Resolved_FOUND='${Resolved_FOUND}'")
+endforeach()
+
+set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH ON)
+foreach(path "/does_not_exist" "/PackageRoot" "")
+ unset(Resolved_FOUND CACHE)
+ set(Resolved_DIR "")
+ set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}")
+ find_package(Resolved NO_SYSTEM_ENVIRONMENT_PATH QUIET)
+ message(STATUS "Resolved_FOUND='${Resolved_FOUND}'")
+endforeach()
+set(ENV{PATH} "${ENV_PATH}")
diff --git a/Tests/RunCMake/find_package/FromPrefixPath-stdout.txt b/Tests/RunCMake/find_package/FromPrefixPath-stdout.txt
new file mode 100644
index 0000000..2ead349
--- /dev/null
+++ b/Tests/RunCMake/find_package/FromPrefixPath-stdout.txt
@@ -0,0 +1,9 @@
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='1'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
diff --git a/Tests/RunCMake/find_package/FromPrefixPath.cmake b/Tests/RunCMake/find_package/FromPrefixPath.cmake
new file mode 100644
index 0000000..be853c1
--- /dev/null
+++ b/Tests/RunCMake/find_package/FromPrefixPath.cmake
@@ -0,0 +1,29 @@
+set(ENV_PATH "$ENV{PATH}")
+set(ENV{PATH} "")
+foreach(path "/does_not_exist" "/PackageRoot" "")
+ unset(Resolved_FOUND CACHE)
+ set(Resolved_DIR "")
+ set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}${path}")
+ find_package(Resolved QUIET)
+ message(STATUS "Resolved_FOUND='${Resolved_FOUND}'")
+endforeach()
+
+set(CMAKE_FIND_USE_CMAKE_PATH OFF)
+set(CMAKE_PREFIX_PATH )
+foreach(path "/does_not_exist" "/PackageRoot" "")
+ unset(Resolved_FOUND CACHE)
+ set(Resolved_DIR "")
+ set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}${path}")
+ find_package(Resolved QUIET)
+ message(STATUS "Resolved_FOUND='${Resolved_FOUND}'")
+endforeach()
+
+set(CMAKE_FIND_USE_CMAKE_PATH ON)
+foreach(path "/does_not_exist" "/PackageRoot" "")
+ unset(Resolved_FOUND CACHE)
+ set(Resolved_DIR "")
+ set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}${path}")
+ find_package(Resolved NO_CMAKE_PATH QUIET)
+ message(STATUS "Resolved_FOUND='${Resolved_FOUND}'")
+endforeach()
+set(ENV{PATH} "${ENV_PATH}")
diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake
index 066523e..208f83c 100644
--- a/Tests/RunCMake/find_package/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake
@@ -3,6 +3,8 @@ include(RunCMake)
run_cmake(CMP0074-WARN)
run_cmake(CMP0074-OLD)
run_cmake(ComponentRequiredAndOptional)
+run_cmake(FromPATHEnv)
+run_cmake(FromPrefixPath)
run_cmake(MissingNormal)
run_cmake(MissingNormalRequired)
run_cmake(MissingNormalVersion)
diff --git a/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt
index 9e73ed5..22226f2 100644
--- a/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt
+++ b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt
@@ -1,5 +1,5 @@
^CMake Error at MATH-InvalidExpression.cmake:1 \(math\):
- math cannot parse the expression: "INVALID": syntax error, unexpected \$end,
- expecting exp_PLUS or exp_MINUS or exp_OPENPARENT or exp_NUMBER \(7\).
+ math cannot parse the expression: "INVALID": syntax error, unexpected \$end
+ \(7\).
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$