diff options
76 files changed, 561 insertions, 276 deletions
diff --git a/.clang-tidy b/.clang-tidy index 0ba4b0b..b35bc65 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -35,7 +35,6 @@ readability-*,\ -readability-redundant-declaration,\ -readability-redundant-member-init,\ -readability-simplify-boolean-expr,\ --readability-static-accessed-through-instance,\ " HeaderFilterRegex: 'Source/cm[^/]*\.(h|hxx|cxx)$' ... diff --git a/Help/command/file.rst b/Help/command/file.rst index f5279c0..26a9ae2 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -25,6 +25,7 @@ Synopsis file({`REMOVE`_ | `REMOVE_RECURSE`_ } [<files>...]) file(`MAKE_DIRECTORY`_ [<dir>...]) file({`COPY`_ | `INSTALL`_} <file>... DESTINATION <dir> [...]) + file(`SIZE`_ <filename> <out-var>) `Path Conversion`_ file(`RELATIVE_PATH`_ <out-var> <directory> <file>) @@ -333,6 +334,16 @@ and ``NO_SOURCE_PERMISSIONS`` is default. Installation scripts generated by the :command:`install` command use this signature (with some undocumented options for internal use). +.. _SIZE: + +.. code-block:: cmake + + file(SIZE <filename> <variable>) + +Determine the file size of the ``<filename>`` and put the result in +``<variable>`` variable. Requires that ``<filename>`` is a valid path +pointing to a file and is readable. + Path Conversion ^^^^^^^^^^^^^^^ diff --git a/Help/cpack_gen/deb.rst b/Help/cpack_gen/deb.rst index fdde654..23f0515 100644 --- a/Help/cpack_gen/deb.rst +++ b/Help/cpack_gen/deb.rst @@ -15,9 +15,9 @@ better deb package when Debian specific tools ``dpkg-xxx`` are usable on the build system. The CPack DEB generator has specific features which are controlled by the -specifics :code:`CPACK_DEBIAN_XXX` variables. +specifics ``CPACK_DEBIAN_XXX`` variables. -:code:`CPACK_DEBIAN_<COMPONENT>_XXXX` variables may be used in order to have +``CPACK_DEBIAN_<COMPONENT>_XXXX`` variables may be used in order to have **component** specific values. Note however that ``<COMPONENT>`` refers to the **grouping name** written in upper case. It may be either a component name or a component GROUP name. @@ -133,8 +133,8 @@ List of CPack DEB generator specific variables: The Debian package architecture * Mandatory : YES - * Default : Output of :code:`dpkg --print-architecture` (or :code:`i386` - if :code:`dpkg` is not found) + * Default : Output of ``dpkg --print-architecture`` (or ``i386`` + if ``dpkg`` is not found) .. variable:: CPACK_DEBIAN_PACKAGE_DEPENDS CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS @@ -176,7 +176,7 @@ List of CPack DEB generator specific variables: The Debian package maintainer * Mandatory : YES - * Default : :code:`CPACK_PACKAGE_CONTACT` + * Default : ``CPACK_PACKAGE_CONTACT`` .. variable:: CPACK_DEBIAN_PACKAGE_DESCRIPTION CPACK_COMPONENT_<COMPONENT>_DESCRIPTION @@ -205,18 +205,18 @@ List of CPack DEB generator specific variables: The archive format used for creating the Debian package. * Mandatory : YES - * Default : "paxr" + * Default : "gnutar" - Possible values are: + Possible value is: - - paxr - gnutar .. note:: - Default pax archive format is the most portable format and generates - packages that do not treat sparse files specially. - GNU tar format on the other hand supports longer filenames. + This variable previously defaulted to the ``paxr`` value, but ``dpkg`` + has never supported that tar format. For backwards compatibility the + ``paxr`` value will be mapped to ``gnutar`` and a deprecation message + will be emitted. .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE @@ -260,7 +260,7 @@ List of CPack DEB generator specific variables: .. variable:: CPACK_DEBIAN_PACKAGE_SHLIBDEPS CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS - May be set to ON in order to use :code:`dpkg-shlibdeps` to generate + May be set to ON in order to use ``dpkg-shlibdeps`` to generate better package dependency list. * Mandatory : NO @@ -272,7 +272,7 @@ List of CPack DEB generator specific variables: .. note:: You may need set :variable:`CMAKE_INSTALL_RPATH` to an appropriate value - if you use this feature, because if you don't :code:`dpkg-shlibdeps` + if you use this feature, because if you don't ``dpkg-shlibdeps`` may fail to find your own shared libs. See https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling @@ -289,7 +289,7 @@ List of CPack DEB generator specific variables: Sets the `Pre-Depends` field of the Debian package. Like :variable:`Depends <CPACK_DEBIAN_PACKAGE_DEPENDS>`, except that it - also forces :code:`dpkg` to complete installation of the packages named + also forces ``dpkg`` to complete installation of the packages named before even starting the installation of the package which declares the pre-dependency. @@ -324,7 +324,7 @@ List of CPack DEB generator specific variables: Sets the `Breaks` field of the Debian package. When a binary package (P) declares that it breaks other packages (B), - :code:`dpkg` will not allow the package (P) which declares `Breaks` be + ``dpkg`` will not allow the package (P) which declares `Breaks` be **unpacked** unless the packages that will be broken (B) are deconfigured first. As long as the package (P) is configured, the previously deconfigured @@ -344,7 +344,7 @@ List of CPack DEB generator specific variables: Sets the `Conflicts` field of the Debian package. When one binary package declares a conflict with another using a `Conflicts` - field, :code:`dpkg` will not allow them to be unpacked on the system at + field, ``dpkg`` will not allow them to be unpacked on the system at the same time. * Mandatory : NO diff --git a/Help/cpack_gen/freebsd.rst b/Help/cpack_gen/freebsd.rst index b22ea9a..a8dd320 100644 --- a/Help/cpack_gen/freebsd.rst +++ b/Help/cpack_gen/freebsd.rst @@ -20,7 +20,7 @@ The CPack FreeBSD generator should work on any host with libpkg installed. The packages it produces are specific to the host architecture and ABI. The CPack FreeBSD generator sets package-metadata through -:code:`CPACK_FREEBSD_XXX` variables. The CPack FreeBSD generator, unlike the +``CPACK_FREEBSD_XXX`` variables. The CPack FreeBSD generator, unlike the CPack Deb generator, does not specially support componentized packages; a single package is created from all the software artifacts created through CMake. diff --git a/Help/cpack_gen/nuget.rst b/Help/cpack_gen/nuget.rst index c8c481f..f8aa626 100644 --- a/Help/cpack_gen/nuget.rst +++ b/Help/cpack_gen/nuget.rst @@ -18,7 +18,7 @@ The CPack NuGet generator may be used to create NuGet packages using it uses the ``CPACK_XXX`` variables used by :module:`CPack`. The CPack NuGet generator has specific features which are controlled by the -specifics :code:`CPACK_NUGET_XXX` variables. In the "one per group" mode +specifics ``CPACK_NUGET_XXX`` variables. In the "one per group" mode (see :variable:`CPACK_COMPONENTS_GROUPING`), ``<compName>`` placeholder in the variables below would contain a group name (uppercased and turned into a "C" identifier). diff --git a/Help/cpack_gen/rpm.rst b/Help/cpack_gen/rpm.rst index 5c543ff..65009db 100644 --- a/Help/cpack_gen/rpm.rst +++ b/Help/cpack_gen/rpm.rst @@ -11,9 +11,9 @@ The CPack RPM generator is a :module:`CPack` generator thus it uses the ``CPACK_XXX`` variables used by :module:`CPack`. The CPack RPM generator has specific features which are controlled by the specifics -:code:`CPACK_RPM_XXX` variables. +``CPACK_RPM_XXX`` variables. -:code:`CPACK_RPM_<COMPONENT>_XXXX` variables may be used in order to have +``CPACK_RPM_<COMPONENT>_XXXX`` variables may be used in order to have **component** specific values. Note however that ``<COMPONENT>`` refers to the **grouping name** written in upper case. It may be either a component name or a component GROUP name. Usually those variables correspond to RPM spec file diff --git a/Help/manual/ccmake.1.rst b/Help/manual/ccmake.1.rst index cc3ceec..9548471 100644 --- a/Help/manual/ccmake.1.rst +++ b/Help/manual/ccmake.1.rst @@ -13,7 +13,7 @@ Synopsis Description =========== -The "ccmake" executable is the CMake curses interface. Project +The **ccmake** executable is the CMake curses interface. Project configuration settings may be specified interactively through this GUI. Brief instructions are provided at the bottom of the terminal when the program is running. diff --git a/Help/manual/cmake-generators.7.rst b/Help/manual/cmake-generators.7.rst index 0287767..1de10c4 100644 --- a/Help/manual/cmake-generators.7.rst +++ b/Help/manual/cmake-generators.7.rst @@ -27,6 +27,8 @@ when creating a new build tree. CMake Generators ================ +.. _`Command-Line Build Tool Generators`: + Command-Line Build Tool Generators ---------------------------------- @@ -58,6 +60,8 @@ Ninja Generator /generator/Ninja +.. _`IDE Build Tool Generators`: + IDE Build Tool Generators ------------------------- diff --git a/Help/manual/cmake-gui.1.rst b/Help/manual/cmake-gui.1.rst index 57a9850..9322e33 100644 --- a/Help/manual/cmake-gui.1.rst +++ b/Help/manual/cmake-gui.1.rst @@ -14,7 +14,7 @@ Synopsis Description =========== -The "cmake-gui" executable is the CMake GUI. Project configuration +The **cmake-gui** executable is the CMake GUI. Project configuration settings may be specified interactively. Brief instructions are provided at the bottom of the window when the program is running. diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index b11526c..915e0d4 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -8,37 +8,164 @@ Synopsis .. parsed-literal:: - cmake [<options>] {<path-to-source> | <path-to-existing-build>} - cmake [<options>] -S <path-to-source> -B <path-to-build> - cmake [{-D <var>=<value>}...] -P <cmake-script-file> - cmake --build <dir> [<options>...] [-- <build-tool-options>...] - cmake --open <dir> - cmake -E <command> [<options>...] - cmake --find-package <options>... + `Generate a Project Buildsystem`_ + cmake [<options>] <path-to-source> + cmake [<options>] <path-to-existing-build> + cmake [<options>] -S <path-to-source> -B <path-to-build> + + `Build a Project`_ + cmake --build <dir> [<options>] [-- <build-tool-options>] + + `Open a Project`_ + cmake --open <dir> + + `Run a Script`_ + cmake [{-D <var>=<value>}...] -P <cmake-script-file> + + `Run a Command-Line Tool`_ + cmake -E <command> [<options>] + + `Run the Find-Package Tool`_ + cmake --find-package [<options>] + + `View Help`_ + cmake --help[-<topic>] Description =========== -The "cmake" executable is the CMake command-line interface. It may be -used to configure projects in scripts. Project configuration settings -may be specified on the command line with the -D option. +The **cmake** executable is the command-line interface of the cross-platform +buildsystem generator CMake. The above `Synopsis`_ lists various actions +the tool can perform as described in sections below. + +To build a software project with CMake, `Generate a Project Buildsystem`_. +Optionally use **cmake** to `Build a Project`_ or just run the +corresponding build tool (e.g. ``make``) directly. **cmake** can also +be used to `View Help`_. + +The other actions are meant for use by software developers writing +scripts in the :manual:`CMake language <cmake-language(7)>` to support +their builds. + +For graphical user interfaces that may be used in place of **cmake**, +see :manual:`ccmake <ccmake(1)>` and :manual:`cmake-gui <cmake-gui(1)>`. +For command-line interfaces to the CMake testing and packaging facilities, +see :manual:`ctest <ctest(1)>` and :manual:`cpack <cpack(1)>`. + +For more information on CMake at large, `see also`_ the links at the end +of this manual. + + +Introduction to CMake Buildsystems +================================== + +A *buildsystem* describes how to build a project's executables and libraries +from its source code using a *build tool* to automate the process. For +example, a buildsystem may be a ``Makefile`` for use with a command-line +``make`` tool or a project file for an Integrated Development Environment +(IDE). In order to avoid maintaining multiple such buildsystems, a project +may specify its buildsystem abstractly using files written in the +:manual:`CMake language <cmake-language(7)>`. From these files CMake +generates a preferred buildsystem locally for each user through a backend +called a *generator*. + +To generate a buildsystem with CMake, the following must be selected: + +Source Tree + The top-level directory containing source files provided by the project. + The project specifies its buildsystem using files as described in the + :manual:`cmake-language(7)` manual, starting with a top-level file named + ``CMakeLists.txt``. These files specify build targets and their + dependencies as described in the :manual:`cmake-buildsystem(7)` manual. + +Build Tree + The top-level directory in which buildsystem files and build output + artifacts (e.g. executables and libraries) are to be stored. + CMake will write a ``CMakeCache.txt`` file to identify the directory + as a build tree and store persistent information such as buildsystem + configuration options. + + To maintain a pristine source tree, perform an *out-of-source* build + by using a separate dedicated build tree. An *in-source* build in + which the build tree is placed in the same directory as the source + tree is also supported, but discouraged. + +Generator + This chooses the kind of buildsystem to generate. See the + :manual:`cmake-generators(7)` manual for documentation of all generators. + Run ``cmake --help`` to see a list of generators available locally. + Optionally use the ``-G`` option below to specify a generator, or simply + accept the default CMake chooses for the current platform. + + When using one of the :ref:`Command-Line Build Tool Generators` + CMake expects that the environment needed by the compiler toolchain + is already configured in the shell. When using one of the + :ref:`IDE Build Tool Generators`, no particular environment is needed. + + +Generate a Project Buildsystem +============================== + +Run CMake with one of the following command signatures to specify the +source and build trees and generate a buildsystem: + +``cmake [<options>] <path-to-source>`` + Uses the current working directory as the build tree, and + ``<path-to-source>`` as the source tree. The specified path may + be absolute or relative to the current working directory. + The source tree must contain a ``CMakeLists.txt`` file and must + *not* contain a ``CMakeCache.txt`` file because the latter + identifies an existing build tree. For example: + + .. code-block:: console + + $ mkdir build ; cd build + $ cmake ../src + +``cmake [<options>] <path-to-existing-build>`` + Uses ``<path-to-existing-build>`` as the build tree, and loads the + path to the source tree from its ``CMakeCache.txt`` file, which must + have already been generated by a previous run of CMake. The specified + path may be absolute or relative to the current working directory. + For example: + + .. code-block:: console + + $ cd build + $ cmake . + +``cmake [<options>] -S <path-to-source> -B <path-to-build>`` + Uses ``<path-to-build>`` as the build tree and ``<path-to-source>`` + as the source tree. The specified paths may be absolute or relative + to the current working directory. The source tree must contain a + ``CMakeLists.txt`` file. The build tree will be created automatically + if it does not already exist. For example: + + .. code-block:: console + + $ cmake -S src -B build + +In all cases the ``<options>`` may be zero or more of the `Options`_ below. + +After generating a buildsystem one may use the corresponding native +build tool to build the project. For example, after using the +:generator:`Unix Makefiles` generator one may run ``make`` directly: + + .. code-block:: console + + $ make + $ make install -CMake is a cross-platform build system generator. Projects specify -their build process with platform-independent CMake listfiles included -in each directory of a source tree with the name CMakeLists.txt. -Users build a project by using CMake to generate a build system for a -native tool on their platform. +Alternatively, one may use **cmake** to `Build a Project`_ by +automatically choosing and invoking the appropriate native build tool. .. _`CMake Options`: Options -======= +------- .. include:: OPTIONS_BUILD.txt -``-E <command> [<options>...]`` - See `Command-Line Tool Mode`_. - ``-L[A][H]`` List non-advanced cached variables. @@ -50,30 +177,12 @@ Options display also advanced variables. If H is specified, it will also display help for each variable. -``--build <dir>`` - See `Build Tool Mode`_. - -``--open <dir>`` - Open the generated project in the associated application. This is - only supported by some generators. - ``-N`` View mode only. Only load the cache. Do not actually run configure and generate steps. -``-P <file>`` - Process script mode. - - Process the given cmake file as a script written in the CMake - language. No configure or generate step is performed and the cache - is not modified. If variables are defined using -D, this must be - done before the -P argument. - -``--find-package`` - See `Find-Package Tool Mode`_. - ``--graphviz=[file]`` Generate graphviz of dependencies, see :module:`CMakeGraphVizOptions` for more. @@ -142,17 +251,17 @@ Options in CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR. This flag tells CMake to warn about other files as well. -.. include:: OPTIONS_HELP.txt - .. _`Build Tool Mode`: -Build Tool Mode +Build a Project =============== CMake provides a command-line signature to build an already-generated -project binary tree:: +project binary tree: - cmake --build <dir> [<options>...] [-- <build-tool-options>...] +.. code-block:: shell + + cmake --build <dir> [<options>] [-- <build-tool-options>] This abstracts a native build tool's command-line interface with the following options: @@ -185,12 +294,41 @@ following options: Run ``cmake --build`` with no options for quick help. -Command-Line Tool Mode -====================== -CMake provides builtin command-line tools through the signature:: +Open a Project +============== + +.. code-block:: shell + + cmake --open <dir> + +Open the generated project in the associated application. This is only +supported by some generators. + + +.. _`Script Processing Mode`: + +Run a Script +============ + +.. code-block:: shell - cmake -E <command> [<options>...] + cmake [{-D <var>=<value>}...] -P <cmake-script-file> + +Process the given cmake file as a script written in the CMake +language. No configure or generate step is performed and the cache +is not modified. If variables are defined using -D, this must be +done before the -P argument. + + +Run a Command-Line Tool +======================= + +CMake provides builtin command-line tools through the signature + +.. code-block:: shell + + cmake -E <command> [<options>] Run ``cmake -E`` or ``cmake -E help`` for a summary of commands. Available commands are: @@ -326,7 +464,7 @@ Available commands are: ``sleep <number>...`` Sleep for given number of seconds. -``tar [cxt][vf][zjJ] file.tar [<options>...] [--] [<file>...]`` +``tar [cxt][vf][zjJ] file.tar [<options>] [--] [<file>...]`` Create or extract a tar or zip archive. Options are: ``--`` @@ -379,24 +517,40 @@ The following ``cmake -E`` commands are available only on Windows: ``write_regv <key> <value>`` Write Windows registry value. -Find-Package Tool Mode -====================== -CMake provides a helper for Makefile-based projects with the signature:: +Run the Find-Package Tool +========================= - cmake --find-package <options>... +CMake provides a pkg-config like helper for Makefile-based projects: -This runs in a pkg-config like mode. +.. code-block:: shell -Search a package using :command:`find_package()` and print the resulting flags -to stdout. This can be used to use cmake instead of pkg-config to find -installed libraries in plain Makefile-based projects or in autoconf-based -projects (via ``share/aclocal/cmake.m4``). + cmake --find-package [<options>] + +It searches a package using :command:`find_package()` and prints the +resulting flags to stdout. This can be used instead of pkg-config +to find installed libraries in plain Makefile-based projects or in +autoconf-based projects (via ``share/aclocal/cmake.m4``). .. note:: This mode is not well-supported due to some technical limitations. It is kept for compatibility but should not be used in new projects. + +View Help +========= + +To print selected pages from the CMake documentation, use + +.. code-block:: shell + + cmake --help[-<topic>] + +with one of the following options: + +.. include:: OPTIONS_HELP.txt + + See Also ======== diff --git a/Help/manual/cpack.1.rst b/Help/manual/cpack.1.rst index 9ddab1e..679c547 100644 --- a/Help/manual/cpack.1.rst +++ b/Help/manual/cpack.1.rst @@ -13,10 +13,10 @@ Synopsis Description =========== -The ``cpack`` executable is the CMake packaging program. It generates +The **cpack** executable is the CMake packaging program. It generates installers and source packages in a variety of formats. -For each installer or package format, ``cpack`` has a specific backend, +For each installer or package format, **cpack** has a specific backend, called "generator". A generator is responsible for generating the required inputs and invoking the specific package creation tools. These installer or package generators are not to be confused with the makefile generators @@ -28,7 +28,7 @@ list of generators supported for the target platform. Which of them are to be used can be selected through the :variable:`CPACK_GENERATOR` variable or through the command-line option ``-G``. -The ``cpack`` program is steered by a configuration file written in the +The **cpack** program is steered by a configuration file written in the :manual:`CMake language <cmake-language(7)>`. Unless chosen differently through the command-line option ``--config``, the file ``CPackConfig.cmake`` in the current directory is used. diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index e24b10d..9e0ce27 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -19,7 +19,7 @@ Synopsis Description =========== -The "ctest" executable is the CMake test driver program. +The **ctest** executable is the CMake test driver program. CMake-generated build trees created for projects that use the ENABLE_TESTING and ADD_TEST commands have testing support. This program will run the tests and report results. @@ -38,7 +38,7 @@ Options ``--progress`` Enable short progress output from tests. - When the output of ``ctest`` is being sent directly to a terminal, the + When the output of **ctest** is being sent directly to a terminal, the progress through the set of tests is reported by updating the same line rather than printing start and end messages for each test on new lines. This can significantly reduce the verbosity of the test output. diff --git a/Help/release/dev/cpack-deb-tar-format.rst b/Help/release/dev/cpack-deb-tar-format.rst new file mode 100644 index 0000000..9296ec6 --- /dev/null +++ b/Help/release/dev/cpack-deb-tar-format.rst @@ -0,0 +1,7 @@ +cpack-deb-tar-format +-------------------- + +* The :module:`CPack` module no longer defaults to the ``paxr`` value in the + :variable:`CPACK_DEBIAN_ARCHIVE_TYPE` variable, because ``dpkg`` has + never supported the PAX tar format. The ``paxr`` value will be mapped + to ``gnutar`` and a deprecation message emitted. diff --git a/Help/release/dev/file-size.rst b/Help/release/dev/file-size.rst new file mode 100644 index 0000000..4f0e196 --- /dev/null +++ b/Help/release/dev/file-size.rst @@ -0,0 +1,5 @@ +file-size +--------- + +* The :command:`file` command gained a ``SIZE`` mode to get the size + of a file on disk. diff --git a/Help/variable/CMAKE_ARGC.rst b/Help/variable/CMAKE_ARGC.rst index aec9711..30db2a2 100644 --- a/Help/variable/CMAKE_ARGC.rst +++ b/Help/variable/CMAKE_ARGC.rst @@ -3,6 +3,6 @@ CMAKE_ARGC Number of command line arguments passed to CMake in script mode. -When run in :ref:`-P <CMake Options>` script mode, CMake sets this variable to -the number of command line arguments. See also :variable:`CMAKE_ARGV0`, -``1``, ``2`` ... +When run in :ref:`-P <Script Processing Mode>` script mode, CMake sets this +variable to the number of command line arguments. See also +:variable:`CMAKE_ARGV0`, ``1``, ``2`` ... diff --git a/Help/variable/CMAKE_ARGV0.rst b/Help/variable/CMAKE_ARGV0.rst index 8b1ecb7..c4d1c21 100644 --- a/Help/variable/CMAKE_ARGV0.rst +++ b/Help/variable/CMAKE_ARGV0.rst @@ -3,7 +3,7 @@ CMAKE_ARGV0 Command line argument passed to CMake in script mode. -When run in :ref:`-P <CMake Options>` script mode, CMake sets this variable to -the first command line argument. It then also sets ``CMAKE_ARGV1``, +When run in :ref:`-P <Script Processing Mode>` script mode, CMake sets this +variable to the first command line argument. It then also sets ``CMAKE_ARGV1``, ``CMAKE_ARGV2``, ... and so on, up to the number of command line arguments given. See also :variable:`CMAKE_ARGC`. diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake index 3042a16..89dc6f0 100644 --- a/Modules/Internal/CPack/CPackDeb.cmake +++ b/Modules/Internal/CPack/CPackDeb.cmake @@ -482,13 +482,16 @@ function(cpack_deb_prepare_package_vars) endif() if(CPACK_DEBIAN_ARCHIVE_TYPE) - set(archive_types_ "paxr;gnutar") - if(NOT CPACK_DEBIAN_ARCHIVE_TYPE IN_LIST archive_types_) + if(CPACK_DEBIAN_ARCHIVE_TYPE STREQUAL "paxr") + message(DEPRECATION "CPACK_DEBIAN_ARCHIVE_TYPE set to old and invalid " + "type 'paxr', mapping to 'gnutar'") + set(CPACK_DEBIAN_ARCHIVE_TYPE "gnutar") + elseif(NOT CPACK_DEBIAN_ARCHIVE_TYPE STREQUAL "gnutar") message(FATAL_ERROR "CPACK_DEBIAN_ARCHIVE_TYPE set to unsupported" "type ${CPACK_DEBIAN_ARCHIVE_TYPE}") endif() else() - set(CPACK_DEBIAN_ARCHIVE_TYPE "paxr") + set(CPACK_DEBIAN_ARCHIVE_TYPE "gnutar") endif() # Compression: (recommended) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 63a1573..e4f11ed 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 13) -set(CMake_VERSION_PATCH 20181127) +set(CMake_VERSION_PATCH 20181206) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index 67e279c..c96b5d4 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -359,7 +359,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) if (this->IsSetToEmpty(option)) { this->DisplayName.clear(); } else if (const char* value = this->GetOption(option)) { - this->ExpandListArgument(value, this->DisplayName); + cmCPackIFWPackage::ExpandListArgument(value, this->DisplayName); } // Description @@ -367,7 +367,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) if (this->IsSetToEmpty(option)) { this->Description.clear(); } else if (const char* value = this->GetOption(option)) { - this->ExpandListArgument(value, this->Description); + cmCPackIFWPackage::ExpandListArgument(value, this->Description); } // Release date diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index ea0ee58..29968af 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -80,7 +80,7 @@ DebGenerator::DebGenerator( , WorkDir(workDir) , TopLevelDir(topLevelDir) , TemporaryDir(temporaryDir) - , DebianArchiveType(debianArchiveType ? debianArchiveType : "paxr") + , DebianArchiveType(debianArchiveType ? debianArchiveType : "gnutar") , ControlValues(controlValues) , GenShLibs(genShLibs) , ShLibsFilename(shLibsFilename) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 5616523..326d26c 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -533,7 +533,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, cmSystemTools::ExpandListArgument(cpack_dmg_languages, languages); } - cmGeneratedFileStream ofs(sla_r.c_str()); + cmGeneratedFileStream ofs(sla_r); ofs << "#include <CoreServices/CoreServices.r>\n\n"; if (oldStyle) { ofs << SLAHeader; diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index f75a750..d02aa5a 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -223,7 +223,8 @@ int cmCPackNSISGenerator::PackageFiles() if (!group.second.Description.empty()) { groupDescriptions += " !insertmacro MUI_DESCRIPTION_TEXT ${" + group.first + "} \"" + - this->TranslateNewlines(group.second.Description) + "\"\n"; + cmCPackNSISGenerator::TranslateNewlines(group.second.Description) + + "\"\n"; } } @@ -253,7 +254,8 @@ int cmCPackNSISGenerator::PackageFiles() if (!comp.second.Description.empty()) { componentDescriptions += " !insertmacro MUI_DESCRIPTION_TEXT ${" + comp.first + "} \"" + - this->TranslateNewlines(comp.second.Description) + "\"\n"; + cmCPackNSISGenerator::TranslateNewlines(comp.second.Description) + + "\"\n"; } } diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index dab7283..1908c17 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -169,7 +169,7 @@ int cmCPackOSXX11Generator::PackageFiles() numTries--; } if (!res || retVal) { - cmGeneratedFileStream ofs(tmpFile.c_str()); + cmGeneratedFileStream ofs(tmpFile); ofs << "# Run command: " << dmgCmd.str() << std::endl << "# Output:" << std::endl << output << std::endl; diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index 5b1a641..a24dd30 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -307,7 +307,7 @@ int cmCPackPackageMakerGenerator::PackageFiles() numTries--; } if (!res || retVal) { - cmGeneratedFileStream ofs(tmpFile.c_str()); + cmGeneratedFileStream ofs(tmpFile); ofs << "# Run command: " << dmgCmd.str() << std::endl << "# Output:" << std::endl << output << std::endl; @@ -475,7 +475,7 @@ bool cmCPackPackageMakerGenerator::RunPackageMaker(const char* command, cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running package maker" << std::endl); if (!res || retVal) { - cmGeneratedFileStream ofs(tmpFile.c_str()); + cmGeneratedFileStream ofs(tmpFile); ofs << "# Run command: " << command << std::endl << "# Output:" << std::endl << output << std::endl; diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx index 76b3275..e73d01f 100644 --- a/Source/CPack/cmCPackProductBuildGenerator.cxx +++ b/Source/CPack/cmCPackProductBuildGenerator.cxx @@ -151,7 +151,7 @@ bool cmCPackProductBuildGenerator::RunProductBuild(const std::string& command) this->GeneratorVerbose, cmDuration::zero()); cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running command" << std::endl); if (!res || retVal) { - cmGeneratedFileStream ofs(tmpFile.c_str()); + cmGeneratedFileStream ofs(tmpFile); ofs << "# Run command: " << command << std::endl << "# Output:" << std::endl << output << std::endl; diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 71fcafb..97c6b4f 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -618,8 +618,8 @@ bool cmCTestGIT::LoadRevisions() git, "diff-tree", "--stdin", "--always", "-z", "-r", "--pretty=raw", "--encoding=utf-8", nullptr }; - this->Log << this->ComputeCommandLine(git_rev_list) << " | " - << this->ComputeCommandLine(git_diff_tree) << "\n"; + this->Log << cmCTestGIT::ComputeCommandLine(git_rev_list) << " | " + << cmCTestGIT::ComputeCommandLine(git_diff_tree) << "\n"; cmsysProcess* cp = cmsysProcess_New(); cmsysProcess_AddCommand(cp, git_rev_list); @@ -628,7 +628,7 @@ bool cmCTestGIT::LoadRevisions() CommitParser out(this, "dt-out> "); OutputLogger err(this->Log, "dt-err> "); - this->RunProcess(cp, &out, &err, cmProcessOutput::UTF8); + cmCTestGIT::RunProcess(cp, &out, &err, cmProcessOutput::UTF8); // Send one extra zero-byte to terminate the last record. out.Process("", 1); diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index c3c5da4..9c6a80d 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -194,7 +194,8 @@ private: this->CData.clear(); if (name == "logentry") { this->Rev = Revision(); - if (const char* rev = this->FindAttribute(atts, "revision")) { + if (const char* rev = + cmCTestHG::LogParser::FindAttribute(atts, "revision")) { this->Rev.Rev = rev; } this->Changes.clear(); diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 58d9b3d..6c439e9 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -330,13 +330,15 @@ private: if (name == "logentry") { this->Rev = Revision(); this->Rev.SVNInfo = &SVNRepo; - if (const char* rev = this->FindAttribute(atts, "revision")) { + if (const char* rev = + cmCTestSVN::LogParser::FindAttribute(atts, "revision")) { this->Rev.Rev = rev; } this->Changes.clear(); } else if (name == "path") { this->CurChange = Change(); - if (const char* action = this->FindAttribute(atts, "action")) { + if (const char* action = + cmCTestSVN::LogParser::FindAttribute(atts, "action")) { this->CurChange.Action = action[0]; } } diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index a87473d..30192c2 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -760,8 +760,8 @@ int cmCTestScriptHandler::RunConfigurationDashboard() // put the initial cache into the bin dir if (!this->InitialCache.empty()) { - if (!this->WriteInitialCache(this->BinaryDir.c_str(), - this->InitialCache.c_str())) { + if (!cmCTestScriptHandler::WriteInitialCache(this->BinaryDir.c_str(), + this->InitialCache.c_str())) { this->RestoreBackupDirectories(); return 9; } diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index 47006c1..67ff2db 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -146,7 +146,7 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args, this->CTest->SetSuppressUpdatingCTestConfiguration(true); int model; if (smodel) { - model = this->CTest->GetTestModelFromString(smodel); + model = cmCTest::GetTestModelFromString(smodel); } else { model = cmCTest::UNKNOWN; } diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index 21c8889..63bd0e6 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -79,13 +79,13 @@ bool cmCTestVC::RunChild(char const* const* cmd, OutputParser* out, OutputParser* err, const char* workDir, Encoding encoding) { - this->Log << this->ComputeCommandLine(cmd) << "\n"; + this->Log << cmCTestVC::ComputeCommandLine(cmd) << "\n"; cmsysProcess* cp = cmsysProcess_New(); cmsysProcess_SetCommand(cp, cmd); workDir = workDir ? workDir : this->SourceDirectory.c_str(); cmsysProcess_SetWorkingDirectory(cp, workDir); - this->RunProcess(cp, out, err, encoding); + cmCTestVC::RunProcess(cp, out, err, encoding); int result = cmsysProcess_GetExitValue(cp); cmsysProcess_Delete(cp); return result == 0; diff --git a/Source/QtDialog/AddCacheEntry.cxx b/Source/QtDialog/AddCacheEntry.cxx index 70610d7..f5e0777 100644 --- a/Source/QtDialog/AddCacheEntry.cxx +++ b/Source/QtDialog/AddCacheEntry.cxx @@ -32,12 +32,12 @@ AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& varNames, this->StackedWidget->addWidget(path); this->StackedWidget->addWidget(filepath); this->StackedWidget->addWidget(string); - this->setTabOrder(this->Name, this->Type); - this->setTabOrder(this->Type, cb); - this->setTabOrder(cb, path); - this->setTabOrder(path, filepath); - this->setTabOrder(filepath, string); - this->setTabOrder(string, this->Description); + AddCacheEntry::setTabOrder(this->Name, this->Type); + AddCacheEntry::setTabOrder(this->Type, cb); + AddCacheEntry::setTabOrder(cb, path); + AddCacheEntry::setTabOrder(path, filepath); + AddCacheEntry::setTabOrder(filepath, string); + AddCacheEntry::setTabOrder(string, this->Description); QCompleter* completer = new QCompleter(this->VarNames, this); this->Name->setCompleter(completer); connect(completer, SIGNAL(activated(const QString&)), this, diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 7b980a0..98cf8b0 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -130,15 +130,15 @@ int main(int argc, char** argv) QTranslator translator; QString transfile = QString("cmake_%1").arg(QLocale::system().name()); translator.load(transfile, translationsDir.path()); - app.installTranslator(&translator); + QApplication::installTranslator(&translator); // app setup - app.setApplicationName("CMakeSetup"); - app.setOrganizationName("Kitware"); + QApplication::setApplicationName("CMakeSetup"); + QApplication::setOrganizationName("Kitware"); QIcon appIcon; appIcon.addFile(":/Icons/CMakeSetup32.png"); appIcon.addFile(":/Icons/CMakeSetup128.png"); - app.setWindowIcon(appIcon); + QApplication::setWindowIcon(appIcon); CMakeSetupDialog dialog; dialog.show(); @@ -159,7 +159,7 @@ int main(int argc, char** argv) dialog.setSourceDirectory(QString::fromLocal8Bit(sourceDirectory.c_str())); dialog.setBinaryDirectory(QString::fromLocal8Bit(binaryDirectory.c_str())); } else { - QStringList args = app.arguments(); + QStringList args = QApplication::arguments(); if (args.count() == 2) { std::string filePath = cmSystemTools::CollapseFullPath(args[1].toLocal8Bit().data()); @@ -189,7 +189,7 @@ int main(int argc, char** argv) } } - return app.exec(); + return QApplication::exec(); } #if defined(Q_OS_MAC) @@ -216,12 +216,11 @@ static bool cmOSXInstall(std::string const& dir, std::string const& tool) if (symlink(tool.c_str(), link.c_str()) == 0) { std::cerr << "Linked: '" << link << "' -> '" << tool << "'\n"; return true; - } else { - int err = errno; - std::cerr << "Failed: '" << link << "' -> '" << tool - << "': " << strerror(err) << "\n"; - return false; } + int err = errno; + std::cerr << "Failed: '" << link << "' -> '" << tool + << "': " << strerror(err) << "\n"; + return false; } static int cmOSXInstall(std::string dir) { diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 7d3aa57..821c3f4 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -248,9 +248,9 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props) } } else if (this->View == GroupView) { QMap<QString, QCMakePropertyList> newPropsTree; - this->breakProperties(newProps, newPropsTree); + QCMakeCacheModel::breakProperties(newProps, newPropsTree); QMap<QString, QCMakePropertyList> newPropsTree2; - this->breakProperties(newProps2, newPropsTree2); + QCMakeCacheModel::breakProperties(newProps2, newPropsTree2); QStandardItem* root = this->invisibleRootItem(); diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h index 6c678ac..6ecdd63 100644 --- a/Source/cmArchiveWrite.h +++ b/Source/cmArchiveWrite.h @@ -40,9 +40,6 @@ private: */ class cmArchiveWrite { - typedef void (cmArchiveWrite::*safe_bool)(); - void safe_bool_true() {} - public: /** Compression type. */ enum Compress @@ -73,10 +70,7 @@ public: bool recursive = true); /** Returns true if there has been no error. */ - operator safe_bool() const - { - return this->Okay() ? &cmArchiveWrite::safe_bool_true : nullptr; - } + explicit operator bool() const { return this->Okay(); } /** Returns true if there has been an error. */ bool operator!() const { return !this->Okay(); } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 56c71c2..d35d41e 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -296,7 +296,7 @@ cmCTest::cmCTest() this->DropSiteCDash = false; this->BuildID = ""; this->OutputTestOutputOnTestFailure = false; - this->OutputColorCode = this->ColoredOutputSupportedByConsole(); + this->OutputColorCode = cmCTest::ColoredOutputSupportedByConsole(); this->RepeatTests = 1; // default to run each test once this->RepeatUntilFail = false; diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 427049d..9139e42 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -66,7 +66,7 @@ public: const std::string& GetName() const { return this->Name; } void Enable() { this->Enabled = true; } - operator bool() const { return this->Enabled; } + explicit operator bool() const { return this->Enabled; } std::vector<std::string> SubmitFiles; diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 0305677..6ccb3a8 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -188,7 +188,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey, } const char* end = entryKey.c_str() + entryKey.size(); - for (const char** p = this->PersistentProperties; *p; ++p) { + for (const char** p = cmCacheManager::PersistentProperties; *p; ++p) { std::string::size_type plen = strlen(*p) + 1; if (entryKey.size() > plen && *(end - plen) == '-' && strcmp(end - plen + 1, *p) == 0) { @@ -212,7 +212,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey, void cmCacheManager::WritePropertyEntries(std::ostream& os, CacheIterator i, cmMessenger* messenger) { - for (const char** p = this->PersistentProperties; *p; ++p) { + for (const char** p = cmCacheManager::PersistentProperties; *p; ++p) { if (const char* value = i.GetProperty(*p)) { std::string helpstring = *p; helpstring += " property for variable: "; @@ -222,9 +222,9 @@ void cmCacheManager::WritePropertyEntries(std::ostream& os, CacheIterator i, std::string key = i.GetName(); key += "-"; key += *p; - this->OutputKey(os, key); + cmCacheManager::OutputKey(os, key); os << ":INTERNAL="; - this->OutputValue(os, value); + cmCacheManager::OutputValue(os, value); os << "\n"; cmCacheManager::OutputNewlineTruncationWarning(os, key, value, messenger); @@ -319,9 +319,9 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger) } else { cmCacheManager::OutputHelpString(fout, "Missing description"); } - this->OutputKey(fout, i.first); + cmCacheManager::OutputKey(fout, i.first); fout << ":" << cmState::CacheEntryTypeToString(t) << "="; - this->OutputValue(fout, ce.Value); + cmCacheManager::OutputValue(fout, ce.Value); fout << "\n"; cmCacheManager::OutputNewlineTruncationWarning(fout, i.first, ce.Value, messenger); @@ -346,11 +346,11 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger) if (t == cmStateEnums::INTERNAL) { // Format is key:type=value if (const char* help = i.GetProperty("HELPSTRING")) { - this->OutputHelpString(fout, help); + cmCacheManager::OutputHelpString(fout, help); } - this->OutputKey(fout, i.GetName()); + cmCacheManager::OutputKey(fout, i.GetName()); fout << ":" << cmState::CacheEntryTypeToString(t) << "="; - this->OutputValue(fout, i.GetValue()); + cmCacheManager::OutputValue(fout, i.GetValue()); fout << "\n"; cmCacheManager::OutputNewlineTruncationWarning(fout, i.GetName(), i.GetValue(), messenger); diff --git a/Source/cmELF.h b/Source/cmELF.h index 9172f38..c8a91e4 100644 --- a/Source/cmELF.h +++ b/Source/cmELF.h @@ -32,7 +32,7 @@ public: std::string const& GetErrorMessage() const { return this->ErrorMessage; } /** Boolean conversion. True if the ELF file is valid. */ - operator bool() const { return this->Valid(); } + explicit operator bool() const { return this->Valid(); } /** Enumeration of ELF file types. */ enum FileType diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index e444087..93115b6 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -397,8 +397,8 @@ void cmExportInstallFileGenerator::SetImportLocationProperty( prop += suffix; // Append the installed file name. - value += itgen->GetInstallFilename(target, config, - cmInstallTargetGenerator::NameImplib); + value += cmInstallTargetGenerator::GetInstallFilename( + target, config, cmInstallTargetGenerator::NameImplib); // Store the property. properties[prop] = value; @@ -426,12 +426,12 @@ void cmExportInstallFileGenerator::SetImportLocationProperty( // Append the installed file name. if (target->IsAppBundleOnApple()) { - value += itgen->GetInstallFilename(target, config); + value += cmInstallTargetGenerator::GetInstallFilename(target, config); value += ".app/Contents/MacOS/"; - value += itgen->GetInstallFilename(target, config); + value += cmInstallTargetGenerator::GetInstallFilename(target, config); } else { - value += itgen->GetInstallFilename(target, config, - cmInstallTargetGenerator::NameReal); + value += cmInstallTargetGenerator::GetInstallFilename( + target, config, cmInstallTargetGenerator::NameReal); } // Store the property. diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 87ee382..8e25e9c 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -171,9 +171,9 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile() // set up the project name: <project>-Source@<baseSourcePathName> cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0]; - std::string name = - this->GenerateProjectName(lg->GetProjectName(), "Source", - this->GetPathBasename(this->HomeDirectory)); + std::string name = cmExtraEclipseCDT4Generator::GenerateProjectName( + lg->GetProjectName(), "Source", + cmExtraEclipseCDT4Generator::GetPathBasename(this->HomeDirectory)); const std::string filename = this->HomeDirectory + "/.project"; cmGeneratedFileStream fout(filename); @@ -278,10 +278,11 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() xml.StartElement("projectDescription"); xml.Element("name", - this->GenerateProjectName( + cmExtraEclipseCDT4Generator::GenerateProjectName( lg->GetProjectName(), mf->GetSafeDefinition("CMAKE_BUILD_TYPE"), - this->GetPathBasename(this->HomeOutputDirectory))); + cmExtraEclipseCDT4Generator::GetPathBasename( + this->HomeOutputDirectory))); xml.Element("comment", ""); xml.Element("projects", ""); @@ -302,16 +303,17 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() // set the make command AppendDictionary(xml, "org.eclipse.cdt.make.core.enabledIncrementalBuild", "true"); - AppendDictionary( - xml, "org.eclipse.cdt.make.core.build.command", - this->GetEclipsePath(mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"))); + AppendDictionary(xml, "org.eclipse.cdt.make.core.build.command", + cmExtraEclipseCDT4Generator::GetEclipsePath( + mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"))); AppendDictionary(xml, "org.eclipse.cdt.make.core.contents", "org.eclipse.cdt.make.core.activeConfigSettings"); AppendDictionary(xml, "org.eclipse.cdt.make.core.build.target.inc", "all"); AppendDictionary(xml, "org.eclipse.cdt.make.core.build.arguments", mf->GetSafeDefinition("CMAKE_ECLIPSE_MAKE_ARGUMENTS")); - AppendDictionary(xml, "org.eclipse.cdt.make.core.buildLocation", - this->GetEclipsePath(this->HomeOutputDirectory)); + AppendDictionary( + xml, "org.eclipse.cdt.make.core.buildLocation", + cmExtraEclipseCDT4Generator::GetEclipsePath(this->HomeOutputDirectory)); AppendDictionary(xml, "org.eclipse.cdt.make.core.useDefaultBuildCmd", "false"); @@ -341,8 +343,9 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() "clean"); AppendDictionary(xml, "org.eclipse.cdt.make.core.fullBuildTarget", "all"); AppendDictionary(xml, "org.eclipse.cdt.make.core.buildArguments", ""); - AppendDictionary(xml, "org.eclipse.cdt.make.core.build.location", - this->GetEclipsePath(this->HomeOutputDirectory)); + AppendDictionary( + xml, "org.eclipse.cdt.make.core.build.location", + cmExtraEclipseCDT4Generator::GetEclipsePath(this->HomeOutputDirectory)); AppendDictionary(xml, "org.eclipse.cdt.make.core.autoBuildTarget", "all"); // set error parsers @@ -407,13 +410,15 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() std::string sourceLinkedResourceName = "[Source directory]"; std::string linkSourceDirectory = - this->GetEclipsePath(lg->GetCurrentSourceDirectory()); + cmExtraEclipseCDT4Generator::GetEclipsePath( + lg->GetCurrentSourceDirectory()); // .project dir can't be subdir of a linked resource dir if (!cmSystemTools::IsSubDirectory(this->HomeOutputDirectory, linkSourceDirectory)) { - this->AppendLinkedResource(xml, sourceLinkedResourceName, - this->GetEclipsePath(linkSourceDirectory), - LinkToFolder); + cmExtraEclipseCDT4Generator::AppendLinkedResource( + xml, sourceLinkedResourceName, + cmExtraEclipseCDT4Generator::GetEclipsePath(linkSourceDirectory), + LinkToFolder); this->SrcLinkedResources.push_back(std::move(sourceLinkedResourceName)); } } @@ -439,8 +444,8 @@ void cmExtraEclipseCDT4Generator::WriteGroups( std::replace(linkName3.begin(), linkName3.end(), '\\', '/'); - this->AppendLinkedResource(xml, linkName3, "virtual:/virtual", - VirtualFolder); + cmExtraEclipseCDT4Generator::AppendLinkedResource( + xml, linkName3, "virtual:/virtual", VirtualFolder); std::vector<cmSourceGroup> const& children = sg.GetGroupChildren(); if (!children.empty()) { this->WriteGroups(children, linkName, xml); @@ -453,8 +458,9 @@ void cmExtraEclipseCDT4Generator::WriteGroups( std::string linkName4 = linkName3; linkName4 += "/"; linkName4 += cmSystemTools::GetFilenameName(fullPath); - this->AppendLinkedResource(xml, linkName4, - this->GetEclipsePath(fullPath), LinkToFile); + cmExtraEclipseCDT4Generator::AppendLinkedResource( + xml, linkName4, + cmExtraEclipseCDT4Generator::GetEclipsePath(fullPath), LinkToFile); } } } @@ -463,7 +469,8 @@ void cmExtraEclipseCDT4Generator::WriteGroups( void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml) { std::string linkName = "[Targets]"; - this->AppendLinkedResource(xml, linkName, "virtual:/virtual", VirtualFolder); + cmExtraEclipseCDT4Generator::AppendLinkedResource( + xml, linkName, "virtual:/virtual", VirtualFolder); for (cmLocalGenerator* lg : this->GlobalGenerator->GetLocalGenerators()) { cmMakefile* makefile = lg->GetMakefile(); @@ -483,8 +490,8 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml) : "[lib] "); linkName2 += prefix; linkName2 += target->GetName(); - this->AppendLinkedResource(xml, linkName2, "virtual:/virtual", - VirtualFolder); + cmExtraEclipseCDT4Generator::AppendLinkedResource( + xml, linkName2, "virtual:/virtual", VirtualFolder); if (!this->GenerateLinkedResources) { break; // skip generating the linked resources to the source files } @@ -522,21 +529,23 @@ void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects( // for each sub project create a linked resource to the source dir // - only if it is an out-of-source build - this->AppendLinkedResource(xml, "[Subprojects]", "virtual:/virtual", - VirtualFolder); + cmExtraEclipseCDT4Generator::AppendLinkedResource( + xml, "[Subprojects]", "virtual:/virtual", VirtualFolder); for (auto const& it : this->GlobalGenerator->GetProjectMap()) { std::string linkSourceDirectory = - this->GetEclipsePath(it.second[0]->GetCurrentSourceDirectory()); + cmExtraEclipseCDT4Generator::GetEclipsePath( + it.second[0]->GetCurrentSourceDirectory()); // a linked resource must not point to a parent directory of .project or // .project itself if ((baseDir != linkSourceDirectory) && !cmSystemTools::IsSubDirectory(baseDir, linkSourceDirectory)) { std::string linkName = "[Subprojects]/"; linkName += it.first; - this->AppendLinkedResource(xml, linkName, - this->GetEclipsePath(linkSourceDirectory), - LinkToFolder); + cmExtraEclipseCDT4Generator::AppendLinkedResource( + xml, linkName, + cmExtraEclipseCDT4Generator::GetEclipsePath(linkSourceDirectory), + LinkToFolder); // Don't add it to the srcLinkedResources, because listing multiple // directories confuses the Eclipse indexer (#13596). } @@ -903,7 +912,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const // Only add the global targets from CMAKE_BINARY_DIR, // not from the subdirs if (subdir.empty()) { - this->AppendTarget(xml, targetName, make, makeArgs, subdir, ": "); + cmExtraEclipseCDT4Generator::AppendTarget(xml, targetName, make, + makeArgs, subdir, ": "); } } break; case cmStateEnums::UTILITY: @@ -918,7 +928,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const break; } - this->AppendTarget(xml, targetName, make, makeArgs, subdir, ": "); + cmExtraEclipseCDT4Generator::AppendTarget(xml, targetName, make, + makeArgs, subdir, ": "); break; case cmStateEnums::EXECUTABLE: case cmStateEnums::STATIC_LIBRARY: @@ -928,10 +939,12 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const const char* prefix = (target->GetType() == cmStateEnums::EXECUTABLE ? "[exe] " : "[lib] "); - this->AppendTarget(xml, targetName, make, makeArgs, subdir, prefix); + cmExtraEclipseCDT4Generator::AppendTarget(xml, targetName, make, + makeArgs, subdir, prefix); std::string fastTarget = targetName; fastTarget += "/fast"; - this->AppendTarget(xml, fastTarget, make, makeArgs, subdir, prefix); + cmExtraEclipseCDT4Generator::AppendTarget(xml, fastTarget, make, + makeArgs, subdir, prefix); // Add Build and Clean targets in the virtual folder of targets: if (this->SupportsVirtualFolders) { @@ -942,8 +955,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const buildArgs += lgen->GetBinaryDirectory(); buildArgs += "\" "; buildArgs += makeArgs; - this->AppendTarget(xml, "Build", make, buildArgs, virtDir, "", - targetName.c_str()); + cmExtraEclipseCDT4Generator::AppendTarget( + xml, "Build", make, buildArgs, virtDir, "", targetName.c_str()); std::string cleanArgs = "-E chdir \""; cleanArgs += lgen->GetCurrentBinaryDirectory(); @@ -953,8 +966,9 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const cmGeneratorTarget* gt = target; cleanArgs += lgen->GetTargetDirectory(gt); cleanArgs += "/cmake_clean.cmake\""; - this->AppendTarget(xml, "Clean", cmSystemTools::GetCMakeCommand(), - cleanArgs, virtDir, "", ""); + cmExtraEclipseCDT4Generator::AppendTarget( + xml, "Clean", cmSystemTools::GetCMakeCommand(), cleanArgs, + virtDir, "", ""); } } break; default: @@ -964,10 +978,12 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const // insert the all and clean targets in every subdir if (!allTarget.empty()) { - this->AppendTarget(xml, allTarget, make, makeArgs, subdir, ": "); + cmExtraEclipseCDT4Generator::AppendTarget(xml, allTarget, make, makeArgs, + subdir, ": "); } if (!cleanTarget.empty()) { - this->AppendTarget(xml, cleanTarget, make, makeArgs, subdir, ": "); + cmExtraEclipseCDT4Generator::AppendTarget(xml, cleanTarget, make, + makeArgs, subdir, ": "); } // insert rules for compiling, preprocessing and assembling individual @@ -981,14 +997,15 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const } else if (f.back() == 'i') { prefix = "[pre] "; } - this->AppendTarget(xml, f, make, makeArgs, subdir, prefix); + cmExtraEclipseCDT4Generator::AppendTarget(xml, f, make, makeArgs, subdir, + prefix); } } xml.EndElement(); // buildTargets xml.EndElement(); // storageModule - this->AppendStorageScanners(xml, *mf); + cmExtraEclipseCDT4Generator::AppendStorageScanners(xml, *mf); xml.EndElement(); // cconfiguration xml.EndElement(); // storageModule diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index fa2a3e1..73ff5a1 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -177,6 +177,9 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args, if (subCommand == "LOCK") { return this->HandleLockCommand(args); } + if (subCommand == "SIZE") { + return this->HandleSizeCommand(args); + } std::string e = "does not recognize sub-command " + subCommand; this->SetError(e); @@ -3606,3 +3609,32 @@ bool cmFileCommand::HandleTimestampCommand( return true; } + +bool cmFileCommand::HandleSizeCommand(std::vector<std::string> const& args) +{ + if (args.size() != 3) { + std::ostringstream e; + e << args[0] << " requires a file name and output variable"; + this->SetError(e.str()); + return false; + } + + unsigned int argsIndex = 1; + + const std::string& filename = args[argsIndex++]; + + const std::string& outputVariable = args[argsIndex++]; + + if (!cmSystemTools::FileExists(filename, true)) { + std::ostringstream e; + e << "SIZE requested of path that is not readable " << filename; + this->SetError(e.str()); + return false; + } + + this->Makefile->AddDefinition( + outputVariable, + std::to_string(cmSystemTools::FileLength(filename)).c_str()); + + return true; +} diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index 719dca2..01e007d 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -59,6 +59,7 @@ protected: bool HandleTimestampCommand(std::vector<std::string> const& args); bool HandleGenerateCommand(std::vector<std::string> const& args); bool HandleLockCommand(std::vector<std::string> const& args); + bool HandleSizeCommand(std::vector<std::string> const& args); private: void AddEvaluationFile(const std::string& inputName, diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2805395..8b20db6 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1204,7 +1204,7 @@ void cmGlobalGenerator::Configure() const char* logs[] = { "CMakeOutput.log", "CMakeError.log", nullptr }; for (const char** log = logs; *log; ++log) { std::string f = this->CMakeInstance->GetHomeOutputDirectory(); - f += this->CMakeInstance->GetCMakeFilesDirectory(); + f += cmake::GetCMakeFilesDirectory(); f += "/"; f += *log; if (cmSystemTools::FileExists(f)) { @@ -2808,7 +2808,7 @@ void cmGlobalGenerator::CheckRuleHashes() #if defined(CMAKE_BUILD_WITH_CMAKE) std::string home = this->GetCMakeInstance()->GetHomeOutputDirectory(); std::string pfile = home; - pfile += this->GetCMakeInstance()->GetCMakeFilesDirectory(); + pfile += cmake::GetCMakeFilesDirectory(); pfile += "/CMakeRuleHashes.txt"; this->CheckRuleHashes(pfile, home); this->WriteRuleHashes(pfile); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 0271b6f..5316b19 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -503,7 +503,7 @@ void cmGlobalNinjaGenerator::Generate() std::ostringstream msg; msg << "The detected version of Ninja (" << this->NinjaVersion; msg << ") is less than the version of Ninja required by CMake ("; - msg << this->RequiredNinjaVersion() << ")."; + msg << cmGlobalNinjaGenerator::RequiredNinjaVersion() << ")."; this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, msg.str()); return; } @@ -577,7 +577,7 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures() RequiredNinjaVersionForConsolePool().c_str()); this->NinjaSupportsImplicitOuts = !cmSystemTools::VersionCompare( cmSystemTools::OP_LESS, this->NinjaVersion.c_str(), - this->RequiredNinjaVersionForImplicitOuts().c_str()); + cmGlobalNinjaGenerator::RequiredNinjaVersionForImplicitOuts().c_str()); this->NinjaSupportsManifestRestat = !cmSystemTools::VersionCompare( cmSystemTools::OP_LESS, this->NinjaVersion.c_str(), RequiredNinjaVersionForManifestRestat().c_str()); @@ -1425,7 +1425,9 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) << "is less than the version of Ninja required by CMake for adding " "restat dependencies to the build.ninja manifest regeneration " "target:\n" - << " " << this->RequiredNinjaVersionForManifestRestat() << "\n"; + << " " + << cmGlobalNinjaGenerator::RequiredNinjaVersionForManifestRestat() + << "\n"; msg << "Any pre-check scripts, such as those generated for file(GLOB " "CONFIGURE_DEPENDS), will not be run by Ninja."; this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, msg.str()); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 8a38f9b..ac4f0be 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -589,8 +589,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( this->CurrentReRunCMakeMakefile += "/CMakeScripts"; cmSystemTools::MakeDirectory(this->CurrentReRunCMakeMakefile.c_str()); this->CurrentReRunCMakeMakefile += "/ReRunCMake.make"; - cmGeneratedFileStream makefileStream( - this->CurrentReRunCMakeMakefile.c_str()); + cmGeneratedFileStream makefileStream(this->CurrentReRunCMakeMakefile); makefileStream.SetCopyIfDifferent(true); makefileStream << "# Generated by CMake, DO NOT EDIT\n\n"; @@ -1404,7 +1403,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt) fname += "."; fname += cmSystemTools::LowerCase(llang); { - cmGeneratedFileStream fout(fname.c_str()); + cmGeneratedFileStream fout(fname); fout << "\n"; } if (cmSourceFile* sf = mf->GetOrCreateSource(fname)) { @@ -1666,7 +1665,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( { std::string makefileName = makefileBasename; makefileName += configName; - cmGeneratedFileStream makefileStream(makefileName.c_str()); + cmGeneratedFileStream makefileStream(makefileName); if (!makefileStream) { return; } @@ -2864,8 +2863,7 @@ bool cmGlobalXCodeGenerator::CreateGroups( } // Add the file to the list of sources. std::string const& source = sf->GetFullPath(); - cmSourceGroup* sourceGroup = - mf->FindSourceGroup(source.c_str(), sourceGroups); + cmSourceGroup* sourceGroup = mf->FindSourceGroup(source, sourceGroups); cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(gtgt, sourceGroup); std::string key = GetGroupMapKeyFromPath(gtgt, source); this->GroupMap[key] = pbxgroup; @@ -2878,8 +2876,7 @@ bool cmGlobalXCodeGenerator::CreateGroups( listfile += "/CMakeLists.txt"; cmSourceFile* sf = gtgt->Makefile->GetOrCreateSource(listfile); std::string const& source = sf->GetFullPath(); - cmSourceGroup* sourceGroup = - mf->FindSourceGroup(source.c_str(), sourceGroups); + cmSourceGroup* sourceGroup = mf->FindSourceGroup(source, sourceGroups); cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(gtgt, sourceGroup); std::string key = GetGroupMapKeyFromPath(gtgt, source); this->GroupMap[key] = pbxgroup; @@ -3251,7 +3248,7 @@ void cmGlobalXCodeGenerator::ComputeObjectDirArch(cmMakefile* mf) void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( std::vector<cmXCodeObject*>& targets) { - cmGeneratedFileStream makefileStream(this->CurrentXCodeHackMakefile.c_str()); + cmGeneratedFileStream makefileStream(this->CurrentXCodeHackMakefile); if (!makefileStream) { cmSystemTools::Error("Could not create", this->CurrentXCodeHackMakefile.c_str()); @@ -3392,7 +3389,7 @@ void cmGlobalXCodeGenerator::OutputXCodeProject( xcodeDir += ".xcodeproj"; cmSystemTools::MakeDirectory(xcodeDir.c_str()); std::string xcodeProjFile = xcodeDir + "/project.pbxproj"; - cmGeneratedFileStream fout(xcodeProjFile.c_str()); + cmGeneratedFileStream fout(xcodeProjFile); fout.SetCopyIfDifferent(true); if (!fout) { return; @@ -3469,7 +3466,7 @@ void cmGlobalXCodeGenerator::OutputXCodeWorkspaceSettings( std::string workspaceSettingsFile = xcodeSharedDataDir; workspaceSettingsFile += "/WorkspaceSettings.xcsettings"; - cmGeneratedFileStream fout(workspaceSettingsFile.c_str()); + cmGeneratedFileStream fout(workspaceSettingsFile); fout.SetCopyIfDifferent(true); if (!fout) { return; diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx index 63bdb00..06eb8a6 100644 --- a/Source/cmInstallCommandArguments.cxx +++ b/Source/cmInstallCommandArguments.cxx @@ -183,7 +183,8 @@ bool cmInstallCommandArguments::CheckPermissions() { this->PermissionsString.clear(); for (std::string const& perm : this->Permissions.GetVector()) { - if (!this->CheckPermissions(perm, this->PermissionsString)) { + if (!cmInstallCommandArguments::CheckPermissions( + perm, this->PermissionsString)) { return false; } } diff --git a/Source/cmJsonObjects.cxx b/Source/cmJsonObjects.cxx index 4148894..bc50f9f 100644 --- a/Source/cmJsonObjects.cxx +++ b/Source/cmJsonObjects.cxx @@ -450,10 +450,9 @@ static Json::Value DumpTarget(cmGeneratorTarget* target, const std::string& config) { cmLocalGenerator* lg = target->GetLocalGenerator(); - const cmState* state = lg->GetState(); const cmStateEnums::TargetType type = target->GetType(); - const std::string typeName = state->GetTargetTypeName(type); + const std::string typeName = cmState::GetTargetTypeName(type); Json::Value ttl = Json::arrayValue; ttl.append("EXECUTABLE"); diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 66edc91..8a07516 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -188,13 +188,12 @@ void cmLocalNinjaGenerator::WriteProjectHeader(std::ostream& os) void cmLocalNinjaGenerator::WriteNinjaRequiredVersion(std::ostream& os) { // Default required version - std::string requiredVersion = - this->GetGlobalNinjaGenerator()->RequiredNinjaVersion(); + std::string requiredVersion = cmGlobalNinjaGenerator::RequiredNinjaVersion(); // Ninja generator uses the 'console' pool if available (>= 1.5) if (this->GetGlobalNinjaGenerator()->SupportsConsolePool()) { requiredVersion = - this->GetGlobalNinjaGenerator()->RequiredNinjaVersionForConsolePool(); + cmGlobalNinjaGenerator::RequiredNinjaVersionForConsolePool(); } // The Ninja generator writes rules which require support for restat @@ -204,7 +203,7 @@ void cmLocalNinjaGenerator::WriteNinjaRequiredVersion(std::ostream& os) !this->GetGlobalNinjaGenerator()->GlobalSettingIsOn( "CMAKE_SUPPRESS_REGENERATION")) { requiredVersion = - this->GetGlobalNinjaGenerator()->RequiredNinjaVersionForManifestRestat(); + cmGlobalNinjaGenerator::RequiredNinjaVersionForManifestRestat(); } cmGlobalNinjaGenerator::WriteComment( diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 6a535c1..11d3608 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -470,12 +470,12 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() << "# The C and CXX include file regular expressions for " << "this directory.\n"; infoFileStream << "set(CMAKE_C_INCLUDE_REGEX_SCAN "; - this->WriteCMakeArgument(infoFileStream, - this->Makefile->GetIncludeRegularExpression()); + cmLocalUnixMakefileGenerator3::WriteCMakeArgument( + infoFileStream, this->Makefile->GetIncludeRegularExpression()); infoFileStream << ")\n"; infoFileStream << "set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "; - this->WriteCMakeArgument(infoFileStream, - this->Makefile->GetComplainRegularExpression()); + cmLocalUnixMakefileGenerator3::WriteCMakeArgument( + infoFileStream, this->Makefile->GetComplainRegularExpression()); infoFileStream << ")\n"; infoFileStream << "set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})\n"; diff --git a/Source/cmMachO.h b/Source/cmMachO.h index 5886d76..5482465 100644 --- a/Source/cmMachO.h +++ b/Source/cmMachO.h @@ -30,7 +30,7 @@ public: std::string const& GetErrorMessage() const; /** Boolean conversion. True if the Mach-O file is valid. */ - operator bool() const { return this->Valid(); } + explicit operator bool() const { return this->Valid(); } /** Get Install name from binary **/ bool GetInstallName(std::string& install_name); diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 08bb2ce..846b12c 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -84,6 +84,10 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule( bool relink) { #ifdef CMAKE_BUILD_WITH_CMAKE + if (!this->GlobalGenerator->GetLanguageEnabled("CUDA")) { + return; + } + const std::string cuda_lang("CUDA"); cmGeneratorTarget::LinkClosure const* closure = this->GeneratorTarget->GetLinkClosure(this->ConfigName); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 9acae49..a79425e 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1236,8 +1236,9 @@ void cmMakefileTargetGenerator::WriteObjectsVariable( } for (std::string const& obj : this->Objects) { *this->BuildFileStream << " " << lineContinue << "\n"; - *this->BuildFileStream << this->LocalGenerator->ConvertToQuotedOutputPath( - obj.c_str(), useWatcomQuote); + *this->BuildFileStream + << cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath( + obj.c_str(), useWatcomQuote); } *this->BuildFileStream << "\n"; @@ -1258,8 +1259,9 @@ void cmMakefileTargetGenerator::WriteObjectsVariable( object = this->LocalGenerator->MaybeConvertToRelativePath(currentBinDir, obj); *this->BuildFileStream << " " << lineContinue << "\n"; - *this->BuildFileStream << this->LocalGenerator->ConvertToQuotedOutputPath( - obj.c_str(), useWatcomQuote); + *this->BuildFileStream + << cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath( + obj.c_str(), useWatcomQuote); } *this->BuildFileStream << "\n" << "\n"; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 1386706..c953d20 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -557,6 +557,10 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd() void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement() { + if (!this->GetGlobalGenerator()->GetLanguageEnabled("CUDA")) { + return; + } + cmGeneratorTarget& genTarget = *this->GetGeneratorTarget(); // determine if we need to do any device linking for this target diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 43a0107..80e6e97 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -111,7 +111,7 @@ std::string cmOutputConverter::ConvertToRelativePath( return remote_path; } - return this->ForceToRelativePath(local_path, remote_path); + return cmOutputConverter::ForceToRelativePath(local_path, remote_path); } std::string cmOutputConverter::ForceToRelativePath( diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index e71feac..49236ed 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -334,7 +334,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets() // Info directory this->Dir.Info = cbd; - this->Dir.Info += makefile->GetCMakeInstance()->GetCMakeFilesDirectory(); + this->Dir.Info += cmake::GetCMakeFilesDirectory(); this->Dir.Info += '/'; this->Dir.Info += this->Target->GetName(); this->Dir.Info += "_autogen"; @@ -1485,7 +1485,7 @@ bool cmQtAutoGenInitializer::GetUicExecutable() } // Test uic command - if (err.empty()) { + if (err.empty() && !this->Uic.Executable.empty()) { if (cmSystemTools::FileExists(this->Uic.Executable, true)) { std::vector<std::string> command; command.push_back(this->Uic.Executable); diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index 903ec85..d817848 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -54,7 +54,7 @@ public: InfoWriter(std::string const& filename); /// @return True if the file is open - operator bool() const { return static_cast<bool>(Ofs_); } + explicit operator bool() const { return static_cast<bool>(Ofs_); } void Write(const char* text) { Ofs_ << text; } void Write(const char* key, std::string const& value); diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index 8a04c1f..f0f92aa 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -122,7 +122,7 @@ void cmRST::ProcessModule(std::istream& is) void cmRST::Reset() { if (!this->MarkupLines.empty()) { - this->UnindentLines(this->MarkupLines); + cmRST::UnindentLines(this->MarkupLines); } switch (this->Directive) { case DirectiveNone: diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx index f15a14a..fe0bdc9 100644 --- a/Source/cmServer.cxx +++ b/Source/cmServer.cxx @@ -216,7 +216,7 @@ cmServerResponse cmServer::SetProtocolVersion(const cmServerRequest& request) } this->Protocol = - this->FindMatchingProtocol(this->SupportedProtocols, major, minor); + cmServer::FindMatchingProtocol(this->SupportedProtocols, major, minor); if (!this->Protocol) { return request.ReportError("Protocol version not supported."); } diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index f051fd9..6dbfd10 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -244,7 +244,7 @@ bool cmServerProtocol1::DoActivate(const cmServerRequest& request, return false; } - const std::string cachePath = cm->FindCacheFile(buildDirectory); + const std::string cachePath = cmake::FindCacheFile(buildDirectory); if (cm->LoadCache(cachePath)) { cmState* state = cm->GetState(); diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 9866d13..28aa57c 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -137,7 +137,10 @@ public: CloseHandle(this->handle_); } } - operator bool() const { return this->handle_ != INVALID_HANDLE_VALUE; } + explicit operator bool() const + { + return this->handle_ != INVALID_HANDLE_VALUE; + } bool operator!() const { return this->handle_ == INVALID_HANDLE_VALUE; } operator HANDLE() const { return this->handle_; } diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index ad33f98..66cc6ee 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -256,7 +256,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass( // Make sure the last argument was not a library type specifier. if (haveLLT) { std::ostringstream e; - e << "The \"" << this->LinkLibraryTypeNames[llt] + e << "The \"" << cmTargetLinkLibrariesCommand::LinkLibraryTypeNames[llt] << "\" argument must be followed by a library."; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); cmSystemTools::SetFatalErrorOccured(); @@ -284,8 +284,10 @@ void cmTargetLinkLibrariesCommand::LinkLibraryTypeSpecifierWarning(int left, int right) { std::ostringstream w; - w << "Link library type specifier \"" << this->LinkLibraryTypeNames[left] - << "\" is followed by specifier \"" << this->LinkLibraryTypeNames[right] + w << "Link library type specifier \"" + << cmTargetLinkLibrariesCommand::LinkLibraryTypeNames[left] + << "\" is followed by specifier \"" + << cmTargetLinkLibrariesCommand::LinkLibraryTypeNames[right] << "\" instead of a library name. " << "The first specifier will be ignored."; this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx index 22fe007..7a54e12 100644 --- a/Source/cmVSSetupHelper.cxx +++ b/Source/cmVSSetupHelper.cxx @@ -267,6 +267,19 @@ bool cmVSSetupAPIHelper::GetVCToolsetVersion(std::string& vsToolsetVersion) return isInstalled && !vsToolsetVersion.empty(); } +bool cmVSSetupAPIHelper::IsEWDKEnabled() +{ + std::string envEnterpriseWDK, envDisableRegistryUse; + cmSystemTools::GetEnv("EnterpriseWDK", envEnterpriseWDK); + cmSystemTools::GetEnv("DisableRegistryUse", envDisableRegistryUse); + if (!cmSystemTools::Strucmp(envEnterpriseWDK.c_str(), "True") && + !cmSystemTools::Strucmp(envDisableRegistryUse.c_str(), "True")) { + return true; + } + + return false; +} + bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance() { bool isVSInstanceExists = false; @@ -274,6 +287,26 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance() return true; } + if (this->IsEWDKEnabled()) { + std::string envWindowsSdkDir81, envVSVersion, envVsInstallDir; + + cmSystemTools::GetEnv("WindowsSdkDir_81", envWindowsSdkDir81); + cmSystemTools::GetEnv("VisualStudioVersion", envVSVersion); + cmSystemTools::GetEnv("VSINSTALLDIR", envVsInstallDir); + if (envVSVersion.empty() || envVsInstallDir.empty()) + return false; + + chosenInstanceInfo.VSInstallLocation = + std::wstring(envVsInstallDir.begin(), envVsInstallDir.end()); + chosenInstanceInfo.Version = + std::wstring(envVSVersion.begin(), envVSVersion.end()); + chosenInstanceInfo.VCToolsetVersion = envVSVersion; + chosenInstanceInfo.ullVersion = std::stoi(envVSVersion); + chosenInstanceInfo.IsWin10SDKInstalled = true; + chosenInstanceInfo.IsWin81SDKInstalled = !envWindowsSdkDir81.empty(); + return true; + } + if (initializationFailure || setupConfig == NULL || setupConfig2 == NULL || setupHelper == NULL) return false; diff --git a/Source/cmVSSetupHelper.h b/Source/cmVSSetupHelper.h index 4144c15..b9cca45 100644 --- a/Source/cmVSSetupHelper.h +++ b/Source/cmVSSetupHelper.h @@ -150,6 +150,7 @@ private: HRESULT comInitialized; // current best instance of VS selected VSInstanceInfo chosenInstanceInfo; + bool IsEWDKEnabled(); std::string SpecifiedVSInstallLocation; }; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index e9a1a67..7d7defc 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3319,7 +3319,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( std::vector<std::string> vsTargetVec; this->AddLibraries(cli, libVec, vsTargetVec, config); if (std::find(linkClosure->Languages.begin(), linkClosure->Languages.end(), - "CUDA") != linkClosure->Languages.end()) { + "CUDA") != linkClosure->Languages.end() && + this->CudaOptions[config] != nullptr) { switch (this->CudaOptions[config]->GetCudaRuntime()) { case cmVisualStudioGeneratorOptions::CudaRuntimeStatic: libVec.push_back("cudadevrt.lib"); diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx index 58cb9c9..d301ad0 100644 --- a/Source/cmXCodeScheme.cxx +++ b/Source/cmXCodeScheme.cxx @@ -35,7 +35,7 @@ void cmXCodeScheme::WriteXCodeSharedScheme(const std::string& xcProjDir, xcodeSchemeFile += this->TargetName; xcodeSchemeFile += ".xcscheme"; - cmGeneratedFileStream fout(xcodeSchemeFile.c_str()); + cmGeneratedFileStream fout(xcodeSchemeFile); fout.SetCopyIfDifferent(true); if (!fout) { return; @@ -216,7 +216,7 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout, if (!arguments.empty()) { xout.StartElement("CommandLineArguments"); - for (auto argument : arguments) { + for (auto const& argument : arguments) { xout.StartElement("CommandLineArgument"); xout.BreakAttributes(); diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 0a4ad7a..331f16e 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -1355,39 +1355,15 @@ bool SystemTools::Touch(const std::string& filename, bool create) } CloseHandle(h); #elif KWSYS_CXX_HAS_UTIMENSAT - struct timespec times[2] = { { 0, UTIME_OMIT }, { 0, UTIME_NOW } }; - if (utimensat(AT_FDCWD, filename.c_str(), times, 0) < 0) { + // utimensat is only available on newer Unixes and macOS 10.13+ + if (utimensat(AT_FDCWD, filename.c_str(), NULL, 0) < 0) { return false; } #else - struct stat st; - if (stat(filename.c_str(), &st) < 0) { - return false; - } - struct timeval mtime; - gettimeofday(&mtime, 0); -# if KWSYS_CXX_HAS_UTIMES - struct timeval atime; -# if KWSYS_CXX_STAT_HAS_ST_MTIM - atime.tv_sec = st.st_atim.tv_sec; - atime.tv_usec = st.st_atim.tv_nsec / 1000; -# elif KWSYS_CXX_STAT_HAS_ST_MTIMESPEC - atime.tv_sec = st.st_atimespec.tv_sec; - atime.tv_usec = st.st_atimespec.tv_nsec / 1000; -# else - atime.tv_sec = st.st_atime; - atime.tv_usec = 0; -# endif - struct timeval times[2] = { atime, mtime }; - if (utimes(filename.c_str(), times) < 0) { + // fall back to utimes + if (utimes(filename.c_str(), NULL) < 0) { return false; } -# else - struct utimbuf times = { st.st_atime, mtime.tv_sec }; - if (utime(filename.c_str(), ×) < 0) { - return false; - } -# endif #endif return true; } diff --git a/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in b/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in index b4c6fae4..3183bc0 100644 --- a/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in +++ b/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in @@ -15,15 +15,15 @@ int main(int ac, char** av) std::string logarg; bool nextarg = false; - if (exename.find("valgrind") != exename.npos) { + if (exename.find("valgrind") != std::string::npos) { logarg = "--log-file="; - } else if (exename.find("purify") != exename.npos) { + } else if (exename.find("purify") != std::string::npos) { #ifdef _WIN32 logarg = "/SAVETEXTDATA="; #else logarg = "-log-file="; #endif - } else if (exename.find("BC") != exename.npos) { + } else if (exename.find("BC") != std::string::npos) { nextarg = true; logarg = "/X"; } diff --git a/Tests/RunCMake/Languages/ExternalCUDA.cmake b/Tests/RunCMake/Languages/ExternalCUDA.cmake new file mode 100644 index 0000000..3afa93e --- /dev/null +++ b/Tests/RunCMake/Languages/ExternalCUDA.cmake @@ -0,0 +1,8 @@ +enable_language(C) + +add_library(ext_cuda IMPORTED STATIC) +set_property(TARGET ext_cuda PROPERTY IMPORTED_LOCATION "/does_not_exist") +set_property(TARGET ext_cuda PROPERTY IMPORTED_LINK_INTERFACE_LANGUAGES "CUDA") + +add_executable(main empty.c) +target_link_libraries(main ext_cuda) diff --git a/Tests/RunCMake/Languages/RunCMakeTest.cmake b/Tests/RunCMake/Languages/RunCMakeTest.cmake index 732baae..2a534b3 100644 --- a/Tests/RunCMake/Languages/RunCMakeTest.cmake +++ b/Tests/RunCMake/Languages/RunCMakeTest.cmake @@ -6,3 +6,5 @@ run_cmake(link-libraries-TARGET_FILE-genex) run_cmake(link-libraries-TARGET_FILE-genex-ok) run_cmake(DetermineFail) + +run_cmake(ExternalCUDA) diff --git a/Tests/RunCMake/Languages/empty.c b/Tests/RunCMake/Languages/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/Languages/empty.c diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index b383230..b9d76bf 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -36,6 +36,8 @@ run_cmake(READ_ELF) run_cmake(GLOB) run_cmake(GLOB_RECURSE) run_cmake(GLOB_RECURSE-noexp-FOLLOW_SYMLINKS) +run_cmake(SIZE) +run_cmake(SIZE-error-does-not-exist) # tests are valid both for GLOB and GLOB_RECURSE run_cmake(GLOB-sort-dedup) diff --git a/Tests/RunCMake/file/SIZE-error-does-not-exist-result.txt b/Tests/RunCMake/file/SIZE-error-does-not-exist-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/SIZE-error-does-not-exist-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/SIZE-error-does-not-exist-stderr.txt b/Tests/RunCMake/file/SIZE-error-does-not-exist-stderr.txt new file mode 100644 index 0000000..b797a41 --- /dev/null +++ b/Tests/RunCMake/file/SIZE-error-does-not-exist-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at SIZE-error-does-not-exist.cmake:[0-9]+ \(file\): + file SIZE requested of path that is not readable + /a/file/that/does-not-exist +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file/SIZE-error-does-not-exist.cmake b/Tests/RunCMake/file/SIZE-error-does-not-exist.cmake new file mode 100644 index 0000000..edcc222 --- /dev/null +++ b/Tests/RunCMake/file/SIZE-error-does-not-exist.cmake @@ -0,0 +1,3 @@ +set(file "/a/file/that/does-not-exist") + +file(SIZE "${file}" CALCULATED_SIZE) diff --git a/Tests/RunCMake/file/SIZE.cmake b/Tests/RunCMake/file/SIZE.cmake new file mode 100644 index 0000000..4d9dbd2 --- /dev/null +++ b/Tests/RunCMake/file/SIZE.cmake @@ -0,0 +1,9 @@ +set(file "${CMAKE_CURRENT_BINARY_DIR}/a-test-file") + +file(WRITE "${file}" "test") + +file(SIZE "${file}" CALCULATED_SIZE) + +if (NOT CALCULATED_SIZE EQUAL 4) + message(FATAL_ERROR "Unexpected file size") +endif() |