summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/target_precompile_headers.rst122
-rw-r--r--Help/guide/tutorial/index.rst4
-rw-r--r--Help/manual/cmake-compile-features.7.rst7
-rw-r--r--Help/manual/cmake-policies.7.rst8
-rw-r--r--Help/manual/cmake-properties.7.rst1
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/manual/cmake.1.rst24
-rw-r--r--Help/policy/CMP0098.rst30
-rw-r--r--Help/prop_tgt/INTERFACE_PRECOMPILE_HEADERS.rst2
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_WORKING_DIRECTORY.rst13
-rw-r--r--Help/release/dev/FindFLEX-work-dir.rst6
-rw-r--r--Help/release/dev/command_rm.rst12
-rw-r--r--Help/release/dev/sdcc-new-librarian.rst6
-rw-r--r--Help/release/dev/xcode-scheme-workdir.rst7
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_WORKING_DIRECTORY.rst12
-rw-r--r--Modules/CMakeAddFortranSubdirectory.cmake2
-rw-r--r--Modules/CMakeSwiftInformation.cmake4
-rw-r--r--Modules/ExternalProject.cmake6
-rw-r--r--Modules/FindCUDA.cmake2
-rw-r--r--Modules/FindCUDA/run_nvcc.cmake6
-rw-r--r--Modules/FindFLEX.cmake73
-rw-r--r--Modules/Internal/CPack/CPackNuGet.cmake8
-rw-r--r--Modules/Platform/Generic-SDCC-C.cmake32
-rw-r--r--Modules/Platform/Windows-GNU.cmake2
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackGenerator.cxx11
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx5
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.cxx2
-rw-r--r--Source/CPack/cmCPackPKGGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.cxx3
-rw-r--r--Source/CPack/cpack.cxx1
-rw-r--r--Source/CursesDialog/ccmake.cxx22
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.cxx22
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.h13
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx46
-rw-r--r--Source/cmExtraCodeLiteGenerator.cxx5
-rw-r--r--Source/cmFileLock.cxx25
-rw-r--r--Source/cmFileLock.h2
-rw-r--r--Source/cmFileLockPool.cxx52
-rw-r--r--Source/cmFileLockPool.h14
-rw-r--r--Source/cmGeneratorTarget.cxx9
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx2
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx2
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx2
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx54
-rw-r--r--Source/cmPolicies.h5
-rw-r--r--Source/cmSystemTools.cxx2
-rw-r--r--Source/cmTarget.cxx8
-rw-r--r--Source/cmXCodeScheme.cxx28
-rw-r--r--Source/cmXCodeScheme.h6
-rw-r--r--Source/cmake.cxx7
-rw-r--r--Source/cmakemain.cxx1
-rw-r--r--Source/cmcmd.cxx92
-rw-r--r--Source/ctest.cxx1
-rw-r--r--Source/kwsys/SystemTools.cxx6
-rw-r--r--Tests/CMakeTestMultipleConfigures/RunCMake.cmake6
-rw-r--r--Tests/CPackComponentsDEB/CMakeLists.txt2
-rw-r--r--Tests/Complex/CMakeLists.txt2
-rw-r--r--Tests/Complex/Library/CMakeLists.txt2
-rw-r--r--Tests/ComplexOneConfig/CMakeLists.txt2
-rw-r--r--Tests/ComplexOneConfig/Library/CMakeLists.txt2
-rw-r--r--Tests/CustomCommand/CMakeLists.txt4
-rw-r--r--Tests/ExportImport/CMakeLists.txt2
-rw-r--r--Tests/FortranOnly/CMakeLists.txt4
-rw-r--r--Tests/JavaExportImport/CMakeLists.txt2
-rw-r--r--Tests/LinkDirectory/CMakeLists.txt2
-rw-r--r--Tests/MacRuntimePath/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/ResourceCommon.cmake2
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_bad_argument-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_bad_argument-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_directory_link_existing-check.cmake3
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_directory_link_existing-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_empty_file_specified-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_empty_file_specified.cmake8
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_file_force_existing-check.cmake3
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_file_force_existing-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_file_force_non_existing-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_file_link_existing-check.cmake3
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_file_link_existing-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_file_link_non_existing-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_file_non_force_existing-check.cmake3
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_file_non_force_existing-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_file_non_force_non_existing-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_file_non_force_non_existing-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_file_recursive_existing-check.cmake3
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_file_recursive_existing-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_file_recursive_non_existing-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_file_recursive_non_existing-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_force_recursive_directory_with_files-check.cmake3
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_force_recursive_directory_with_files-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_force_recursive_non_existing_file-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_no_file_specified-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_no_file_specified-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-check.cmake3
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_recursive_directory-two-directories-check.cmake3
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_recursive_directory-two-directories-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_recursive_directory_link_existing-check.cmake3
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_recursive_directory_link_existing-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_recursive_file_link_existing-check.cmake3
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_recursive_file_link_existing-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_rm_recursive_file_link_non_existing-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake70
-rw-r--r--Tests/RunCMake/ParseImplicitData/mingw.org-C-GNU-4.9.3.input2
-rw-r--r--Tests/RunCMake/ParseImplicitData/mingw.org-CXX-GNU-4.9.3.input2
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake9
-rw-r--r--Tests/RunCMake/PrecompileHeaders/foobar.c8
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake1
-rw-r--r--Tests/StagingPrefix/CMakeLists.txt2
-rw-r--r--Tests/SubDir/Examples/example1/CMakeLists.txt2
-rw-r--r--Tests/SubDirSpaces/Some Examples/example1/CMakeLists.txt2
-rw-r--r--Tests/VSMidl/CMakeLists.txt4
-rw-r--r--Utilities/CMakeLists.txt2
-rw-r--r--Utilities/IWYU/mapping.imp2
-rw-r--r--Utilities/cmcurl/CMake/cmake_uninstall.cmake.in2
-rw-r--r--cmake_uninstall.cmake.in2
120 files changed, 773 insertions, 283 deletions
diff --git a/Help/command/target_precompile_headers.rst b/Help/command/target_precompile_headers.rst
index 5ab3766..569c7eb 100644
--- a/Help/command/target_precompile_headers.rst
+++ b/Help/command/target_precompile_headers.rst
@@ -3,33 +3,21 @@ target_precompile_headers
Add a list of header files to precompile.
+Precompiling header files can speed up compilation by creating a partially
+processed version of some header files, and then using that version during
+compilations rather than repeatedly parsing the original headers.
+
+Main Form
+^^^^^^^^^
+
.. code-block:: cmake
target_precompile_headers(<target>
<INTERFACE|PUBLIC|PRIVATE> [header1...]
[<INTERFACE|PUBLIC|PRIVATE> [header2...] ...])
- target_precompile_headers(<target> REUSE_FROM <other_target>)
-
-Adds header files to :prop_tgt:`PRECOMPILE_HEADERS` or
-:prop_tgt:`INTERFACE_PRECOMPILE_HEADERS` target properties.
-
-The second signature will reuse an already precompiled header file artefact
-from another target. This is done by setting the
-:prop_tgt:`PRECOMPILE_HEADERS_REUSE_FROM` to ``<other_target>`` value.
-The ``<other_target>`` will become a dependency of ``<target>``.
-
-.. note::
-
- The second signature will require the same set of compiler options,
- compiler flags, compiler definitions for both ``<target>``, and
- ``<other_target>``. Compilers (e.g. GCC) will issue a warning if the
- precompiled header file cannot be used (``-Winvalid-pch``).
-
-Precompiling header files can speed up compilation by creating a partially
-processed version of some header files, and then using that version during
-compilations rather than repeatedly parsing the original headers.
-
+The command adds header files to the :prop_tgt:`PRECOMPILE_HEADERS` and/or
+:prop_tgt:`INTERFACE_PRECOMPILE_HEADERS` target properties of ``<target>``.
The named ``<target>`` must have been created by a command such as
:command:`add_executable` or :command:`add_library` and must not be an
:ref:`ALIAS target <Alias Targets>`.
@@ -38,25 +26,50 @@ The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to
specify the scope of the following arguments. ``PRIVATE`` and ``PUBLIC``
items will populate the :prop_tgt:`PRECOMPILE_HEADERS` property of
``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the
-:prop_tgt:`INTERFACE_PRECOMPILE_HEADERS` property of ``<target>``.
-(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items.)
-Repeated calls for the same ``<target>`` append items in the order called.
+:prop_tgt:`INTERFACE_PRECOMPILE_HEADERS` property of ``<target>``
+(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items).
+Repeated calls for the same ``<target>`` will append items in the order called.
+
+Projects should generally avoid using ``PUBLIC`` or ``INTERFACE`` for targets
+that will be :ref:`exported <install(EXPORT)>`, or they should at least use
+the ``$<BUILD_INTERFACE:...>`` generator expression to prevent precompile
+headers from appearing in an installed exported target. Consumers of a target
+should typically be in control of what precompile headers they use, not have
+precompile headers forced on them by the targets being consumed (since
+precompile headers are not typically usage requirements). A notable exception
+to this is where an :ref:`interface library <Interface Libraries>` is created
+to define a commonly used set of precompile headers in one place and then other
+targets link to that interface library privately. In this case, the interface
+library exists specifically to propagate the precompile headers to its
+consumers and the consumer is effectively still in control, since it decides
+whether to link to the interface library or not.
+
+The list of header files is used to generate a header file named
+``cmake_pch.h|xx`` which is used to generate the precompiled header file
+(``.pch``, ``.gch``, ``.pchi``) artifact. The ``cmake_pch.h|xx`` header
+file will be force included (``-include`` for GCC, ``/FI`` for MSVC) to
+all source files, so sources do not need to have ``#include "pch.h"``.
+
+Header file names specified with angle brackets (e.g. ``<unordered_map>``) or
+explicit double quotes (escaped for the :manual:`cmake-language(7)`,
+e.g. ``[["other_header.h"]]``) will be treated as is, and include directories
+must be available for the compiler to find them. Other header file names
+(e.g. ``project_header.h``) are interpreted as being relative to the current
+source directory (e.g. :variable:`CMAKE_CURRENT_SOURCE_DIR`) and will be
+included by absolute path.
-Arguments to ``target_precompile_headers`` may use "generator expressions"
+Arguments to ``target_precompile_headers()`` may use "generator expressions"
with the syntax ``$<...>``.
See the :manual:`cmake-generator-expressions(7)` manual for available
expressions. See the :manual:`cmake-compile-features(7)` manual for
information on compile features and a list of supported compilers.
The ``$<COMPILE_LANGUAGE:...>`` generator expression is particularly
useful for specifying a language-specific header to precompile for
-only one language (e.g. ``CXX`` and not ``C``).
-
-Usage
-^^^^^
+only one language (e.g. ``CXX`` and not ``C``). For example:
.. code-block:: cmake
- target_precompile_headers(<target>
+ target_precompile_headers(myTarget
PUBLIC
project_header.h
"$<$<COMPILE_LANGUAGE:CXX>:cxx_only.h>"
@@ -65,20 +78,6 @@ Usage
<unordered_map>
)
-The list of header files is used to generate a header file named
-``cmake_pch.h|xx`` which is used to generate the precompiled header file
-(``.pch``, ``.gch``, ``.pchi``) artifact. The ``cmake_pch.h|xx`` header
-file will be force included (``-include`` for GCC, ``/FI`` for MSVC) to
-all source files, so sources do not need to have ``#include "pch.h"``.
-
-Header file names specified with angle brackets (e.g. ``<unordered_map>``) or
-explicit double quotes (escaped for the :manual:`cmake-language(7)`,
-e.g. ``[["other_header.h"]]``) will be treated as is, and include directories
-must be available for the compiler to find them. Other header file names
-(e.g. ``project_header.h``) are interpreted as being relative to the current
-source directory (e.g. :variable:`CMAKE_CURRENT_SOURCE_DIR`) and will be
-included by absolute path.
-
When specifying angle brackets inside a :manual:`generator expression
<cmake-generator-expressions(7)>`, be sure to encode the closing ``>``
as ``$<ANGLE-R>``. For example:
@@ -88,13 +87,38 @@ as ``$<ANGLE-R>``. For example:
target_precompile_headers(mylib PRIVATE
"$<$<COMPILE_LANGUAGE:C>:<stddef.h$<ANGLE-R>>"
"$<$<COMPILE_LANGUAGE:CXX>:<cstddef$<ANGLE-R>>"
- )
+ )
+
+
+Reusing Precompile Headers
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The command also supports a second signature which can be used to specify that
+one target re-uses a precompiled header file artefact from another target
+instead of generating its own:
+
+.. code-block:: cmake
+
+ target_precompile_headers(<target> REUSE_FROM <other_target>)
+
+This form sets the :prop_tgt:`PRECOMPILE_HEADERS_REUSE_FROM` property to
+``<other_target>`` and adds a dependency such that ``<target>`` will depend
+on ``<other_target>``. CMake will halt with an error if the
+:prop_tgt:`PRECOMPILE_HEADERS` property of ``<target>`` is already set when
+the ``REUSE_FROM`` form is used.
+
+.. note::
+
+ The ``REUSE_FROM`` form requires the same set of compiler options,
+ compiler flags and compiler definitions for both ``<target>`` and
+ ``<other_target>``. Some compilers (e.g. GCC) may issue a warning if the
+ precompiled header file cannot be used (``-Winvalid-pch``).
See Also
^^^^^^^^
-For disabling precompile headers for specific targets there is the
-property :prop_tgt:`DISABLE_PRECOMPILE_HEADERS`.
+To disable precompile headers for specific targets, see the
+:prop_tgt:`DISABLE_PRECOMPILE_HEADERS` target property.
-For skipping certain source files there is the source file property
-:prop_sf:`SKIP_PRECOMPILE_HEADERS`.
+To prevent precompile headers from being used when compiling a specific
+source file, see the :prop_sf:`SKIP_PRECOMPILE_HEADERS` source file property.
diff --git a/Help/guide/tutorial/index.rst b/Help/guide/tutorial/index.rst
index 3f20aa2..d74d160 100644
--- a/Help/guide/tutorial/index.rst
+++ b/Help/guide/tutorial/index.rst
@@ -610,12 +610,12 @@ CTest will read in this file when it runs. To create a simple dashboard you can
run **cmake** or **cmake-gui** to configure the project, but do not build it
yet. Instead, change directory to the binary tree, and then run::
- ctest [-VV] –D Experimental
+ ctest [-VV] -D Experimental
Remember, for multi-config generators (e.g. Visual Studio), the configuration
type must be specified::
- ctest [-VV] -C Debug –D Experimental
+ ctest [-VV] -C Debug -D Experimental
Or, from an IDE, build the ``Experimental`` target.
diff --git a/Help/manual/cmake-compile-features.7.rst b/Help/manual/cmake-compile-features.7.rst
index a821189..a14e322 100644
--- a/Help/manual/cmake-compile-features.7.rst
+++ b/Help/manual/cmake-compile-features.7.rst
@@ -28,10 +28,15 @@ CMake knows are known to the compiler, regardless of language standard
or compile flags needed to use them.
Features known to CMake are named mostly following the same convention
-as the Clang feature test macros. The are some exceptions, such as
+as the Clang feature test macros. There are some exceptions, such as
CMake using ``cxx_final`` and ``cxx_override`` instead of the single
``cxx_override_control`` used by Clang.
+Note that there are no separate compile features properties or variables for
+the ``OBJC`` or ``OBJCXX`` languages. These are based off ``C`` or ``C++``
+respectively, so the properties and variables for their corresponding base
+language should be used instead.
+
Compile Feature Requirements
============================
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 44ea1a8..eceeac7 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -51,6 +51,14 @@ The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used
to determine whether to report an error on use of deprecated macros or
functions.
+Policies Introduced by CMake 3.17
+=================================
+
+.. toctree::
+ :maxdepth: 1
+
+ CMP0098: FindFLEX runs flex in CMAKE_CURRENT_BINARY_DIR when executing. </policy/CMP0098>
+
Policies Introduced by CMake 3.16
=================================
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 94d08c6..c5ef09a 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -381,6 +381,7 @@ Properties on Targets
/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER
/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN
/prop_tgt/XCODE_SCHEME_ARGUMENTS
+ /prop_tgt/XCODE_SCHEME_WORKING_DIRECTORY
/prop_tgt/XCODE_SCHEME_DEBUG_AS_ROOT
/prop_tgt/XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING
/prop_tgt/XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 01dd5fd..0c1d510 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -239,6 +239,7 @@ Variables that Change Behavior
/variable/CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY
/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER
/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN
+ /variable/CMAKE_XCODE_SCHEME_WORKING_DIRECTORY
/variable/CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING
/variable/CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER
/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 71110d1..6f33866 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -554,22 +554,38 @@ Available commands are:
7a0b54896fe5e70cca6dd643ad6f672614b189bf26f8153061c4d219474b05dad08c4e729af9f4b009f1a1a280cb625454bf587c690f4617c27e3aebdf3b7a2d file2.txt
``remove [-f] <file>...``
- Remove the file(s). If any of the listed files already do not
- exist, the command returns a non-zero exit code, but no message
- is logged. The ``-f`` option changes the behavior to return a
+ .. deprecated:: 3.17
+
+ Remove the file(s). The planned behaviour was that if any of the
+ listed files already do not exist, the command returns a non-zero exit code,
+ but no message is logged. The ``-f`` option changes the behavior to return a
zero exit code (i.e. success) in such situations instead.
``remove`` does not follow symlinks. That means it remove only symlinks
and not files it point to.
+ The implementation was buggy and always returned 0. It cannot be fixed without
+ breaking backwards compatibility. Use ``rm`` instead.
+
``remove_directory <dir>...``
- Remove ``<dir>`` directories and their contents. If a directory does
+ .. deprecated:: 3.17
+
+ Remove ``<dir>`` directories and their contents. If a directory does
not exist it will be silently ignored. If ``<dir>`` is a symlink to
a directory, just the symlink will be removed.
+ Use ``rm`` instead.
``rename <oldname> <newname>``
Rename a file or directory (on one volume). If file with the ``<newname>`` name
already exists, then it will be silently replaced.
+``rm [-rRf] <file> <dir>...``
+ Remove the files ``<file>`` or directories ``dir``.
+ Use ``-r`` or ``-R`` to remove directories and their contents recursively.
+ If any of the listed files/directories do not exist, the command returns a
+ non-zero exit code, but no message is logged. The ``-f`` option changes
+ the behavior to return a zero exit code (i.e. success) in such
+ situations instead.
+
``server``
Launch :manual:`cmake-server(7)` mode.
diff --git a/Help/policy/CMP0098.rst b/Help/policy/CMP0098.rst
new file mode 100644
index 0000000..6d1443b
--- /dev/null
+++ b/Help/policy/CMP0098.rst
@@ -0,0 +1,30 @@
+CMP0098
+-------
+
+:module:`FindFLEX` runs ``flex`` in directory
+:variable:`CMAKE_CURRENT_BINARY_DIR` when executing.
+
+The module provides a ``FLEX_TARGET`` macro which generates FLEX output.
+In CMake 3.16 and below the macro would generate a custom command that runs
+``flex`` in the current source directory. CMake 3.17 and later prefer to
+run it in the build directory and use :variable:`CMAKE_CURRENT_BINARY_DIR`
+as the ``WORKING_DIRECTORY`` of its :command:`add_custom_command` invocation.
+This ensures that any implicitly generated file is written relative to the
+build tree rather than the source tree, unless the generated file is
+provided as absolute path.
+
+This policy provides compatibility for projects that have not been updated
+to expect the new behavior.
+
+The ``OLD`` behavior for this policy is for ``FLEX_TARGET`` to use
+the current source directory for the ``WORKING_DIRECTORY`` and where
+to generate implicit files. The ``NEW`` behavior of this policy is to
+use the current binary directory for the ``WORKING_DIRECTORY`` relative to
+which implicit files are generated unless provided as absolute path.
+
+This policy was introduced in CMake version 3.17. Use the
+:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
+Unlike many policies, CMake version |release| does *not* warn
+when this policy is not set and simply uses ``OLD`` behavior.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/prop_tgt/INTERFACE_PRECOMPILE_HEADERS.rst b/Help/prop_tgt/INTERFACE_PRECOMPILE_HEADERS.rst
index 8ff7e8b..e285407 100644
--- a/Help/prop_tgt/INTERFACE_PRECOMPILE_HEADERS.rst
+++ b/Help/prop_tgt/INTERFACE_PRECOMPILE_HEADERS.rst
@@ -7,6 +7,8 @@ Targets may populate this property to publish the header files
for consuming targets to precompile. The :command:`target_precompile_headers`
command populates this property with values given to the ``PUBLIC`` and
``INTERFACE`` keywords. Projects may also get and set the property directly.
+See the discussion in :command:`target_precompile_headers` for guidance on
+appropriate use of this property for installed or exported targets.
Contents of ``INTERFACE_PRECOMPILE_HEADERS`` may use "generator expressions"
with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
diff --git a/Help/prop_tgt/XCODE_SCHEME_WORKING_DIRECTORY.rst b/Help/prop_tgt/XCODE_SCHEME_WORKING_DIRECTORY.rst
new file mode 100644
index 0000000..7ffa74b
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_WORKING_DIRECTORY.rst
@@ -0,0 +1,13 @@
+XCODE_SCHEME_WORKING_DIRECTORY
+------------------------------
+
+Specify the ``Working Directory`` a of the `Run` and `Profile`
+action in the generated Xcode scheme. In case the value contains
+generator expressions those are evaluated.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_WORKING_DIRECTORY` if it is set
+when a target is created.
+
+Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property
+documentation to see all Xcode schema related properties.
diff --git a/Help/release/dev/FindFLEX-work-dir.rst b/Help/release/dev/FindFLEX-work-dir.rst
new file mode 100644
index 0000000..3569185
--- /dev/null
+++ b/Help/release/dev/FindFLEX-work-dir.rst
@@ -0,0 +1,6 @@
+FindFLEX-work-dir
+-----------------
+
+* The :module:`FindFLEX` module's ``FLEX_TARGET`` command now runs ``flex``
+ with :variable:`CMAKE_CURRENT_BINARY_DIR` as the working directory.
+ See policy :policy:`CMP0098`.
diff --git a/Help/release/dev/command_rm.rst b/Help/release/dev/command_rm.rst
new file mode 100644
index 0000000..a58362e
--- /dev/null
+++ b/Help/release/dev/command_rm.rst
@@ -0,0 +1,12 @@
+Command-Line
+--------------------
+
+* :manual:`cmake(1)` gained a ``rm`` command line
+ option that can be used to remove directories (with ``-r`` or ``-R`` flag)
+ and files.
+ If the ``-f`` flag is not specified, attempting to remove a file that
+ doesn't exist returns an non-zero error code.
+ This command deprecates ``remove`` and ``remove_directory``.
+ The ``remove`` implementation was buggy and always returned 0 when ``force``
+ flag was not present and a file didn't exist. It cannot be fixed without
+ breaking backwards compatibility so we introduced ``rm``.
diff --git a/Help/release/dev/sdcc-new-librarian.rst b/Help/release/dev/sdcc-new-librarian.rst
new file mode 100644
index 0000000..93961ce
--- /dev/null
+++ b/Help/release/dev/sdcc-new-librarian.rst
@@ -0,0 +1,6 @@
+sdcc-new-librarian
+------------------
+
+* Since sdcc 3.2.0, sdcclib has been deprecated in favor of sdar as librarian.
+ Since sdcc 3.8.6, it has been removed from the distribution.
+ Use sdar if found, else use sdcclib to keep older compatibility.
diff --git a/Help/release/dev/xcode-scheme-workdir.rst b/Help/release/dev/xcode-scheme-workdir.rst
new file mode 100644
index 0000000..8eb5ed8
--- /dev/null
+++ b/Help/release/dev/xcode-scheme-workdir.rst
@@ -0,0 +1,7 @@
+xcode-scheme-workdir
+--------------------
+
+* The Xcode generator learnt to set the value of the
+ ``Custom Working Directory`` schema
+ option with the :prop_tgt:`XCODE_SCHEME_WORKING_DIRECTORY`
+ target property.
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_WORKING_DIRECTORY.rst b/Help/variable/CMAKE_XCODE_SCHEME_WORKING_DIRECTORY.rst
new file mode 100644
index 0000000..cc690f7
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_WORKING_DIRECTORY.rst
@@ -0,0 +1,12 @@
+CMAKE_XCODE_SCHEME_WORKING_DIRECTORY
+------------------------------------
+
+Specify the ``Working Directory`` a of the `Run` and `Profile`
+action in the generated Xcode scheme.
+
+This variable initializes the
+:prop_tgt:`XCODE_SCHEME_WORKING_DIRECTORY`
+property on all targets.
+
+Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property
+documentation to see all Xcode schema related properties.
diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake
index 2613569..09e739d 100644
--- a/Modules/CMakeAddFortranSubdirectory.cmake
+++ b/Modules/CMakeAddFortranSubdirectory.cmake
@@ -155,7 +155,7 @@ function(cmake_add_fortran_subdirectory subdir)
# make the external project always run make with each build
externalproject_add_step(${project_name}_build forcebuild
COMMAND ${CMAKE_COMMAND}
- -E remove
+ -E rm -f
${CMAKE_CURRENT_BUILD_DIR}/${project_name}-prefix/src/${project_name}-stamp/${project_name}-build
DEPENDEES configure
DEPENDERS build
diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake
index f2bf232..2c54da0 100644
--- a/Modules/CMakeSwiftInformation.cmake
+++ b/Modules/CMakeSwiftInformation.cmake
@@ -24,7 +24,7 @@ elseif(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
set(CMAKE_SHARED_LIBRARY_SONAME_Swift_FLAG "-Xlinker -soname -Xlinker ")
endif()
-if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows AND NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
+if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ")
set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG_SEP ":")
endif()
@@ -77,7 +77,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows)
endif()
if(NOT CMAKE_Swift_CREATE_SHARED_LIBRARY)
- set(CMAKE_Swift_CREATE_SHARED_LIBRARY "<CMAKE_Swift_COMPILER> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -j ${CMAKE_Swift_NUM_THREADS} -emit-library -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <SONAME_FLAG> <TARGET_SONAME> ${CMAKE_Swift_IMPLIB_LINKER_FLAGS} <LINK_LIBRARIES>")
+ set(CMAKE_Swift_CREATE_SHARED_LIBRARY "<CMAKE_Swift_COMPILER> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -j ${CMAKE_Swift_NUM_THREADS} -emit-library -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> ${CMAKE_Swift_IMPLIB_LINKER_FLAGS} <LINK_LIBRARIES>")
endif()
if(NOT CMAKE_Swift_CREATE_SHARED_MODULE)
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index cd4e22d..1e54266 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1120,7 +1120,7 @@ if(NOT \"${gitclone_infofile}\" IS_NEWER_THAN \"${gitclone_stampfile}\")
endif()
execute_process(
- COMMAND \${CMAKE_COMMAND} -E remove_directory \"${source_dir}\"
+ COMMAND \${CMAKE_COMMAND} -E rm -rf \"${source_dir}\"
RESULT_VARIABLE error_code
)
if(error_code)
@@ -1196,7 +1196,7 @@ if(NOT \"${hgclone_infofile}\" IS_NEWER_THAN \"${hgclone_stampfile}\")
endif()
execute_process(
- COMMAND \${CMAKE_COMMAND} -E remove_directory \"${source_dir}\"
+ COMMAND \${CMAKE_COMMAND} -E rm -rf \"${source_dir}\"
RESULT_VARIABLE error_code
)
if(error_code)
@@ -2580,7 +2580,7 @@ function(_ep_add_download_command name)
if(IS_DIRECTORY "${url}")
get_filename_component(abs_dir "${url}" ABSOLUTE)
set(comment "Performing download step (DIR copy) for '${name}'")
- set(cmd ${CMAKE_COMMAND} -E remove_directory ${source_dir}
+ set(cmd ${CMAKE_COMMAND} -E rm -rf ${source_dir}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${abs_dir} ${source_dir})
else()
get_property(no_extract TARGET "${name}" PROPERTY _EP_DOWNLOAD_NO_EXTRACT SET)
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 2a3e131..ad7fe99 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -2006,7 +2006,7 @@ macro(CUDA_BUILD_CLEAN_TARGET)
string(TOUPPER ${cuda_clean_target_name} cuda_clean_target_name)
endif()
add_custom_target(${cuda_clean_target_name}
- COMMAND ${CMAKE_COMMAND} -E remove ${CUDA_ADDITIONAL_CLEAN_FILES})
+ COMMAND ${CMAKE_COMMAND} -E rm -f ${CUDA_ADDITIONAL_CLEAN_FILES})
# Clear out the variable, so the next time we configure it will be empty.
# This is useful so that the files won't persist in the list after targets
diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake
index af15d55..ba35433 100644
--- a/Modules/FindCUDA/run_nvcc.cmake
+++ b/Modules/FindCUDA/run_nvcc.cmake
@@ -174,7 +174,7 @@ endmacro()
# Delete the target file
cuda_execute_process(
"Removing ${generated_file}"
- COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}"
+ COMMAND "${CMAKE_COMMAND}" -E rm -f "${generated_file}"
)
# For CUDA 2.3 and below, -G -M doesn't work, so remove the -G flag
@@ -241,7 +241,7 @@ endif()
# Delete the temporary file
cuda_execute_process(
"Removing ${cmake_dependency_file}.tmp and ${NVCC_generated_dependency_file}"
- COMMAND "${CMAKE_COMMAND}" -E remove "${cmake_dependency_file}.tmp" "${NVCC_generated_dependency_file}"
+ COMMAND "${CMAKE_COMMAND}" -E rm -f "${cmake_dependency_file}.tmp" "${NVCC_generated_dependency_file}"
)
if(CUDA_result)
@@ -267,7 +267,7 @@ if(CUDA_result)
# Since nvcc can sometimes leave half done files make sure that we delete the output file.
cuda_execute_process(
"Removing ${generated_file}"
- COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}"
+ COMMAND "${CMAKE_COMMAND}" -E rm -f "${generated_file}"
)
message(FATAL_ERROR "Error generating file ${generated_file}")
else()
diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake
index d22b7ec..90e5f86 100644
--- a/Modules/FindFLEX.cmake
+++ b/Modules/FindFLEX.cmake
@@ -142,8 +142,6 @@ if(FLEX_EXECUTABLE)
#============================================================
#
macro(FLEX_TARGET Name Input Output)
- set(FLEX_TARGET_outputs "${Output}")
- set(FLEX_EXECUTABLE_opts "")
set(FLEX_TARGET_PARAM_OPTIONS)
set(FLEX_TARGET_PARAM_ONE_VALUE_KEYWORDS
@@ -165,31 +163,68 @@ if(FLEX_EXECUTABLE)
if(NOT "${FLEX_TARGET_ARG_UNPARSED_ARGUMENTS}" STREQUAL "")
message(SEND_ERROR ${FLEX_TARGET_usage})
else()
+
+ cmake_policy(GET CMP0098 _flex_CMP0098
+ PARENT_SCOPE # undocumented, do not use outside of CMake
+ )
+ set(_flex_INPUT "${Input}")
+ if("x${_flex_CMP0098}x" STREQUAL "xNEWx")
+ set(_flex_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}")
+ if(NOT IS_ABSOLUTE "${_flex_INPUT}")
+ set(_flex_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/${_flex_INPUT}")
+ endif()
+ else()
+ set(_flex_WORKING_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+ endif()
+ unset(_flex_CMP0098)
+
+ set(_flex_OUTPUT "${Output}")
+ if(NOT IS_ABSOLUTE ${_flex_OUTPUT})
+ set(_flex_OUTPUT "${_flex_WORKING_DIR}/${_flex_OUTPUT}")
+ endif()
+ set(_flex_TARGET_OUTPUTS "${_flex_OUTPUT}")
+
+ set(_flex_EXE_OPTS "")
if(NOT "${FLEX_TARGET_ARG_COMPILE_FLAGS}" STREQUAL "")
- set(FLEX_EXECUTABLE_opts "${FLEX_TARGET_ARG_COMPILE_FLAGS}")
- separate_arguments(FLEX_EXECUTABLE_opts)
+ set(_flex_EXE_OPTS "${FLEX_TARGET_ARG_COMPILE_FLAGS}")
+ separate_arguments(_flex_EXE_OPTS)
endif()
+
+ set(_flex_OUTPUT_HEADER "")
if(NOT "${FLEX_TARGET_ARG_DEFINES_FILE}" STREQUAL "")
- list(APPEND FLEX_TARGET_outputs "${FLEX_TARGET_ARG_DEFINES_FILE}")
- list(APPEND FLEX_EXECUTABLE_opts --header-file=${FLEX_TARGET_ARG_DEFINES_FILE})
+ set(_flex_OUTPUT_HEADER "${FLEX_TARGET_ARG_DEFINES_FILE}")
+ if(IS_ABSOLUTE "${_flex_OUTPUT_HEADER}")
+ set(_flex_OUTPUT_HEADER_ABS "${_flex_OUTPUT_HEADER}")
+ else()
+ set(_flex_OUTPUT_HEADER_ABS "${_flex_WORKING_DIR}/${_flex_OUTPUT_HEADER}")
+ endif()
+ list(APPEND _flex_TARGET_OUTPUTS "${_flex_OUTPUT_HEADER_ABS}")
+ list(APPEND _flex_EXE_OPTS --header-file=${_flex_OUTPUT_HEADER_ABS})
endif()
- add_custom_command(OUTPUT ${FLEX_TARGET_outputs}
- COMMAND ${FLEX_EXECUTABLE} ${FLEX_EXECUTABLE_opts} -o${Output} ${Input}
+ get_filename_component(_flex_EXE_NAME_WE "${FLEX_EXECUTABLE}" NAME_WE)
+ add_custom_command(OUTPUT ${_flex_TARGET_OUTPUTS}
+ COMMAND ${FLEX_EXECUTABLE} ${_flex_EXE_OPTS} -o${_flex_OUTPUT} ${_flex_INPUT}
VERBATIM
- DEPENDS ${Input}
- COMMENT "[FLEX][${Name}] Building scanner with flex ${FLEX_VERSION}"
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+ DEPENDS ${_flex_INPUT}
+ COMMENT "[FLEX][${Name}] Building scanner with ${_flex_EXE_NAME_WE} ${FLEX_VERSION}"
+ WORKING_DIRECTORY ${_flex_WORKING_DIR})
set(FLEX_${Name}_DEFINED TRUE)
- set(FLEX_${Name}_OUTPUTS ${Output})
- set(FLEX_${Name}_INPUT ${Input})
- set(FLEX_${Name}_COMPILE_FLAGS ${FLEX_EXECUTABLE_opts})
- if("${FLEX_TARGET_ARG_DEFINES_FILE}" STREQUAL "")
- set(FLEX_${Name}_OUTPUT_HEADER "")
- else()
- set(FLEX_${Name}_OUTPUT_HEADER ${FLEX_TARGET_ARG_DEFINES_FILE})
- endif()
+ set(FLEX_${Name}_OUTPUTS ${_flex_TARGET_OUTPUTS})
+ set(FLEX_${Name}_INPUT ${_flex_INPUT})
+ set(FLEX_${Name}_COMPILE_FLAGS ${_flex_EXE_OPTS})
+ set(FLEX_${Name}_OUTPUT_HEADER ${_flex_OUTPUT_HEADER})
+
+ unset(_flex_EXE_NAME_WE)
+ unset(_flex_EXE_OPTS)
+ unset(_flex_INPUT)
+ unset(_flex_OUTPUT)
+ unset(_flex_OUTPUT_HEADER)
+ unset(_flex_OUTPUT_HEADER_ABS)
+ unset(_flex_TARGET_OUTPUTS)
+ unset(_flex_WORKING_DIR)
+
endif()
endmacro()
#============================================================
diff --git a/Modules/Internal/CPack/CPackNuGet.cmake b/Modules/Internal/CPack/CPackNuGet.cmake
index 82053b2..b46a7b1 100644
--- a/Modules/Internal/CPack/CPackNuGet.cmake
+++ b/Modules/Internal/CPack/CPackNuGet.cmake
@@ -230,13 +230,11 @@ function(_cpack_nuget_render_spec)
foreach(_dep IN LISTS _deps)
_cpack_nuget_debug(" checking dependency `${_dep}`")
- string(MAKE_C_IDENTIFIER "${_dep}" _dep_id)
-
- _cpack_nuget_variable_fallback(_ver DEPENDENCIES_${_dep_id}_VERSION)
+ _cpack_nuget_variable_fallback(_ver DEPENDENCIES_${_dep}_VERSION)
if(NOT _ver)
- string(TOUPPER "${_dep_id}" _dep_id)
- _cpack_nuget_variable_fallback(_ver DEPENDENCIES_${_dep_id}_VERSION)
+ string(TOUPPER "${_dep}" _dep_upper)
+ _cpack_nuget_variable_fallback(_ver DEPENDENCIES_${_dep_upper}_VERSION)
endif()
if(_ver)
diff --git a/Modules/Platform/Generic-SDCC-C.cmake b/Modules/Platform/Generic-SDCC-C.cmake
index aef4abf..c51767e 100644
--- a/Modules/Platform/Generic-SDCC-C.cmake
+++ b/Modules/Platform/Generic-SDCC-C.cmake
@@ -19,14 +19,28 @@ set(CMAKE_DL_LIBS "")
set(CMAKE_C_OUTPUT_EXTENSION ".rel")
-# find sdcclib as CMAKE_AR
-# since cmake may already have searched for "ar", sdcclib has to
-# be searched with a different variable name (SDCCLIB_EXECUTABLE)
-# and must then be forced into the cache
+# find sdar/sdcclib as CMAKE_AR
+# since cmake may already have searched for "ar", sdar has to
+# be searched with a different variable name (SDCCAR_EXECUTABLE)
+# and must then be forced into the cache.
+# sdcclib has been deprecated in SDCC 3.2.0 and removed in 3.8.6
+# so we first look for sdar
get_filename_component(SDCC_LOCATION "${CMAKE_C_COMPILER}" PATH)
-find_program(SDCCLIB_EXECUTABLE sdcclib PATHS "${SDCC_LOCATION}" NO_DEFAULT_PATH)
-find_program(SDCCLIB_EXECUTABLE sdcclib)
-set(CMAKE_AR "${SDCCLIB_EXECUTABLE}" CACHE FILEPATH "The sdcc librarian" FORCE)
+find_program(SDCCAR_EXECUTABLE sdar NAMES sdcclib PATHS "${SDCC_LOCATION}" NO_DEFAULT_PATH)
+find_program(SDCCAR_EXECUTABLE sdar NAMES sdcclib)
+# for compatibility, in case SDCCLIB_EXECUTABLE is set, we use it
+if(DEFINED SDCCLIB_EXECUTABLE)
+ set(CMAKE_AR "${SDCCLIB_EXECUTABLE}" CACHE FILEPATH "The sdcc librarian" FORCE)
+else()
+ set(CMAKE_AR "${SDCCAR_EXECUTABLE}" CACHE FILEPATH "The sdcc librarian" FORCE)
+endif()
+
+
+if("${SDCCAR_EXECUTABLE}" MATCHES "sdcclib")
+ set(CMAKE_AR_OPTIONS "-a")
+else()
+ set(CMAKE_AR_OPTIONS "-rc")
+endif()
# CMAKE_C_FLAGS_INIT and CMAKE_EXE_LINKER_FLAGS_INIT should be set in a CMAKE_SYSTEM_PROCESSOR file
if(NOT DEFINED CMAKE_C_FLAGS_INIT)
@@ -45,10 +59,10 @@ set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o
# link object files to an executable
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <OBJECTS> -o <TARGET> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>")
-# needs sdcc 2.7.0 + sddclib from cvs
+# needs sdcc + sdar/sdcclib
set(CMAKE_C_CREATE_STATIC_LIBRARY
"\"${CMAKE_COMMAND}\" -E remove <TARGET>"
- "<CMAKE_AR> -a <TARGET> <LINK_FLAGS> <OBJECTS> ")
+ "<CMAKE_AR> ${CMAKE_AR_OPTIONS} <TARGET> <LINK_FLAGS> <OBJECTS> ")
# not supported by sdcc
set(CMAKE_C_CREATE_SHARED_LIBRARY "")
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index 71189b1..cf85367 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -124,7 +124,7 @@ macro(__windows_compiler_gnu lang)
string(REPLACE "<OBJECTS>" "-Wl,--whole-archive <OBJECT_DIR>/objects.a -Wl,--no-whole-archive"
CMAKE_${lang}_${rule} "${CMAKE_${lang}_${rule}}")
set(CMAKE_${lang}_${rule}
- "<CMAKE_COMMAND> -E remove -f <OBJECT_DIR>/objects.a"
+ "<CMAKE_COMMAND> -E rm -f <OBJECT_DIR>/objects.a"
"<CMAKE_AR> cr <OBJECT_DIR>/objects.a <OBJECTS>"
"${CMAKE_${lang}_${rule}}"
)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index f9e3d4a..8a606d4 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 16)
-set(CMake_VERSION_PATCH 20191115)
+set(CMake_VERSION_PATCH 20191119)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 5fdbeab..e71a38f 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -610,7 +610,7 @@ std::string cmCPackWIXGenerator::GetRootFolderId() const
bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate()
{
- std::string wixTemplate = FindTemplate("Internal/CPack/WIX.template.in");
+ std::string wixTemplate = FindTemplate("WIX.template.in");
if (GetOption("CPACK_WIX_TEMPLATE") != 0) {
wixTemplate = GetOption("CPACK_WIX_TEMPLATE");
}
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 7a6c50b..9530227 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -23,6 +23,7 @@
#include "cmState.h"
#include "cmStateSnapshot.h"
#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
#include "cmVersion.h"
#include "cmWorkingDirectory.h"
#include "cmXMLSafe.h"
@@ -1254,7 +1255,17 @@ std::string cmCPackGenerator::FindTemplate(const char* name)
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Look for template: " << (name ? name : "(NULL)")
<< std::endl);
+ // Search CMAKE_MODULE_PATH for a custom template.
std::string ffile = this->MakefileMap->GetModulesFile(name);
+ if (ffile.empty()) {
+ // Fall back to our internal builtin default.
+ ffile = cmStrCat(cmSystemTools::GetCMakeRoot(), "/Modules/Internal/CPack/",
+ name);
+ cmSystemTools::ConvertToUnixSlashes(ffile);
+ if (!cmSystemTools::FileExists(ffile)) {
+ ffile.clear();
+ }
+ }
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Found template: " << ffile << std::endl);
return ffile;
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index f90a740..4702639 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -39,8 +39,7 @@ int cmCPackNSISGenerator::PackageFiles()
{
// TODO: Fix nsis to force out file name
- std::string nsisInFileName =
- this->FindTemplate("Internal/CPack/NSIS.template.in");
+ std::string nsisInFileName = this->FindTemplate("NSIS.template.in");
if (nsisInFileName.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPack error: Could not find NSIS installer template file."
@@ -48,7 +47,7 @@ int cmCPackNSISGenerator::PackageFiles()
return false;
}
std::string nsisInInstallOptions =
- this->FindTemplate("Internal/CPack/NSIS.InstallOptions.ini.in");
+ this->FindTemplate("NSIS.InstallOptions.ini.in");
if (nsisInInstallOptions.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPack error: Could not find NSIS installer options file."
diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx
index cd65694..951c65f 100644
--- a/Source/CPack/cmCPackOSXX11Generator.cxx
+++ b/Source/CPack/cmCPackOSXX11Generator.cxx
@@ -240,7 +240,7 @@ bool cmCPackOSXX11Generator::CopyResourcePlistFile(
const std::string& name, const std::string& dir,
const char* outputFileName /* = 0 */, bool copyOnly /* = false */)
{
- std::string inFName = cmStrCat("Internal/CPack/CPack.", name, ".in");
+ std::string inFName = cmStrCat("CPack.", name, ".in");
std::string inFileName = this->FindTemplate(inFName.c_str());
if (inFileName.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx
index 328aac3..ac3d64d 100644
--- a/Source/CPack/cmCPackPKGGenerator.cxx
+++ b/Source/CPack/cmCPackPKGGenerator.cxx
@@ -108,7 +108,7 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile,
const char* genName)
{
std::string distributionTemplate =
- this->FindTemplate("Internal/CPack/CPack.distribution.dist.in");
+ this->FindTemplate("CPack.distribution.dist.in");
if (distributionTemplate.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot find input file: " << distributionTemplate
@@ -364,7 +364,7 @@ bool cmCPackPKGGenerator::CopyResourcePlistFile(const std::string& name,
outName = name.c_str();
}
- std::string inFName = cmStrCat("Internal/CPack/CPack.", name, ".in");
+ std::string inFName = cmStrCat("CPack.", name, ".in");
std::string inFileName = this->FindTemplate(inFName.c_str());
if (inFileName.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx
index bb0ed4f..a4a5e6f 100644
--- a/Source/CPack/cmCPackSTGZGenerator.cxx
+++ b/Source/CPack/cmCPackSTGZGenerator.cxx
@@ -27,8 +27,7 @@ int cmCPackSTGZGenerator::InitializeInternal()
{
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0");
- std::string inFile =
- this->FindTemplate("Internal/CPack/CPack.STGZ_Header.sh.in");
+ std::string inFile = this->FindTemplate("CPack.STGZ_Header.sh.in");
if (inFile.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot find template file: " << inFile << std::endl);
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index d7868f3..dc31623 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -115,7 +115,6 @@ int main(int argc, char const* const* argv)
argc = args.argc();
argv = args.argv();
- cmSystemTools::EnableMSVCDebugHook();
cmSystemTools::InitializeLibUV();
cmSystemTools::FindCMakeResources(argv[0]);
cmCPackLog log;
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index 7732105..01fce85 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -155,10 +155,28 @@ int main(int argc, char const* const* argv)
return 1;
}
+ /*
+ * The message is stored in a list by the form which will be
+ * joined by '\n' before display.
+ * Removing any trailing '\n' avoid extra empty lines in the final results
+ */
+ auto cleanMessage = [](const std::string& message) -> std::string {
+ auto msg = message;
+ if (!msg.empty() && msg.back() == '\n') {
+ msg.pop_back();
+ }
+ return msg;
+ };
cmSystemTools::SetMessageCallback(
- [myform](const std::string& message, const char* title) {
- myform->AddError(message, title);
+ [&](const std::string& message, const char* title) {
+ myform->AddError(cleanMessage(message), title);
});
+ cmSystemTools::SetStderrCallback([&](const std::string& message) {
+ myform->AddError(cleanMessage(message), "");
+ });
+ cmSystemTools::SetStdoutCallback([&](const std::string& message) {
+ myform->UpdateProgress(cleanMessage(message), -1);
+ });
cmCursesForm::CurrentForm = myform;
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx
index a69fdee..806e663 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.cxx
+++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx
@@ -17,7 +17,9 @@ inline int ctrl(int z)
}
cmCursesLongMessageForm::cmCursesLongMessageForm(
- std::vector<std::string> const& messages, const char* title)
+ std::vector<std::string> const& messages, const char* title,
+ ScrollBehavior scrollBehavior)
+ : Scrolling(scrollBehavior)
{
// Append all messages into on big string
this->Messages = cmJoin(messages, "\n");
@@ -109,8 +111,6 @@ void cmCursesLongMessageForm::Render(int /*left*/, int /*top*/, int /*width*/,
const char* msg = this->Messages.c_str();
- curses_clear();
-
if (this->Fields[0]) {
free_field(this->Fields[0]);
this->Fields[0] = nullptr;
@@ -133,7 +133,11 @@ void cmCursesLongMessageForm::Render(int /*left*/, int /*top*/, int /*width*/,
}
i++;
}
- form_driver(this->Form, REQ_BEG_FIELD);
+ if (this->Scrolling == ScrollBehavior::ScrollDown) {
+ form_driver(this->Form, REQ_END_FIELD);
+ } else {
+ form_driver(this->Form, REQ_BEG_FIELD);
+ }
this->UpdateStatusBar();
touchwin(stdscr);
@@ -174,13 +178,3 @@ void cmCursesLongMessageForm::HandleInput()
wrefresh(stdscr);
}
}
-
-void cmCursesLongMessageForm::ScrollDown()
-{
- if (this->Form) {
- form_driver(this->Form, REQ_END_FIELD);
- this->UpdateStatusBar();
- touchwin(stdscr);
- wrefresh(stdscr);
- }
-}
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.h b/Source/CursesDialog/cmCursesLongMessageForm.h
index dde5bff..88efe62 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.h
+++ b/Source/CursesDialog/cmCursesLongMessageForm.h
@@ -14,8 +14,14 @@
class cmCursesLongMessageForm : public cmCursesForm
{
public:
+ enum class ScrollBehavior
+ {
+ NoScroll,
+ ScrollDown
+ };
+
cmCursesLongMessageForm(std::vector<std::string> const& messages,
- const char* title);
+ const char* title, ScrollBehavior scrollBehavior);
~cmCursesLongMessageForm() override;
cmCursesLongMessageForm(cmCursesLongMessageForm const&) = delete;
@@ -26,10 +32,6 @@ public:
void HandleInput() override;
// Description:
- // Scroll down to the end of the content
- void ScrollDown();
-
- // Description:
// Display form. Use a window of size width x height, starting
// at top, left.
void Render(int left, int top, int width, int height) override;
@@ -47,6 +49,7 @@ public:
protected:
std::string Messages;
std::string Title;
+ ScrollBehavior Scrolling;
FIELD* Fields[2];
};
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index ffc9528..612b432 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -498,10 +498,6 @@ void cmCursesMainForm::UpdateProgress(const std::string& msg, float prog)
int cmCursesMainForm::Configure(int noconfigure)
{
- int xi;
- int yi;
- getmaxyx(stdscr, yi, xi);
-
this->ResetOutputs();
if (noconfigure == 0) {
@@ -546,24 +542,26 @@ int cmCursesMainForm::Configure(int noconfigure)
if (cmSystemTools::GetErrorOccuredFlag()) {
title = "Configure failed with the following output";
}
- cmCursesLongMessageForm* msgs =
- new cmCursesLongMessageForm(this->Outputs, title);
+ cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(
+ this->Outputs, title,
+ cmCursesLongMessageForm::ScrollBehavior::ScrollDown);
// reset error condition
cmSystemTools::ResetErrorOccuredFlag();
CurrentForm = msgs;
msgs->Render(1, 1, xx, yy);
- msgs->ScrollDown();
msgs->HandleInput();
// If they typed the wrong source directory, we report
// an error and exit
if (retVal == -2) {
return retVal;
}
- CurrentForm = this;
- this->Render(1, 1, xx, yy);
}
this->InitializeUI();
+ CurrentForm = this;
+ int xi;
+ int yi;
+ getmaxyx(stdscr, yi, xi);
this->Render(1, 1, xi, yi);
return 0;
@@ -571,10 +569,6 @@ int cmCursesMainForm::Configure(int noconfigure)
int cmCursesMainForm::Generate()
{
- int xi;
- int yi;
- getmaxyx(stdscr, yi, xi);
-
this->ResetOutputs();
this->UpdateProgress("Generating", 0);
@@ -603,22 +597,24 @@ int cmCursesMainForm::Generate()
if (cmSystemTools::GetErrorOccuredFlag()) {
title = "Generate failed with the following output";
}
- cmCursesLongMessageForm* msgs =
- new cmCursesLongMessageForm(this->Outputs, title);
+ cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(
+ this->Outputs, title,
+ cmCursesLongMessageForm::ScrollBehavior::ScrollDown);
CurrentForm = msgs;
msgs->Render(1, 1, xx, yy);
- msgs->ScrollDown();
msgs->HandleInput();
// If they typed the wrong source directory, we report
// an error and exit
if (retVal == -2) {
return retVal;
}
- CurrentForm = this;
- this->Render(1, 1, xx, yy);
}
this->InitializeUI();
+ CurrentForm = this;
+ int xi;
+ int yi;
+ getmaxyx(stdscr, yi, xi);
this->Render(1, 1, xi, yi);
return 0;
@@ -858,8 +854,9 @@ void cmCursesMainForm::HandleInput()
this->HelpMessage[1] = "";
}
- cmCursesLongMessageForm* msgs =
- new cmCursesLongMessageForm(this->HelpMessage, "Help");
+ cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(
+ this->HelpMessage, "Help",
+ cmCursesLongMessageForm::ScrollBehavior::NoScroll);
CurrentForm = msgs;
msgs->Render(1, 1, x, y);
msgs->HandleInput();
@@ -871,7 +868,8 @@ void cmCursesMainForm::HandleInput()
else if (key == 'l') {
getmaxyx(stdscr, y, x);
cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(
- this->Outputs, "CMake produced the following output");
+ this->Outputs, "CMake produced the following output",
+ cmCursesLongMessageForm::ScrollBehavior::NoScroll);
CurrentForm = msgs;
msgs->Render(1, 1, x, y);
msgs->HandleInput();
@@ -1048,12 +1046,12 @@ void cmCursesMainForm::DisplayOutputs()
int yi;
getmaxyx(stdscr, yi, xi);
- auto newLogForm =
- new cmCursesLongMessageForm(this->Outputs, this->LastProgress.c_str());
+ auto newLogForm = new cmCursesLongMessageForm(
+ this->Outputs, this->LastProgress.c_str(),
+ cmCursesLongMessageForm::ScrollBehavior::ScrollDown);
CurrentForm = newLogForm;
this->LogForm.reset(newLogForm);
this->LogForm->Render(1, 1, xi, yi);
- this->LogForm->ScrollDown();
}
const char* cmCursesMainForm::s_ConstHelpMessage =
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index 269e8dd..3557e5c 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -635,7 +635,10 @@ std::string cmExtraCodeLiteGenerator::GetBuildCommand(
if (generator == "NMake Makefiles" || generator == "Ninja") {
ss << make;
} else if (generator == "MinGW Makefiles" || generator == "Unix Makefiles") {
- ss << make << " -f$(ProjectPath)/Makefile -j " << this->CpuCount;
+ ss << make << " -f$(ProjectPath)/Makefile";
+ if (this->CpuCount > 0) {
+ ss << " -j " << this->CpuCount;
+ }
}
if (!targetName.empty()) {
ss << " " << targetName;
diff --git a/Source/cmFileLock.cxx b/Source/cmFileLock.cxx
index e90f571..6010233 100644
--- a/Source/cmFileLock.cxx
+++ b/Source/cmFileLock.cxx
@@ -3,11 +3,23 @@
#include "cmFileLock.h"
#include <cassert>
+#include <utility>
#include "cmFileLockResult.h"
// Common implementation
+cmFileLock::cmFileLock(cmFileLock&& other) noexcept
+{
+ this->File = other.File;
+#if defined(_WIN32)
+ other.File = INVALID_HANDLE_VALUE;
+#else
+ other.File = -1;
+#endif
+ this->Filename = std::move(other.Filename);
+}
+
cmFileLock::~cmFileLock()
{
if (!this->Filename.empty()) {
@@ -17,6 +29,19 @@ cmFileLock::~cmFileLock()
}
}
+cmFileLock& cmFileLock::operator=(cmFileLock&& other) noexcept
+{
+ this->File = other.File;
+#if defined(_WIN32)
+ other.File = INVALID_HANDLE_VALUE;
+#else
+ other.File = -1;
+#endif
+ this->Filename = std::move(other.Filename);
+
+ return *this;
+}
+
cmFileLockResult cmFileLock::Lock(const std::string& filename,
unsigned long timeout)
{
diff --git a/Source/cmFileLock.h b/Source/cmFileLock.h
index 2130d65..5fe068e 100644
--- a/Source/cmFileLock.h
+++ b/Source/cmFileLock.h
@@ -26,7 +26,9 @@ public:
~cmFileLock();
cmFileLock(cmFileLock const&) = delete;
+ cmFileLock(cmFileLock&&) noexcept;
cmFileLock& operator=(cmFileLock const&) = delete;
+ cmFileLock& operator=(cmFileLock&&) noexcept;
/**
* @brief Lock the file.
diff --git a/Source/cmFileLockPool.cxx b/Source/cmFileLockPool.cxx
index 8db2db2..e1f6e94 100644
--- a/Source/cmFileLockPool.cxx
+++ b/Source/cmFileLockPool.cxx
@@ -3,40 +3,34 @@
#include "cmFileLockPool.h"
#include <cassert>
+#include <utility>
-#include "cmAlgorithms.h"
#include "cmFileLock.h"
#include "cmFileLockResult.h"
cmFileLockPool::cmFileLockPool() = default;
-cmFileLockPool::~cmFileLockPool()
-{
- cmDeleteAll(this->FunctionScopes);
- cmDeleteAll(this->FileScopes);
-}
+cmFileLockPool::~cmFileLockPool() = default;
void cmFileLockPool::PushFunctionScope()
{
- this->FunctionScopes.push_back(new ScopePool());
+ this->FunctionScopes.push_back(ScopePool());
}
void cmFileLockPool::PopFunctionScope()
{
assert(!this->FunctionScopes.empty());
- delete this->FunctionScopes.back();
this->FunctionScopes.pop_back();
}
void cmFileLockPool::PushFileScope()
{
- this->FileScopes.push_back(new ScopePool());
+ this->FileScopes.push_back(ScopePool());
}
void cmFileLockPool::PopFileScope()
{
assert(!this->FileScopes.empty());
- delete this->FileScopes.back();
this->FileScopes.pop_back();
}
@@ -49,7 +43,7 @@ cmFileLockResult cmFileLockPool::LockFunctionScope(const std::string& filename,
if (this->FunctionScopes.empty()) {
return cmFileLockResult::MakeNoFunction();
}
- return this->FunctionScopes.back()->Lock(filename, timeoutSec);
+ return this->FunctionScopes.back().Lock(filename, timeoutSec);
}
cmFileLockResult cmFileLockPool::LockFileScope(const std::string& filename,
@@ -59,7 +53,7 @@ cmFileLockResult cmFileLockPool::LockFileScope(const std::string& filename,
return cmFileLockResult::MakeAlreadyLocked();
}
assert(!this->FileScopes.empty());
- return this->FileScopes.back()->Lock(filename, timeoutSec);
+ return this->FileScopes.back().Lock(filename, timeoutSec);
}
cmFileLockResult cmFileLockPool::LockProcessScope(const std::string& filename,
@@ -74,14 +68,14 @@ cmFileLockResult cmFileLockPool::LockProcessScope(const std::string& filename,
cmFileLockResult cmFileLockPool::Release(const std::string& filename)
{
for (auto& funcScope : this->FunctionScopes) {
- const cmFileLockResult result = funcScope->Release(filename);
+ const cmFileLockResult result = funcScope.Release(filename);
if (!result.IsOk()) {
return result;
}
}
for (auto& fileScope : this->FileScopes) {
- const cmFileLockResult result = fileScope->Release(filename);
+ const cmFileLockResult result = fileScope.Release(filename);
if (!result.IsOk()) {
return result;
}
@@ -93,14 +87,14 @@ cmFileLockResult cmFileLockPool::Release(const std::string& filename)
bool cmFileLockPool::IsAlreadyLocked(const std::string& filename) const
{
for (auto const& funcScope : this->FunctionScopes) {
- const bool result = funcScope->IsAlreadyLocked(filename);
+ const bool result = funcScope.IsAlreadyLocked(filename);
if (result) {
return true;
}
}
for (auto const& fileScope : this->FileScopes) {
- const bool result = fileScope->IsAlreadyLocked(filename);
+ const bool result = fileScope.IsAlreadyLocked(filename);
if (result) {
return true;
}
@@ -111,21 +105,29 @@ bool cmFileLockPool::IsAlreadyLocked(const std::string& filename) const
cmFileLockPool::ScopePool::ScopePool() = default;
-cmFileLockPool::ScopePool::~ScopePool()
+cmFileLockPool::ScopePool::~ScopePool() = default;
+
+cmFileLockPool::ScopePool::ScopePool(ScopePool&&) noexcept = default;
+
+cmFileLockPool::ScopePool& cmFileLockPool::ScopePool::operator=(
+ ScopePool&& other) noexcept
{
- cmDeleteAll(this->Locks);
+ if (this != &other) {
+ this->Locks = std::move(other.Locks);
+ }
+
+ return *this;
}
cmFileLockResult cmFileLockPool::ScopePool::Lock(const std::string& filename,
unsigned long timeoutSec)
{
- cmFileLock* lock = new cmFileLock();
- const cmFileLockResult result = lock->Lock(filename, timeoutSec);
+ cmFileLock lock;
+ const cmFileLockResult result = lock.Lock(filename, timeoutSec);
if (result.IsOk()) {
- this->Locks.push_back(lock);
+ this->Locks.push_back(std::move(lock));
return cmFileLockResult::MakeOk();
}
- delete lock;
return result;
}
@@ -133,8 +135,8 @@ cmFileLockResult cmFileLockPool::ScopePool::Release(
const std::string& filename)
{
for (auto& lock : this->Locks) {
- if (lock->IsLocked(filename)) {
- return lock->Release();
+ if (lock.IsLocked(filename)) {
+ return lock.Release();
}
}
return cmFileLockResult::MakeOk();
@@ -144,7 +146,7 @@ bool cmFileLockPool::ScopePool::IsAlreadyLocked(
const std::string& filename) const
{
for (auto const& lock : this->Locks) {
- if (lock->IsLocked(filename)) {
+ if (lock.IsLocked(filename)) {
return true;
}
}
diff --git a/Source/cmFileLockPool.h b/Source/cmFileLockPool.h
index dae68dd..d45c82c 100644
--- a/Source/cmFileLockPool.h
+++ b/Source/cmFileLockPool.h
@@ -8,7 +8,8 @@
#include <string>
#include <vector>
-class cmFileLock;
+#include "cmFileLock.h"
+
class cmFileLockResult;
class cmFileLockPool
@@ -64,7 +65,9 @@ private:
~ScopePool();
ScopePool(ScopePool const&) = delete;
+ ScopePool(ScopePool&&) noexcept;
ScopePool& operator=(ScopePool const&) = delete;
+ ScopePool& operator=(ScopePool&&) noexcept;
cmFileLockResult Lock(const std::string& filename,
unsigned long timeoutSec);
@@ -72,17 +75,12 @@ private:
bool IsAlreadyLocked(const std::string& filename) const;
private:
- using List = std::vector<cmFileLock*>;
- using It = List::iterator;
- using CIt = List::const_iterator;
+ using List = std::vector<cmFileLock>;
List Locks;
};
- using List = std::vector<ScopePool*>;
-
- using It = List::iterator;
- using CIt = List::const_iterator;
+ using List = std::vector<ScopePool>;
List FunctionScopes;
List FileScopes;
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 573ad4d..d0b5f9e 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3360,19 +3360,20 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
if (this->GetPropertyAsBool("DISABLE_PRECOMPILE_HEADERS")) {
return std::string();
}
+ const cmGeneratorTarget* generatorTarget = this;
+ const char* pchReuseFrom =
+ generatorTarget->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM");
+
const auto inserted =
this->PchHeaders.insert(std::make_pair(language + config, ""));
if (inserted.second) {
const std::vector<BT<std::string>> headers =
this->GetPrecompileHeaders(config, language);
- if (headers.empty()) {
+ if (headers.empty() && !pchReuseFrom) {
return std::string();
}
std::string& filename = inserted.first->second;
- const cmGeneratorTarget* generatorTarget = this;
- const char* pchReuseFrom =
- generatorTarget->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM");
if (pchReuseFrom) {
generatorTarget =
this->GetGlobalGenerator()->FindGeneratorTarget(pchReuseFrom);
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 154bd8e..40e8d48 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3414,7 +3414,7 @@ bool cmGlobalXCodeGenerator::OutputXCodeSharedSchemes(
(root->GetMakefile()->GetCMakeInstance()->GetIsInTryCompile() ||
obj->GetTarget()->GetPropertyAsBool("XCODE_GENERATE_SCHEME"))) {
const std::string& targetName = obj->GetTarget()->GetName();
- cmXCodeScheme schm(obj, testables[targetName],
+ cmXCodeScheme schm(root, obj, testables[targetName],
this->CurrentConfigurationTypes,
this->XcodeVersion);
schm.WriteXCodeSharedScheme(xcProjDir,
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index ce3be63..7b6d0f3 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -629,7 +629,7 @@ void cmLocalUnixMakefileGenerator3::WriteMakeVariables(
<< "# The command to remove a file.\n"
<< "RM = "
<< cmakeShellCommand
- << " -E remove -f\n"
+ << " -E rm -f\n"
<< "\n";
makefileStream
<< "# Escaping for special characters.\n"
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index beedef4..72bef21 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -486,7 +486,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
std::string cmakeCommand =
this->GetLocalGenerator()->ConvertToOutputFormat(
cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL);
- linkCmds.push_back(cmakeCommand + " -E remove $TARGET_FILE");
+ linkCmds.push_back(cmakeCommand + " -E rm -f $TARGET_FILE");
}
// TODO: Use ARCHIVE_APPEND for archives over a certain size.
{
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index e093be0..147f97f 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -7,10 +7,11 @@
#include <set>
#include <utility>
+#include <cm/memory>
+
#include "cmsys/FStream.hxx"
#include "cmsys/RegularExpression.hxx"
-#include "cmAlgorithms.h"
#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
#include "cmMakefile.h"
@@ -94,7 +95,7 @@ public:
/**
* Destructor.
*/
- ~cmLBDepend() { cmDeleteAll(this->DependInformationMap); }
+ ~cmLBDepend() = default;
cmLBDepend(const cmLBDepend&) = delete;
cmLBDepend& operator=(const cmLBDepend&) = delete;
@@ -152,9 +153,9 @@ public:
* Generate dependencies for the file given. Returns a pointer to
* the cmDependInformation object for the file.
*/
- const cmDependInformation* FindDependencies(const char* file)
+ const cmDependInformation* FindDependencies(const std::string& file)
{
- cmDependInformation* info = this->GetDependInformation(file, nullptr);
+ cmDependInformation* info = this->GetDependInformation(file, "");
this->GenerateDependInformation(info);
return info;
}
@@ -203,7 +204,7 @@ protected:
}
// Add this file and all its dependencies.
- this->AddDependency(info, includeFile.c_str());
+ this->AddDependency(info, includeFile);
/// add the cxx file if it exists
std::string cxxFile = includeFile;
std::string::size_type pos = cxxFile.rfind('.');
@@ -254,7 +255,7 @@ protected:
}
}
if (found) {
- this->AddDependency(info, cxxFile.c_str());
+ this->AddDependency(info, cxxFile);
}
}
}
@@ -264,10 +265,10 @@ protected:
/**
* Add a dependency. Possibly walk it for more dependencies.
*/
- void AddDependency(cmDependInformation* info, const char* file)
+ void AddDependency(cmDependInformation* info, const std::string& file)
{
cmDependInformation* dependInfo =
- this->GetDependInformation(file, info->PathOnly.c_str());
+ this->GetDependInformation(file, info->PathOnly);
this->GenerateDependInformation(dependInfo);
info->AddDependencies(dependInfo);
}
@@ -313,7 +314,7 @@ protected:
// Dependency hints have been given. Use them to begin the
// recursion.
for (std::string const& file : cFile.GetDepends()) {
- this->AddDependency(info, file.c_str());
+ this->AddDependency(info, file);
}
// Found dependency information. We are done.
@@ -361,8 +362,8 @@ protected:
* Get an instance of cmDependInformation corresponding to the given file
* name.
*/
- cmDependInformation* GetDependInformation(const char* file,
- const char* extraPath)
+ cmDependInformation* GetDependInformation(const std::string& file,
+ const std::string& extraPath)
{
// Get the full path for the file so that lookup is unambiguous.
std::string fullPath = this->FullPath(file, extraPath);
@@ -371,15 +372,16 @@ protected:
auto result = this->DependInformationMap.find(fullPath);
if (result != this->DependInformationMap.end()) {
// Found an instance, return it.
- return result->second;
+ return result->second.get();
}
// Didn't find an instance. Create a new one and save it.
- cmDependInformation* info = new cmDependInformation;
+ auto info = cm::make_unique<cmDependInformation>();
+ auto ptr = info.get();
info->FullPath = fullPath;
info->PathOnly = cmSystemTools::GetFilenamePath(fullPath);
info->IncludeName = file;
- this->DependInformationMap[fullPath] = info;
- return info;
+ this->DependInformationMap[fullPath] = std::move(info);
+ return ptr;
}
/**
@@ -387,14 +389,9 @@ protected:
* This uses the include directories.
* TODO: Cache path conversions to reduce FileExists calls.
*/
- std::string FullPath(const char* fname, const char* extraPath)
+ std::string FullPath(const std::string& fname, const std::string& extraPath)
{
- DirectoryToFileToPathMapType::iterator m;
- if (extraPath) {
- m = this->DirectoryToFileToPathMap.find(extraPath);
- } else {
- m = this->DirectoryToFileToPathMap.find("");
- }
+ auto m = this->DirectoryToFileToPathMap.find(extraPath);
if (m != this->DirectoryToFileToPathMap.end()) {
FileToPathMapType& map = m->second;
@@ -406,7 +403,7 @@ protected:
if (cmSystemTools::FileExists(fname, true)) {
std::string fp = cmSystemTools::CollapseFullPath(fname);
- this->DirectoryToFileToPathMap[extraPath ? extraPath : ""][fname] = fp;
+ this->DirectoryToFileToPathMap[extraPath][fname] = fp;
return fp;
}
@@ -418,12 +415,12 @@ protected:
if (cmSystemTools::FileExists(path, true) &&
!cmSystemTools::FileIsDirectory(path)) {
std::string fp = cmSystemTools::CollapseFullPath(path);
- this->DirectoryToFileToPathMap[extraPath ? extraPath : ""][fname] = fp;
+ this->DirectoryToFileToPathMap[extraPath][fname] = fp;
return fp;
}
}
- if (extraPath) {
+ if (!extraPath.empty()) {
std::string path = extraPath;
if (!path.empty() && path.back() != '/') {
path = path + "/";
@@ -438,7 +435,7 @@ protected:
}
// Couldn't find the file.
- return std::string(fname);
+ return fname;
}
cmMakefile* Makefile;
@@ -449,7 +446,8 @@ protected:
using FileToPathMapType = std::map<std::string, std::string>;
using DirectoryToFileToPathMapType =
std::map<std::string, FileToPathMapType>;
- using DependInformationMapType = std::map<std::string, cmDependInformation*>;
+ using DependInformationMapType =
+ std::map<std::string, std::unique_ptr<cmDependInformation>>;
DependInformationMapType DependInformationMap;
DirectoryToFileToPathMapType DirectoryToFileToPathMap;
};
@@ -476,7 +474,7 @@ bool cmOutputRequiredFilesCommand(std::vector<std::string> const& args,
md.SetMakefile(&status.GetMakefile());
md.AddSearchPath(status.GetMakefile().GetCurrentSourceDirectory());
// find the depends for a file
- const cmDependInformation* info = md.FindDependencies(file.c_str());
+ const cmDependInformation* info = md.FindDependencies(file);
if (info) {
// write them out
FILE* fout = cmsys::SystemTools::Fopen(outputFile, "w");
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 92c80bb..da32204 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -290,7 +290,10 @@ class cmMakefile;
SELECT(POLICY, CMP0097, \
"ExternalProject_Add with GIT_SUBMODULES \"\" initializes no " \
"submodules.", \
- 3, 16, 0, cmPolicies::WARN)
+ 3, 16, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0098, \
+ "FindFLEX runs flex in CMAKE_CURRENT_BINARY_DIR when executing.", 3, \
+ 17, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index c4a4220..17d32c6 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -814,6 +814,8 @@ void cmSystemTools::InitializeLibUV()
# else
_fmode = _O_TEXT;
# endif
+ // Replace libuv's report handler with our own to suppress popups.
+ cmSystemTools::EnableMSVCDebugHook();
#endif
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 05c9e6e..b9bf7a5 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -371,6 +371,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("XCODE_SCHEME_THREAD_SANITIZER_STOP");
initProp("XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER");
initProp("XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP");
+ initProp("XCODE_SCHEME_WORKING_DIRECTORY");
initProp("XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER");
initProp("XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP");
initProp("XCODE_SCHEME_MALLOC_SCRIBBLE");
@@ -1288,11 +1289,8 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
reusedTarget->SetProperty("COMPILE_PDB_OUTPUT_DIRECTORY",
cmStrCat(reusedFrom, ".dir/").c_str());
- for (auto p : { "COMPILE_PDB_NAME", "PRECOMPILE_HEADERS",
- "INTERFACE_PRECOMPILE_HEADERS" }) {
- this->SetProperty(p, reusedTarget->GetProperty(p));
- }
-
+ this->SetProperty("COMPILE_PDB_NAME",
+ reusedTarget->GetProperty("COMPILE_PDB_NAME"));
this->AddUtility(reusedFrom, impl->Makefile);
} else {
impl->Properties.SetProperty(prop, value);
diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx
index afc95f5..b34c2f6 100644
--- a/Source/cmXCodeScheme.cxx
+++ b/Source/cmXCodeScheme.cxx
@@ -8,13 +8,16 @@
#include <utility>
#include "cmGeneratedFileStream.h"
+#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmXMLSafe.h"
-cmXCodeScheme::cmXCodeScheme(cmXCodeObject* xcObj, TestObjects tests,
+cmXCodeScheme::cmXCodeScheme(cmLocalGenerator* lg, cmXCodeObject* xcObj,
+ TestObjects tests,
const std::vector<std::string>& configList,
unsigned int xcVersion)
- : Target(xcObj)
+ : LocalGenerator(lg)
+ , Target(xcObj)
, Tests(std::move(tests))
, TargetName(xcObj->GetTarget()->GetName())
, ConfigList(configList)
@@ -135,7 +138,8 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
xout.Attribute("selectedLauncherIdentifier",
"Xcode.DebuggerFoundation.Launcher.LLDB");
xout.Attribute("launchStyle", "0");
- xout.Attribute("useCustomWorkingDirectory", "NO");
+ WriteCustomWorkingDirectory(xout, configuration);
+
xout.Attribute("ignoresPersistentStateOnLaunch", "NO");
WriteLaunchActionBooleanAttribute(xout, "debugDocumentVersioning",
"XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING",
@@ -355,7 +359,7 @@ void cmXCodeScheme::WriteProfileAction(cmXMLWriter& xout,
xout.Attribute("buildConfiguration", configuration);
xout.Attribute("shouldUseLaunchSchemeArgsEnv", "YES");
xout.Attribute("savedToolIdentifier", "");
- xout.Attribute("useCustomWorkingDirectory", "NO");
+ WriteCustomWorkingDirectory(xout, configuration);
WriteLaunchActionBooleanAttribute(xout, "debugDocumentVersioning",
"XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING",
true);
@@ -395,6 +399,22 @@ void cmXCodeScheme::WriteBuildableReference(cmXMLWriter& xout,
xout.EndElement();
}
+void cmXCodeScheme::WriteCustomWorkingDirectory(
+ cmXMLWriter& xout, const std::string& configuration)
+{
+ std::string propertyValue = this->Target->GetTarget()->GetSafeProperty(
+ "XCODE_SCHEME_WORKING_DIRECTORY");
+ if (propertyValue.empty()) {
+ xout.Attribute("useCustomWorkingDirectory", "NO");
+ } else {
+ xout.Attribute("useCustomWorkingDirectory", "YES");
+
+ auto customWorkingDirectory = cmGeneratorExpression::Evaluate(
+ propertyValue, this->LocalGenerator, configuration);
+ xout.Attribute("customWorkingDirectory", customWorkingDirectory);
+ }
+}
+
std::string cmXCodeScheme::WriteVersionString()
{
std::ostringstream v;
diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h
index dff5e35..da40856 100644
--- a/Source/cmXCodeScheme.h
+++ b/Source/cmXCodeScheme.h
@@ -20,7 +20,7 @@ class cmXCodeScheme
public:
using TestObjects = std::vector<const cmXCodeObject*>;
- cmXCodeScheme(cmXCodeObject* xcObj, TestObjects tests,
+ cmXCodeScheme(cmLocalGenerator* lg, cmXCodeObject* xcObj, TestObjects tests,
const std::vector<std::string>& configList,
unsigned int xcVersion);
@@ -28,6 +28,7 @@ public:
const std::string& container);
private:
+ cmLocalGenerator* const LocalGenerator;
const cmXCodeObject* const Target;
const TestObjects Tests;
const std::string& TargetName;
@@ -63,6 +64,9 @@ private:
void WriteBuildableReference(cmXMLWriter& xout, const cmXCodeObject* xcObj,
const std::string& container);
+ void WriteCustomWorkingDirectory(cmXMLWriter& xout,
+ const std::string& configuration);
+
std::string WriteVersionString();
std::string FindConfiguration(const std::string& name);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 4a6108d..b1c6e8f 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -330,9 +330,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
}
} else {
- std::cerr << "Parse error in command line argument: " << arg << "\n"
- << "Should be: VAR:type=value\n";
- cmSystemTools::Error("No cmake script provided.");
+ cmSystemTools::Error("Parse error in command line argument: " + arg +
+ "\n" + "Should be: VAR:type=value\n");
return false;
}
} else if (cmHasLiteralPrefix(arg, "-W")) {
@@ -422,7 +421,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
return false;
}
}
- std::cout << "loading initial cache file " << path << "\n";
+ cmSystemTools::Stdout("loading initial cache file " + path + "\n");
// Resolve script path specified on command line relative to $PWD.
path = cmSystemTools::CollapseFullPath(path);
this->ReadListFile(args, path);
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index baf975e..d817971 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -683,7 +683,6 @@ int main(int ac, char const* const* av)
ac = args.argc();
av = args.argv();
- cmSystemTools::EnableMSVCDebugHook();
cmSystemTools::InitializeLibUV();
cmSystemTools::FindCMakeResources(av[0]);
if (ac > 1) {
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index d05e3c8..c2fbb43 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -107,10 +107,12 @@ void CMakeCommandUsage(const char* program)
<< " sha384sum <file>... - create SHA384 checksum of files\n"
<< " sha512sum <file>... - create SHA512 checksum of files\n"
<< " remove [-f] <file>... - remove the file(s), use -f to force "
- "it\n"
- << " remove_directory <dir>... - remove directories and their contents\n"
+ "it (deprecated: use rm instead)\n"
+ << " remove_directory <dir>... - remove directories and their contents (deprecated: use rm instead)\n"
<< " rename oldname newname - rename a file or directory "
"(on one volume)\n"
+ << " rm [-rRf] <file/dir>... - remove files or directories, use -f to "
+ "force it, r or R to remove directories and their contents recursively\n"
<< " server - start cmake in server mode\n"
<< " sleep <number>... - sleep for given number of seconds\n"
<< " tar [cxt][vf][zjJ] file.tar [file/dir1 file/dir2 ...]\n"
@@ -172,6 +174,24 @@ static bool cmTarFilesFrom(std::string const& file,
return true;
}
+static bool cmRemoveDirectory(const std::string& dir, bool recursive = true)
+{
+ if (cmSystemTools::FileIsSymlink(dir)) {
+ if (!cmSystemTools::RemoveFile(dir)) {
+ std::cerr << "Error removing directory symlink \"" << dir << "\".\n";
+ return false;
+ }
+ } else if (!recursive) {
+ std::cerr << "Error removing directory \"" << dir
+ << "\" without recursive option.\n";
+ return false;
+ } else if (!cmSystemTools::RemoveADirectory(dir)) {
+ std::cerr << "Error removing directory \"" << dir << "\".\n";
+ return false;
+ }
+ return true;
+}
+
static int HandleIWYU(const std::string& runCmd,
const std::string& /* sourceFile */,
const std::vector<std::string>& orig_cmd)
@@ -706,14 +726,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
bool return_value = false;
for (auto const& arg : cmMakeRange(args).advance(2)) {
if (cmSystemTools::FileIsDirectory(arg)) {
- if (cmSystemTools::FileIsSymlink(arg)) {
- if (!cmSystemTools::RemoveFile(arg)) {
- std::cerr << "Error removing directory symlink \"" << arg
- << "\".\n";
- return_value = true;
- }
- } else if (!cmSystemTools::RemoveADirectory(arg)) {
- std::cerr << "Error removing directory \"" << arg << "\".\n";
+ if (!cmRemoveDirectory(arg)) {
return_value = true;
}
}
@@ -739,6 +752,65 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
return 0;
}
+ // Remove directories or files with rm
+ if (args[1] == "rm" && args.size() > 2) {
+ // If an error occurs, we want to continue removing the remaining
+ // files/directories.
+ int return_value = 0;
+ bool force = false;
+ bool recursive = false;
+ bool doing_options = true;
+ bool at_least_one_file = false;
+ for (auto const& arg : cmMakeRange(args).advance(2)) {
+ if (doing_options && cmHasLiteralPrefix(arg, "-")) {
+ if (arg == "--") {
+ doing_options = false;
+ }
+ if (arg.find('f') != std::string::npos) {
+ force = true;
+ }
+ if (arg.find_first_of("rR") != std::string::npos) {
+ recursive = true;
+ }
+ if (arg.find_first_not_of("-frR") != std::string::npos) {
+ cmSystemTools::Error("Unknown -E rm argument: " + arg);
+ return 1;
+ }
+ } else {
+ if (arg.empty()) {
+ continue;
+ }
+ at_least_one_file = true;
+ // Complain if the -f option was not given and
+ // either file does not exist or
+ // file could not be removed and still exists
+ bool file_exists_or_forced_remove = cmSystemTools::FileExists(arg) ||
+ cmSystemTools::FileIsSymlink(arg) || force;
+ if (cmSystemTools::FileIsDirectory(arg)) {
+ if (!cmRemoveDirectory(arg, recursive)) {
+ return_value = 1;
+ }
+ } else if ((!file_exists_or_forced_remove) ||
+ (!cmSystemTools::RemoveFile(arg) &&
+ cmSystemTools::FileExists(arg))) {
+ if (!file_exists_or_forced_remove) {
+ cmSystemTools::Error(
+ "File to remove does not exist and force is not set: " + arg);
+ } else {
+ cmSystemTools::Error("File can't be removed and still exist: " +
+ arg);
+ }
+ return_value = 1;
+ }
+ }
+ }
+ if (!at_least_one_file) {
+ cmSystemTools::Error("Missing file/directory to remove");
+ return 1;
+ }
+ return return_value;
+ }
+
// Touch file
if (args[1] == "touch" && args.size() > 2) {
for (auto const& arg : cmMakeRange(args).advance(2)) {
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 1f25492..9b45bb0 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -164,7 +164,6 @@ int main(int argc, char const* const* argv)
argv = encoding_args.argv();
cmSystemTools::DoNotInheritStdPipes();
- cmSystemTools::EnableMSVCDebugHook();
cmSystemTools::InitializeLibUV();
cmSystemTools::FindCMakeResources(argv[0]);
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index dcf05da..39873e6 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -4666,8 +4666,12 @@ void SystemTools::ClassFinalize()
# include <stdlib.h>
namespace KWSYS_NAMESPACE {
-static int SystemToolsDebugReport(int, char* message, int*)
+static int SystemToolsDebugReport(int, char* message, int* ret)
{
+ if (ret) {
+ // Pretend user clicked on Retry button in popup.
+ *ret = 1;
+ }
fprintf(stderr, "%s", message);
fflush(stderr);
return 1; // no further reporting required
diff --git a/Tests/CMakeTestMultipleConfigures/RunCMake.cmake b/Tests/CMakeTestMultipleConfigures/RunCMake.cmake
index 9632664..a79bfcb 100644
--- a/Tests/CMakeTestMultipleConfigures/RunCMake.cmake
+++ b/Tests/CMakeTestMultipleConfigures/RunCMake.cmake
@@ -21,11 +21,11 @@ set(N 7)
# First setup source and binary trees:
#
-execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory
+execute_process(COMMAND ${CMAKE_COMMAND} -E rm -rf
${dir}/Source
)
-execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory
+execute_process(COMMAND ${CMAKE_COMMAND} -E rm -rf
${dir}/Build
)
@@ -69,7 +69,7 @@ foreach(i RANGE 1 ${N})
# Save this iteration of the Build directory:
#
- execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory
+ execute_process(COMMAND ${CMAKE_COMMAND} -E rm -rf
${dir}/b${i}
)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory
diff --git a/Tests/CPackComponentsDEB/CMakeLists.txt b/Tests/CPackComponentsDEB/CMakeLists.txt
index bc5b6a9..4363f1b 100644
--- a/Tests/CPackComponentsDEB/CMakeLists.txt
+++ b/Tests/CPackComponentsDEB/CMakeLists.txt
@@ -104,7 +104,7 @@ install(FILES ${CPackComponentsDEB_BINARY_DIR}/symtest
COMPONENT applications)
if(EXISTS "./dirtest")
- execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ./dirtest)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E rm -rf ./dirtest)
endif()
# NOTE: directory left empty on purpose
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ./dirtest)
diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt
index 2e41754..9fd85be 100644
--- a/Tests/Complex/CMakeLists.txt
+++ b/Tests/Complex/CMakeLists.txt
@@ -324,7 +324,7 @@ if (WIN32)
${file}
"[${hkey}]" DOC "Registry_Test_Path")
exec_program(${CMAKE_COMMAND} ARGS "-E delete_regv \"${hkey}\"")
- exec_program(${CMAKE_COMMAND} ARGS "-E remove \"${dir}/${file}\"")
+ exec_program(${CMAKE_COMMAND} ARGS "-E rm -f \"${dir}/${file}\"")
endif ()
endif ()
diff --git a/Tests/Complex/Library/CMakeLists.txt b/Tests/Complex/Library/CMakeLists.txt
index 64f6dc8..df874ef 100644
--- a/Tests/Complex/Library/CMakeLists.txt
+++ b/Tests/Complex/Library/CMakeLists.txt
@@ -131,7 +131,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM)
# Custom target to try preprocessing invocation.
add_custom_target(test_preprocess ${MAYBE_ALL}
- COMMAND ${CMAKE_COMMAND} -E remove CMakeFiles/create_file.dir/create_file.i
+ COMMAND ${CMAKE_COMMAND} -E rm -f CMakeFiles/create_file.dir/create_file.i
COMMAND ${CMAKE_MAKE_PROGRAM} create_file.i
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/test_preprocess.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt
index 628cd4e..28b73af 100644
--- a/Tests/ComplexOneConfig/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/CMakeLists.txt
@@ -281,7 +281,7 @@ if (WIN32)
${file}
"[${hkey}]" DOC "Registry_Test_Path")
exec_program(${CMAKE_COMMAND} ARGS "-E delete_regv \"${hkey}\"")
- exec_program(${CMAKE_COMMAND} ARGS "-E remove \"${dir}/${file}\"")
+ exec_program(${CMAKE_COMMAND} ARGS "-E rm -f \"${dir}/${file}\"")
endif ()
endif ()
diff --git a/Tests/ComplexOneConfig/Library/CMakeLists.txt b/Tests/ComplexOneConfig/Library/CMakeLists.txt
index 64f6dc8..df874ef 100644
--- a/Tests/ComplexOneConfig/Library/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/Library/CMakeLists.txt
@@ -131,7 +131,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM)
# Custom target to try preprocessing invocation.
add_custom_target(test_preprocess ${MAYBE_ALL}
- COMMAND ${CMAKE_COMMAND} -E remove CMakeFiles/create_file.dir/create_file.i
+ COMMAND ${CMAKE_COMMAND} -E rm -f CMakeFiles/create_file.dir/create_file.i
COMMAND ${CMAKE_MAKE_PROGRAM} create_file.i
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/test_preprocess.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index e9a9f52..e4b50d0 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -70,7 +70,7 @@ add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc1.h APPEND
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1temp.h
${PROJECT_BINARY_DIR}/doc1.h
COMMAND ${CMAKE_COMMAND} -E echo " Removing doc1temp.h."
- COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_BINARY_DIR}/doc1temp.h
+ COMMAND ${CMAKE_COMMAND} -E rm -f ${PROJECT_BINARY_DIR}/doc1temp.h
)
# Add custom command to generate foo.h.
@@ -412,7 +412,7 @@ add_custom_target(do_check_command_line ALL
add_dependencies(do_check_command_line check_command_line)
add_custom_target(pre_check_command_line
- COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/check_mark.txt
+ COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_CURRENT_BINARY_DIR}/check_mark.txt
)
add_dependencies(do_check_command_line pre_check_command_line)
diff --git a/Tests/ExportImport/CMakeLists.txt b/Tests/ExportImport/CMakeLists.txt
index dc621eb..d88eb11 100644
--- a/Tests/ExportImport/CMakeLists.txt
+++ b/Tests/ExportImport/CMakeLists.txt
@@ -7,7 +7,7 @@ endif()
# Wipe out the install tree to make sure the exporter works.
add_custom_command(
OUTPUT ${ExportImport_BINARY_DIR}/CleanupProject
- COMMAND ${CMAKE_COMMAND} -E remove_directory ${ExportImport_BINARY_DIR}/Root
+ COMMAND ${CMAKE_COMMAND} -E rm -rf ${ExportImport_BINARY_DIR}/Root
)
add_custom_target(CleanupTarget ALL DEPENDS ${ExportImport_BINARY_DIR}/CleanupProject)
set_property(
diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt
index de887fa..d945375 100644
--- a/Tests/FortranOnly/CMakeLists.txt
+++ b/Tests/FortranOnly/CMakeLists.txt
@@ -103,11 +103,11 @@ if("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM)
# Custom target to try preprocessing invocation.
add_custom_target(test_preprocess ${MAYBE_ALL}
- COMMAND ${CMAKE_COMMAND} -E remove CMakeFiles/preprocess.dir/preprocess.F.i
+ COMMAND ${CMAKE_COMMAND} -E rm -f CMakeFiles/preprocess.dir/preprocess.F.i
COMMAND ${CMAKE_MAKE_PROGRAM} preprocess.i
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/test_preprocess.cmake
# Remove bogus file some compilers leave behind.
- COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_SOURCE_DIR}/preprocess.s
+ COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_CURRENT_SOURCE_DIR}/preprocess.s
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
endif()
diff --git a/Tests/JavaExportImport/CMakeLists.txt b/Tests/JavaExportImport/CMakeLists.txt
index c70704a..7a2d020 100644
--- a/Tests/JavaExportImport/CMakeLists.txt
+++ b/Tests/JavaExportImport/CMakeLists.txt
@@ -9,7 +9,7 @@ find_package(Java COMPONENTS Development)
# Wipe out the install tree to make sure the exporter works.
add_custom_command(
OUTPUT ${JavaExportImport_BINARY_DIR}/CleanupProject
- COMMAND ${CMAKE_COMMAND} -E remove_directory ${JavaExportImport_BINARY_DIR}/Root
+ COMMAND ${CMAKE_COMMAND} -E rm -rf ${JavaExportImport_BINARY_DIR}/Root
)
add_custom_target(CleanupTarget ALL DEPENDS ${JavaExportImport_BINARY_DIR}/CleanupProject)
set_property(
diff --git a/Tests/LinkDirectory/CMakeLists.txt b/Tests/LinkDirectory/CMakeLists.txt
index c60de84..c7a2700 100644
--- a/Tests/LinkDirectory/CMakeLists.txt
+++ b/Tests/LinkDirectory/CMakeLists.txt
@@ -33,7 +33,7 @@ ExternalProject_Add(ExternalTarget
# directly because it does not know the full paths to the libraries.
# (The purpose of this test is to check that link_directories works.)
ExternalProject_Add_Step(ExternalTarget cleanup
- COMMAND ${CMAKE_COMMAND} -E remove_directory ${LinkDirectory_BINARY_DIR}/bin
+ COMMAND ${CMAKE_COMMAND} -E rm -rf ${LinkDirectory_BINARY_DIR}/bin
DEPENDEES download
DEPENDERS configure
DEPENDS mylibA mylibB
diff --git a/Tests/MacRuntimePath/CMakeLists.txt b/Tests/MacRuntimePath/CMakeLists.txt
index a3c6fd9..9f1bf1a 100644
--- a/Tests/MacRuntimePath/CMakeLists.txt
+++ b/Tests/MacRuntimePath/CMakeLists.txt
@@ -7,7 +7,7 @@ endif()
# Wipe out the install tree to make sure the exporter works.
add_custom_command(
OUTPUT ${MacRuntimePath_BINARY_DIR}/CleanupProject
- COMMAND ${CMAKE_COMMAND} -E remove_directory ${MacRuntimePath_BINARY_DIR}/Root
+ COMMAND ${CMAKE_COMMAND} -E rm -rf ${MacRuntimePath_BINARY_DIR}/Root
)
add_custom_target(CleanupTarget ALL DEPENDS ${MacRuntimePath_BINARY_DIR}/CleanupProject)
set_property(
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 1371295..e88b29d 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -445,7 +445,7 @@ add_RunCMake_test(target_include_directories)
add_RunCMake_test(target_sources)
add_RunCMake_test(CheckModules)
add_RunCMake_test(CheckIPOSupported)
-add_RunCMake_test(CommandLine -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
+add_RunCMake_test(CommandLine -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCYGWIN=${CYGWIN})
add_RunCMake_test(CommandLineTar)
if(CMAKE_PLATFORM_NO_VERSIONED_SONAME OR (NOT CMAKE_SHARED_LIBRARY_SONAME_FLAG AND NOT CMAKE_SHARED_LIBRARY_SONAME_C_FLAG))
diff --git a/Tests/RunCMake/CTestResourceAllocation/ResourceCommon.cmake b/Tests/RunCMake/CTestResourceAllocation/ResourceCommon.cmake
index 7d63299..ef79dce 100644
--- a/Tests/RunCMake/CTestResourceAllocation/ResourceCommon.cmake
+++ b/Tests/RunCMake/CTestResourceAllocation/ResourceCommon.cmake
@@ -1,6 +1,6 @@
function(setup_resource_tests)
if(CTEST_RESOURCE_ALLOC_ENABLED)
- add_test(NAME ResourceSetup COMMAND "${CMAKE_COMMAND}" -E remove -f "${CMAKE_BINARY_DIR}/ctresalloc.log")
+ add_test(NAME ResourceSetup COMMAND "${CMAKE_COMMAND}" -E rm -f "${CMAKE_BINARY_DIR}/ctresalloc.log")
endif()
endfunction()
diff --git a/Tests/RunCMake/CommandLine/E_rm_bad_argument-result.txt b/Tests/RunCMake/CommandLine/E_rm_bad_argument-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_bad_argument-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/E_rm_bad_argument-stderr.txt b/Tests/RunCMake/CommandLine/E_rm_bad_argument-stderr.txt
new file mode 100644
index 0000000..62b963a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_bad_argument-stderr.txt
@@ -0,0 +1 @@
+^CMake Error: Unknown -E rm argument: -rd$
diff --git a/Tests/RunCMake/CommandLine/E_rm_directory_link_existing-check.cmake b/Tests/RunCMake/CommandLine/E_rm_directory_link_existing-check.cmake
new file mode 100644
index 0000000..b1a29a2
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_directory_link_existing-check.cmake
@@ -0,0 +1,3 @@
+if(NOT EXISTS ${out}/dir/existing.txt)
+ set(RunCMake_TEST_FAILED "${out}/dir/existing.txt should exist (we only removed the link to dir folder)")
+endif()
diff --git a/Tests/RunCMake/CommandLine/E_rm_directory_link_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_directory_link_existing-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_directory_link_existing-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CommandLine/E_rm_empty_file_specified-stderr.txt b/Tests/RunCMake/CommandLine/E_rm_empty_file_specified-stderr.txt
new file mode 100644
index 0000000..1ac7dba
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_empty_file_specified-stderr.txt
@@ -0,0 +1 @@
+^CMake Error: Missing file/directory to remove$
diff --git a/Tests/RunCMake/CommandLine/E_rm_empty_file_specified.cmake b/Tests/RunCMake/CommandLine/E_rm_empty_file_specified.cmake
new file mode 100644
index 0000000..6cd4edd
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_empty_file_specified.cmake
@@ -0,0 +1,8 @@
+execute_process(
+ COMMAND ${CMAKE_COMMAND} -E rm ""
+ RESULT_VARIABLE actual_result
+ )
+
+if(NOT "${actual_result}" EQUAL "1")
+ message(SEND_ERROR "cmake -E rm \"\" should have returned 1, got ${actual_result}")
+endif()
diff --git a/Tests/RunCMake/CommandLine/E_rm_file_force_existing-check.cmake b/Tests/RunCMake/CommandLine/E_rm_file_force_existing-check.cmake
new file mode 100644
index 0000000..e28b160
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_file_force_existing-check.cmake
@@ -0,0 +1,3 @@
+if(EXISTS ${out}/existing.txt)
+ set(RunCMake_TEST_FAILED "${out}/existing.txt not removed")
+endif()
diff --git a/Tests/RunCMake/CommandLine/E_rm_file_force_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_file_force_existing-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_file_force_existing-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CommandLine/E_rm_file_force_non_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_file_force_non_existing-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_file_force_non_existing-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CommandLine/E_rm_file_link_existing-check.cmake b/Tests/RunCMake/CommandLine/E_rm_file_link_existing-check.cmake
new file mode 100644
index 0000000..a0a9b20
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_file_link_existing-check.cmake
@@ -0,0 +1,3 @@
+if(NOT EXISTS ${out}/existing.txt)
+ set(RunCMake_TEST_FAILED "${out}/existing.txt should exist (we only removed the link)")
+endif()
diff --git a/Tests/RunCMake/CommandLine/E_rm_file_link_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_file_link_existing-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_file_link_existing-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CommandLine/E_rm_file_link_non_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_file_link_non_existing-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_file_link_non_existing-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CommandLine/E_rm_file_non_force_existing-check.cmake b/Tests/RunCMake/CommandLine/E_rm_file_non_force_existing-check.cmake
new file mode 100644
index 0000000..e28b160
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_file_non_force_existing-check.cmake
@@ -0,0 +1,3 @@
+if(EXISTS ${out}/existing.txt)
+ set(RunCMake_TEST_FAILED "${out}/existing.txt not removed")
+endif()
diff --git a/Tests/RunCMake/CommandLine/E_rm_file_non_force_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_file_non_force_existing-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_file_non_force_existing-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CommandLine/E_rm_file_non_force_non_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_file_non_force_non_existing-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_file_non_force_non_existing-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/E_rm_file_non_force_non_existing-stderr.txt b/Tests/RunCMake/CommandLine/E_rm_file_non_force_non_existing-stderr.txt
new file mode 100644
index 0000000..05df88a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_file_non_force_non_existing-stderr.txt
@@ -0,0 +1 @@
+^CMake Error: File to remove does not exist and force is not set: .*/rm_tests/not_existing.txt
diff --git a/Tests/RunCMake/CommandLine/E_rm_file_recursive_existing-check.cmake b/Tests/RunCMake/CommandLine/E_rm_file_recursive_existing-check.cmake
new file mode 100644
index 0000000..e28b160
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_file_recursive_existing-check.cmake
@@ -0,0 +1,3 @@
+if(EXISTS ${out}/existing.txt)
+ set(RunCMake_TEST_FAILED "${out}/existing.txt not removed")
+endif()
diff --git a/Tests/RunCMake/CommandLine/E_rm_file_recursive_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_file_recursive_existing-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_file_recursive_existing-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CommandLine/E_rm_file_recursive_non_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_file_recursive_non_existing-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_file_recursive_non_existing-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/E_rm_file_recursive_non_existing-stderr.txt b/Tests/RunCMake/CommandLine/E_rm_file_recursive_non_existing-stderr.txt
new file mode 100644
index 0000000..05df88a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_file_recursive_non_existing-stderr.txt
@@ -0,0 +1 @@
+^CMake Error: File to remove does not exist and force is not set: .*/rm_tests/not_existing.txt
diff --git a/Tests/RunCMake/CommandLine/E_rm_force_recursive_directory_with_files-check.cmake b/Tests/RunCMake/CommandLine/E_rm_force_recursive_directory_with_files-check.cmake
new file mode 100644
index 0000000..1a976cb
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_force_recursive_directory_with_files-check.cmake
@@ -0,0 +1,3 @@
+if(EXISTS ${out})
+ set(RunCMake_TEST_FAILED "${out} not removed")
+endif()
diff --git a/Tests/RunCMake/CommandLine/E_rm_force_recursive_directory_with_files-result.txt b/Tests/RunCMake/CommandLine/E_rm_force_recursive_directory_with_files-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_force_recursive_directory_with_files-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CommandLine/E_rm_force_recursive_non_existing_file-result.txt b/Tests/RunCMake/CommandLine/E_rm_force_recursive_non_existing_file-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_force_recursive_non_existing_file-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CommandLine/E_rm_no_file_specified-result.txt b/Tests/RunCMake/CommandLine/E_rm_no_file_specified-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_no_file_specified-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/E_rm_no_file_specified-stderr.txt b/Tests/RunCMake/CommandLine/E_rm_no_file_specified-stderr.txt
new file mode 100644
index 0000000..1ac7dba
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_no_file_specified-stderr.txt
@@ -0,0 +1 @@
+^CMake Error: Missing file/directory to remove$
diff --git a/Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-check.cmake b/Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-check.cmake
new file mode 100644
index 0000000..609271e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-check.cmake
@@ -0,0 +1,3 @@
+if(NOT EXISTS ${out}/d1 OR NOT EXISTS ${out}/d2)
+ set(RunCMake_TEST_FAILED "${out}/d1 or ${out}/d2 is removed but should not")
+endif()
diff --git a/Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-result.txt b/Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-stderr.txt b/Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-stderr.txt
new file mode 100644
index 0000000..33ea2e3
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-stderr.txt
@@ -0,0 +1,2 @@
+^Error removing directory ".*/rm_tests/d1" without recursive option\.
+Error removing directory ".*/rm_tests/d2" without recursive option\.$
diff --git a/Tests/RunCMake/CommandLine/E_rm_recursive_directory-two-directories-check.cmake b/Tests/RunCMake/CommandLine/E_rm_recursive_directory-two-directories-check.cmake
new file mode 100644
index 0000000..5282da7
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_recursive_directory-two-directories-check.cmake
@@ -0,0 +1,3 @@
+if(EXISTS ${out}/d1 OR EXISTS ${out}/d2)
+ set(RunCMake_TEST_FAILED "${out}/d1 or ${out}/d2 should be removed")
+endif()
diff --git a/Tests/RunCMake/CommandLine/E_rm_recursive_directory-two-directories-result.txt b/Tests/RunCMake/CommandLine/E_rm_recursive_directory-two-directories-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_recursive_directory-two-directories-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CommandLine/E_rm_recursive_directory_link_existing-check.cmake b/Tests/RunCMake/CommandLine/E_rm_recursive_directory_link_existing-check.cmake
new file mode 100644
index 0000000..b1a29a2
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_recursive_directory_link_existing-check.cmake
@@ -0,0 +1,3 @@
+if(NOT EXISTS ${out}/dir/existing.txt)
+ set(RunCMake_TEST_FAILED "${out}/dir/existing.txt should exist (we only removed the link to dir folder)")
+endif()
diff --git a/Tests/RunCMake/CommandLine/E_rm_recursive_directory_link_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_recursive_directory_link_existing-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_recursive_directory_link_existing-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CommandLine/E_rm_recursive_file_link_existing-check.cmake b/Tests/RunCMake/CommandLine/E_rm_recursive_file_link_existing-check.cmake
new file mode 100644
index 0000000..a0a9b20
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_recursive_file_link_existing-check.cmake
@@ -0,0 +1,3 @@
+if(NOT EXISTS ${out}/existing.txt)
+ set(RunCMake_TEST_FAILED "${out}/existing.txt should exist (we only removed the link)")
+endif()
diff --git a/Tests/RunCMake/CommandLine/E_rm_recursive_file_link_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_recursive_file_link_existing-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_recursive_file_link_existing-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CommandLine/E_rm_recursive_file_link_non_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_recursive_file_link_non_existing-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_rm_recursive_file_link_non_existing-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index f903c3d..bd368cb 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -388,6 +388,76 @@ endif()
unset(out)
unset(outfile)
+set(out ${RunCMake_BINARY_DIR}/rm_tests)
+file(REMOVE_RECURSE "${out}")
+file(MAKE_DIRECTORY ${out})
+file(TOUCH ${out}/existing.txt)
+run_cmake_command(E_rm_file_force_existing
+ ${CMAKE_COMMAND} -E rm -f ${out}/existing.txt)
+file(TOUCH ${out}/existing.txt)
+run_cmake_command(E_rm_file_non_force_existing
+ ${CMAKE_COMMAND} -E rm ${out}/existing.txt)
+run_cmake_command(E_rm_file_force_non_existing
+ ${CMAKE_COMMAND} -E rm -f ${out}/not_existing.txt)
+run_cmake_command(E_rm_file_non_force_non_existing
+ ${CMAKE_COMMAND} -E rm ${out}/not_existing.txt)
+
+file(TOUCH ${out}/existing.txt)
+run_cmake_command(E_rm_file_recursive_existing
+ ${CMAKE_COMMAND} -E rm -r ${out}/existing.txt)
+run_cmake_command(E_rm_file_recursive_non_existing
+ ${CMAKE_COMMAND} -E rm -r ${out}/not_existing.txt)
+
+file(MAKE_DIRECTORY ${out}/d1 ${out}/d2)
+run_cmake_command(E_rm_non_recursive_directory-two-directories
+ ${CMAKE_COMMAND} -E rm ${out}/d1 ${out}/d2)
+
+run_cmake_command(E_rm_recursive_directory-two-directories
+ ${CMAKE_COMMAND} -E rm -R ${out}/d1 ${out}/d2)
+
+run_cmake_command(E_rm_no_file_specified
+ ${CMAKE_COMMAND} -E rm -rf)
+
+run_cmake_command(E_rm_empty_file_specified
+ ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_rm_empty_file_specified.cmake)
+
+run_cmake_command(E_rm_bad_argument
+ ${CMAKE_COMMAND} -E rm -rd ${out}/d1 ${out}/d2)
+
+file(MAKE_DIRECTORY ${out}/d1 ${out}/d2)
+file(WRITE ${out}/test.txt "")
+run_cmake_command(E_rm_force_recursive_directory_with_files
+ ${CMAKE_COMMAND} -E rm -rf ${out}/)
+
+run_cmake_command(E_rm_force_recursive_non_existing_file
+ ${CMAKE_COMMAND} -E rm -Rf ${out}/test.txt)
+
+if(NOT WIN32 AND NOT CYGWIN)
+ file(MAKE_DIRECTORY ${out})
+ file(TOUCH ${out}/existing.txt)
+ file(MAKE_DIRECTORY ${out}/dir)
+ file(TOUCH ${out}/dir/existing.txt) # add a file in the folder
+ file(CREATE_LINK ${out}/dir ${out}/link_dir SYMBOLIC)
+ file(CREATE_LINK ${out}/existing.txt ${out}/existing_file_link.txt SYMBOLIC)
+ file(CREATE_LINK ${out}/non_existing.txt ${out}/non_existing_file_link.txt SYMBOLIC)
+ run_cmake_command(E_rm_file_link_existing
+ ${CMAKE_COMMAND} -E rm ${out}/existing_file_link.txt)
+ run_cmake_command(E_rm_directory_link_existing
+ ${CMAKE_COMMAND} -E rm ${out}/link_dir)
+ run_cmake_command(E_rm_file_link_non_existing
+ ${CMAKE_COMMAND} -E rm ${out}/non_existing_file_link.txt)
+
+ file(CREATE_LINK ${out}/dir ${out}/link_dir SYMBOLIC)
+ file(CREATE_LINK ${out}/existing.txt ${out}/existing_file_link.txt SYMBOLIC)
+ file(CREATE_LINK ${out}/non_existing.txt ${out}/non_existing_file_link.txt SYMBOLIC)
+ run_cmake_command(E_rm_recursive_file_link_existing
+ ${CMAKE_COMMAND} -E rm -R ${out}/existing_file_link.txt)
+ run_cmake_command(E_rm_recursive_directory_link_existing
+ ${CMAKE_COMMAND} -E rm -r ${out}/link_dir)
+ run_cmake_command(E_rm_recursive_file_link_non_existing
+ ${CMAKE_COMMAND} -E rm -r ${out}/non_existing_file_link.txt)
+endif()
+unset(out)
run_cmake_command(E_env-no-command0 ${CMAKE_COMMAND} -E env)
run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1)
diff --git a/Tests/RunCMake/ParseImplicitData/mingw.org-C-GNU-4.9.3.input b/Tests/RunCMake/ParseImplicitData/mingw.org-C-GNU-4.9.3.input
index 81e9ee0..b1c4ce0 100644
--- a/Tests/RunCMake/ParseImplicitData/mingw.org-C-GNU-4.9.3.input
+++ b/Tests/RunCMake/ParseImplicitData/mingw.org-C-GNU-4.9.3.input
@@ -53,7 +53,7 @@ LIBRARY_PATH=c:/DoesNotExist/mingw/bin/../lib/gcc/mingw32/4.9.3/;c:/DoesNotExist
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\cmTC_ab097.dir\CMakeCCompilerABI.c.obj' '-c' '-mtune=generic' '-march=i586'
Linking C executable cmTC_ab097.exe
"C:\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_ab097.dir\link.txt --verbose=1
-"C:\CMake\bin\cmake.exe" -E remove -f CMakeFiles\cmTC_ab097.dir/objects.a
+"C:\CMake\bin\cmake.exe" -E rm -f CMakeFiles\cmTC_ab097.dir/objects.a
C:\DoesNotExist\MinGW\bin\ar.exe cr CMakeFiles\cmTC_ab097.dir/objects.a @CMakeFiles\cmTC_ab097.dir\objects1.rsp
C:\DoesNotExist\MinGW\bin\gcc.exe -v -Wl,--whole-archive CMakeFiles\cmTC_ab097.dir/objects.a -Wl,--no-whole-archive -o cmTC_ab097.exe -Wl,--out-implib,libcmTC_ab097.dll.a -Wl,--major-image-version,0,--minor-image-version,0
Using built-in specs.
diff --git a/Tests/RunCMake/ParseImplicitData/mingw.org-CXX-GNU-4.9.3.input b/Tests/RunCMake/ParseImplicitData/mingw.org-CXX-GNU-4.9.3.input
index cd77340..aae67bb 100644
--- a/Tests/RunCMake/ParseImplicitData/mingw.org-CXX-GNU-4.9.3.input
+++ b/Tests/RunCMake/ParseImplicitData/mingw.org-CXX-GNU-4.9.3.input
@@ -59,7 +59,7 @@ LIBRARY_PATH=c:/DoesNotExist/mingw/bin/../lib/gcc/mingw32/4.9.3/;c:/DoesNotExist
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\cmTC_2b790.dir\CMakeCXXCompilerABI.cpp.obj' '-c' '-shared-libgcc' '-mtune=generic' '-march=i586'
Linking CXX executable cmTC_2b790.exe
"C:\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_2b790.dir\link.txt --verbose=1
-"C:\CMake\bin\cmake.exe" -E remove -f CMakeFiles\cmTC_2b790.dir/objects.a
+"C:\CMake\bin\cmake.exe" -E rm -f CMakeFiles\cmTC_2b790.dir/objects.a
C:\DoesNotExist\MinGW\bin\ar.exe cr CMakeFiles\cmTC_2b790.dir/objects.a @CMakeFiles\cmTC_2b790.dir\objects1.rsp
C:\DoesNotExist\MinGW\bin\g++.exe -v -Wl,--whole-archive CMakeFiles\cmTC_2b790.dir/objects.a -Wl,--no-whole-archive -o cmTC_2b790.exe -Wl,--out-implib,libcmTC_2b790.dll.a -Wl,--major-image-version,0,--minor-image-version,0
Using built-in specs.
diff --git a/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake
index 4502456..03a97ed 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake
@@ -1,8 +1,12 @@
cmake_minimum_required(VERSION 3.15)
project(PchReuseFrom C)
+if(CMAKE_C_COMPILE_OPTIONS_USE_PCH)
+ add_definitions(-DHAVE_PCH_SUPPORT)
+endif()
+
add_library(empty empty.c)
-target_precompile_headers(empty PUBLIC
+target_precompile_headers(empty PRIVATE
<stdio.h>
<string.h>
)
@@ -12,6 +16,9 @@ add_library(foo foo.c)
target_include_directories(foo PUBLIC include)
target_precompile_headers(foo REUSE_FROM empty)
+# should not cause problems if configured multiple times
+target_precompile_headers(foo REUSE_FROM empty)
+
add_executable(foobar foobar.c)
target_link_libraries(foobar foo )
set_target_properties(foobar PROPERTIES PRECOMPILE_HEADERS_REUSE_FROM foo)
diff --git a/Tests/RunCMake/PrecompileHeaders/foobar.c b/Tests/RunCMake/PrecompileHeaders/foobar.c
index 7a135ea..97d465c 100644
--- a/Tests/RunCMake/PrecompileHeaders/foobar.c
+++ b/Tests/RunCMake/PrecompileHeaders/foobar.c
@@ -4,5 +4,11 @@
int main()
{
- return foo() + foo2() + bar();
+ int zeroSize = 0;
+
+#ifdef HAVE_PCH_SUPPORT
+ zeroSize = (int)strlen("");
+#endif
+
+ return foo() + foo2() + bar() + zeroSize;
}
diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
index 7d83a70..c742f50 100644
--- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
@@ -45,6 +45,7 @@ check_property("ENVIRONMENT" [=[key="FOO"]=])
check_property("ENVIRONMENT" [=[value="foo"]=])
check_property("ENVIRONMENT" [=[key="BAR"]=])
check_property("ENVIRONMENT" [=[value="bar"]=])
+check_property("WORKING_DIRECTORY" [=["/working/dir"]=])
expect_no_schema("NoSchema")
diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
index be219f4..ce5c0c9 100644
--- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
@@ -35,6 +35,7 @@ endfunction()
create_scheme_for_property(EXECUTABLE myExecutable)
create_scheme_for_property(ARGUMENTS "--foo;--bar=baz")
create_scheme_for_property(ENVIRONMENT "FOO=foo;BAR=bar")
+create_scheme_for_property(WORKING_DIRECTORY "/working/dir")
add_executable(NoSchema main.cpp)
set_target_properties(NoSchema PROPERTIES XCODE_GENERATE_SCHEME OFF)
diff --git a/Tests/StagingPrefix/CMakeLists.txt b/Tests/StagingPrefix/CMakeLists.txt
index 8d2519e..9ed5c12 100644
--- a/Tests/StagingPrefix/CMakeLists.txt
+++ b/Tests/StagingPrefix/CMakeLists.txt
@@ -5,7 +5,7 @@ project(StagingPrefix)
# Wipe out the install tree
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/CleanupProject
- COMMAND ${CMAKE_COMMAND} -E remove_directory
+ COMMAND ${CMAKE_COMMAND} -E rm -rf
${CMAKE_BINARY_DIR}/ConsumerBuild
${CMAKE_BINARY_DIR}/ProducerBuild
${CMAKE_BINARY_DIR}/stage
diff --git a/Tests/SubDir/Examples/example1/CMakeLists.txt b/Tests/SubDir/Examples/example1/CMakeLists.txt
index 20d065e..8ec1c02 100644
--- a/Tests/SubDir/Examples/example1/CMakeLists.txt
+++ b/Tests/SubDir/Examples/example1/CMakeLists.txt
@@ -3,5 +3,5 @@ project(example1)
add_executable(example1 example1.cxx)
add_custom_command(TARGET example1 POST_BUILD
- COMMAND "${CMAKE_COMMAND}" ARGS -E remove ${SUBDIR_BINARY_DIR}/ShouldBeHere
+ COMMAND "${CMAKE_COMMAND}" ARGS -E rm -f ${SUBDIR_BINARY_DIR}/ShouldBeHere
COMMENT "Remove marker file that should exist because this should not be run")
diff --git a/Tests/SubDirSpaces/Some Examples/example1/CMakeLists.txt b/Tests/SubDirSpaces/Some Examples/example1/CMakeLists.txt
index 20d065e..8ec1c02 100644
--- a/Tests/SubDirSpaces/Some Examples/example1/CMakeLists.txt
+++ b/Tests/SubDirSpaces/Some Examples/example1/CMakeLists.txt
@@ -3,5 +3,5 @@ project(example1)
add_executable(example1 example1.cxx)
add_custom_command(TARGET example1 POST_BUILD
- COMMAND "${CMAKE_COMMAND}" ARGS -E remove ${SUBDIR_BINARY_DIR}/ShouldBeHere
+ COMMAND "${CMAKE_COMMAND}" ARGS -E rm -f ${SUBDIR_BINARY_DIR}/ShouldBeHere
COMMENT "Remove marker file that should exist because this should not be run")
diff --git a/Tests/VSMidl/CMakeLists.txt b/Tests/VSMidl/CMakeLists.txt
index 432506c..3ff7c27 100644
--- a/Tests/VSMidl/CMakeLists.txt
+++ b/Tests/VSMidl/CMakeLists.txt
@@ -56,8 +56,8 @@ set(source_dir "${base_dir}/src")
#
ExternalProject_Add(clean-${PROJECT_NAME}
DOWNLOAD_COMMAND ""
- CONFIGURE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${source_dir}"
- BUILD_COMMAND ${CMAKE_COMMAND} -E remove_directory "${binary_dir}"
+ CONFIGURE_COMMAND ${CMAKE_COMMAND} -E rm -rf "${source_dir}"
+ BUILD_COMMAND ${CMAKE_COMMAND} -E rm -rf "${binary_dir}"
INSTALL_COMMAND ""
)
diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt
index 0564540..22a3d5a 100644
--- a/Utilities/CMakeLists.txt
+++ b/Utilities/CMakeLists.txt
@@ -13,7 +13,7 @@ if(CMAKE_DOC_TARBALL)
endif()
add_custom_command(
OUTPUT ${dir}.stamp
- COMMAND cmake -E remove_directory ${dir}
+ COMMAND cmake -E rm -rf ${dir}
COMMAND cmake -E tar xf ${CMAKE_DOC_TARBALL}
COMMAND cmake -E touch ${dir}.stamp
DEPENDS ${CMAKE_DOC_TARBALL}
diff --git a/Utilities/IWYU/mapping.imp b/Utilities/IWYU/mapping.imp
index 5e4c7ba..3497b53 100644
--- a/Utilities/IWYU/mapping.imp
+++ b/Utilities/IWYU/mapping.imp
@@ -47,6 +47,8 @@
# HACK: iwyu suggests <ext/alloc_traits.h> and <memory> each time vector[] is used.
# https://github.com/include-what-you-use/include-what-you-use/issues/166
{ include: [ "<ext/alloc_traits.h>", private, "<vector>", public ] },
+ { symbol: [ "std::allocator_traits<std::allocator<cmFileLock> >::value_type", private, "<vector>", public ] },
+ { symbol: [ "std::allocator_traits<std::allocator<cmFileLockPool::ScopePool> >::value_type", private, "<vector>", public ] },
{ symbol: [ "std::allocator_traits<std::allocator<cmComputeComponentGraph::TarjanEntry> >::value_type", private, "<vector>", public ] },
{ symbol: [ "std::allocator_traits<std::allocator<cmFortranFile> >::value_type", private, "<vector>", public ] },
{ symbol: [ "std::allocator_traits<std::allocator<cmGraphEdgeList> >::value_type", private, "<vector>", public ] },
diff --git a/Utilities/cmcurl/CMake/cmake_uninstall.cmake.in b/Utilities/cmcurl/CMake/cmake_uninstall.cmake.in
index db8e536..5178fd8 100644
--- a/Utilities/cmcurl/CMake/cmake_uninstall.cmake.in
+++ b/Utilities/cmcurl/CMake/cmake_uninstall.cmake.in
@@ -13,7 +13,7 @@ foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
- "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ "@CMAKE_COMMAND@" ARGS "-E rm -f \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in
index d81f62a..b5fc700 100644
--- a/cmake_uninstall.cmake.in
+++ b/cmake_uninstall.cmake.in
@@ -8,7 +8,7 @@ foreach(file ${files})
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
if(EXISTS "$ENV{DESTDIR}${file}")
exec_program(
- "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ "@CMAKE_COMMAND@" ARGS "-E rm -f \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)