diff options
721 files changed, 5184 insertions, 2188 deletions
diff --git a/Help/command/cmake_path.rst b/Help/command/cmake_path.rst new file mode 100644 index 0000000..9248eae --- /dev/null +++ b/Help/command/cmake_path.rst @@ -0,0 +1,641 @@ +cmake_path +---------- + +.. versionadded:: 3.19 + +Filesystem path manipulation command. + +This command is dedicated to the manipulation of objects of type path which +represent paths on a filesystem. Only syntactic aspects of paths are handled: +the pathname may represent a non-existing path or even one that is not allowed +to exist on the current file system or OS. + +For operations involving the filesystem, have a look at the :command:`file` +command. + +The path name has the following syntax: + +1. ``root-name`` (optional): identifies the root on a filesystem with multiple + roots (such as ``"C:"`` or ``"//myserver"``). + +2. ``root-directory`` (optional): a directory separator that, if present, marks + this path as absolute. If it is missing (and the first element other than + the root name is a file name), then the path is relative. + +Zero or more of the following: + +3. ``file-name``: sequence of characters that aren't directory separators. This + name may identify a file, a hard link, a symbolic link, or a directory. Two + special file-names are recognized: + + * ``dot``: the file name consisting of a single dot character ``.`` is a + directory name that refers to the current directory. + + * ``dot-dot``: the file name consisting of two dot characters ``..`` is a + directory name that refers to the parent directory. + +4. ``directory-separator``: the forward slash character ``/``. If this + character is repeated, it is treated as a single directory separator: + ``/usr///////lib`` is the same as ``/usr/lib``. + +.. _EXTENSION_DEF: + +A ``file-name`` can have an extension. By default, the extension is defined as +the sub-string beginning at the leftmost period (including the period) and +until the end of the pathname. When the option ``LAST_ONLY`` is specified, the +extension is the sub-string beginning at the rightmost period. + +.. note:: + + ``cmake_path`` command handles paths in the format of the build system, not + the target system. So this is not generally applicable to the target system + in cross-compiling environment. + +For all commands, ``<path>`` placeholder expect a variable name. An error will +be raised if the variable does not exist, except for `APPEND`_ and +`CMAKE_PATH`_ sub-commands. ``<input>`` placeholder expect a string literal. +``[<input>...]`` placeholder expect zero or more arguments. ``<output>`` +placeholder expect a variable name. + +.. note:: + + ``cmake_path`` command does not support list of paths. The ``<path>`` + placeholder must store only one path name. + +To initialize a path variable, three possibilities can be used: + +1. :command:`set` command. +2. :ref:`cmake_path(APPEND) <APPEND>` command. Can be used to build a path from + already available path fragments. +3. :ref:`cmake_path(CMAKE_PATH) <CMAKE_PATH>` command. Mainly used to build a + path variable from a native path. + + .. code-block:: cmake + + # To build the path "${CMAKE_CURRENT_SOURCE_DIR}/data" + + set (path1 "${CMAKE_CURRENT_SOURCE_DIR}/data") + + cmake_path(APPEND path2 "${CMAKE_CURRENT_SOURCE_DIR}" "data") + + cmake_path(CMAKE_PATH path3 "${CMAKE_CURRENT_SOURCE_DIR}/data") + +`Modification`_ and `Generation`_ sub-commands store the result in-place or in +the variable specified by ``OUTPUT_VARIABLE`` option. All other sub-commands, +except `CMAKE_PATH`_, store the result in the required ``<output>`` variable. + +Sub-commands supporting ``NORMALIZE`` option will :ref:`normalize <NORMAL_PATH>` +the path. + +Synopsis +^^^^^^^^ + +.. parsed-literal:: + + `Decomposition`_ + cmake_path(`GET`_ <path> :ref:`ROOT_NAME <GET_ROOT_NAME>` <output>) + cmake_path(`GET`_ <path> :ref:`ROOT_DIRECTORY <GET_ROOT_DIRECTORY>` <output>) + cmake_path(`GET`_ <path> :ref:`ROOT_PATH <GET_ROOT_PATH>` <output>) + cmake_path(`GET`_ <path> :ref:`FILENAME <GET_FILENAME>` <output>) + cmake_path(`GET`_ <path> :ref:`EXTENSION <GET_EXTENSION>` [LAST_ONLY] <output>) + cmake_path(`GET`_ <path> :ref:`STEM <GET_STEM>` [LAST_ONLY] <output>) + cmake_path(`GET`_ <path> :ref:`RELATIVE_PATH <GET_RELATIVE_PATH>` <output>) + cmake_path(`GET`_ <path> :ref:`PARENT_PATH <GET_PARENT_PATH>` <output>) + + `Modification`_ + cmake_path(`APPEND`_ <path> [<input>...] [OUTPUT_VARIABLE <output>]) + cmake_path(`CONCAT`_ <path> [<input>...] [OUTPUT_VARIABLE <output>]) + cmake_path(`REMOVE_FILENAME`_ <path> [OUTPUT_VARIABLE <output>]) + cmake_path(`REPLACE_FILENAME`_ <path> <input> [OUTPUT_VARIABLE <output>]) + cmake_path(`REMOVE_EXTENSION`_ <path> [LAST_ONLY] + [OUTPUT_VARIABLE <output>]) + cmake_path(`REPLACE_EXTENSION`_ <path> [LAST_ONLY] <input> + [OUTPUT_VARIABLE <output>]) + + `Generation`_ + cmake_path(`NORMAL_PATH`_ <path> [OUTPUT_VARIABLE <output>]) + cmake_path(`RELATIVE_PATH`_ <path> [BASE_DIRECTORY <path>] + [OUTPUT_VARIABLE <output>]) + cmake_path(`PROXIMATE_PATH`_ <path> [BASE_DIRECTORY <path>] + [OUTPUT_VARIABLE <output>]) + cmake_path(`ABSOLUTE_PATH`_ <path> [BASE_DIRECTORY <path>] [NORMALIZE] + [OUTPUT_VARIABLE <output>]) + + `Conversion`_ + cmake_path(`CMAKE_PATH`_ <path> [NORMALIZE] <input>) + cmake_path(`NATIVE_PATH`_ <path> [NORMALIZE] <output>) + cmake_path(`CONVERT`_ <input> `TO_CMAKE_PATH_LIST`_ <output>) + cmake_path(`CONVERT`_ <input> `TO_NATIVE_PATH_LIST`_ <output>) + + `Comparison`_ + cmake_path(`COMPARE`_ <path> <OP> <input> <output>) + + `Query`_ + cmake_path(`HAS_ROOT_NAME`_ <path> <output>) + cmake_path(`HAS_ROOT_DIRECTORY`_ <path> <output>) + cmake_path(`HAS_ROOT_PATH`_ <path> <output>) + cmake_path(`HAS_FILENAME`_ <path> <output>) + cmake_path(`HAS_EXTENSION`_ <path> <output>) + cmake_path(`HAS_STEM`_ <path> <output>) + cmake_path(`HAS_RELATIVE_PATH`_ <path> <output>) + cmake_path(`HAS_PARENT_PATH`_ <path> <output>) + cmake_path(`IS_ABSOLUTE`_ <path> <output>) + cmake_path(`IS_RELATIVE`_ <path> <output>) + cmake_path(`IS_PREFIX`_ <path> <input> [NORMALIZE] <output>) + + `Hashing`_ + cmake_path(`HASH`_ <path> [NORMALIZE] <output>) + +Decomposition +^^^^^^^^^^^^^ + +.. _GET: +.. _GET_ROOT_NAME: + +.. code-block:: cmake + + cmake_path(GET <path> ROOT_NAME <output>) + +Returns the root name of the path. If the path does not include a root name, +returns an empty path. + +.. _GET_ROOT_DIRECTORY: + +.. code-block:: cmake + + cmake_path(GET <path> ROOT_DIRECTORY <output>) + +Returns the root directory of the path. If the path does not include a root +directory, returns an empty path. + +.. _GET_ROOT_PATH: + +.. code-block:: cmake + + cmake_path(GET <path> ROOT_PATH <output>) + +Returns the root path of the path. If the path does not include a root path, +returns an empty path. + +Effectively, returns the following: ``root-name / root-directory``. + +.. _GET_FILENAME: + +.. code-block:: cmake + + cmake_path(GET <path> FILENAME <output>) + +Returns the filename component of the path. If the path ends with a +``directory-separator``, there is no filename, so returns an empty path. + +.. _GET_EXTENSION: + +.. code-block:: cmake + + cmake_path(GET <path> EXTENSION [LAST_ONLY] <output>) + +Returns the :ref:`extension <EXTENSION_DEF>` of the filename component. + +If the ``FILENAME`` component of the path contains a period (``.``), and is not +one of the special filesystem elements ``dot`` or ``dot-dot``, then the +:ref:`extension <EXTENSION_DEF>` is returned. + + .. code-block:: cmake + + set (path "name.ext1.ext2") + cmake_path (GET path EXTENSION result) + cmake_path (GET path EXTENSION LAST_ONLY result) + +First extension extraction will return ``.ex1.ext2``, while the second one will +return only ``.ext2``. + +The following exceptions apply: + + * If the first character in the filename is a period, that period is ignored + (a filename like ``".profile"`` is not treated as an extension). + + * If the pathname is either ``.`` or ``..``, or if ``FILENAME`` component + does not contain the ``.`` character, then an empty path is returned. + +.. _GET_STEM: + +.. code-block:: cmake + + cmake_path(GET <path> STEM [LAST_ONLY] <output>) + +Returns the ``FILENAME`` component of the path stripped of its +:ref:`extension <EXTENSION_DEF>`. + + .. code-block:: cmake + + set (path "name.ext1.ext2") + cmake_path (GET path STEM result) + cmake_path (GET path STEM LAST_ONLY result) + +First stem extraction will return only ``name``, while the second one will +return ``name.ext1``. + +The following exceptions apply: + + * If the first character in the filename is a period, that period is ignored + (a filename like ``".profile"`` is not treated as an extension). + + * If the filename is one of the special filesystem components ``dot`` or + ``dot-dot``, or if it has no periods, the function returns the entire + ``FILENAME`` component. + +.. _GET_RELATIVE_PATH: + +.. code-block:: cmake + + cmake_path(GET <path> RELATIVE_PATH <output>) + +Returns path relative to ``root-path``, that is, a pathname composed of +every component of ``<path>`` after ``root-path``. If ``<path>`` is an empty +path, returns an empty path. + +.. _GET_PARENT_PATH: + +.. code-block:: cmake + + cmake_path(GET <path> PARENT_PATH <output>) + +Returns the path to the parent directory. + +If `HAS_RELATIVE_PATH`_ sub-command returns false, the result is a copy of +``<path>``. Otherwise, the result is ``<path>`` with one fewer element. + +Modification +^^^^^^^^^^^^ + +.. _APPEND: + +.. code-block:: cmake + + cmake_path(APPEND <path> [<input>...] [OUTPUT_VARIABLE <output>]) + +Append all the ``<input>`` arguments to the ``<path>`` using ``/`` as +``directory-separator``. + +For each ``<input>`` argument, the following algorithm (pseudo-code) applies: + + .. code-block:: cmake + + IF (<input>.is_absolute() OR + (<input>.has_root_name() AND + NOT <input>.root_name() STREQUAL <path>.root_name())) + replaces <path> with <input> + RETURN() + ENDIF() + + IF (<input>.has_root_directory()) + remove any root-directory and the entire relative path from <path> + ELSEIF (<path>.has_filename() OR + (NOT <path>.has_root_directory() OR <path>.is_absolute())) + appends directory-separator to <path> + ENDIF() + + appends <input> omitting any root-name to <path> + +.. _CONCAT: + +.. code-block:: cmake + + cmake_path(CONCAT <path> [<input>...] [OUTPUT_VARIABLE <output>]) + +Concatenates all the ``<input>`` arguments to the ``<path>`` without +``directory-separator``. + +.. _REMOVE_FILENAME: + +.. code-block:: cmake + + cmake_path(REMOVE_FILENAME <path> [OUTPUT_VARIABLE <output>]) + +Removes a single filename component (as returned by +:ref:`GET ... FILENAME <GET_FILENAME>`) from ``<path>``. + +After this function returns, if change is done in-place, `HAS_FILENAME`_ +returns false for ``<path>``. + +.. _REPLACE_FILENAME: + +.. code-block:: cmake + + cmake_path(REPLACE_FILENAME <path> <input> [OUTPUT_VARIABLE <output>]) + +Replaces a single filename component from ``<path>`` with ``<input>``. + +Equivalent to the following: + + .. code-block:: cmake + + cmake_path(REMOVE_FILENAME path) + cmake_path(APPEND path "replacement"); + +If ``<path>`` has no filename component (`HAS_FILENAME`_ returns false), the +path is unchanged. + +.. _REMOVE_EXTENSION: + +.. code-block:: cmake + + cmake_path(REMOVE_EXTENSION <path> [LAST_ONLY] [OUTPUT_VARIABLE <output>]) + +Removes the :ref:`extension <EXTENSION_DEF>`, if any, from ``<path>``. + +.. _REPLACE_EXTENSION: + +.. code-block:: cmake + + cmake_path(REPLACE_EXTENSION <path> [LAST_ONLY] <input> + [OUTPUT_VARIABLE <output>]) + +Replaces the :ref:`extension <EXTENSION_DEF>` with ``<input>``. + +First, if ``<path>`` has an :ref:`extension <EXTENSION_DEF>` (`HAS_EXTENSION`_ +is true), it is removed. Then, a ``dot`` character is appended to ``<path>``, +if ``<input>`` is not empty or does not begin with a ``dot`` character. + +Then ``<input>`` is appended as if `CONCAT`_ was used. + +Generation +^^^^^^^^^^ + +.. _NORMAL_PATH: + +.. code-block:: cmake + + cmake_path(NORMAL_PATH <path> [OUTPUT_VARIABLE <output>]) + +Normalize ``<path>``. + +A path can be normalized by following this algorithm: + + 1. If the path is empty, stop (normal form of an empty path is an empty + path). + 2. Replace each ``directory-separator`` (which may consist of multiple + separators) with a single ``/``. + 3. Replace each ``directory-separator`` character in the ``root-name`` with + ``/``. + 4. Remove each ``dot`` and any immediately following ``directory-separator``. + 5. Remove each non-dot-dot filename immediately followed by a + ``directory-separator`` and a ``dot-dot``, along with any immediately + following ``directory-separator``. + 6. If there is ``root-directory``, remove all ``dot-dots`` and any + ``directory-separators`` immediately following them. + 7. If the last filename is ``dot-dot``, remove any trailing + ``directory-separator``. + 8. If the path is empty, add a ``dot`` (normal form of ``./`` is ``.``). + +.. _cmake_path-RELATIVE_PATH: +.. _RELATIVE_PATH: + +.. code-block:: cmake + + cmake_path(RELATIVE_PATH <path> [BASE_DIRECTORY <path>] + [OUTPUT_VARIABLE <output>]) + +Returns ``<path>`` made relative to ``BASE_DIRECTORY`` argument. If +``BASE_DIRECTORY`` is not specified, the default base directory will be +:variable:`CMAKE_CURRENT_SOURCE_DIR`. + +For reference, the algorithm used to compute the relative path is described +`here <https://en.cppreference.com/w/cpp/filesystem/path/lexically_normal>`_. + +.. _PROXIMATE_PATH: + +.. code-block:: cmake + + cmake_path(PROXIMATE_PATH <path> [BASE_DIRECTORY <path>] + [OUTPUT_VARIABLE <output>]) + +If the value of `RELATIVE_PATH`_ is not an empty path, return +it. Otherwise return ``<path>``. + +If ``BASE_DIRECTORY`` is not specified, the default base directory will be +:variable:`CMAKE_CURRENT_SOURCE_DIR`. + +.. _ABSOLUTE_PATH: + +.. code-block:: cmake + + cmake_path(ABSOLUTE_PATH <path> [BASE_DIRECTORY <path>] [NORMALIZE] + [OUTPUT_VARIABLE <output>]) + +If ``<path>`` is a relative path, it is evaluated relative to the given base +directory specified by ``BASE_DIRECTORY`` option. If no base directory is +provided, the default base directory will be +:variable:`CMAKE_CURRENT_SOURCE_DIR`. + +When ``NORMALIZE`` option is specified, the path is :ref:`normalized +<NORMAL_PATH>` after the path computation. + +Because ``cmake_path`` does not access to the filesystem, symbolic links are +not resolved. To compute a real path, use :command:`get_filename_component` +command with ``REALPATH`` sub-command. + +Conversion +^^^^^^^^^^ + +.. _cmake_path-CMAKE_PATH: +.. _CMAKE_PATH: + +.. code-block:: cmake + + cmake_path(CMAKE_PATH <path> [NORMALIZE] <input>) + +Converts a native ``<input>`` path into cmake-style path with forward-slashes +(``/``). On Windows, the long filename marker is taken into account. + +When ``NORMALIZE`` option is specified, the path is :ref:`normalized +<NORMAL_PATH>` before the conversion. + +.. _cmake_path-NATIVE_PATH: +.. _NATIVE_PATH: + +.. code-block:: cmake + + cmake_path(NATIVE_PATH <path> [NORMALIZE] <output>) + +Converts a cmake-style ``<path>`` into a native +path with platform-specific slashes (``\`` on Windows and ``/`` elsewhere). + +When ``NORMALIZE`` option is specified, the path is :ref:`normalized +<NORMAL_PATH>` before the conversion. + +.. _CONVERT: +.. _cmake_path-TO_CMAKE_PATH_LIST: +.. _TO_CMAKE_PATH_LIST: + +.. code-block:: cmake + + cmake_path(CONVERT <input> TO_CMAKE_PATH_LIST <output> [NORMALIZE]) + +Converts a native ``<input>`` path into cmake-style path with forward-slashes +(``/``). On Windows, the long filename marker is taken into account. The input can +be a single path or a system search path like ``$ENV{PATH}``. A search path +will be converted to a cmake-style list separated by ``;`` characters. The +result of the conversion is stored in the ``<output>`` variable. + +When ``NORMALIZE`` option is specified, the path is :ref:`normalized +<NORMAL_PATH>` before the conversion. + +.. _cmake_path-TO_NATIVE_PATH_LIST: +.. _TO_NATIVE_PATH_LIST: + +.. code-block:: cmake + + cmake_path(CONVERT <input> TO_NATIVE_PATH_LIST <output> [NORMALIZE]) + +Converts a cmake-style ``<input>`` path into a native path with +platform-specific slashes (``\`` on Windows and ``/`` elsewhere). The input can +be a single path or a cmake-style list. A list will be converted into a native +search path. The result of the conversion is stored in the ``<output>`` +variable. + +When ``NORMALIZE`` option is specified, the path is :ref:`normalized +<NORMAL_PATH>` before the conversion. + +Comparison +^^^^^^^^^^ + +.. _COMPARE: + +.. code-block:: cmake + + cmake_path(COMPARE <path> EQUAL <input> <output>) + cmake_path(COMPARE <path> NOT_EQUAL <input> <output>) + +Compares the lexical representations of the path and another path. + +For testing equality, the following algorithm (pseudo-code) apply: + + .. code-block:: cmake + + IF (NOT <path>.root_name() STREQUAL <input>.root_name()) + returns FALSE + ELSEIF (<path>.has_root_directory() XOR <input>.has_root_directory()) + returns FALSE + ENDIF() + + returns TRUE or FALSE if the relative portion of <path> is + lexicographically equal or not to the relative portion of <input>. + Comparison is performed path component-wise + +Query +^^^^^ + +.. _HAS_ROOT_NAME: + +.. code-block:: cmake + + cmake_path(HAS_ROOT_NAME <path> <output>) + +Checks if ``<path>`` has ``root-name``. + +.. _HAS_ROOT_DIRECTORY: + +.. code-block:: cmake + + cmake_path(HAS_ROOT_DIRECTORY <path> <output>) + +Checks if ``<path>`` has ``root-directory``. + +.. _HAS_ROOT_PATH: + +.. code-block:: cmake + + cmake_path(HAS_ROOT_PATH <path> <output>) + +Checks if ``<path>`` has root path. + +Effectively, checks the following: ``root-name / root-directory``. + +.. _HAS_FILENAME: + +.. code-block:: cmake + + cmake_path(HAS_FILENAME <path> <output>) + +Checks if ``<path>`` has ``file-name``. + +.. _HAS_EXTENSION: + +.. code-block:: cmake + + cmake_path(HAS_EXTENSION <path> <output>) + +Checks if ``<path>`` has an :ref:`<extension <EXTENSION_DEF>`. If the first +character in the filename is a period, it is not treated as an extension (for +example ".profile"). + +.. _HAS_STEM: + +.. code-block:: cmake + + cmake_path(HAS_STEM <path> <output>) + +Checks if ``<path>`` has stem. + +.. _HAS_RELATIVE_PATH: + +.. code-block:: cmake + + cmake_path(HAS_RELATIVE_PATH <path> <output>) + +Checks if ``<path>`` has relative path. + +.. _HAS_PARENT_PATH: + +.. code-block:: cmake + + cmake_path(HAS_PARENT_PATH <path> <output>) + +Checks if ``<path>`` has parent path. + +.. _IS_ABSOLUTE: + +.. code-block:: cmake + + cmake_path(IS_ABSOLUTE <path> <output>) + +Checks if ``<path>`` is absolute. + +An absolute path is a path that unambiguously identifies the location of a file +without reference to an additional starting location. + +.. _IS_RELATIVE: + +.. code-block:: cmake + + cmake_path(IS_RELATIVE <path> <output>) + +Checks if path is relative. + +.. _IS_PREFIX: + +.. code-block:: cmake + + cmake_path(IS_PREFIX <path> <input> [NORMALIZE] <output>) + +Checks if ``<path>`` is the prefix of ``<input>``. + +When ``NORMALIZE`` option is specified, the paths are :ref:`normalized +<NORMAL_PATH>` before the check. + +Hashing +^^^^^^^ + +.. _HASH: + +.. code-block:: cmake + + cmake_path(HASH <path> [NORMALIZE] <output>) + +Compute hash value of ``<path>`` such that if for two paths (``p1`` and ``p2``) +are equal (:ref:`COMPARE ... EQUAL <COMPARE>`) then hash value of p1 is equal +to hash value of p2. + +When ``NORMALIZE`` option is specified, the paths are :ref:`normalized +<NORMAL_PATH>` before the check. diff --git a/Help/command/file.rst b/Help/command/file.rst index 9d6ff91..f4a817e 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -3,6 +3,21 @@ file File manipulation command. +This command is dedicated to file and path manipulation requiring access to the +filesystem. + +For other path manipulation, handling only syntactic aspects, have a look at +:command:`cmake_path` command. + +.. note:: + + The sub-commands `RELATIVE_PATH`_, `TO_CMAKE_PATH`_ and `TO_NATIVE_PATH`_ has + been superseded, respectively, by sub-commands + :ref:`RELATIVE_PATH <cmake_path-RELATIVE_PATH>`, + :ref:`CONVERT ... TO_CMAKE_PATH_LIST <cmake_path-TO_CMAKE_PATH_LIST>` and + :ref:`CONVERT ... TO_NATIVE_PATH_LIST <cmake_path-TO_NATIVE_PATH_LIST>` of + :command:`cmake_path` command. + Synopsis ^^^^^^^^ diff --git a/Help/command/get_filename_component.rst b/Help/command/get_filename_component.rst index 9bbf877..9d33a0a 100644 --- a/Help/command/get_filename_component.rst +++ b/Help/command/get_filename_component.rst @@ -44,6 +44,11 @@ Paths are returned with forward slashes and have no trailing slashes. If the optional ``CACHE`` argument is specified, the result variable is added to the cache. +.. note:: + + All previous sub-commands, except ``REALPATH``, has been superseded by + :command:`cmake_path` command. + .. code-block:: cmake get_filename_component(<var> <FileName> PROGRAM [PROGRAM_ARGS <arg_var>] [CACHE]) diff --git a/Help/dev/source.rst b/Help/dev/source.rst index d93e55c..9be4451 100644 --- a/Help/dev/source.rst +++ b/Help/dev/source.rst @@ -158,6 +158,9 @@ These are: * ``cm::is_unique_ptr``: Checks if a type is a ``std::unique_ptr`` type. +CMake assumes the compiler supports ``#pragma once``. Use this for all +hand-written header files. + Dynamic Memory Management ========================= diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst index 0aa4f75..036fa8f 100644 --- a/Help/manual/cmake-commands.7.rst +++ b/Help/manual/cmake-commands.7.rst @@ -20,6 +20,7 @@ These commands are always available. /command/cmake_language /command/cmake_minimum_required /command/cmake_parse_arguments + /command/cmake_path /command/cmake_policy /command/configure_file /command/continue diff --git a/Help/release/dev/cmake_path-command.rst b/Help/release/dev/cmake_path-command.rst new file mode 100644 index 0000000..f4d9f27 --- /dev/null +++ b/Help/release/dev/cmake_path-command.rst @@ -0,0 +1,5 @@ +cmake_path-command +------------------ + +* The :command:`cmake_path` command was added for operations on + filesystem paths. diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index 6dd3b8e..42bb9fe 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -9,6 +9,9 @@ # Initial configuration # +cmake_policy(PUSH) +# numbers and boolean constants +cmake_policy (SET CMP0012 NEW) # IN_LIST operator cmake_policy (SET CMP0057 NEW) @@ -44,7 +47,6 @@ macro (_PYTHON_DISPLAY_FAILURE _PYTHON_MSG) set (${_PYTHON_PREFIX}_FOUND FALSE) string (TOUPPER "${_PYTHON_PREFIX}" _${_PYTHON_PREFIX}_UPPER_PREFIX) set (${_PYTHON_UPPER_PREFIX}_FOUND FALSE) - return() endmacro() @@ -1022,6 +1024,9 @@ endfunction() if (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION_MAJOR AND NOT ${_PYTHON_PREFIX}_FIND_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR) _python_display_failure ("Could NOT find ${_PYTHON_PREFIX}: Wrong major version specified is \"${${_PYTHON_PREFIX}_FIND_VERSION_MAJOR}\", but expected major version is \"${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}\"") + + cmake_policy(POP) + return() endif() @@ -2962,6 +2967,9 @@ endif() if (${_PYTHON_PREFIX}_VERSION_MAJOR AND NOT ${_PYTHON_PREFIX}_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR) _python_display_failure ("Could NOT find ${_PYTHON_PREFIX}: Found unsuitable major version \"${${_PYTHON_PREFIX}_VERSION_MAJOR}\", but required major version is exact version \"${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}\"") + + cmake_policy(POP) + return() endif() unset (_${_PYTHON_PREFIX}_REASON_FAILURE) @@ -3170,3 +3178,5 @@ if (DEFINED _${_PYTHON_PREFIX}_CMAKE_FIND_FRAMEWORK) else() unset (CMAKE_FIND_FRAMEWORK) endif() + +cmake_policy(POP) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index ee8767f..310ffeb 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -182,6 +182,8 @@ set(SRCS cmCheckCustomOutputs.cxx cmCLocaleEnvironmentScope.h cmCLocaleEnvironmentScope.cxx + cmCMakePath.h + cmCMakePath.cxx cmCommandArgumentParserHelper.cxx cmCommonTargetGenerator.cxx cmCommonTargetGenerator.h @@ -498,6 +500,8 @@ set(SRCS cmCMakeLanguageCommand.h cmCMakeMinimumRequired.cxx cmCMakeMinimumRequired.h + cmCMakePathCommand.h + cmCMakePathCommand.cxx cmCMakePolicyCommand.cxx cmCMakePolicyCommand.h cmConditionEvaluator.cxx diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 535a580..24976ad 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 18) -set(CMake_VERSION_PATCH 20200903) +set(CMake_VERSION_PATCH 20200908) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CPack/IFW/cmCPackIFWCommon.h b/Source/CPack/IFW/cmCPackIFWCommon.h index 354d849..95ed213 100644 --- a/Source/CPack/IFW/cmCPackIFWCommon.h +++ b/Source/CPack/IFW/cmCPackIFWCommon.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackIFWCommon_h -#define cmCPackIFWCommon_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -77,5 +76,3 @@ protected: cmCPackLog_msg.str().c_str()); \ } \ } while (false) - -#endif // cmCPackIFWCommon_h diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h index 86a73c8..024d25d 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.h +++ b/Source/CPack/IFW/cmCPackIFWGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackIFWGenerator_h -#define cmCPackIFWGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -152,5 +151,3 @@ private: std::vector<std::string> PkgsDirsVector; std::vector<std::string> RepoDirsVector; }; - -#endif diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h index 8b3f96a..6f398e3 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.h +++ b/Source/CPack/IFW/cmCPackIFWInstaller.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackIFWInstaller_h -#define cmCPackIFWInstaller_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -132,5 +131,3 @@ protected: void printSkippedOptionWarning(const std::string& optionName, const std::string& optionValue); }; - -#endif // cmCPackIFWInstaller_h diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h index 6a4a170..dbd5540 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.h +++ b/Source/CPack/IFW/cmCPackIFWPackage.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackIFWPackage_h -#define cmCPackIFWPackage_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -149,5 +148,3 @@ public: // Patch to package directory std::string Directory; }; - -#endif // cmCPackIFWPackage_h diff --git a/Source/CPack/IFW/cmCPackIFWRepository.h b/Source/CPack/IFW/cmCPackIFWRepository.h index c293981..21afd8b 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.h +++ b/Source/CPack/IFW/cmCPackIFWRepository.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackIFWRepository_h -#define cmCPackIFWRepository_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -84,5 +83,3 @@ public: RepositoriesVector RepositoryUpdate; std::string Directory; }; - -#endif // cmCPackIFWRepository_h diff --git a/Source/CPack/WiX/cmCMakeToWixPath.h b/Source/CPack/WiX/cmCMakeToWixPath.h index 8bb9e04..074cc8e 100644 --- a/Source/CPack/WiX/cmCMakeToWixPath.h +++ b/Source/CPack/WiX/cmCMakeToWixPath.h @@ -1,12 +1,9 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCMakeToWixPath_h -#define cmCMakeToWixPath_h +#pragma once #include "cmConfigure.h" //IWYU pragma: keep #include <string> std::string CMakeToWixPath(const std::string& cygpath); - -#endif // cmCMakeToWixPath_h diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h index b9c37e9..8609cf3 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.h +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackWIXGenerator_h -#define cmCPackWIXGenerator_h +#pragma once #include <map> #include <memory> @@ -171,5 +170,3 @@ private: cmWIXSourceWriter::GuidType ComponentGuidType; }; - -#endif diff --git a/Source/CPack/WiX/cmWIXAccessControlList.h b/Source/CPack/WiX/cmWIXAccessControlList.h index 64f9a13..ee5efa5 100644 --- a/Source/CPack/WiX/cmWIXAccessControlList.h +++ b/Source/CPack/WiX/cmWIXAccessControlList.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmWIXAccessControlList_h -#define cmWIXAccessControlList_h +#pragma once #include "cmCPackLog.h" #include "cmInstalledFile.h" @@ -29,5 +28,3 @@ private: cmInstalledFile const& InstalledFile; cmWIXSourceWriter& SourceWriter; }; - -#endif diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h index a907d6d..0af3094 100644 --- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmWIXDirectoriesSourceWriter_h -#define cmWIXDirectoriesSourceWriter_h +#pragma once #include <string> @@ -29,5 +28,3 @@ public: void EndInstallationPrefixDirectory(size_t size); }; - -#endif diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h index e03e87b..0facf97 100644 --- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmWIXFeaturesSourceWriter_h -#define cmWIXFeaturesSourceWriter_h +#pragma once #include "cmCPackGenerator.h" #include "cmWIXPatch.h" @@ -27,5 +26,3 @@ public: void EmitComponentRef(std::string const& id); }; - -#endif diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h index 8cc98f5..60dddd4 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmWIXFilesSourceWriter_h -#define cmWIXFilesSourceWriter_h +#pragma once #include "cmCPackGenerator.h" #include "cmWIXPatch.h" @@ -37,5 +36,3 @@ public: std::string const& filePath, cmWIXPatch& patch, cmInstalledFile const* installedFile); }; - -#endif diff --git a/Source/CPack/WiX/cmWIXPatch.h b/Source/CPack/WiX/cmWIXPatch.h index 31a60f4..c78722d 100644 --- a/Source/CPack/WiX/cmWIXPatch.h +++ b/Source/CPack/WiX/cmWIXPatch.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmWIXPatch_h -#define cmWIXPatch_h +#pragma once #include <string> @@ -33,5 +32,3 @@ private: cmWIXPatchParser::fragment_map_t Fragments; }; - -#endif diff --git a/Source/CPack/WiX/cmWIXPatchParser.h b/Source/CPack/WiX/cmWIXPatchParser.h index 8d5d2ad..70a21bc 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.h +++ b/Source/CPack/WiX/cmWIXPatchParser.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackWIXPatchParser_h -#define cmCPackWIXPatchParser_h +#pragma once #include <map> #include <memory> @@ -91,5 +90,3 @@ private: std::vector<cmWIXPatchElement*> ElementStack; }; - -#endif diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h index a879f3d..99471f1 100644 --- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h +++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmWIXRichTextFormatWriter_h -#define cmWIXRichTextFormatWriter_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -42,5 +41,3 @@ private: cmsys::ofstream File; }; - -#endif diff --git a/Source/CPack/WiX/cmWIXShortcut.h b/Source/CPack/WiX/cmWIXShortcut.h index c67baf3..315b5ea 100644 --- a/Source/CPack/WiX/cmWIXShortcut.h +++ b/Source/CPack/WiX/cmWIXShortcut.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmWIXShortcut_h -#define cmWIXShortcut_h +#pragma once #include <map> #include <set> @@ -56,5 +55,3 @@ private: shortcut_type_map_t Shortcuts; shortcut_id_map_t EmptyIdMap; }; - -#endif diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h index 6030ea3..f643acd 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.h +++ b/Source/CPack/WiX/cmWIXSourceWriter.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmWIXSourceWriter_h -#define cmWIXSourceWriter_h +#pragma once #include <string> #include <vector> @@ -76,5 +75,3 @@ private: GuidType ComponentGuidType; }; - -#endif diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h index 7eb5665..5b40013 100644 --- a/Source/CPack/cmCPackArchiveGenerator.h +++ b/Source/CPack/cmCPackArchiveGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackArchiveGenerator_h -#define cmCPackArchiveGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -93,5 +92,3 @@ private: std::string ArchiveFormat; std::string OutputExtension; }; - -#endif diff --git a/Source/CPack/cmCPackBundleGenerator.h b/Source/CPack/cmCPackBundleGenerator.h index 27bac3a..072d14f 100644 --- a/Source/CPack/cmCPackBundleGenerator.h +++ b/Source/CPack/cmCPackBundleGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackBundleGenerator_h -#define cmCPackBundleGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -33,5 +32,3 @@ protected: std::string InstallPrefix; }; - -#endif diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h index bb980d7..58377d4 100644 --- a/Source/CPack/cmCPackComponentGroup.h +++ b/Source/CPack/cmCPackComponentGroup.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackComponentGroup_h -#define cmCPackComponentGroup_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -167,5 +166,3 @@ public: /// The list of components. std::vector<cmCPackComponent*> Components; }; - -#endif diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.h b/Source/CPack/cmCPackCygwinBinaryGenerator.h index 47bd41e..f5f7700 100644 --- a/Source/CPack/cmCPackCygwinBinaryGenerator.h +++ b/Source/CPack/cmCPackCygwinBinaryGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackCygwinBinaryGenerator_h -#define cmCPackCygwinBinaryGenerator_h +#pragma once #include "cmCPackArchiveGenerator.h" @@ -25,5 +24,3 @@ protected: virtual const char* GetOutputExtension(); std::string OutputExtension; }; - -#endif diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.h b/Source/CPack/cmCPackCygwinSourceGenerator.h index 98d8f0a..964a4d4 100644 --- a/Source/CPack/cmCPackCygwinSourceGenerator.h +++ b/Source/CPack/cmCPackCygwinSourceGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackCygwinSourceGenerator_h -#define cmCPackCygwinSourceGenerator_h +#pragma once #include "cmCPackArchiveGenerator.h" @@ -27,5 +26,3 @@ protected: std::string InstallPrefix; std::string OutputExtension; }; - -#endif diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h index ce77e08..ee8f39a 100644 --- a/Source/CPack/cmCPackDebGenerator.h +++ b/Source/CPack/cmCPackDebGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackDebGenerator_h -#define cmCPackDebGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -69,5 +68,3 @@ private: std::vector<std::string> packageFiles; }; - -#endif diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h index dbd190c..310b0ab 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.h +++ b/Source/CPack/cmCPackDragNDropGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackDragNDropGenerator_h -#define cmCPackDragNDropGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -81,5 +80,3 @@ private: bool BreakLongLine(const std::string& line, std::vector<std::string>& lines, std::string* error); }; - -#endif diff --git a/Source/CPack/cmCPackExternalGenerator.h b/Source/CPack/cmCPackExternalGenerator.h index 80011fd..dfd13e8 100644 --- a/Source/CPack/cmCPackExternalGenerator.h +++ b/Source/CPack/cmCPackExternalGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackExternalGenerator_h -#define cmCPackExternalGenerator_h +#pragma once #include <memory> #include <string> @@ -86,5 +85,3 @@ private: std::unique_ptr<cmCPackExternalVersionGenerator> Generator; }; - -#endif diff --git a/Source/CPack/cmCPackFreeBSDGenerator.h b/Source/CPack/cmCPackFreeBSDGenerator.h index a18b72f..eed8053 100644 --- a/Source/CPack/cmCPackFreeBSDGenerator.h +++ b/Source/CPack/cmCPackFreeBSDGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackFreeBSDGenerator_h -#define cmCPackFreeBSDGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -33,5 +32,3 @@ protected: std::string var_lookup(const char* var_name); void write_manifest_fields(cmGeneratedFileStream&); }; - -#endif diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 33026c1..2512d42 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackGenerator_h -#define cmCPackGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -339,5 +338,3 @@ protected: this->Logger->Log(logType, __FILE__, __LINE__, \ cmCPackLog_msg.str().c_str()); \ } while (false) - -#endif diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h index 62b7484..0846573 100644 --- a/Source/CPack/cmCPackGeneratorFactory.h +++ b/Source/CPack/cmCPackGeneratorFactory.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackGeneratorFactory_h -#define cmCPackGeneratorFactory_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -44,5 +43,3 @@ private: DescriptionsMap GeneratorDescriptions; cmCPackLog* Logger; }; - -#endif diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h index 68ffcce..6cec39c 100644 --- a/Source/CPack/cmCPackLog.h +++ b/Source/CPack/cmCPackLog.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackLog_h -#define cmCPackLog_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -139,5 +138,3 @@ inline std::ostream& operator<<(std::ostream& os, const cmCPackLogWrite& c) os.flush(); return os; } - -#endif diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h index 88cba45..ded02de 100644 --- a/Source/CPack/cmCPackNSISGenerator.h +++ b/Source/CPack/cmCPackNSISGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackNSISGenerator_h -#define cmCPackNSISGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -85,5 +84,3 @@ protected: bool Nsis64; }; - -#endif diff --git a/Source/CPack/cmCPackNuGetGenerator.h b/Source/CPack/cmCPackNuGetGenerator.h index a59db2d..609ec79 100644 --- a/Source/CPack/cmCPackNuGetGenerator.h +++ b/Source/CPack/cmCPackNuGetGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackNuGetGenerator_h -#define cmCPackNuGetGenerator_h +#pragma once #include "cmCPackGenerator.h" @@ -33,5 +32,3 @@ protected: */ void AddGeneratedPackageNames(); }; - -#endif diff --git a/Source/CPack/cmCPackOSXX11Generator.h b/Source/CPack/cmCPackOSXX11Generator.h index a6461c8..8fae136 100644 --- a/Source/CPack/cmCPackOSXX11Generator.h +++ b/Source/CPack/cmCPackOSXX11Generator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackOSXX11Generator_h -#define cmCPackOSXX11Generator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -38,5 +37,3 @@ protected: bool copyOnly = false); std::string InstallPrefix; }; - -#endif diff --git a/Source/CPack/cmCPackPKGGenerator.h b/Source/CPack/cmCPackPKGGenerator.h index be730ab..17cdcdf 100644 --- a/Source/CPack/cmCPackPKGGenerator.h +++ b/Source/CPack/cmCPackPKGGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackPKGGenerator_h -#define cmCPackPKGGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -94,5 +93,3 @@ protected: // The PostFlight component when creating a metapackage cmCPackComponent PostFlightComponent; }; - -#endif diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h index 0575587..cda9277 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.h +++ b/Source/CPack/cmCPackPackageMakerGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackPackageMakerGenerator_h -#define cmCPackPackageMakerGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -49,5 +48,3 @@ protected: double PackageMakerVersion; unsigned int PackageCompatibilityVersion; }; - -#endif diff --git a/Source/CPack/cmCPackProductBuildGenerator.h b/Source/CPack/cmCPackProductBuildGenerator.h index 015fe4a..462e2fc 100644 --- a/Source/CPack/cmCPackProductBuildGenerator.h +++ b/Source/CPack/cmCPackProductBuildGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackProductBuildGenerator_h -#define cmCPackProductBuildGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -49,5 +48,3 @@ protected: const char* GetComponentScript(const char* script, const char* script_component); }; - -#endif diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h index 075ce84..0288f2f 100644 --- a/Source/CPack/cmCPackRPMGenerator.h +++ b/Source/CPack/cmCPackRPMGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackRPMGenerator_h -#define cmCPackRPMGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -68,5 +67,3 @@ protected: void AddGeneratedPackageNames(); }; - -#endif diff --git a/Source/CPack/cmCPackSTGZGenerator.h b/Source/CPack/cmCPackSTGZGenerator.h index 79d7035..d2df1f2 100644 --- a/Source/CPack/cmCPackSTGZGenerator.h +++ b/Source/CPack/cmCPackSTGZGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackSTGZGenerator_h -#define cmCPackSTGZGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -30,5 +29,3 @@ protected: int InitializeInternal() override; int GenerateHeader(std::ostream* os) override; }; - -#endif diff --git a/Source/CTest/cmCTestBZR.h b/Source/CTest/cmCTestBZR.h index d7c6321..eb0dbbe 100644 --- a/Source/CTest/cmCTestBZR.h +++ b/Source/CTest/cmCTestBZR.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestBZR_h -#define cmCTestBZR_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -50,5 +49,3 @@ private: friend class UpdateParser; friend class StatusParser; }; - -#endif diff --git a/Source/CTest/cmCTestBinPacker.h b/Source/CTest/cmCTestBinPacker.h index ff02b85..e56a437 100644 --- a/Source/CTest/cmCTestBinPacker.h +++ b/Source/CTest/cmCTestBinPacker.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestBinPacker_h -#define cmCTestBinPacker_h +#pragma once #include <cstddef> #include <map> @@ -27,5 +26,3 @@ bool cmAllocateCTestResourcesRoundRobin( bool cmAllocateCTestResourcesBlock( const std::map<std::string, cmCTestResourceAllocator::Resource>& resources, std::vector<cmCTestBinPackerAllocation>& allocations); - -#endif diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h index 0c8a040..b9cc35c 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.h +++ b/Source/CTest/cmCTestBuildAndTestHandler.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestBuildAndTestHandler_h -#define cmCTestBuildAndTestHandler_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -71,5 +70,3 @@ protected: bool BuildNoCMake; cmDuration Timeout; }; - -#endif diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h index 0f82817..00dbcc4 100644 --- a/Source/CTest/cmCTestBuildCommand.h +++ b/Source/CTest/cmCTestBuildCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestBuildCommand_h -#define cmCTestBuildCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -62,5 +61,3 @@ protected: std::string Flags; std::string ProjectName; }; - -#endif diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h index a5193f6..58e8d9c 100644 --- a/Source/CTest/cmCTestBuildHandler.h +++ b/Source/CTest/cmCTestBuildHandler.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestBuildHandler_h -#define cmCTestBuildHandler_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -156,5 +155,3 @@ private: friend class LaunchHelper; class FragmentCompare; }; - -#endif diff --git a/Source/CTest/cmCTestCVS.h b/Source/CTest/cmCTestCVS.h index 7d33d8f..d20239b 100644 --- a/Source/CTest/cmCTestCVS.h +++ b/Source/CTest/cmCTestCVS.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestCVS_h -#define cmCTestCVS_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -51,5 +50,3 @@ private: friend class LogParser; friend class UpdateParser; }; - -#endif diff --git a/Source/CTest/cmCTestCommand.h b/Source/CTest/cmCTestCommand.h index 8efb419..007378d 100644 --- a/Source/CTest/cmCTestCommand.h +++ b/Source/CTest/cmCTestCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestCommand_h -#define cmCTestCommand_h +#pragma once #include "cmCommand.h" @@ -27,5 +26,3 @@ public: cmCTest* CTest; cmCTestScriptHandler* CTestScriptHandler; }; - -#endif diff --git a/Source/CTest/cmCTestConfigureCommand.h b/Source/CTest/cmCTestConfigureCommand.h index 3f5944a..f338637 100644 --- a/Source/CTest/cmCTestConfigureCommand.h +++ b/Source/CTest/cmCTestConfigureCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestConfigureCommand_h -#define cmCTestConfigureCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -45,5 +44,3 @@ protected: std::string Options; }; - -#endif diff --git a/Source/CTest/cmCTestConfigureHandler.h b/Source/CTest/cmCTestConfigureHandler.h index 01fe801..2aad98c 100644 --- a/Source/CTest/cmCTestConfigureHandler.h +++ b/Source/CTest/cmCTestConfigureHandler.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestConfigureHandler_h -#define cmCTestConfigureHandler_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -25,5 +24,3 @@ public: void Initialize() override; }; - -#endif diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h index 76aaf46..9344852 100644 --- a/Source/CTest/cmCTestCoverageCommand.h +++ b/Source/CTest/cmCTestCoverageCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestCoverageCommand_h -#define cmCTestCoverageCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -48,5 +47,3 @@ protected: bool LabelsMentioned; std::vector<std::string> Labels; }; - -#endif diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index 991b89d..8732723 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestCoverageHandler_h -#define cmCTestCoverageHandler_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -149,5 +148,3 @@ private: bool IntersectsFilter(LabelSet const& labels); bool IsFilteredOut(std::string const& source); }; - -#endif diff --git a/Source/CTest/cmCTestCurl.h b/Source/CTest/cmCTestCurl.h index b0d7f07..d9aa916 100644 --- a/Source/CTest/cmCTestCurl.h +++ b/Source/CTest/cmCTestCurl.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestCurl_h -#define cmCTestCurl_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -52,5 +51,3 @@ private: bool Quiet; int TimeOutSeconds; }; - -#endif diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h index ac96a4e..ba2b0eb 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestEmptyBinaryDirectoryCommand_h -#define cmCTestEmptyBinaryDirectoryCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -45,5 +44,3 @@ public: bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus& status) override; }; - -#endif diff --git a/Source/CTest/cmCTestGIT.h b/Source/CTest/cmCTestGIT.h index 3103d84..a15aef5 100644 --- a/Source/CTest/cmCTestGIT.h +++ b/Source/CTest/cmCTestGIT.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestGIT_h -#define cmCTestGIT_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -53,5 +52,3 @@ public: friend class DiffParser; friend class OneLineParser; }; - -#endif diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index 94e5418..591d9cd 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestGenericHandler_h -#define cmCTestGenericHandler_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -105,5 +104,3 @@ protected: cmCTestCommand* Command; int SubmitIndex; }; - -#endif diff --git a/Source/CTest/cmCTestGlobalVC.h b/Source/CTest/cmCTestGlobalVC.h index ff86591..679b0e1 100644 --- a/Source/CTest/cmCTestGlobalVC.h +++ b/Source/CTest/cmCTestGlobalVC.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestGlobalVC_h -#define cmCTestGlobalVC_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -73,5 +72,3 @@ protected: void WriteXMLDirectory(cmXMLWriter& xml, std::string const& path, Directory const& dir); }; - -#endif diff --git a/Source/CTest/cmCTestHG.h b/Source/CTest/cmCTestHG.h index 2900139..b81f042 100644 --- a/Source/CTest/cmCTestHG.h +++ b/Source/CTest/cmCTestHG.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestHG_h -#define cmCTestHG_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -42,5 +41,3 @@ private: friend class LogParser; friend class StatusParser; }; - -#endif diff --git a/Source/CTest/cmCTestHandlerCommand.h b/Source/CTest/cmCTestHandlerCommand.h index a20d607..756952d 100644 --- a/Source/CTest/cmCTestHandlerCommand.h +++ b/Source/CTest/cmCTestHandlerCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestHandlerCommand_h -#define cmCTestHandlerCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -58,5 +57,3 @@ protected: "The APPEND option marks results for append to those previously " \ "submitted to a dashboard server since the last ctest_start. " \ "Append semantics are defined by the dashboard server in use." - -#endif diff --git a/Source/CTest/cmCTestLaunch.h b/Source/CTest/cmCTestLaunch.h index 79a7712..33ff82c 100644 --- a/Source/CTest/cmCTestLaunch.h +++ b/Source/CTest/cmCTestLaunch.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestLaunch_h -#define cmCTestLaunch_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -103,5 +102,3 @@ private: void LoadConfig(); std::string SourceDir; }; - -#endif diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h index 8f4ffb8..6544f16 100644 --- a/Source/CTest/cmCTestMemCheckCommand.h +++ b/Source/CTest/cmCTestMemCheckCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestMemCheckCommand_h -#define cmCTestMemCheckCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -43,5 +42,3 @@ protected: std::string DefectCount; }; - -#endif diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 63ab573..6ef5d20 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestMemCheckHandler_h -#define cmCTestMemCheckHandler_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -157,5 +156,3 @@ private: //! generate the output filename for the given test index void TestOutputFileNames(int test, std::vector<std::string>& files); }; - -#endif diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index e21b912..5de42f9 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestMultiProcessHandler_h -#define cmCTestMultiProcessHandler_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -200,5 +199,3 @@ protected: bool Quiet; bool SerialTestRunning; }; - -#endif diff --git a/Source/CTest/cmCTestP4.h b/Source/CTest/cmCTestP4.h index e19472e..d03f9cb 100644 --- a/Source/CTest/cmCTestP4.h +++ b/Source/CTest/cmCTestP4.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestP4_h -#define cmCTestP4_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -72,5 +71,3 @@ private: friend class DescribeParser; friend class DiffParser; }; - -#endif diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h index cbb9390..03714f6 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.h +++ b/Source/CTest/cmCTestReadCustomFilesCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestReadCustomFilesCommand_h -#define cmCTestReadCustomFilesCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -44,5 +43,3 @@ public: bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus& status) override; }; - -#endif diff --git a/Source/CTest/cmCTestResourceAllocator.h b/Source/CTest/cmCTestResourceAllocator.h index 9f0b9c9..129e64e 100644 --- a/Source/CTest/cmCTestResourceAllocator.h +++ b/Source/CTest/cmCTestResourceAllocator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestResourceAllocator_h -#define cmCTestResourceAllocator_h +#pragma once #include <map> #include <string> @@ -35,5 +34,3 @@ public: private: std::map<std::string, std::map<std::string, Resource>> Resources; }; - -#endif diff --git a/Source/CTest/cmCTestResourceGroupsLexerHelper.h b/Source/CTest/cmCTestResourceGroupsLexerHelper.h index 2cb6cb1..ae4fa99 100644 --- a/Source/CTest/cmCTestResourceGroupsLexerHelper.h +++ b/Source/CTest/cmCTestResourceGroupsLexerHelper.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestResourceGroupsLexerHelper_h -#define cmCTestResourceGroupsLexerHelper_h +#pragma once #include <string> #include <vector> @@ -40,5 +39,3 @@ private: }; #define YY_EXTRA_TYPE cmCTestResourceGroupsLexerHelper* - -#endif diff --git a/Source/CTest/cmCTestResourceSpec.h b/Source/CTest/cmCTestResourceSpec.h index cb242c0..1aa279b 100644 --- a/Source/CTest/cmCTestResourceSpec.h +++ b/Source/CTest/cmCTestResourceSpec.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestResourceSpec_h -#define cmCTestResourceSpec_h +#pragma once #include <map> #include <string> @@ -51,5 +50,3 @@ public: bool operator==(const cmCTestResourceSpec& other) const; bool operator!=(const cmCTestResourceSpec& other) const; }; - -#endif diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h index 2d8bde1..510b748 100644 --- a/Source/CTest/cmCTestRunScriptCommand.h +++ b/Source/CTest/cmCTestRunScriptCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestRunScriptCommand_h -#define cmCTestRunScriptCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -45,5 +44,3 @@ public: bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus& status) override; }; - -#endif diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index d831247..863ac1b 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestRunTest_h -#define cmCTestRunTest_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -159,5 +158,3 @@ inline int getNumWidth(size_t n) } return w; } - -#endif diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index b74dc12..370d176 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestSVN_h -#define cmCTestSVN_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -103,5 +102,3 @@ private: friend class UpdateParser; friend class ExternalParser; }; - -#endif diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h index ebb7905..8eb9658 100644 --- a/Source/CTest/cmCTestScriptHandler.h +++ b/Source/CTest/cmCTestScriptHandler.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestScriptHandler_h -#define cmCTestScriptHandler_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -176,5 +175,3 @@ private: std::unique_ptr<cmGlobalGenerator> GlobalGenerator; std::unique_ptr<cmake> CMake; }; - -#endif diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h index 1c3b8a1..9425576 100644 --- a/Source/CTest/cmCTestSleepCommand.h +++ b/Source/CTest/cmCTestSleepCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestSleepCommand_h -#define cmCTestSleepCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -45,5 +44,3 @@ public: bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus& status) override; }; - -#endif diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h index b30b1bb..b3d06a7 100644 --- a/Source/CTest/cmCTestStartCommand.h +++ b/Source/CTest/cmCTestStartCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestStartCommand_h -#define cmCTestStartCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -62,5 +61,3 @@ private: bool CreateNewTag; bool Quiet; }; - -#endif diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h index 9060771..c5d11df 100644 --- a/Source/CTest/cmCTestSubmitCommand.h +++ b/Source/CTest/cmCTestSubmitCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestSubmitCommand_h -#define cmCTestSubmitCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -55,5 +54,3 @@ protected: std::vector<std::string> HttpHeaders; std::vector<std::string> Parts; }; - -#endif diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h index 304daaa..809c615 100644 --- a/Source/CTest/cmCTestSubmitHandler.h +++ b/Source/CTest/cmCTestSubmitHandler.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestSubmitHandler_h -#define cmCTestSubmitHandler_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -77,5 +76,3 @@ private: std::set<std::string> Files; std::vector<std::string> HttpHeaders; }; - -#endif diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index 7925586..624cd91 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestTestCommand_h -#define cmCTestTestCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -62,5 +61,3 @@ protected: std::string ResourceSpecFile; bool StopOnFailure = false; }; - -#endif diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index f9e9391..aa29eeb 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestTestHandler_h -#define cmCTestTestHandler_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -360,5 +359,3 @@ private: int RepeatCount = 1; bool RerunFailed; }; - -#endif diff --git a/Source/CTest/cmCTestUpdateCommand.h b/Source/CTest/cmCTestUpdateCommand.h index 5555c16..e4c3453 100644 --- a/Source/CTest/cmCTestUpdateCommand.h +++ b/Source/CTest/cmCTestUpdateCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestUpdateCommand_h -#define cmCTestUpdateCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -42,5 +41,3 @@ public: protected: cmCTestGenericHandler* InitializeHandler() override; }; - -#endif diff --git a/Source/CTest/cmCTestUpdateHandler.h b/Source/CTest/cmCTestUpdateHandler.h index afc0e3d..25bbb2f 100644 --- a/Source/CTest/cmCTestUpdateHandler.h +++ b/Source/CTest/cmCTestUpdateHandler.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestUpdateHandler_h -#define cmCTestUpdateHandler_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -63,5 +62,3 @@ private: int DetectVCS(const char* dir); bool SelectVCS(); }; - -#endif diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h index 8334a9e..fe155f6 100644 --- a/Source/CTest/cmCTestUploadCommand.h +++ b/Source/CTest/cmCTestUploadCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestUploadCommand_h -#define cmCTestUploadCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -48,5 +47,3 @@ protected: std::vector<std::string> Files; }; - -#endif diff --git a/Source/CTest/cmCTestUploadHandler.h b/Source/CTest/cmCTestUploadHandler.h index dde14df..55d21c1 100644 --- a/Source/CTest/cmCTestUploadHandler.h +++ b/Source/CTest/cmCTestUploadHandler.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestUploadHandler_h -#define cmCTestUploadHandler_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -36,5 +35,3 @@ public: private: std::set<std::string> Files; }; - -#endif diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h index 3037e01..9bd7229 100644 --- a/Source/CTest/cmCTestVC.h +++ b/Source/CTest/cmCTestVC.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestVC_h -#define cmCTestVC_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -150,5 +149,3 @@ protected: // Count paths reported with each PathStatus value. int PathCount[3]; }; - -#endif diff --git a/Source/CTest/cmParseBlanketJSCoverage.h b/Source/CTest/cmParseBlanketJSCoverage.h index cd1b225..e107454 100644 --- a/Source/CTest/cmParseBlanketJSCoverage.h +++ b/Source/CTest/cmParseBlanketJSCoverage.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmParseBlanketJSCoverage_h -#define cmParseBlanketJSCoverage_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -39,4 +38,3 @@ protected: cmCTestCoverageHandlerContainer& Coverage; cmCTest* CTest; }; -#endif diff --git a/Source/CTest/cmParseCacheCoverage.h b/Source/CTest/cmParseCacheCoverage.h index a8200b7..523f83b 100644 --- a/Source/CTest/cmParseCacheCoverage.h +++ b/Source/CTest/cmParseCacheCoverage.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmParseCacheCoverage_h -#define cmParseCacheCoverage_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -31,5 +30,3 @@ protected: // Read a single mcov file bool ReadCMCovFile(const char* f); }; - -#endif diff --git a/Source/CTest/cmParseCoberturaCoverage.h b/Source/CTest/cmParseCoberturaCoverage.h index cb6d097..0340433 100644 --- a/Source/CTest/cmParseCoberturaCoverage.h +++ b/Source/CTest/cmParseCoberturaCoverage.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmParseCoberturaCoverage_h -#define cmParseCoberturaCoverage_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -41,5 +40,3 @@ private: cmCTest* CTest; std::string CurFileName; }; - -#endif diff --git a/Source/CTest/cmParseDelphiCoverage.h b/Source/CTest/cmParseDelphiCoverage.h index 1b37405..2a014a1 100644 --- a/Source/CTest/cmParseDelphiCoverage.h +++ b/Source/CTest/cmParseDelphiCoverage.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmParseDelphiCoverage_h -#define cmParseDelphiCoverage_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -35,4 +34,3 @@ protected: cmCTestCoverageHandlerContainer& Coverage; cmCTest* CTest; }; -#endif diff --git a/Source/CTest/cmParseGTMCoverage.h b/Source/CTest/cmParseGTMCoverage.h index 41cc7f5..c35bf6e 100644 --- a/Source/CTest/cmParseGTMCoverage.h +++ b/Source/CTest/cmParseGTMCoverage.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmParseGTMCoverage_h -#define cmParseGTMCoverage_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -37,5 +36,3 @@ protected: bool ParseMCOVLine(std::string const& line, std::string& routine, std::string& function, int& linenumber, int& count); }; - -#endif diff --git a/Source/CTest/cmParseJacocoCoverage.h b/Source/CTest/cmParseJacocoCoverage.h index f2aec6d..3442dd0 100644 --- a/Source/CTest/cmParseJacocoCoverage.h +++ b/Source/CTest/cmParseJacocoCoverage.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmParseJacocoCoverage_h -#define cmParseJacocoCoverage_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -49,5 +48,3 @@ private: cmCTestCoverageHandlerContainer& Coverage; cmCTest* CTest; }; - -#endif diff --git a/Source/CTest/cmParseMumpsCoverage.h b/Source/CTest/cmParseMumpsCoverage.h index 8c08702..00a8431 100644 --- a/Source/CTest/cmParseMumpsCoverage.h +++ b/Source/CTest/cmParseMumpsCoverage.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmParseMumpsCoverage_h -#define cmParseMumpsCoverage_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -43,5 +42,3 @@ protected: cmCTestCoverageHandlerContainer& Coverage; cmCTest* CTest; }; - -#endif diff --git a/Source/CTest/cmParsePHPCoverage.h b/Source/CTest/cmParsePHPCoverage.h index ff0e636..763a6bb 100644 --- a/Source/CTest/cmParsePHPCoverage.h +++ b/Source/CTest/cmParsePHPCoverage.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmParsePHPCoverage_h -#define cmParsePHPCoverage_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -35,5 +34,3 @@ private: cmCTestCoverageHandlerContainer& Coverage; cmCTest* CTest; }; - -#endif diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h index 1e6578c..9eec952 100644 --- a/Source/CTest/cmProcess.h +++ b/Source/CTest/cmProcess.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmProcess_h -#define cmProcess_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -132,5 +131,3 @@ private: int Id; int64_t ExitValue; }; - -#endif diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake index e726fc7..5c1593d 100644 --- a/Source/Checks/cm_cxx_features.cmake +++ b/Source/Checks/cm_cxx_features.cmake @@ -1,6 +1,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/cm_message_checks_compat.cmake) function(cm_check_cxx_feature name) + set(TRY_RUN_FEATURE "${ARGN}") string(TOUPPER ${name} FEATURE) if(NOT DEFINED CMake_HAVE_CXX_${FEATURE}) cm_message_checks_compat( @@ -12,12 +13,26 @@ function(cm_check_cxx_feature name) else() set(maybe_cxx_standard "") endif() - try_compile(CMake_HAVE_CXX_${FEATURE} - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_LIST_DIR}/cm_cxx_${name}.cxx - CMAKE_FLAGS ${maybe_cxx_standard} - OUTPUT_VARIABLE OUTPUT - ) + if (TRY_RUN_FEATURE) + try_run(CMake_RUN_CXX_${FEATURE} CMake_COMPILE_CXX_${FEATURE} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_LIST_DIR}/cm_cxx_${name}.cxx + CMAKE_FLAGS ${maybe_cxx_standard} + OUTPUT_VARIABLE OUTPUT + ) + if (CMake_RUN_CXX_${FEATURE} EQUAL "0" AND CMake_COMPILE_CXX_${FEATURE}) + set(CMake_HAVE_CXX_${FEATURE} ON CACHE INTERNAL "TRY_RUN" FORCE) + else() + set(CMake_HAVE_CXX_${FEATURE} OFF CACHE INTERNAL "TRY_RUN" FORCE) + endif() + else() + try_compile(CMake_HAVE_CXX_${FEATURE} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_LIST_DIR}/cm_cxx_${name}.cxx + CMAKE_FLAGS ${maybe_cxx_standard} + OUTPUT_VARIABLE OUTPUT + ) + endif() set(check_output "${OUTPUT}") # Filter out MSBuild output that looks like a warning. string(REGEX REPLACE " +0 Warning\\(s\\)" "" check_output "${check_output}") @@ -64,7 +79,7 @@ if(CMake_HAVE_CXX_MAKE_UNIQUE) endif() cm_check_cxx_feature(unique_ptr) if (NOT CMAKE_CXX_STANDARD LESS "17") - cm_check_cxx_feature(filesystem) + cm_check_cxx_feature(filesystem TRY_RUN) else() set(CMake_HAVE_CXX_FILESYSTEM FALSE) endif() diff --git a/Source/Checks/cm_cxx_filesystem.cxx b/Source/Checks/cm_cxx_filesystem.cxx index e508d1c..ae8acc5 100644 --- a/Source/Checks/cm_cxx_filesystem.cxx +++ b/Source/Checks/cm_cxx_filesystem.cxx @@ -3,8 +3,25 @@ int main() { + std::filesystem::path p0(L"/a/b/c"); + std::filesystem::path p1("/a/b/c"); std::filesystem::path p2("/a/b/c"); + if (p1 != p2) { + return 1; + } + +#if defined(_WIN32) + std::filesystem::path p3("//host/a/b/../c"); + if (p3.lexically_normal().generic_string() != "//host/a/c") { + return 1; + } + + std::filesystem::path p4("c://a/.///b/../"); + if (p4.lexically_normal().generic_string() != "c:/a/") { + return 1; + } +#endif - return p1 == p2 ? 0 : 1; + return 0; } diff --git a/Source/CursesDialog/cmCursesBoolWidget.h b/Source/CursesDialog/cmCursesBoolWidget.h index 8c96256..746825b 100644 --- a/Source/CursesDialog/cmCursesBoolWidget.h +++ b/Source/CursesDialog/cmCursesBoolWidget.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCursesBoolWidget_h -#define cmCursesBoolWidget_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -29,5 +28,3 @@ public: void SetValueAsBool(bool value); bool GetValueAsBool(); }; - -#endif // cmCursesBoolWidget_h diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h index a711363..d414918 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.h +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCursesCacheEntryComposite_h -#define cmCursesCacheEntryComposite_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -41,5 +40,3 @@ protected: int LabelWidth; int EntryWidth; }; - -#endif // cmCursesCacheEntryComposite_h diff --git a/Source/CursesDialog/cmCursesColor.h b/Source/CursesDialog/cmCursesColor.h index f83265f..4e8a1e4 100644 --- a/Source/CursesDialog/cmCursesColor.h +++ b/Source/CursesDialog/cmCursesColor.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCursesColor_h -#define cmCursesColor_h +#pragma once class cmCursesColor { @@ -23,5 +22,3 @@ public: protected: static short GetColor(char id, short fallback); }; - -#endif // cmCursesColor_h diff --git a/Source/CursesDialog/cmCursesDummyWidget.h b/Source/CursesDialog/cmCursesDummyWidget.h index 07b7288..4347746 100644 --- a/Source/CursesDialog/cmCursesDummyWidget.h +++ b/Source/CursesDialog/cmCursesDummyWidget.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCursesDummyWidget_h -#define cmCursesDummyWidget_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -24,5 +23,3 @@ public: // handled. bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) override; }; - -#endif // cmCursesDummyWidget_h diff --git a/Source/CursesDialog/cmCursesFilePathWidget.h b/Source/CursesDialog/cmCursesFilePathWidget.h index 3f71259..2ae5d14 100644 --- a/Source/CursesDialog/cmCursesFilePathWidget.h +++ b/Source/CursesDialog/cmCursesFilePathWidget.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCursesFilePathWidget_h -#define cmCursesFilePathWidget_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -15,5 +14,3 @@ public: cmCursesFilePathWidget(cmCursesFilePathWidget const&) = delete; cmCursesFilePathWidget& operator=(cmCursesFilePathWidget const&) = delete; }; - -#endif // cmCursesFilePathWidget_h diff --git a/Source/CursesDialog/cmCursesForm.h b/Source/CursesDialog/cmCursesForm.h index e3626e6..93459b9 100644 --- a/Source/CursesDialog/cmCursesForm.h +++ b/Source/CursesDialog/cmCursesForm.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCursesForm_h -#define cmCursesForm_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -62,5 +61,3 @@ protected: FORM* Form; }; - -#endif // cmCursesForm_h diff --git a/Source/CursesDialog/cmCursesLabelWidget.h b/Source/CursesDialog/cmCursesLabelWidget.h index 9e75681..c10aa37 100644 --- a/Source/CursesDialog/cmCursesLabelWidget.h +++ b/Source/CursesDialog/cmCursesLabelWidget.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCursesLabelWidget_h -#define cmCursesLabelWidget_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -28,5 +27,3 @@ public: // handled bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) override; }; - -#endif // cmCursesLabelWidget_h diff --git a/Source/CursesDialog/cmCursesLongMessageForm.h b/Source/CursesDialog/cmCursesLongMessageForm.h index da9fea2..4f69cb1 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.h +++ b/Source/CursesDialog/cmCursesLongMessageForm.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCursesLongMessageForm_h -#define cmCursesLongMessageForm_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -59,5 +58,3 @@ protected: FIELD* Fields[2]; }; - -#endif // cmCursesLongMessageForm_h diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 2e06b90..c6db66f 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCursesMainForm_h -#define cmCursesMainForm_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -170,5 +169,3 @@ protected: std::string OldSearchString; bool SearchMode; }; - -#endif // cmCursesMainForm_h diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h index 0de8e64..cb06e4d 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.h +++ b/Source/CursesDialog/cmCursesOptionsWidget.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCursesOptionsWidget_h -#define cmCursesOptionsWidget_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -35,5 +34,3 @@ protected: std::vector<std::string> Options; std::vector<std::string>::size_type CurrentOption; }; - -#endif // cmCursesOptionsWidget_h diff --git a/Source/CursesDialog/cmCursesPathWidget.h b/Source/CursesDialog/cmCursesPathWidget.h index fb365e9..79e342e 100644 --- a/Source/CursesDialog/cmCursesPathWidget.h +++ b/Source/CursesDialog/cmCursesPathWidget.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCursesPathWidget_h -#define cmCursesPathWidget_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -34,5 +33,3 @@ protected: bool Cycle; std::string::size_type CurrentIndex; }; - -#endif // cmCursesPathWidget_h diff --git a/Source/CursesDialog/cmCursesStandardIncludes.h b/Source/CursesDialog/cmCursesStandardIncludes.h index 5b0ad58..9745b97 100644 --- a/Source/CursesDialog/cmCursesStandardIncludes.h +++ b/Source/CursesDialog/cmCursesStandardIncludes.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCursesStandardIncludes_h -#define cmCursesStandardIncludes_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -41,5 +40,3 @@ inline void curses_clear() # undef __attribute__ #endif #undef cm_no__attribute__ - -#endif // cmCursesStandardIncludes_h diff --git a/Source/CursesDialog/cmCursesStringWidget.h b/Source/CursesDialog/cmCursesStringWidget.h index ce06c6d..faa2ade 100644 --- a/Source/CursesDialog/cmCursesStringWidget.h +++ b/Source/CursesDialog/cmCursesStringWidget.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCursesStringWidget_h -#define cmCursesStringWidget_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -65,5 +64,3 @@ protected: std::string OriginalString; bool Done; }; - -#endif // cmCursesStringWidget_h diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h index 9d03c6e..29ec28b 100644 --- a/Source/CursesDialog/cmCursesWidget.h +++ b/Source/CursesDialog/cmCursesWidget.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCursesWidget_h -#define cmCursesWidget_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -68,5 +67,3 @@ protected: // The page in the main form this widget is in int Page; }; - -#endif // cmCursesWidget_h diff --git a/Source/QtDialog/AddCacheEntry.h b/Source/QtDialog/AddCacheEntry.h index e7a60dd..35522c5 100644 --- a/Source/QtDialog/AddCacheEntry.h +++ b/Source/QtDialog/AddCacheEntry.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef AddCacheEntry_h -#define AddCacheEntry_h +#pragma once #include "QCMake.h" #include <QCheckBox> @@ -32,5 +31,3 @@ private: const QStringList& VarNames; const QStringList& VarTypes; }; - -#endif diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index 914be12..eba0b1e 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef CMakeSetupDialog_h -#define CMakeSetupDialog_h +#pragma once #include <memory> @@ -146,5 +145,3 @@ protected: virtual void run(); std::unique_ptr<QCMake> CMakeInstance; }; - -#endif // CMakeSetupDialog_h diff --git a/Source/QtDialog/Compilers.h b/Source/QtDialog/Compilers.h index 931c935..5da0781 100644 --- a/Source/QtDialog/Compilers.h +++ b/Source/QtDialog/Compilers.h @@ -1,7 +1,6 @@ -#ifndef COMPILERS_HPP -#define COMPILERS_HPP +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -21,5 +20,3 @@ public: this->setupUi(this); } }; - -#endif diff --git a/Source/QtDialog/FirstConfigure.h b/Source/QtDialog/FirstConfigure.h index c26f489..4c757da 100644 --- a/Source/QtDialog/FirstConfigure.h +++ b/Source/QtDialog/FirstConfigure.h @@ -1,6 +1,5 @@ -#ifndef FirstConfigure_h -#define FirstConfigure_h +#pragma once #include <QWizard> #include <QWizardPage> @@ -201,5 +200,3 @@ protected: ToolchainCompilerSetup* mToolchainCompilerSetupPage; QString mDefaultGenerator; }; - -#endif // FirstConfigure_h diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h index 39555d6..e87660b 100644 --- a/Source/QtDialog/QCMake.h +++ b/Source/QtDialog/QCMake.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef QCMake_h -#define QCMake_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -182,5 +181,3 @@ protected: QString CMakeExecutable; QAtomicInt InterruptFlag; }; - -#endif // QCMake_h diff --git a/Source/QtDialog/QCMakeCacheView.h b/Source/QtDialog/QCMakeCacheView.h index a252708..836a939 100644 --- a/Source/QtDialog/QCMakeCacheView.h +++ b/Source/QtDialog/QCMakeCacheView.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef QCMakeCacheView_h -#define QCMakeCacheView_h +#pragma once #include "QCMake.h" #include <QItemDelegate> @@ -164,5 +163,3 @@ protected: // properties changed by user via this delegate QSet<QCMakeProperty> mChanges; }; - -#endif diff --git a/Source/QtDialog/QCMakeWidgets.h b/Source/QtDialog/QCMakeWidgets.h index 5d2368e..9a2a27e 100644 --- a/Source/QtDialog/QCMakeWidgets.h +++ b/Source/QtDialog/QCMakeWidgets.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef QCMakeWidgets_h -#define QCMakeWidgets_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -77,5 +76,3 @@ public: } } }; - -#endif diff --git a/Source/QtDialog/RegexExplorer.h b/Source/QtDialog/RegexExplorer.h index 1a1d770..9a42320 100644 --- a/Source/QtDialog/RegexExplorer.h +++ b/Source/QtDialog/RegexExplorer.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef RegexExplorer_h -#define RegexExplorer_h +#pragma once #include <string> @@ -39,5 +38,3 @@ private: std::string m_regex; bool m_matched; }; - -#endif diff --git a/Source/QtDialog/WarningMessagesDialog.h b/Source/QtDialog/WarningMessagesDialog.h index f209dbd..bb01704 100644 --- a/Source/QtDialog/WarningMessagesDialog.h +++ b/Source/QtDialog/WarningMessagesDialog.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef WarningMessagesDialog_h -#define WarningMessagesDialog_h +#pragma once #include "QCMake.h" #include <QDialog> @@ -63,5 +62,3 @@ private: */ void setupSignals(); }; - -#endif /* MessageDialog_h */ diff --git a/Source/bindexplib.h b/Source/bindexplib.h index 538177d..bd1398f 100644 --- a/Source/bindexplib.h +++ b/Source/bindexplib.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef bindexplib_h -#define bindexplib_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -25,4 +24,3 @@ private: std::set<std::string> DataSymbols; std::string NmPath; }; -#endif diff --git a/Source/cmAddCompileDefinitionsCommand.h b/Source/cmAddCompileDefinitionsCommand.h index 4bd621c..29282d6 100644 --- a/Source/cmAddCompileDefinitionsCommand.h +++ b/Source/cmAddCompileDefinitionsCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmAddCompileDefinitionsCommand_h -#define cmAddCompileDefinitionsCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmAddCompileDefinitionsCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmAddCompileOptionsCommand.h b/Source/cmAddCompileOptionsCommand.h index b172412..076a427 100644 --- a/Source/cmAddCompileOptionsCommand.h +++ b/Source/cmAddCompileOptionsCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmAddCompileOptionsCommand_h -#define cmAddCompileOptionsCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmAddCompileOptionsCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h index 4f8c58f..383d116 100644 --- a/Source/cmAddCustomCommandCommand.h +++ b/Source/cmAddCustomCommandCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmAddCustomCommandCommand_h -#define cmAddCustomCommandCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmAddCustomCommandCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h index e23ef9f..3b784cb 100644 --- a/Source/cmAddCustomTargetCommand.h +++ b/Source/cmAddCustomTargetCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmAddCustomTargetCommand_h -#define cmAddCustomTargetCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmAddCustomTargetCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h index a67f095..45b4554 100644 --- a/Source/cmAddDefinitionsCommand.h +++ b/Source/cmAddDefinitionsCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmAddDefinitionsCommand_h -#define cmAddDefinitionsCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmAddDefinitionsCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h index 0c60e3a..a767550 100644 --- a/Source/cmAddDependenciesCommand.h +++ b/Source/cmAddDependenciesCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmDependenciessCommand_h -#define cmDependenciessCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmAddDependenciesCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h index f7bc273..032c14d 100644 --- a/Source/cmAddExecutableCommand.h +++ b/Source/cmAddExecutableCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExecutablesCommand_h -#define cmExecutablesCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmAddExecutableCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h index 609449c..a4a0ea0 100644 --- a/Source/cmAddLibraryCommand.h +++ b/Source/cmAddLibraryCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLibrarysCommand_h -#define cmLibrarysCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmAddLibraryCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmAddLinkOptionsCommand.h b/Source/cmAddLinkOptionsCommand.h index 466fc32..5c9d5e4 100644 --- a/Source/cmAddLinkOptionsCommand.h +++ b/Source/cmAddLinkOptionsCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmAddLinkOptionsCommand_h -#define cmAddLinkOptionsCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmAddLinkOptionsCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h index 87da840..ece3b27 100644 --- a/Source/cmAddSubDirectoryCommand.h +++ b/Source/cmAddSubDirectoryCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmAddSubDirectoryCommand_h -#define cmAddSubDirectoryCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmAddSubDirectoryCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h index 5877547..8cba2b1 100644 --- a/Source/cmAddTestCommand.h +++ b/Source/cmAddTestCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmAddTestCommand_h -#define cmAddTestCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmAddTestCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index c8e8dcb..87000da 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmAlgorithms_h -#define cmAlgorithms_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -143,5 +142,3 @@ typename Range::const_iterator cmFindNot(Range const& r, T const& t) { return std::find_if(r.begin(), r.end(), [&t](T const& i) { return i != t; }); } - -#endif diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h index b643bce..fff4556 100644 --- a/Source/cmArchiveWrite.h +++ b/Source/cmArchiveWrite.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmArchiveWrite_h -#define cmArchiveWrite_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -180,5 +179,3 @@ private: cmArchiveWriteOptional<int> Permissions; cmArchiveWriteOptional<int> PermissionsMask; }; - -#endif diff --git a/Source/cmArgumentParser.h b/Source/cmArgumentParser.h index 5d2dfa2..71ed844 100644 --- a/Source/cmArgumentParser.h +++ b/Source/cmArgumentParser.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmArgumentParser_h -#define cmArgumentParser_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -146,5 +145,3 @@ protected: private: ArgumentParser::ActionMap Bindings; }; - -#endif diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h index ae26092..29ee429 100644 --- a/Source/cmAuxSourceDirectoryCommand.h +++ b/Source/cmAuxSourceDirectoryCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmAuxSourceDirectoryCommand_h -#define cmAuxSourceDirectoryCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmAuxSourceDirectoryCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmBase32.h b/Source/cmBase32.h index d85198d..726f45d 100644 --- a/Source/cmBase32.h +++ b/Source/cmBase32.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmBase32_h -#define cmBase32_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -29,5 +28,3 @@ public: std::string encodeString(const unsigned char* input, size_t len, bool padding = true); }; - -#endif diff --git a/Source/cmBinUtilsLinker.h b/Source/cmBinUtilsLinker.h index 78d517b..5330070 100644 --- a/Source/cmBinUtilsLinker.h +++ b/Source/cmBinUtilsLinker.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmBinUtilsLinker_h -#define cmBinUtilsLinker_h +#pragma once #include <string> @@ -26,5 +25,3 @@ protected: void SetError(const std::string& e); }; - -#endif // cmBinUtilsLinker_h diff --git a/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h b/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h index d514e7f..15216a4 100644 --- a/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h +++ b/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmBinUtilsLinuxELFGetRuntimeDependenciesTool_h -#define cmBinUtilsLinuxELFGetRuntimeDependenciesTool_h +#pragma once #include <string> #include <vector> @@ -26,5 +25,3 @@ protected: void SetError(const std::string& e); }; - -#endif // cmBinUtilsLinuxELFGetRuntimeDependenciesTool_h diff --git a/Source/cmBinUtilsLinuxELFLinker.h b/Source/cmBinUtilsLinuxELFLinker.h index b17df11..4e7e36d 100644 --- a/Source/cmBinUtilsLinuxELFLinker.h +++ b/Source/cmBinUtilsLinuxELFLinker.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmBinUtilsLinuxELFLinker_h -#define cmBinUtilsLinuxELFLinker_h +#pragma once #include <memory> #include <string> @@ -40,5 +39,3 @@ private: bool GetLDConfigPaths(); }; - -#endif // cmBinUtilsLinuxELFLinker_h diff --git a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h index 969e4d4..def1dd0 100644 --- a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h +++ b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmBinUtilsLinuxELFGetRuntimeCollectDependenciesTool_h -#define cmBinUtilsLinuxELFGetRuntimeCollectDependenciesTool_h +#pragma once #include <string> #include <vector> @@ -22,5 +21,3 @@ public: std::vector<std::string>& rpaths, std::vector<std::string>& runpaths) override; }; - -#endif // cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool_h diff --git a/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h b/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h index dbb2882..60d34aa 100644 --- a/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h +++ b/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmBinUtilsMacOSMachOGetRuntimeDependenciesTool_h -#define cmBinUtilsMacOSMachOGetRuntimeDependenciesTool_h +#pragma once #include <string> #include <vector> @@ -25,5 +24,3 @@ protected: void SetError(const std::string& error); }; - -#endif // cmBinUtilsMacOSMachOGetRuntimeDependenciesTool_h diff --git a/Source/cmBinUtilsMacOSMachOLinker.h b/Source/cmBinUtilsMacOSMachOLinker.h index 4a24ea3..1c4a5fc 100644 --- a/Source/cmBinUtilsMacOSMachOLinker.h +++ b/Source/cmBinUtilsMacOSMachOLinker.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmBinUtilsMacOSMachOLinker_h -#define cmBinUtilsMacOSMachOLinker_h +#pragma once #include <memory> #include <string> @@ -55,5 +54,3 @@ private: std::vector<std::string> const& rpaths, std::string& path, bool& resolved); }; - -#endif // cmBinUtilsMacOSMachOLinker_h diff --git a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h index 8ac7e18..9d17450 100644 --- a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h +++ b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool_h -#define cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool_h +#pragma once #include <string> #include <vector> @@ -21,5 +20,3 @@ public: bool GetFileInfo(std::string const& file, std::vector<std::string>& libs, std::vector<std::string>& rpaths) override; }; - -#endif // cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool_h diff --git a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h index eae22ea..8609479 100644 --- a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h +++ b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool_h -#define cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool_h +#pragma once #include <string> #include <vector> @@ -21,5 +20,3 @@ public: bool GetFileInfo(const std::string& file, std::vector<std::string>& needed) override; }; - -#endif // cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool_h diff --git a/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h b/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h index e9e402b..da71aaa 100644 --- a/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h +++ b/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmBinUtilsWindowsPEGetRuntimeDependenciesTool_h -#define cmBinUtilsWindowsPEGetRuntimeDependenciesTool_h +#pragma once #include <string> #include <vector> @@ -24,5 +23,3 @@ protected: void SetError(const std::string& error); }; - -#endif // cmBinUtilsWindowsPEGetRuntimeDependenciesTool_h diff --git a/Source/cmBinUtilsWindowsPELinker.h b/Source/cmBinUtilsWindowsPELinker.h index a8bb596..6bb7875 100644 --- a/Source/cmBinUtilsWindowsPELinker.h +++ b/Source/cmBinUtilsWindowsPELinker.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmBinUtilsWindowsPELinker_h -#define cmBinUtilsWindowsPELinker_h +#pragma once #include <memory> #include <string> @@ -29,5 +28,3 @@ private: bool ResolveDependency(std::string const& name, std::string const& origin, std::string& path, bool& resolved); }; - -#endif // cmBinUtilsWindowsPELinker_h diff --git a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h index a67cb0c..fe89a2d 100644 --- a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h +++ b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool_h -#define cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool_h +#pragma once #include <string> #include <vector> @@ -21,5 +20,3 @@ public: bool GetFileInfo(const std::string& file, std::vector<std::string>& needed) override; }; - -#endif // cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool_h diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h index e6ce6fe..6241867 100644 --- a/Source/cmBreakCommand.h +++ b/Source/cmBreakCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmBreakCommand_h -#define cmBreakCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -17,5 +16,3 @@ class cmExecutionStatus; */ bool cmBreakCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h index 45aa71d..eafe185 100644 --- a/Source/cmBuildCommand.h +++ b/Source/cmBuildCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmBuildCommand_h -#define cmBuildCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmBuildCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h index 37a7268..650dc74 100644 --- a/Source/cmBuildNameCommand.h +++ b/Source/cmBuildNameCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmBuildNameCommand_h -#define cmBuildNameCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmBuildNameCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmCLocaleEnvironmentScope.h b/Source/cmCLocaleEnvironmentScope.h index aa2827e..0919acc 100644 --- a/Source/cmCLocaleEnvironmentScope.h +++ b/Source/cmCLocaleEnvironmentScope.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCLocaleEnvironmentScope_h -#define cmCLocaleEnvironmentScope_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -25,5 +24,3 @@ private: using backup_map_t = std::map<std::string, std::string>; backup_map_t EnvironmentBackup; }; - -#endif diff --git a/Source/cmCMakeHostSystemInformationCommand.h b/Source/cmCMakeHostSystemInformationCommand.h index 79e3f27..8a64f6a 100644 --- a/Source/cmCMakeHostSystemInformationCommand.h +++ b/Source/cmCMakeHostSystemInformationCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCMakeHostSystemInformationCommand_h -#define cmCMakeHostSystemInformationCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -18,5 +17,3 @@ class cmExecutionStatus; */ bool cmCMakeHostSystemInformationCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmCMakeLanguageCommand.h b/Source/cmCMakeLanguageCommand.h index aeb8f60..d45003a 100644 --- a/Source/cmCMakeLanguageCommand.h +++ b/Source/cmCMakeLanguageCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCMakeLanguageCommand_h -#define cmCMakeLanguageCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -16,5 +15,3 @@ struct cmListFileArgument; */ bool cmCMakeLanguageCommand(std::vector<cmListFileArgument> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h index 53f78f6..712d6d6 100644 --- a/Source/cmCMakeMinimumRequired.h +++ b/Source/cmCMakeMinimumRequired.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCMakeMinimumRequired_h -#define cmCMakeMinimumRequired_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -17,5 +16,3 @@ class cmExecutionStatus; */ bool cmCMakeMinimumRequired(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmCMakePath.cxx b/Source/cmCMakePath.cxx new file mode 100644 index 0000000..b8215df --- /dev/null +++ b/Source/cmCMakePath.cxx @@ -0,0 +1,146 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +#include "cmConfigure.h" // IWYU pragma: keep + +#include "cmCMakePath.h" + +#include <string> + +#if defined(_WIN32) +# include <cstdlib> +#endif + +#include <cm/filesystem> +#include <cm/string_view> + +#if defined(_WIN32) +# include "cmStringAlgorithms.h" +#endif + +cmCMakePath& cmCMakePath::ReplaceWideExtension(cm::string_view extension) +{ + auto file = this->Path.filename().string(); + if (!file.empty() && file != "." && file != "..") { + auto pos = file.find('.', file[0] == '.' ? 1 : 0); + if (pos != std::string::npos) { + file.erase(pos); + } + } + if (!extension.empty()) { + if (extension[0] != '.') { + file += '.'; + } + file.append(std::string(extension)); + } + this->Path.replace_filename(file); + return *this; +} + +cmCMakePath cmCMakePath::GetWideExtension() const +{ + auto file = this->Path.filename().string(); + if (file.empty() || file == "." || file == "..") { + return cmCMakePath{}; + } + + auto pos = file.find('.', file[0] == '.' ? 1 : 0); + if (pos != std::string::npos) { + return cm::string_view(file.data() + pos, file.length() - pos); + } + + return cmCMakePath{}; +} + +cmCMakePath cmCMakePath::GetNarrowStem() const +{ + auto stem = this->Path.stem().string(); + if (!stem.empty()) { + auto pos = stem.find('.', stem[0] == '.' ? 1 : 0); + if (pos != std::string::npos) { + return stem.substr(0, pos); + } + } + return stem; +} + +cmCMakePath cmCMakePath::Absolute(const cm::filesystem::path& base) const +{ + if (this->Path.is_relative()) { + auto path = base; + path /= this->Path; + // filesystem::path::operator/= use preferred_separator ('\' on Windows) + // so converts back to '/' + return path.generic_string(); + } + return *this; +} + +bool cmCMakePath::IsPrefix(const cmCMakePath& path) const +{ + auto prefix_it = this->Path.begin(); + auto prefix_end = this->Path.end(); + auto path_it = path.Path.begin(); + auto path_end = path.Path.end(); + + while (prefix_it != prefix_end && path_it != path_end && + *prefix_it == *path_it) { + ++prefix_it; + ++path_it; + } + return prefix_it == prefix_end; +} + +std::string cmCMakePath::FormatPath(std::string path, format fmt) +{ +#if defined(_WIN32) + if (fmt == auto_format || fmt == native_format) { + auto prefix = path.substr(0, 4); + for (auto& c : prefix) { + if (c == '\\') { + c = '/'; + } + } + // remove Windows long filename marker + if (prefix == "//?/"_s) { + path.erase(0, 4); + } + if (cmHasPrefix(path, "UNC/"_s) || cmHasPrefix(path, "UNC\\"_s)) { + path.erase(0, 2); + path[0] = '/'; + } + } +#else + static_cast<void>(fmt); +#endif + return path; +} + +void cmCMakePath::GetNativePath(std::string& path) const +{ + cm::filesystem::path tmp(this->Path); + tmp.make_preferred(); + + path = tmp.string(); +} +void cmCMakePath::GetNativePath(std::wstring& path) const +{ + cm::filesystem::path tmp(this->Path); + tmp.make_preferred(); + + path = tmp.wstring(); + +#if defined(_WIN32) + // Windows long filename + static std::wstring UNC(L"\\\\?\\UNC"); + static std::wstring PREFIX(L"\\\\?\\"); + + if (this->IsAbsolute() && path.length() > _MAX_PATH - 12) { + if (this->HasRootName() && path[0] == L'\\') { + path = UNC + path.substr(1); + } else { + path = PREFIX + path; + } + } +#endif +} diff --git a/Source/cmCMakePath.h b/Source/cmCMakePath.h new file mode 100644 index 0000000..15aa30c --- /dev/null +++ b/Source/cmCMakePath.h @@ -0,0 +1,571 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +#pragma once + +#include "cmConfigure.h" // IWYU pragma: keep + +#include <cstddef> +#include <string> +#include <utility> + +#include <cm/filesystem> +#include <cm/string_view> +#include <cm/type_traits> +#include <cmext/string_view> + +namespace detail { +#if defined(__SUNPRO_CC) && defined(__sparc) +// Oracle DeveloperStudio C++ compiler on Solaris/Sparc fails to compile +// the full 'is_pathable' and 'is_move_pathable' checks. We use it only to +// improve error messages via 'enable_if' when calling methods with incorrect +// types. Just pretend all types are allowed so we can at least compile valid +// code. +template <typename T> +struct is_pathable : std::true_type +{ +}; + +template <typename T> +struct is_move_pathable : std::true_type +{ +}; + +#else +template <typename T, typename = void> +struct is_pathable : std::false_type +{ +}; + +template <> +struct is_pathable<cm::filesystem::path> : std::true_type +{ +}; +template <> +struct is_pathable<std::string> : std::true_type +{ +}; +template <> +struct is_pathable<cm::string_view> : std::true_type +{ +}; +template <> +struct is_pathable<cm::static_string_view> : std::true_type +{ +}; +template <typename T> +struct is_pathable< + T, + cm::enable_if_t<std::is_same<char*, typename std::decay<T>::type>::value, + void>> + : cm::bool_constant<std::is_same<char*, typename std::decay<T>::type>::value> +{ +}; + +template <typename T> +struct is_move_pathable : std::false_type +{ +}; + +template <> +struct is_move_pathable<cm::filesystem::path> : std::true_type +{ +}; +template <> +struct is_move_pathable<std::string> : std::true_type +{ +}; +#endif +} + +class cmCMakePath +{ +private: + template <typename Source> + using enable_if_move_pathable = + cm::enable_if_t<detail::is_move_pathable<Source>::value, cmCMakePath&>; + + template <typename Source> + using enable_if_pathable = + cm::enable_if_t<detail::is_pathable<Source>::value, cmCMakePath&>; + +public: + using value_type = cm::filesystem::path::value_type; + using string_type = cm::filesystem::path::string_type; + + enum format : unsigned char + { + auto_format = + static_cast<unsigned char>(cm::filesystem::path::format::auto_format), + native_format = + static_cast<unsigned char>(cm::filesystem::path::format::native_format), + generic_format = + static_cast<unsigned char>(cm::filesystem::path::format::generic_format) + }; + + class iterator; + using const_iterator = iterator; + + cmCMakePath() noexcept = default; + + cmCMakePath(const cmCMakePath&) = default; + + cmCMakePath(cmCMakePath&& path) noexcept + : Path(std::forward<cm::filesystem::path>(path.Path)) + { + } + + cmCMakePath(cm::filesystem::path path) noexcept + : Path(std::move(path)) + { + } + cmCMakePath(cm::string_view source, format fmt = generic_format) noexcept + : Path(FormatPath(source, fmt)) + { + } + template <typename Source, typename = enable_if_move_pathable<Source>> + cmCMakePath(Source source, format fmt = generic_format) + : Path(FormatPath(std::move(source), fmt)) + { + } + + template <typename Source, typename = enable_if_move_pathable<Source>> + cmCMakePath& Assign(Source&& source) + { + this->Path = std::forward<Source>(source); + return *this; + } + template <typename Source, typename = enable_if_pathable<Source>> + cmCMakePath& Assign(const Source& source) + { + this->Path = source; + return *this; + } + + cmCMakePath& operator=(const cmCMakePath& path) + { + if (this != &path) { + this->Path = path.Path; + } + return *this; + } + cmCMakePath& operator=(cmCMakePath&& path) noexcept + { + if (this != &path) { + this->Path = std::move(path.Path); + } + return *this; + } + template <typename Source, typename = enable_if_move_pathable<Source>> + cmCMakePath& operator=(Source&& source) + { + this->Assign(std::forward<Source>(source)); + return *this; + } + template <typename Source, typename = enable_if_pathable<Source>> + cmCMakePath& operator=(const Source& source) + { + this->Assign(source); + return *this; + } + + // Concatenation + cmCMakePath& Append(const cmCMakePath& path) + { + return this->Append(path.Path); + } + cmCMakePath& Append(const cm::filesystem::path& path) + { + this->Path /= path; + // filesystem::path::append use preferred_separator ('\' on Windows) + // so convert back to '/' + this->Path = this->Path.generic_string(); + return *this; + } + + template <typename Source, typename = enable_if_pathable<Source>> + cmCMakePath& Append(const Source& source) + { + return this->Append(cm::filesystem::path(source)); + } + + cmCMakePath& operator/=(const cmCMakePath& path) + { + return this->Append(path); + } + template <typename Source, typename = enable_if_pathable<Source>> + cmCMakePath& operator/=(const Source& source) + { + return this->Append(source); + } + + cmCMakePath& Concat(const cmCMakePath& path) + { + this->Path += path.Path; + return *this; + } + cmCMakePath& Concat(cm::static_string_view source) + { + this->Path.concat(std::string(source)); + return *this; + } + template <typename Source, typename = enable_if_pathable<Source>> + cmCMakePath& Concat(const Source& source) + { + this->Path.concat(source); + return *this; + } + + cmCMakePath& operator+=(const cmCMakePath& path) + { + return this->Concat(path); + } + template <typename Source, typename = enable_if_pathable<Source>> + cmCMakePath& operator+=(const Source& source) + { + return this->Concat(source); + } + + // Manipulation + void Clear() noexcept { this->Path.clear(); } + + cmCMakePath& RemoveFileName() + { + this->Path.remove_filename(); + return *this; + } + + cmCMakePath& ReplaceFileName(const cmCMakePath& filename) + { + if (this->Path.has_filename()) { + this->Path.replace_filename(filename.Path); + } + return *this; + } + template <typename Source, typename = enable_if_pathable<Source>> + cmCMakePath& ReplaceFileName(const Source& filename) + { + if (this->Path.has_filename()) { + this->Path.replace_filename(filename); + } + return *this; + } + + cmCMakePath& ReplaceExtension(const cmCMakePath& extension = cmCMakePath()) + { + this->Path.replace_extension(extension.Path); + return *this; + } + template <typename Source, typename = enable_if_pathable<Source>> + cmCMakePath& ReplaceExtension(const Source& extension) + { + this->Path.replace_extension(extension); + return *this; + } + + cmCMakePath& ReplaceWideExtension( + const cmCMakePath& extension = cmCMakePath()) + { + return this->ReplaceWideExtension( + static_cast<cm::string_view>(extension.Path.string())); + } + template <typename Source, typename = enable_if_pathable<Source>> + cmCMakePath& ReplaceWideExtension(const Source& extension) + { + return this->ReplaceWideExtension(cm::string_view(extension)); + } + cmCMakePath& ReplaceWideExtension(cm::string_view extension); + + cmCMakePath& RemoveExtension() + { + if (this->Path.has_extension()) { + this->ReplaceExtension(cm::string_view("")); + } + return *this; + } + + cmCMakePath& RemoveWideExtension() + { + if (this->Path.has_extension()) { + this->ReplaceWideExtension(cm::string_view("")); + } + return *this; + } + + void swap(cmCMakePath& other) noexcept { this->Path.swap(other.Path); } + + // Observers + std::string String() const { return this->Path.string(); } + std::wstring WString() const { return this->Path.wstring(); } + + string_type Native() const + { + string_type path; + this->GetNativePath(path); + + return path; + } + std::string NativeString() const + { + std::string path; + this->GetNativePath(path); + + return path; + } + std::wstring NativeWString() const + { + std::wstring path; + this->GetNativePath(path); + + return path; + } + std::string GenericString() const { return this->Path.generic_string(); } + std::wstring GenericWString() const { return this->Path.generic_wstring(); } + + // Decomposition + cmCMakePath GetRootName() const { return this->Path.root_name(); } + cmCMakePath GetRootDirectory() const { return this->Path.root_directory(); } + cmCMakePath GetRootPath() const { return this->Path.root_path(); } + cmCMakePath GetFileName() const { return this->Path.filename(); } + cmCMakePath GetExtension() const { return this->Path.extension(); } + cmCMakePath GetWideExtension() const; + cmCMakePath GetStem() const { return this->Path.stem(); } + cmCMakePath GetNarrowStem() const; + + cmCMakePath GetRelativePath() const { return this->Path.relative_path(); } + cmCMakePath GetParentPath() const { return this->Path.parent_path(); } + + // Generation + cmCMakePath Normal() const + { + auto path = this->Path.lexically_normal(); + // filesystem::path:lexically_normal use preferred_separator ('\') on + // Windows) so convert back to '/' + return path.generic_string(); + } + + cmCMakePath Relative(const cmCMakePath& base) const + { + return this->Relative(base.Path); + } + cmCMakePath Relative(const cm::filesystem::path& base) const + { + auto path = this->Path.lexically_relative(base); + // filesystem::path:lexically_relative use preferred_separator ('\') on + // Windows) so convert back to '/' + return path.generic_string(); + } + template <typename Source, typename = enable_if_pathable<Source>> + cmCMakePath Relative(const Source& base) const + { + return this->Relative(cm::filesystem::path(base)); + } + + cmCMakePath Proximate(const cmCMakePath& base) const + { + return this->Proximate(base.Path); + } + cmCMakePath Proximate(const cm::filesystem::path& base) const + { + auto path = this->Path.lexically_proximate(base); + // filesystem::path::lexically_proximate use preferred_separator ('\') on + // Windows) so convert back to '/' + return path.generic_string(); + } + template <typename Source, typename = enable_if_pathable<Source>> + cmCMakePath Proximate(const Source& base) const + { + return this->Proximate(cm::filesystem::path(base)); + } + + cmCMakePath Absolute(const cmCMakePath& base) const + { + return this->Absolute(base.Path); + } + template <typename Source, typename = enable_if_pathable<Source>> + cmCMakePath Absolute(const Source& base) const + { + return this->Absolute(cm::filesystem::path(base)); + } + cmCMakePath Absolute(const cm::filesystem::path& base) const; + + // Comparison + int Compare(const cmCMakePath& path) const noexcept + { + return this->Path.compare(path.Path); + } + + // Query + bool IsEmpty() const noexcept { return this->Path.empty(); } + + bool HasRootPath() const { return this->Path.has_root_path(); } + bool HasRootName() const { return this->Path.has_root_name(); } + bool HasRootDirectory() const { return this->Path.has_root_directory(); } + bool HasRelativePath() const { return this->Path.has_relative_path(); } + bool HasParentPath() const { return this->Path.has_parent_path(); } + bool HasFileName() const { return this->Path.has_filename(); } + bool HasStem() const { return this->Path.has_stem(); } + bool HasExtension() const { return this->Path.has_extension(); } + + bool IsAbsolute() const { return this->Path.is_absolute(); } + bool IsRelative() const { return this->Path.is_relative(); } + bool IsPrefix(const cmCMakePath& path) const; + + // Iterators + // ========= + inline iterator begin() const; + inline iterator end() const; + + // Non-members + // =========== + friend inline bool operator==(const cmCMakePath& lhs, + const cmCMakePath& rhs) noexcept + { + return lhs.Compare(rhs) == 0; + } + friend inline bool operator!=(const cmCMakePath& lhs, + const cmCMakePath& rhs) noexcept + { + return lhs.Compare(rhs) != 0; + } + + friend inline cmCMakePath operator/(const cmCMakePath& lhs, + const cmCMakePath& rhs) + { + cmCMakePath result(lhs); + result /= rhs; + + return result; + } + +private: + friend std::size_t hash_value(const cmCMakePath& path) noexcept; + + static std::string FormatPath(std::string path, format fmt = generic_format); + static std::string FormatPath(cm::string_view path, + format fmt = generic_format) + { + return FormatPath(std::string(path), fmt); + } + + void GetNativePath(std::string& path) const; + void GetNativePath(std::wstring& path) const; + + cm::filesystem::path Path; +}; + +class cmCMakePath::iterator +{ +public: + using iterator_category = cm::filesystem::path::iterator::iterator_category; + + using value_type = cmCMakePath; + using difference_type = cm::filesystem::path::iterator::difference_type; + using pointer = const cmCMakePath*; + using reference = const cmCMakePath&; + + iterator() = default; + + iterator(const iterator& other) + : Iterator(other.Iterator) + , Path(other.Path) + , PathElement(*this->Iterator) + { + } + + ~iterator() = default; + + iterator& operator=(const iterator& other) + { + if (this != &other) { + this->Iterator = other.Iterator; + this->Path = other.Path; + this->PathElement = *this->Iterator; + } + + return *this; + } + + reference operator*() const { return this->PathElement; } + + pointer operator->() const { return &this->PathElement; } + + iterator& operator++() + { + ++this->Iterator; + this->PathElement = *this->Iterator; + + return *this; + } + + iterator operator++(int) + { + iterator it(*this); + this->operator++(); + return it; + } + + iterator& operator--() + { + --this->Iterator; + this->PathElement = *this->Iterator; + + return *this; + } + + iterator operator--(int) + { + iterator it(*this); + this->operator--(); + return it; + } + +private: + friend class cmCMakePath; + friend bool operator==(const iterator&, const iterator&); + + iterator(const cmCMakePath* path, const cm::filesystem::path::iterator& it) + : Iterator(it) + , Path(path) + , PathElement(*this->Iterator) + { + } + + cm::filesystem::path::iterator Iterator; + const cmCMakePath* Path = nullptr; + cmCMakePath PathElement; +}; + +inline cmCMakePath::iterator cmCMakePath::begin() const +{ + return iterator(this, this->Path.begin()); +} +inline cmCMakePath::iterator cmCMakePath::end() const +{ + return iterator(this, this->Path.end()); +} + +// Non-member functions +// ==================== +inline bool operator==(const cmCMakePath::iterator& lhs, + const cmCMakePath::iterator& rhs) +{ + return lhs.Path == rhs.Path && lhs.Path != nullptr && + lhs.Iterator == rhs.Iterator; +} + +inline bool operator!=(const cmCMakePath::iterator& lhs, + const cmCMakePath::iterator& rhs) +{ + return !(lhs == rhs); +} + +inline void swap(cmCMakePath& lhs, cmCMakePath& rhs) noexcept +{ + lhs.swap(rhs); +} + +inline std::size_t hash_value(const cmCMakePath& path) noexcept +{ + return cm::filesystem::hash_value(path.Path); +} diff --git a/Source/cmCMakePathCommand.cxx b/Source/cmCMakePathCommand.cxx new file mode 100644 index 0000000..720f582 --- /dev/null +++ b/Source/cmCMakePathCommand.cxx @@ -0,0 +1,1019 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmCMakePathCommand.h" + +#include <algorithm> +#include <functional> +#include <iomanip> +#include <map> +#include <sstream> +#include <string> +#include <utility> +#include <vector> + +#include <cm/string_view> +#include <cmext/string_view> + +#include "cmArgumentParser.h" +#include "cmCMakePath.h" +#include "cmExecutionStatus.h" +#include "cmMakefile.h" +#include "cmRange.h" +#include "cmStringAlgorithms.h" +#include "cmSubcommandTable.h" +#include "cmSystemTools.h" + +namespace { +// Helper classes for argument parsing +template <typename Result> +class CMakePathArgumentParser : public cmArgumentParser<Result> +{ +public: + CMakePathArgumentParser() + : cmArgumentParser<Result>() + { + } + + template <typename T> + CMakePathArgumentParser& Bind(cm::static_string_view name, T Result::*member) + { + cmArgumentParser<Result>::Bind(name, member); + return *this; + } + + template <int Advance = 2> + Result Parse(std::vector<std::string> const& args, + std::vector<std::string>* keywordsMissingValue = nullptr, + std::vector<std::string>* parsedKeywords = nullptr) const + { + this->Inputs.clear(); + + return cmArgumentParser<Result>::Parse(cmMakeRange(args).advance(Advance), + &this->Inputs, keywordsMissingValue, + parsedKeywords); + } + + const std::vector<std::string>& GetInputs() const { return Inputs; } + +protected: + mutable std::vector<std::string> Inputs; +}; + +// OUTPUT_VARIABLE is expected +template <typename Result> +class ArgumentParserWithOutputVariable : public CMakePathArgumentParser<Result> +{ +public: + ArgumentParserWithOutputVariable() + : CMakePathArgumentParser<Result>() + { + this->Bind("OUTPUT_VARIABLE"_s, &Result::Output); + } + + template <typename T> + ArgumentParserWithOutputVariable& Bind(cm::static_string_view name, + T Result::*member) + { + cmArgumentParser<Result>::Bind(name, member); + return *this; + } + + template <int Advance = 2> + Result Parse(std::vector<std::string> const& args) const + { + this->KeywordsMissingValue.clear(); + this->ParsedKeywords.clear(); + + return CMakePathArgumentParser<Result>::template Parse<Advance>( + args, &this->KeywordsMissingValue, &this->ParsedKeywords); + } + + const std::vector<std::string>& GetKeywordsMissingValue() const + { + return this->KeywordsMissingValue; + } + const std::vector<std::string>& GetParsedKeywords() const + { + return this->ParsedKeywords; + } + + bool checkOutputVariable(const Result& arguments, + cmExecutionStatus& status) const + { + if (std::find(this->GetKeywordsMissingValue().begin(), + this->GetKeywordsMissingValue().end(), + "OUTPUT_VARIABLE"_s) != + this->GetKeywordsMissingValue().end()) { + status.SetError("OUTPUT_VARIABLE requires an argument."); + return false; + } + + if (std::find(this->GetParsedKeywords().begin(), + this->GetParsedKeywords().end(), + "OUTPUT_VARIABLE"_s) != this->GetParsedKeywords().end() && + arguments.Output.empty()) { + status.SetError("Invalid name for output variable."); + return false; + } + + return true; + } + +private: + mutable std::vector<std::string> KeywordsMissingValue; + mutable std::vector<std::string> ParsedKeywords; +}; + +struct OutputVariable +{ + std::string Output; +}; +// Usable when OUTPUT_VARIABLE is the only option +class OutputVariableParser + : public ArgumentParserWithOutputVariable<OutputVariable> +{ +}; + +struct NormalizeOption +{ + bool Normalize = false; +}; +// Usable when NORMALIZE is the only option +class NormalizeParser : public CMakePathArgumentParser<NormalizeOption> +{ +public: + NormalizeParser() { this->Bind("NORMALIZE"_s, &NormalizeOption::Normalize); } +}; + +// retrieve value of input path from specified variable +bool getInputPath(const std::string& arg, cmExecutionStatus& status, + std::string& path) +{ + auto def = status.GetMakefile().GetDefinition(arg); + if (def == nullptr) { + status.SetError("undefined variable for input path."); + return false; + } + + path = *def; + return true; +} + +bool HandleGetCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + static std::map<cm::string_view, + std::function<cmCMakePath(const cmCMakePath&, bool)>> const + actions{ { "ROOT_NAME"_s, + [](const cmCMakePath& path, bool) -> cmCMakePath { + return path.GetRootName(); + } }, + { "ROOT_DIRECTORY"_s, + [](const cmCMakePath& path, bool) -> cmCMakePath { + return path.GetRootDirectory(); + } }, + { "ROOT_PATH"_s, + [](const cmCMakePath& path, bool) -> cmCMakePath { + return path.GetRootPath(); + } }, + { "FILENAME"_s, + [](const cmCMakePath& path, bool) -> cmCMakePath { + return path.GetFileName(); + } }, + { "EXTENSION"_s, + [](const cmCMakePath& path, bool last_only) -> cmCMakePath { + if (last_only) { + return path.GetExtension(); + } + return path.GetWideExtension(); + } }, + { "STEM"_s, + [](const cmCMakePath& path, bool last_only) -> cmCMakePath { + if (last_only) { + return path.GetStem(); + } + return path.GetNarrowStem(); + } }, + { "RELATIVE_PATH"_s, + [](const cmCMakePath& path, bool) -> cmCMakePath { + return path.GetRelativePath(); + } }, + { "PARENT_PATH"_s, + [](const cmCMakePath& path, bool) -> cmCMakePath { + return path.GetParentPath(); + } } }; + + if (args.size() < 4) { + status.SetError("GET must be called with at least three arguments."); + return false; + } + + const auto& action = args[2]; + + if (actions.find(action) == actions.end()) { + status.SetError( + cmStrCat("GET called with an unknown action: ", action, ".")); + return false; + } + + struct Arguments + { + bool LastOnly = false; + }; + + CMakePathArgumentParser<Arguments> parser; + if ((action == "EXTENSION"_s || action == "STEM"_s)) { + parser.Bind("LAST_ONLY"_s, &Arguments::LastOnly); + } + + Arguments const arguments = parser.Parse<3>(args); + + if (parser.GetInputs().size() != 1) { + status.SetError("GET called with unexpected arguments."); + return false; + } + if (parser.GetInputs().front().empty()) { + status.SetError("Invalid name for output variable."); + return false; + } + + std::string path; + if (!getInputPath(args[1], status, path)) { + return false; + } + + auto result = actions.at(action)(path, arguments.LastOnly); + + status.GetMakefile().AddDefinition(parser.GetInputs().front(), + result.String()); + + return true; +} + +bool HandleAppendCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + static OutputVariableParser const parser{}; + + const auto arguments = parser.Parse(args); + + if (!parser.checkOutputVariable(arguments, status)) { + return false; + } + + cmCMakePath path(status.GetMakefile().GetSafeDefinition(args[1])); + for (const auto& input : parser.GetInputs()) { + path /= input; + } + + status.GetMakefile().AddDefinition( + arguments.Output.empty() ? args[1] : arguments.Output, path.String()); + + return true; +} + +bool HandleConcatCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + static OutputVariableParser const parser{}; + + const auto arguments = parser.Parse(args); + + if (!parser.checkOutputVariable(arguments, status)) { + return false; + } + + std::string inputPath; + if (!getInputPath(args[1], status, inputPath)) { + return false; + } + + cmCMakePath path(inputPath); + for (const auto& input : parser.GetInputs()) { + path += input; + } + + status.GetMakefile().AddDefinition( + arguments.Output.empty() ? args[1] : arguments.Output, path.String()); + + return true; +} + +bool HandleRemoveFilenameCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + static OutputVariableParser const parser{}; + + const auto arguments = parser.Parse(args); + + if (!parser.checkOutputVariable(arguments, status)) { + return false; + } + + if (!parser.GetInputs().empty()) { + status.SetError("REMOVE_FILENAME called with unexpected arguments."); + return false; + } + + std::string inputPath; + if (!getInputPath(args[1], status, inputPath)) { + return false; + } + + cmCMakePath path(inputPath); + path.RemoveFileName(); + + status.GetMakefile().AddDefinition( + arguments.Output.empty() ? args[1] : arguments.Output, path.String()); + + return true; +} + +bool HandleReplaceFilenameCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + static OutputVariableParser const parser{}; + + const auto arguments = parser.Parse(args); + + if (!parser.checkOutputVariable(arguments, status)) { + return false; + } + + if (parser.GetInputs().size() > 1) { + status.SetError("REPLACE_FILENAME called with unexpected arguments."); + return false; + } + + std::string inputPath; + if (!getInputPath(args[1], status, inputPath)) { + return false; + } + + cmCMakePath path(inputPath); + path.ReplaceFileName( + parser.GetInputs().empty() ? "" : parser.GetInputs().front()); + + status.GetMakefile().AddDefinition( + arguments.Output.empty() ? args[1] : arguments.Output, path.String()); + + return true; +} + +bool HandleRemoveExtensionCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + struct Arguments + { + std::string Output; + bool LastOnly = false; + }; + + static auto const parser = + ArgumentParserWithOutputVariable<Arguments>{}.Bind("LAST_ONLY"_s, + &Arguments::LastOnly); + + Arguments const arguments = parser.Parse(args); + + if (!parser.checkOutputVariable(arguments, status)) { + return false; + } + + if (!parser.GetInputs().empty()) { + status.SetError("REMOVE_EXTENSION called with unexpected arguments."); + return false; + } + + std::string inputPath; + if (!getInputPath(args[1], status, inputPath)) { + return false; + } + + cmCMakePath path(inputPath); + + if (arguments.LastOnly) { + path.RemoveExtension(); + } else { + path.RemoveWideExtension(); + } + + status.GetMakefile().AddDefinition( + arguments.Output.empty() ? args[1] : arguments.Output, path.String()); + + return true; +} + +bool HandleReplaceExtensionCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + struct Arguments + { + std::string Output; + bool LastOnly = false; + }; + + static auto const parser = + ArgumentParserWithOutputVariable<Arguments>{}.Bind("LAST_ONLY"_s, + &Arguments::LastOnly); + + Arguments const arguments = parser.Parse(args); + + if (!parser.checkOutputVariable(arguments, status)) { + return false; + } + + if (parser.GetInputs().size() > 1) { + status.SetError("REPLACE_EXTENSION called with unexpected arguments."); + return false; + } + + std::string inputPath; + if (!getInputPath(args[1], status, inputPath)) { + return false; + } + + cmCMakePath path(inputPath); + cmCMakePath extension( + parser.GetInputs().empty() ? "" : parser.GetInputs().front()); + + if (arguments.LastOnly) { + path.ReplaceExtension(extension); + } else { + path.ReplaceWideExtension(extension); + } + + status.GetMakefile().AddDefinition( + arguments.Output.empty() ? args[1] : arguments.Output, path.String()); + + return true; +} + +bool HandleNormalPathCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + static OutputVariableParser const parser{}; + + const auto arguments = parser.Parse(args); + + if (!parser.checkOutputVariable(arguments, status)) { + return false; + } + + if (!parser.GetInputs().empty()) { + status.SetError("NORMAL_PATH called with unexpected arguments."); + return false; + } + + std::string inputPath; + if (!getInputPath(args[1], status, inputPath)) { + return false; + } + + auto path = cmCMakePath(inputPath).Normal(); + + status.GetMakefile().AddDefinition( + arguments.Output.empty() ? args[1] : arguments.Output, path.String()); + + return true; +} + +bool HandleTransformPathCommand( + std::vector<std::string> const& args, cmExecutionStatus& status, + const std::function<cmCMakePath(const cmCMakePath&, + const std::string& base)>& transform, + bool normalizeOption = false) +{ + struct Arguments + { + std::string Output; + std::string BaseDirectory; + bool Normalize = false; + }; + + auto parser = ArgumentParserWithOutputVariable<Arguments>{}.Bind( + "BASE_DIRECTORY"_s, &Arguments::BaseDirectory); + if (normalizeOption) { + parser.Bind("NORMALIZE"_s, &Arguments::Normalize); + } + + Arguments arguments = parser.Parse(args); + + if (!parser.checkOutputVariable(arguments, status)) { + return false; + } + + if (!parser.GetInputs().empty()) { + status.SetError(cmStrCat(args[0], " called with unexpected arguments.")); + return false; + } + + if (std::find(parser.GetKeywordsMissingValue().begin(), + parser.GetKeywordsMissingValue().end(), "BASE_DIRECTORY"_s) != + parser.GetKeywordsMissingValue().end()) { + status.SetError("BASE_DIRECTORY requires an argument."); + return false; + } + + if (std::find(parser.GetParsedKeywords().begin(), + parser.GetParsedKeywords().end(), + "BASE_DIRECTORY"_s) == parser.GetParsedKeywords().end()) { + arguments.BaseDirectory = status.GetMakefile().GetCurrentSourceDirectory(); + } + + std::string inputPath; + if (!getInputPath(args[1], status, inputPath)) { + return false; + } + + auto path = transform(cmCMakePath(inputPath), arguments.BaseDirectory); + if (arguments.Normalize) { + path = path.Normal(); + } + + status.GetMakefile().AddDefinition( + arguments.Output.empty() ? args[1] : arguments.Output, path.String()); + + return true; +} + +bool HandleRelativePathCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + return HandleTransformPathCommand( + args, status, + [](const cmCMakePath& path, const std::string& base) -> cmCMakePath { + return path.Relative(base); + }); +} + +bool HandleProximatePathCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + return HandleTransformPathCommand( + args, status, + [](const cmCMakePath& path, const std::string& base) -> cmCMakePath { + return path.Proximate(base); + }); +} + +bool HandleAbsolutePathCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + return HandleTransformPathCommand( + args, status, + [](const cmCMakePath& path, const std::string& base) -> cmCMakePath { + return path.Absolute(base); + }, + true); +} + +bool HandleCMakePathCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + if (args.size() < 3 || args.size() > 4) { + status.SetError("CMAKE_PATH must be called with two or three arguments."); + return false; + } + + static NormalizeParser const parser; + + const auto arguments = parser.Parse(args); + + if (parser.GetInputs().size() != 1) { + status.SetError("CMAKE_PATH called with unexpected arguments."); + return false; + } + + if (args[1].empty()) { + status.SetError("Invalid name for output variable."); + return false; + } + + auto path = + cmCMakePath(parser.GetInputs().front(), cmCMakePath::native_format); + + if (arguments.Normalize) { + path = path.Normal(); + } + + status.GetMakefile().AddDefinition(args[1], path.GenericString()); + + return true; +} + +bool HandleNativePathCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + if (args.size() < 3 || args.size() > 4) { + status.SetError("NATIVE_PATH must be called with two or three arguments."); + return false; + } + + static NormalizeParser const parser; + + const auto arguments = parser.Parse(args); + + if (parser.GetInputs().size() != 1) { + status.SetError("NATIVE_PATH called with unexpected arguments."); + return false; + } + if (parser.GetInputs().front().empty()) { + status.SetError("Invalid name for output variable."); + return false; + } + + std::string inputPath; + if (!getInputPath(args[1], status, inputPath)) { + return false; + } + + cmCMakePath path(inputPath); + if (arguments.Normalize) { + path = path.Normal(); + } + + status.GetMakefile().AddDefinition(parser.GetInputs().front(), + path.NativeString()); + + return true; +} + +bool HandleConvertCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + const auto pathSep = ";"_s; +#else + const auto pathSep = ":"_s; +#endif + const auto cmakePath = "TO_CMAKE_PATH_LIST"_s; + const auto nativePath = "TO_NATIVE_PATH_LIST"_s; + + if (args.size() < 4 || args.size() > 5) { + status.SetError("CONVERT must be called with three or four arguments."); + return false; + } + + const auto& action = args[2]; + + if (action != cmakePath && action != nativePath) { + status.SetError( + cmStrCat("CONVERT called with an unknown action: ", action, ".")); + return false; + } + + if (args[3].empty()) { + status.SetError("Invalid name for output variable."); + return false; + } + + static NormalizeParser const parser; + + const auto arguments = parser.Parse<4>(args); + + if (!parser.GetInputs().empty()) { + status.SetError("CONVERT called with unexpected arguments."); + return false; + } + + std::vector<std::string> paths; + + if (action == cmakePath) { + paths = cmSystemTools::SplitString(args[1], pathSep.front()); + } else { + cmExpandList(args[1], paths); + } + + for (auto& path : paths) { + auto p = cmCMakePath(path, + action == cmakePath ? cmCMakePath::native_format + : cmCMakePath::generic_format); + if (arguments.Normalize) { + p = p.Normal(); + } + if (action == cmakePath) { + path = p.GenericString(); + } else { + path = p.NativeString(); + } + } + + auto value = cmJoin(paths, action == cmakePath ? ";"_s : pathSep); + status.GetMakefile().AddDefinition(args[3], value); + + return true; +} + +bool HandleCompareCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + if (args.size() != 5) { + status.SetError("COMPARE must be called with four arguments."); + return false; + } + + static std::map<cm::string_view, + std::function<bool(const cmCMakePath&, + const cmCMakePath&)>> const operators{ + { "EQUAL"_s, + [](const cmCMakePath& path1, const cmCMakePath& path2) -> bool { + return path1 == path2; + } }, + { "NOT_EQUAL"_s, + [](const cmCMakePath& path1, const cmCMakePath& path2) -> bool { + return path1 != path2; + } } + }; + + const auto op = operators.find(args[2]); + if (op == operators.end()) { + status.SetError(cmStrCat( + "COMPARE called with an unknown comparison operator: ", args[2], ".")); + return false; + } + + if (args[4].empty()) { + status.SetError("Invalid name for output variable."); + return false; + } + + std::string inputPath; + if (!getInputPath(args[1], status, inputPath)) { + return false; + } + + cmCMakePath path1(inputPath); + cmCMakePath path2(args[3]); + auto result = op->second(path1, path2); + + status.GetMakefile().AddDefinitionBool(args[4], result); + + return true; +} + +bool HandleHasItemCommand( + std::vector<std::string> const& args, cmExecutionStatus& status, + const std::function<bool(const cmCMakePath&)>& has_item) +{ + if (args.size() != 3) { + status.SetError( + cmStrCat(args.front(), " must be called with two arguments.")); + return false; + } + + std::string inputPath; + if (!getInputPath(args[1], status, inputPath)) { + return false; + } + + if (args[2].empty()) { + status.SetError("Invalid name for output variable."); + return false; + } + + cmCMakePath path(inputPath); + auto result = has_item(path); + + status.GetMakefile().AddDefinitionBool(args[2], result); + + return true; +} + +bool HandleHasRootNameCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + return HandleHasItemCommand( + args, status, + [](const cmCMakePath& path) -> bool { return path.HasRootName(); }); +} + +bool HandleHasRootDirectoryCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + return HandleHasItemCommand( + args, status, + [](const cmCMakePath& path) -> bool { return path.HasRootDirectory(); }); +} + +bool HandleHasRootPathCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + return HandleHasItemCommand( + args, status, + [](const cmCMakePath& path) -> bool { return path.HasRootPath(); }); +} + +bool HandleHasFilenameCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + return HandleHasItemCommand( + args, status, + [](const cmCMakePath& path) -> bool { return path.HasFileName(); }); +} + +bool HandleHasExtensionCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + return HandleHasItemCommand( + args, status, + [](const cmCMakePath& path) -> bool { return path.HasExtension(); }); +} + +bool HandleHasStemCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + return HandleHasItemCommand( + args, status, + [](const cmCMakePath& path) -> bool { return path.HasStem(); }); +} + +bool HandleHasRelativePathCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + return HandleHasItemCommand( + args, status, + [](const cmCMakePath& path) -> bool { return path.HasRelativePath(); }); +} + +bool HandleHasParentPathCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + return HandleHasItemCommand( + args, status, + [](const cmCMakePath& path) -> bool { return path.HasParentPath(); }); +} + +bool HandleIsAbsoluteCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + if (args.size() != 3) { + status.SetError("IS_ABSOLUTE must be called with two arguments."); + return false; + } + + std::string inputPath; + if (!getInputPath(args[1], status, inputPath)) { + return false; + } + + if (args[2].empty()) { + status.SetError("Invalid name for output variable."); + return false; + } + + bool isAbsolute = cmCMakePath(inputPath).IsAbsolute(); + + status.GetMakefile().AddDefinitionBool(args[2], isAbsolute); + + return true; +} + +bool HandleIsRelativeCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + if (args.size() != 3) { + status.SetError("IS_RELATIVE must be called with two arguments."); + return false; + } + + std::string inputPath; + if (!getInputPath(args[1], status, inputPath)) { + return false; + } + + if (args[2].empty()) { + status.SetError("Invalid name for output variable."); + return false; + } + + bool isRelative = cmCMakePath(inputPath).IsRelative(); + + status.GetMakefile().AddDefinitionBool(args[2], isRelative); + + return true; +} + +bool HandleIsPrefixCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + if (args.size() < 4 || args.size() > 5) { + status.SetError("IS_PREFIX must be called with three or four arguments."); + return false; + } + + static NormalizeParser const parser; + + const auto arguments = parser.Parse(args); + + if (parser.GetInputs().size() != 2) { + status.SetError("IS_PREFIX called with unexpected arguments."); + return false; + } + + std::string inputPath; + if (!getInputPath(args[1], status, inputPath)) { + return false; + } + + const auto& input = parser.GetInputs().front(); + const auto& output = parser.GetInputs().back(); + + if (output.empty()) { + status.SetError("Invalid name for output variable."); + return false; + } + + bool isPrefix; + if (arguments.Normalize) { + isPrefix = + cmCMakePath(inputPath).Normal().IsPrefix(cmCMakePath(input).Normal()); + } else { + isPrefix = cmCMakePath(inputPath).IsPrefix(input); + } + + status.GetMakefile().AddDefinitionBool(output, isPrefix); + + return true; +} + +bool HandleHashCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + if (args.size() < 3 || args.size() > 4) { + status.SetError("HASH must be called with two or three arguments."); + return false; + } + + static NormalizeParser const parser; + + const auto arguments = parser.Parse(args); + + if (parser.GetInputs().size() != 1) { + status.SetError("HASH called with unexpected arguments."); + return false; + } + + std::string inputPath; + if (!getInputPath(args[1], status, inputPath)) { + return false; + } + + const auto& output = parser.GetInputs().front(); + + if (output.empty()) { + status.SetError("Invalid name for output variable."); + return false; + } + + auto hash = hash_value(arguments.Normalize ? cmCMakePath(inputPath).Normal() + : cmCMakePath(inputPath)); + + std::ostringstream out; + out << std::setbase(16) << hash; + + status.GetMakefile().AddDefinition(output, out.str()); + + return true; +} +} // anonymous namespace + +bool cmCMakePathCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + if (args.size() < 2) { + status.SetError("must be called with at least two arguments."); + return false; + } + + static cmSubcommandTable const subcommand{ + { "GET"_s, HandleGetCommand }, + { "APPEND"_s, HandleAppendCommand }, + { "CONCAT"_s, HandleConcatCommand }, + { "REMOVE_FILENAME"_s, HandleRemoveFilenameCommand }, + { "REPLACE_FILENAME"_s, HandleReplaceFilenameCommand }, + { "REMOVE_EXTENSION"_s, HandleRemoveExtensionCommand }, + { "REPLACE_EXTENSION"_s, HandleReplaceExtensionCommand }, + { "NORMAL_PATH"_s, HandleNormalPathCommand }, + { "RELATIVE_PATH"_s, HandleRelativePathCommand }, + { "PROXIMATE_PATH"_s, HandleProximatePathCommand }, + { "ABSOLUTE_PATH"_s, HandleAbsolutePathCommand }, + { "CMAKE_PATH"_s, HandleCMakePathCommand }, + { "NATIVE_PATH"_s, HandleNativePathCommand }, + { "CONVERT"_s, HandleConvertCommand }, + { "COMPARE"_s, HandleCompareCommand }, + { "HAS_ROOT_NAME"_s, HandleHasRootNameCommand }, + { "HAS_ROOT_DIRECTORY"_s, HandleHasRootDirectoryCommand }, + { "HAS_ROOT_PATH"_s, HandleHasRootPathCommand }, + { "HAS_FILENAME"_s, HandleHasFilenameCommand }, + { "HAS_EXTENSION"_s, HandleHasExtensionCommand }, + { "HAS_STEM"_s, HandleHasStemCommand }, + { "HAS_RELATIVE_PATH"_s, HandleHasRelativePathCommand }, + { "HAS_PARENT_PATH"_s, HandleHasParentPathCommand }, + { "IS_ABSOLUTE"_s, HandleIsAbsoluteCommand }, + { "IS_RELATIVE"_s, HandleIsRelativeCommand }, + { "IS_PREFIX"_s, HandleIsPrefixCommand }, + { "HASH"_s, HandleHashCommand } + }; + + return subcommand(args[0], args, status); +} diff --git a/Source/cmCMakePathCommand.h b/Source/cmCMakePathCommand.h new file mode 100644 index 0000000..49e9380 --- /dev/null +++ b/Source/cmCMakePathCommand.h @@ -0,0 +1,14 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +#pragma once + +#include "cmConfigure.h" // IWYU pragma: keep + +#include <string> +#include <vector> + +class cmExecutionStatus; + +bool cmCMakePathCommand(std::vector<std::string> const& args, + cmExecutionStatus& status); diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h index ba9397d..7346b66 100644 --- a/Source/cmCMakePolicyCommand.h +++ b/Source/cmCMakePolicyCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCMakePolicyCommand_h -#define cmCMakePolicyCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -18,5 +17,3 @@ class cmExecutionStatus; */ bool cmCMakePolicyCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmCPackPropertiesGenerator.h b/Source/cmCPackPropertiesGenerator.h index 8339238..63c469a 100644 --- a/Source/cmCPackPropertiesGenerator.h +++ b/Source/cmCPackPropertiesGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCPackPropertiesGenerator_h -#define cmCPackPropertiesGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -36,5 +35,3 @@ protected: cmLocalGenerator* LG; cmInstalledFile const& InstalledFile; }; - -#endif diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 1a1bbec..ee2960b 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -581,13 +581,13 @@ const char* CCONV cmSourceFileGetProperty(void* arg, const char* prop) cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg); if (cmSourceFile* rsf = sf->RealSourceFile) { cmProp p = rsf->GetProperty(prop); - return p ? p->c_str() : nullptr; + return cmToCStr(p); } if (!strcmp(prop, "LOCATION")) { return sf->FullPath.c_str(); } cmProp retVal = sf->Properties.GetPropertyValue(prop); - return retVal ? retVal->c_str() : nullptr; + return cmToCStr(retVal); } int CCONV cmSourceFileGetPropertyAsBool(void* arg, const char* prop) diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 1e0fb8c..e12f8b0 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTest_h -#define cmCTest_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -571,5 +570,3 @@ inline std::ostream& operator<<(std::ostream& os, const cmCTestLogWrite& c) (ctSelf)->Log(cmCTest::logType, __FILE__, __LINE__, \ cmCTestLog_msg.str().c_str(), suppress); \ } while (false) - -#endif diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index f036258..20d49a8 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCacheManager_h -#define cmCacheManager_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -210,5 +209,3 @@ private: unsigned int CacheMajorVersion = 0; unsigned int CacheMinorVersion = 0; }; - -#endif diff --git a/Source/cmCallVisualStudioMacro.h b/Source/cmCallVisualStudioMacro.h index 9b5b3a8..795b863 100644 --- a/Source/cmCallVisualStudioMacro.h +++ b/Source/cmCallVisualStudioMacro.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCallVisualStudioMacro_h -#define cmCallVisualStudioMacro_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -32,5 +31,3 @@ public: protected: private: }; - -#endif diff --git a/Source/cmCheckCustomOutputs.h b/Source/cmCheckCustomOutputs.h index 9f33d16..2752ed4 100644 --- a/Source/cmCheckCustomOutputs.h +++ b/Source/cmCheckCustomOutputs.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCheckCustomOutputs_h -#define cmCheckCustomOutputs_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -14,5 +13,3 @@ class cmExecutionStatus; bool cmCheckCustomOutputs(const std::vector<std::string>& outputs, cm::string_view keyword, cmExecutionStatus& status); - -#endif diff --git a/Source/cmCommand.h b/Source/cmCommand.h index bcb178d..68c56d9 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCommand_h -#define cmCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -96,5 +95,3 @@ public: private: std::unique_ptr<cmCommand> Command; }; - -#endif diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index b46edcb..8ff689e 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCommandArgumentParserHelper_h -#define cmCommandArgumentParserHelper_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -89,5 +88,3 @@ private: #define YY_EXTRA_TYPE cmCommandArgumentParserHelper* #define YY_DECL \ int cmCommandArgument_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner) - -#endif diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index c94f128..37be542 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -17,6 +17,7 @@ #include "cmBreakCommand.h" #include "cmBuildCommand.h" #include "cmCMakeMinimumRequired.h" +#include "cmCMakePathCommand.h" #include "cmCMakePolicyCommand.h" #include "cmCommand.h" #include "cmConfigureFileCommand.h" @@ -120,6 +121,7 @@ void GetScriptingCommands(cmState* state) { state->AddBuiltinCommand("break", cmBreakCommand); state->AddBuiltinCommand("cmake_minimum_required", cmCMakeMinimumRequired); + state->AddBuiltinCommand("cmake_path", cmCMakePathCommand); state->AddBuiltinCommand("cmake_policy", cmCMakePolicyCommand); state->AddBuiltinCommand("configure_file", cmConfigureFileCommand); state->AddBuiltinCommand("continue", cmContinueCommand); diff --git a/Source/cmCommands.h b/Source/cmCommands.h index 1f8fafb..5605430 100644 --- a/Source/cmCommands.h +++ b/Source/cmCommands.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCommands_h -#define cmCommands_h +#pragma once class cmState; @@ -13,5 +12,3 @@ class cmState; void GetScriptingCommands(cmState* state); void GetProjectCommands(cmState* state); void GetProjectCommandsInScriptMode(cmState* state); - -#endif diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index c3c3a3a..fba6b0a 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCommonTargetGenerator_h -#define cmCommonTargetGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -75,5 +74,3 @@ private: }; std::map<std::string, ByConfig> Configs; }; - -#endif diff --git a/Source/cmComputeComponentGraph.h b/Source/cmComputeComponentGraph.h index b873131..1d1d134 100644 --- a/Source/cmComputeComponentGraph.h +++ b/Source/cmComputeComponentGraph.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmComputeComponentGraph_h -#define cmComputeComponentGraph_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -78,5 +77,3 @@ private: // Connected components. }; - -#endif diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index e806dff..902500a 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmComputeLinkDepends_h -#define cmComputeLinkDepends_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -160,5 +159,3 @@ private: bool DebugMode; bool OldLinkDirMode; }; - -#endif diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 544ff23..543b6d7 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmComputeLinkInformation_h -#define cmComputeLinkInformation_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -209,5 +208,3 @@ private: const cmGeneratorTarget* target); void AddLibraryRuntimeInfo(std::string const& fullPath); }; - -#endif diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h index 277521d..3517844 100644 --- a/Source/cmComputeTargetDepends.h +++ b/Source/cmComputeTargetDepends.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmComputeTargetDepends_h -#define cmComputeTargetDepends_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -105,5 +104,3 @@ private: bool IntraComponent(std::vector<int> const& cmap, int c, int i, int* head, std::set<int>& emitted, std::set<int>& visited); }; - -#endif diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index daa9f4c..8021b49 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -535,9 +535,10 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs, this->IncrementArguments(newArgs, argP1, argP2); if (argP1 != newArgs.end() && argP2 != newArgs.end() && IsKeyword(keyMATCHES, *argP1)) { - def = this->GetVariableOrString(*arg); - if (def != arg->c_str() // yes, we compare the pointer value - && cmHasLiteralPrefix(arg->GetValue(), "CMAKE_MATCH_")) { + def = this->GetDefinitionIfUnquoted(*arg); + if (!def) { + def = arg->c_str(); + } else if (cmHasLiteralPrefix(arg->GetValue(), "CMAKE_MATCH_")) { // The string to match is owned by our match result variables. // Move it to our own buffer before clearing them. def_buf = def; diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h index 082534c..a1e3829 100644 --- a/Source/cmConditionEvaluator.h +++ b/Source/cmConditionEvaluator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmConditionEvaluator_h -#define cmConditionEvaluator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -87,5 +86,3 @@ private: cmPolicies::PolicyStatus Policy57Status; cmPolicies::PolicyStatus Policy64Status; }; - -#endif diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index 97e7856..ceb2a32 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmConfigure_h -#define cmConfigure_h +#pragma once #include "cmsys/Configure.hxx" // IWYU pragma: export @@ -28,5 +27,3 @@ #if defined(_WIN32) && !defined(NOMINMAX) # define NOMINMAX #endif - -#endif diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h index c7f95b8..009c145 100644 --- a/Source/cmConfigureFileCommand.h +++ b/Source/cmConfigureFileCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmConfigureFileCommand_h -#define cmConfigureFileCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,4 +11,3 @@ class cmExecutionStatus; bool cmConfigureFileCommand(std::vector<std::string> const& args, cmExecutionStatus& status); -#endif diff --git a/Source/cmContinueCommand.h b/Source/cmContinueCommand.h index ff903aa..29a219f 100644 --- a/Source/cmContinueCommand.h +++ b/Source/cmContinueCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmContinueCommand_h -#define cmContinueCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -17,5 +16,3 @@ class cmExecutionStatus; */ bool cmContinueCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h index 916572a..594fd7f 100644 --- a/Source/cmCoreTryCompile.h +++ b/Source/cmCoreTryCompile.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCoreTryCompile_h -#define cmCoreTryCompile_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -48,5 +47,3 @@ protected: std::string FindErrorMessage; bool SrcFileSignature = false; }; - -#endif diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h index 19503f4..a7f11a6 100644 --- a/Source/cmCreateTestSourceList.h +++ b/Source/cmCreateTestSourceList.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCreateTestSourceList_h -#define cmCreateTestSourceList_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmCreateTestSourceList(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h index f27bb5d..a2d45e7 100644 --- a/Source/cmCryptoHash.h +++ b/Source/cmCryptoHash.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCryptoHash_h -#define cmCryptoHash_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -85,5 +84,3 @@ private: unsigned int Id; struct rhash_context* CTX; }; - -#endif diff --git a/Source/cmCurl.h b/Source/cmCurl.h index 7bd036e..fb716f8 100644 --- a/Source/cmCurl.h +++ b/Source/cmCurl.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCurl_h -#define cmCurl_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ std::string cmCurlSetCAInfo(::CURL* curl, const char* cafile = nullptr); std::string cmCurlSetNETRCOption(::CURL* curl, const std::string& netrc_level, const std::string& netrc_file); - -#endif diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index aa572ad..2036e90 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCustomCommand_h -#define cmCustomCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -114,5 +113,3 @@ private: bool CommandExpandLists = false; bool StdPipesUTF8 = false; }; - -#endif diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index 67ee9e0..412eba8 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCustomCommandGenerator_h -#define cmCustomCommandGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -47,5 +46,3 @@ public: std::vector<std::string> const& GetDepends() const; bool HasOnlyEmptyCommandLines() const; }; - -#endif diff --git a/Source/cmCustomCommandLines.h b/Source/cmCustomCommandLines.h index ead5792..ee8d080 100644 --- a/Source/cmCustomCommandLines.h +++ b/Source/cmCustomCommandLines.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCustomCommandLines_h -#define cmCustomCommandLines_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -28,5 +27,3 @@ cmCustomCommandLine cmMakeCommandLine( /** Return a command line vector with a single command line. */ cmCustomCommandLines cmMakeSingleCommandLine( std::initializer_list<cm::string_view> ilist); - -#endif diff --git a/Source/cmCustomCommandTypes.h b/Source/cmCustomCommandTypes.h index d4bf1f9..5c900ce 100644 --- a/Source/cmCustomCommandTypes.h +++ b/Source/cmCustomCommandTypes.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCustomCommandTypes_h -#define cmCustomCommandTypes_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -35,5 +34,3 @@ struct cmUtilityOutput std::string Name; std::string NameCMP0049; }; - -#endif diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h index 60dd76a..3c478b3 100644 --- a/Source/cmDefinePropertyCommand.h +++ b/Source/cmDefinePropertyCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmDefinesPropertyCommand_h -#define cmDefinesPropertyCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmDefinePropertyCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index d57750a..b650aa8 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmDefinitions_h -#define cmDefinitions_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -67,5 +66,3 @@ private: static Def const& GetInternal(const std::string& key, StackIter begin, StackIter end, bool raise); }; - -#endif diff --git a/Source/cmDepends.h b/Source/cmDepends.h index 8cf528f..0240da9 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmDepends_h -#define cmDepends_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -112,5 +111,3 @@ protected: void SetIncludePathFromLanguage(const std::string& lang); }; - -#endif diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h index e01faa4..c79da1a 100644 --- a/Source/cmDependsC.h +++ b/Source/cmDependsC.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmDependsC_h -#define cmDependsC_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -93,5 +92,3 @@ protected: void WriteCacheFile() const; void ReadCacheFile(); }; - -#endif diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index 3e306dd..e377a2c 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFortran_h -#define cmFortran_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -91,5 +90,3 @@ private: std::string MaybeConvertToRelativePath(std::string const& base, std::string const& path); }; - -#endif diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h index 2a90251..1db7ce1 100644 --- a/Source/cmDependsJava.h +++ b/Source/cmDependsJava.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmDependsJava_h -#define cmDependsJava_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -36,5 +35,3 @@ protected: const std::string& internalDependsFileName, DependencyMap& validDeps) override; }; - -#endif diff --git a/Source/cmDependsJavaParserHelper.h b/Source/cmDependsJavaParserHelper.h index c545ee2..869b7d4 100644 --- a/Source/cmDependsJavaParserHelper.h +++ b/Source/cmDependsJavaParserHelper.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmDependsJavaParserHelper_h -#define cmDependsJavaParserHelper_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -97,5 +96,3 @@ private: #define YYSTYPE_IS_DECLARED #define YY_EXTRA_TYPE cmDependsJavaParserHelper* #define YY_DECL int cmDependsJava_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner) - -#endif diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 3768e1a..313be32 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef _cmDocumentation_h -#define _cmDocumentation_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -125,5 +124,3 @@ private: static void WarnFormFromFilename(RequestedHelpItem& request, bool& result); }; - -#endif diff --git a/Source/cmDocumentationEntry.h b/Source/cmDocumentationEntry.h index afbca5e..89a2899 100644 --- a/Source/cmDocumentationEntry.h +++ b/Source/cmDocumentationEntry.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmDocumentationEntry_h -#define cmDocumentationEntry_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -33,5 +32,3 @@ struct cmDocumentationEntry } } }; - -#endif diff --git a/Source/cmDocumentationFormatter.h b/Source/cmDocumentationFormatter.h index 17b63da..cb3038a 100644 --- a/Source/cmDocumentationFormatter.h +++ b/Source/cmDocumentationFormatter.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef _cmDocumentationFormatter_h -#define _cmDocumentationFormatter_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -62,5 +61,3 @@ private: int TextWidth = 77; const char* TextIndent = ""; }; - -#endif diff --git a/Source/cmDocumentationSection.h b/Source/cmDocumentationSection.h index 641263d..276e520 100644 --- a/Source/cmDocumentationSection.h +++ b/Source/cmDocumentationSection.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef _cmDocumentationSection_h -#define _cmDocumentationSection_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -67,5 +66,3 @@ private: std::string Name; std::vector<cmDocumentationEntry> Entries; }; - -#endif diff --git a/Source/cmDynamicLoader.h b/Source/cmDynamicLoader.h index 4b89388..53ea5cb 100644 --- a/Source/cmDynamicLoader.h +++ b/Source/cmDynamicLoader.h @@ -5,8 +5,7 @@ // cmDynamicLoader provides a portable interface to loading dynamic // libraries into a process. -#ifndef cmDynamicLoader_h -#define cmDynamicLoader_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -29,5 +28,3 @@ protected: cmDynamicLoader() = default; ~cmDynamicLoader() = default; }; - -#endif diff --git a/Source/cmELF.h b/Source/cmELF.h index 123bf9b..99eb4f4 100644 --- a/Source/cmELF.h +++ b/Source/cmELF.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmELF_h -#define cmELF_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -112,5 +111,3 @@ private: std::unique_ptr<cmELFInternal> Internal; std::string ErrorMessage; }; - -#endif diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h index 1f8c4ce..730ba65 100644 --- a/Source/cmEnableLanguageCommand.h +++ b/Source/cmEnableLanguageCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmEnableLanguageCommand_h -#define cmEnableLanguageCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmEnableLanguageCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmEnableTestingCommand.h b/Source/cmEnableTestingCommand.h index e4593f2..1722511 100644 --- a/Source/cmEnableTestingCommand.h +++ b/Source/cmEnableTestingCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmEnableTestingCommand_h -#define cmEnableTestingCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -25,5 +24,3 @@ class cmExecutionStatus; */ bool cmEnableTestingCommand(std::vector<std::string> const&, cmExecutionStatus&); - -#endif diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h index 7c751e1..111a56e 100644 --- a/Source/cmExecProgramCommand.h +++ b/Source/cmExecProgramCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExecProgramCommand_h -#define cmExecProgramCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -19,5 +18,3 @@ class cmExecutionStatus; */ bool cmExecProgramCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h index 9c4b600..cc8cc38 100644 --- a/Source/cmExecuteProcessCommand.h +++ b/Source/cmExecuteProcessCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExecuteProcessCommand_h -#define cmExecuteProcessCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -18,5 +17,3 @@ class cmExecutionStatus; */ bool cmExecuteProcessCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h index d2cc9b8..0feaedf 100644 --- a/Source/cmExecutionStatus.h +++ b/Source/cmExecutionStatus.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExecutionStatus_h -#define cmExecutionStatus_h +#pragma once #include <cmConfigure.h> // IWYU pragma: keep @@ -48,5 +47,3 @@ private: bool ContinueInvoked = false; bool NestedError = false; }; - -#endif diff --git a/Source/cmExpandedCommandArgument.h b/Source/cmExpandedCommandArgument.h index 69d35de..50a17a8 100644 --- a/Source/cmExpandedCommandArgument.h +++ b/Source/cmExpandedCommandArgument.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExpandedCommandArgument_h -#define cmExpandedCommandArgument_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -35,5 +34,3 @@ private: std::string Value; bool Quoted = false; }; - -#endif diff --git a/Source/cmExportBuildAndroidMKGenerator.h b/Source/cmExportBuildAndroidMKGenerator.h index a9b6107..250564f 100644 --- a/Source/cmExportBuildAndroidMKGenerator.h +++ b/Source/cmExportBuildAndroidMKGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExportBuildAndroidMKGenerator_h -#define cmExportBuildAndroidMKGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -63,5 +62,3 @@ protected: cmGeneratorTarget const* target, std::ostream& os, const ImportPropertyMap& properties) override; }; - -#endif diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h index 66e8cbb..264494d 100644 --- a/Source/cmExportBuildFileGenerator.h +++ b/Source/cmExportBuildFileGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExportBuildFileGenerator_h -#define cmExportBuildFileGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -85,5 +84,3 @@ protected: std::vector<cmGeneratorTarget*> Exports; cmLocalGenerator* LG; }; - -#endif diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h index 9655628..3f87bcf 100644 --- a/Source/cmExportCommand.h +++ b/Source/cmExportCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExportCommand_h -#define cmExportCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmExportCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index e9d0da7..45eaed0 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExportFileGenerator_h -#define cmExportFileGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -223,5 +222,3 @@ private: virtual std::string InstallNameDir(cmGeneratorTarget* target, const std::string& config) = 0; }; - -#endif diff --git a/Source/cmExportInstallAndroidMKGenerator.h b/Source/cmExportInstallAndroidMKGenerator.h index 8883ffa..40978e0 100644 --- a/Source/cmExportInstallAndroidMKGenerator.h +++ b/Source/cmExportInstallAndroidMKGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExportInstallAndroidMKGenerator_h -#define cmExportInstallAndroidMKGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -69,5 +68,3 @@ protected: bool GenerateImportFileConfig(const std::string& config, std::vector<std::string>&) override; }; - -#endif diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h index 5fa812c..2d8de9d 100644 --- a/Source/cmExportInstallFileGenerator.h +++ b/Source/cmExportInstallFileGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExportInstallFileGenerator_h -#define cmExportInstallFileGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -103,5 +102,3 @@ protected: // The import file generated for each configuration. std::map<std::string, std::string> ConfigImportFiles; }; - -#endif diff --git a/Source/cmExportLibraryDependenciesCommand.h b/Source/cmExportLibraryDependenciesCommand.h index 230c906..1834bfa 100644 --- a/Source/cmExportLibraryDependenciesCommand.h +++ b/Source/cmExportLibraryDependenciesCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExportLibraryDependenciesCommand_h -#define cmExportLibraryDependenciesCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmExportLibraryDependenciesCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmExportSet.h b/Source/cmExportSet.h index f0d921f..07deb11 100644 --- a/Source/cmExportSet.h +++ b/Source/cmExportSet.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExportSet_h -#define cmExportSet_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -61,5 +60,3 @@ public: */ cmExportSet& operator[](const std::string& name); }; - -#endif diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h index 7573427..6bf5781 100644 --- a/Source/cmExportTryCompileFileGenerator.h +++ b/Source/cmExportTryCompileFileGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExportTryCompileFileGenerator_h -#define cmExportTryCompileFileGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -58,5 +57,3 @@ private: std::string Config; std::vector<std::string> Languages; }; - -#endif diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h index 717acdc..54dd6a4 100644 --- a/Source/cmExprParserHelper.h +++ b/Source/cmExprParserHelper.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExprParserHelper_h -#define cmExprParserHelper_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -58,5 +57,3 @@ private: #define YYSTYPE_IS_DECLARED #define YY_EXTRA_TYPE cmExprParserHelper* #define YY_DECL int cmExpr_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner) - -#endif diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h index 2b8d505..3ade67b 100644 --- a/Source/cmExternalMakefileProjectGenerator.h +++ b/Source/cmExternalMakefileProjectGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExternalMakefileProjectGenerator_h -#define cmExternalMakefileProjectGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -109,5 +108,3 @@ public: return p; } }; - -#endif diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h index d9f92bd..cada5dd 100644 --- a/Source/cmExtraCodeBlocksGenerator.h +++ b/Source/cmExtraCodeBlocksGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExtraCodeBlocksGenerator_h -#define cmExtraCodeBlocksGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -51,5 +50,3 @@ private: const cmLocalGenerator* lg, const std::string& compiler, const std::string& makeFlags); }; - -#endif diff --git a/Source/cmExtraCodeLiteGenerator.h b/Source/cmExtraCodeLiteGenerator.h index 0ce90b0..2478585 100644 --- a/Source/cmExtraCodeLiteGenerator.h +++ b/Source/cmExtraCodeLiteGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalCodeLiteGenerator_h -#define cmGlobalCodeLiteGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -68,5 +67,3 @@ public: void CreateNewProjectFile(const cmGeneratorTarget* lg, const std::string& filename); }; - -#endif diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h index a7aa549..c4ed577 100644 --- a/Source/cmExtraEclipseCDT4Generator.h +++ b/Source/cmExtraEclipseCDT4Generator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExtraEclipseCDT4Generator_h -#define cmExtraEclipseCDT4Generator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -106,5 +105,3 @@ private: bool CEnabled; bool CXXEnabled; }; - -#endif diff --git a/Source/cmExtraKateGenerator.h b/Source/cmExtraKateGenerator.h index 1fb81b4..c66ddbf 100644 --- a/Source/cmExtraKateGenerator.h +++ b/Source/cmExtraKateGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExtraKateGenerator_h -#define cmExtraKateGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -43,5 +42,3 @@ private: std::string ProjectName; bool UseNinja; }; - -#endif diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h index 078cfe7..671b65a 100644 --- a/Source/cmExtraSublimeTextGenerator.h +++ b/Source/cmExtraSublimeTextGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmExtraSublimeTextGenerator_h -#define cmExtraSublimeTextGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -75,5 +74,3 @@ private: bool ExcludeBuildFolder; std::string EnvSettings; }; - -#endif diff --git a/Source/cmFLTKWrapUICommand.h b/Source/cmFLTKWrapUICommand.h index bb56dbd..7c1fc52 100644 --- a/Source/cmFLTKWrapUICommand.h +++ b/Source/cmFLTKWrapUICommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFLTKWrapUICommand_h -#define cmFLTKWrapUICommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmFLTKWrapUICommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmFSPermissions.h b/Source/cmFSPermissions.h index fef72e6..78f2240 100644 --- a/Source/cmFSPermissions.h +++ b/Source/cmFSPermissions.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFSPermissions_h -#define cmFSPermissions_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -41,5 +40,3 @@ static const mode_t mode_setgid = S_ISGID; bool stringToModeT(std::string const& arg, mode_t& permissions); } // ns - -#endif diff --git a/Source/cmFileAPI.h b/Source/cmFileAPI.h index ae07612..086a92a 100644 --- a/Source/cmFileAPI.h +++ b/Source/cmFileAPI.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFileAPI_h -#define cmFileAPI_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -205,5 +204,3 @@ private: ClientRequest& r, std::vector<RequestVersion> const& versions); Json::Value BuildInternalTest(Object const& object); }; - -#endif diff --git a/Source/cmFileAPICMakeFiles.h b/Source/cmFileAPICMakeFiles.h index 1ae1e4f..5b48ed3 100644 --- a/Source/cmFileAPICMakeFiles.h +++ b/Source/cmFileAPICMakeFiles.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFileAPICMakeFiles_h -#define cmFileAPICMakeFiles_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -11,5 +10,3 @@ class cmFileAPI; extern Json::Value cmFileAPICMakeFilesDump(cmFileAPI& fileAPI, unsigned long version); - -#endif diff --git a/Source/cmFileAPICache.h b/Source/cmFileAPICache.h index 2f30c76..bd9feeb 100644 --- a/Source/cmFileAPICache.h +++ b/Source/cmFileAPICache.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFileAPICache_h -#define cmFileAPICache_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -11,5 +10,3 @@ class cmFileAPI; extern Json::Value cmFileAPICacheDump(cmFileAPI& fileAPI, unsigned long version); - -#endif diff --git a/Source/cmFileAPICodemodel.h b/Source/cmFileAPICodemodel.h index a6c6bdd..263f675 100644 --- a/Source/cmFileAPICodemodel.h +++ b/Source/cmFileAPICodemodel.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFileAPICodemodel_h -#define cmFileAPICodemodel_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -11,5 +10,3 @@ class cmFileAPI; extern Json::Value cmFileAPICodemodelDump(cmFileAPI& fileAPI, unsigned long version); - -#endif diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index 8c9b219..ec9ee47 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFileCommand_h -#define cmFileCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmFileCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmFileCopier.h b/Source/cmFileCopier.h index 612a57f..217d58d 100644 --- a/Source/cmFileCopier.h +++ b/Source/cmFileCopier.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFileCopier_h -#define cmFileCopier_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -120,5 +119,3 @@ protected: bool GetDefaultDirectoryPermissions(mode_t** mode); }; - -#endif diff --git a/Source/cmFileInstaller.h b/Source/cmFileInstaller.h index 537cd53..3a905d3 100644 --- a/Source/cmFileInstaller.h +++ b/Source/cmFileInstaller.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFileInstaller_h -#define cmFileInstaller_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -50,5 +49,3 @@ protected: bool GetTargetTypeFromString(const std::string& stype); bool HandleInstallDestination(); }; - -#endif diff --git a/Source/cmFileLock.h b/Source/cmFileLock.h index 5fe068e..2b125af 100644 --- a/Source/cmFileLock.h +++ b/Source/cmFileLock.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFileLock_h -#define cmFileLock_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -63,5 +62,3 @@ private: std::string Filename; }; - -#endif // cmFileLock_h diff --git a/Source/cmFileLockPool.h b/Source/cmFileLockPool.h index d45c82c..f2f9f23 100644 --- a/Source/cmFileLockPool.h +++ b/Source/cmFileLockPool.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFileLockPool_h -#define cmFileLockPool_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -86,5 +85,3 @@ private: List FileScopes; ScopePool ProcessScope; }; - -#endif // cmFileLockPool_h diff --git a/Source/cmFileLockResult.h b/Source/cmFileLockResult.h index 81c1906..8a58d1f 100644 --- a/Source/cmFileLockResult.h +++ b/Source/cmFileLockResult.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFileLockResult_h -#define cmFileLockResult_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -73,5 +72,3 @@ private: ErrorType Type; Error ErrorValue; }; - -#endif // cmFileLockResult_h diff --git a/Source/cmFilePathChecksum.h b/Source/cmFilePathChecksum.h index b7d5cd2..a6f7bd3 100644 --- a/Source/cmFilePathChecksum.h +++ b/Source/cmFilePathChecksum.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFilePathChecksum_h -#define cmFilePathChecksum_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -60,5 +59,3 @@ private: /// List of (directory name, seed name) pairs std::array<std::pair<std::string, std::string>, 4> parentDirs; }; - -#endif diff --git a/Source/cmFileTime.h b/Source/cmFileTime.h index e9a8559..f496cdc 100644 --- a/Source/cmFileTime.h +++ b/Source/cmFileTime.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFileTime_h -#define cmFileTime_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -126,5 +125,3 @@ public: private: NSC NS = 0; }; - -#endif diff --git a/Source/cmFileTimeCache.h b/Source/cmFileTimeCache.h index 83b77b6..336136e 100644 --- a/Source/cmFileTimeCache.h +++ b/Source/cmFileTimeCache.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFileTimeCache_h -#define cmFileTimeCache_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -53,5 +52,3 @@ public: private: std::unordered_map<std::string, cmFileTime> Cache; }; - -#endif diff --git a/Source/cmFileTimes.h b/Source/cmFileTimes.h index 191d89e..f1916f7 100644 --- a/Source/cmFileTimes.h +++ b/Source/cmFileTimes.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFileTimes_h -#define cmFileTimes_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -36,5 +35,3 @@ private: class Times; std::unique_ptr<Times> times; }; - -#endif diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h index 4cbf09e..57a40be 100644 --- a/Source/cmFindBase.h +++ b/Source/cmFindBase.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFindBase_h -#define cmFindBase_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -94,5 +93,3 @@ private: std::vector<DebugLibState> FailedSearchLocations; DebugLibState FoundSearchLocation; }; - -#endif diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h index 916f3bc..f84242e 100644 --- a/Source/cmFindCommon.h +++ b/Source/cmFindCommon.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFindCommon_h -#define cmFindCommon_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -143,5 +142,3 @@ protected: cmMakefile* Makefile; cmExecutionStatus& Status; }; - -#endif diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h index 7dc6e55..368a7c9 100644 --- a/Source/cmFindFileCommand.h +++ b/Source/cmFindFileCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFindFileCommand_h -#define cmFindFileCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -28,5 +27,3 @@ public: bool cmFindFile(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h index b2f71b3..f3874ff 100644 --- a/Source/cmFindLibraryCommand.h +++ b/Source/cmFindLibraryCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFindLibraryCommand_h -#define cmFindLibraryCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -44,5 +43,3 @@ private: bool cmFindLibrary(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 7058a54..eacd1ce 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFindPackageCommand_h -#define cmFindPackageCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -233,5 +232,3 @@ struct hash<cmFindPackageCommand::ConfigFileInfo> bool cmFindPackage(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h index 18bfb7d..b9fe673 100644 --- a/Source/cmFindPathCommand.h +++ b/Source/cmFindPathCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFindPathCommand_h -#define cmFindPathCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -38,5 +37,3 @@ private: bool cmFindPath(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h index 043b43c..161a680 100644 --- a/Source/cmFindProgramCommand.h +++ b/Source/cmFindProgramCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFindProgramCommand_h -#define cmFindProgramCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -38,5 +37,3 @@ private: bool cmFindProgram(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h index 1feb965..6476fea 100644 --- a/Source/cmForEachCommand.h +++ b/Source/cmForEachCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmForEachCommand_h -#define cmForEachCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -13,4 +12,3 @@ class cmExecutionStatus; /// Starts foreach() ... endforeach() block bool cmForEachCommand(std::vector<std::string> const& args, cmExecutionStatus& status); -#endif diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h index 6f97b42..1b14d17 100644 --- a/Source/cmFortranParser.h +++ b/Source/cmFortranParser.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFortranParser_h -#define cmFortranParser_h +#pragma once #if !defined(cmFortranLexer_cxx) && !defined(cmFortranParser_cxx) # include "cmConfigure.h" // IWYU pragma: keep @@ -181,5 +180,3 @@ struct cmFortranParser_s cmFortranSourceInfo& Info; }; #endif - -#endif diff --git a/Source/cmFunctionBlocker.h b/Source/cmFunctionBlocker.h index 59bb892..b4b493b 100644 --- a/Source/cmFunctionBlocker.h +++ b/Source/cmFunctionBlocker.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFunctionBlocker_h -#define cmFunctionBlocker_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -50,5 +49,3 @@ private: std::vector<cmListFileFunction> Functions; unsigned int ScopeDepth = 1; }; - -#endif diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h index d6b549c..07ff4f7 100644 --- a/Source/cmFunctionCommand.h +++ b/Source/cmFunctionCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmFunctionCommand_h -#define cmFunctionCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -13,5 +12,3 @@ class cmExecutionStatus; /// Starts function() ... endfunction() block bool cmFunctionCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmGccDepfileLexerHelper.h b/Source/cmGccDepfileLexerHelper.h index e6b2fcf..07ca61d 100644 --- a/Source/cmGccDepfileLexerHelper.h +++ b/Source/cmGccDepfileLexerHelper.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGccDepfileLexerHelper_h -#define cmGccDepfileLexerHelper_h +#pragma once #include <utility> @@ -36,5 +35,3 @@ private: }; #define YY_EXTRA_TYPE cmGccDepfileLexerHelper* - -#endif diff --git a/Source/cmGccDepfileReader.h b/Source/cmGccDepfileReader.h index 9313010..395dd77 100644 --- a/Source/cmGccDepfileReader.h +++ b/Source/cmGccDepfileReader.h @@ -1,10 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGccDepfileReader_h -#define cmGccDepfileReader_h +#pragma once #include "cmGccDepfileReaderTypes.h" cmGccDepfileContent cmReadGccDepfile(const char* filePath); - -#endif diff --git a/Source/cmGccDepfileReaderTypes.h b/Source/cmGccDepfileReaderTypes.h index 8b15c73..246e355 100644 --- a/Source/cmGccDepfileReaderTypes.h +++ b/Source/cmGccDepfileReaderTypes.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGccDepfileReaderTypes_h -#define cmGccDepfileReaderTypes_h +#pragma once #include <string> #include <vector> @@ -13,5 +12,3 @@ struct cmGccStyleDependency }; using cmGccDepfileContent = std::vector<cmGccStyleDependency>; - -#endif diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h index f6da86e..bb7e3bf 100644 --- a/Source/cmGeneratedFileStream.h +++ b/Source/cmGeneratedFileStream.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGeneratedFileStream_h -#define cmGeneratedFileStream_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -158,5 +157,3 @@ private: // The original locale of the stream (performs no encoding conversion). std::locale OriginalLocale; }; - -#endif diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 09d8b88..03be782 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGeneratorExpression_h -#define cmGeneratorExpression_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -208,5 +207,3 @@ protected: cmGeneratorTarget const* HeadTarget = nullptr; std::string Language; }; - -#endif diff --git a/Source/cmGeneratorExpressionContext.h b/Source/cmGeneratorExpressionContext.h index bceff12..22e7463 100644 --- a/Source/cmGeneratorExpressionContext.h +++ b/Source/cmGeneratorExpressionContext.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGeneratorExpressionContext_h -#define cmGeneratorExpressionContext_h +#pragma once #include <map> #include <set> @@ -43,5 +42,3 @@ struct cmGeneratorExpressionContext bool HadLinkLanguageSensitiveCondition; bool EvaluateForBuildsystem; }; - -#endif diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h index ac2314c..53225cd 100644 --- a/Source/cmGeneratorExpressionDAGChecker.h +++ b/Source/cmGeneratorExpressionDAGChecker.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGeneratorExpressionDAGChecker_h -#define cmGeneratorExpressionDAGChecker_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -100,5 +99,3 @@ private: Result CheckResult; bool TransitivePropertiesOnly; }; - -#endif diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h index caa8064..2cd35ae 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.h +++ b/Source/cmGeneratorExpressionEvaluationFile.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGeneratorExpressionEvaluationFile_h -#define cmGeneratorExpressionEvaluationFile_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -61,5 +60,3 @@ private: const bool InputIsContent; cmPolicies::PolicyStatus PolicyStatusCMP0070; }; - -#endif diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index 10496fd..3e7737e 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGeneratorExpressionEvaluator_h -#define cmGeneratorExpressionEvaluator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -115,5 +114,3 @@ private: const char* StartContent; size_t ContentLength; }; - -#endif diff --git a/Source/cmGeneratorExpressionLexer.h b/Source/cmGeneratorExpressionLexer.h index 9e01948..a4321d1 100644 --- a/Source/cmGeneratorExpressionLexer.h +++ b/Source/cmGeneratorExpressionLexer.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGeneratorExpressionLexer_h -#define cmGeneratorExpressionLexer_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -49,5 +48,3 @@ private: bool SawBeginExpression = false; bool SawGeneratorExpression = false; }; - -#endif diff --git a/Source/cmGeneratorExpressionNode.h b/Source/cmGeneratorExpressionNode.h index 13e8484..f068b02 100644 --- a/Source/cmGeneratorExpressionNode.h +++ b/Source/cmGeneratorExpressionNode.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGeneratorExpressionNode_h -#define cmGeneratorExpressionNode_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -52,5 +51,3 @@ struct cmGeneratorExpressionNode void reportError(cmGeneratorExpressionContext* context, const std::string& expr, const std::string& result); - -#endif diff --git a/Source/cmGeneratorExpressionParser.h b/Source/cmGeneratorExpressionParser.h index 1ba1654..d49bf3e 100644 --- a/Source/cmGeneratorExpressionParser.h +++ b/Source/cmGeneratorExpressionParser.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGeneratorExpressionParser_h -#define cmGeneratorExpressionParser_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -30,5 +29,3 @@ private: const std::vector<cmGeneratorExpressionToken> Tokens; unsigned int NestingLevel; }; - -#endif diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 05c8cc8..b75aa63 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -4775,12 +4775,11 @@ cmGeneratorTarget::Names cmGeneratorTarget::GetLibraryNames( // The library's soname. this->ComputeVersionedName(targetNames.SharedObject, prefix, targetNames.Base, suffix, targetNames.Output, - (soversion ? soversion->c_str() : nullptr)); + cmToCStr(soversion)); // The library's real name on disk. this->ComputeVersionedName(targetNames.Real, prefix, targetNames.Base, - suffix, targetNames.Output, - (version ? version->c_str() : nullptr)); + suffix, targetNames.Output, cmToCStr(version)); } // The import library name. @@ -4816,10 +4815,7 @@ cmGeneratorTarget::Names cmGeneratorTarget::GetExecutableNames( const char* version = nullptr; #else // Check for executable version properties. - const char* version = nullptr; - if (cmProp p = this->GetProperty("VERSION")) { - version = p->c_str(); - } + const char* version = cmToCStr(this->GetProperty("VERSION")); if (this->GetType() != cmStateEnums::EXECUTABLE || this->Makefile->IsOn("XCODE")) { version = nullptr; @@ -5536,7 +5532,7 @@ const char* getTypedProperty<const char*>( cmProp value = tgt->GetProperty(prop); if (genexInterpreter == nullptr) { - return value ? value->c_str() : nullptr; + return cmToCStr(value); } return genexInterpreter->Evaluate(value ? *value : "", prop).c_str(); @@ -5550,7 +5546,7 @@ std::string getTypedProperty<std::string>( cmProp value = tgt->GetProperty(prop); if (genexInterpreter == nullptr) { - return valueAsString(value ? value->c_str() : nullptr); + return valueAsString(cmToCStr(value)); } return genexInterpreter->Evaluate(value ? *value : "", prop); diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 246eede..b64fd53 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGeneratorTarget_h -#define cmGeneratorTarget_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -1093,5 +1092,3 @@ public: cmGeneratorTarget const* t2) const; }; }; - -#endif diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h index 7a6728c..3a2e702 100644 --- a/Source/cmGetCMakePropertyCommand.h +++ b/Source/cmGetCMakePropertyCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGetCMakePropertyCommand_h -#define cmGetCMakePropertyCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmGetCMakePropertyCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index fa4a40b..c2098c0 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -86,9 +86,7 @@ bool cmGetDirectoryPropertyCommand(std::vector<std::string> const& args, break; } } - if (cmProp p = dir->GetProperty(*i)) { - prop = p->c_str(); - } + prop = cmToCStr(dir->GetProperty(*i)); } StoreResult(status.GetMakefile(), variable, prop); return true; diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h index f356ea5..4b0883c 100644 --- a/Source/cmGetDirectoryPropertyCommand.h +++ b/Source/cmGetDirectoryPropertyCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGetDirectoryPropertyCommand_h -#define cmGetDirectoryPropertyCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmGetDirectoryPropertyCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h index db5293b..4e1addf 100644 --- a/Source/cmGetFilenameComponentCommand.h +++ b/Source/cmGetFilenameComponentCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGetFilenameComponentCommand_h -#define cmGetFilenameComponentCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -18,5 +17,3 @@ class cmExecutionStatus; */ bool cmGetFilenameComponentCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmGetPipes.h b/Source/cmGetPipes.h index 2a46b51..6b1b495 100644 --- a/Source/cmGetPipes.h +++ b/Source/cmGetPipes.h @@ -1,8 +1,5 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGetPipes_h -#define cmGetPipes_h +#pragma once int cmGetPipes(int* fds); - -#endif diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 7f60f85..3a5b39d 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -281,8 +281,7 @@ bool HandleGlobalMode(cmExecutionStatus& status, const std::string& name, // Get the property. cmake* cm = status.GetMakefile().GetCMakeInstance(); cmProp p = cm->GetState()->GetGlobalProperty(propertyName); - return StoreResult(infoType, status.GetMakefile(), variable, - p ? p->c_str() : nullptr); + return StoreResult(infoType, status.GetMakefile(), variable, cmToCStr(p)); } bool HandleDirectoryMode(cmExecutionStatus& status, const std::string& name, @@ -329,8 +328,7 @@ bool HandleDirectoryMode(cmExecutionStatus& status, const std::string& name, // Get the property. cmProp p = mf->GetProperty(propertyName); - return StoreResult(infoType, status.GetMakefile(), variable, - p ? p->c_str() : nullptr); + return StoreResult(infoType, status.GetMakefile(), variable, cmToCStr(p)); } bool HandleTargetMode(cmExecutionStatus& status, const std::string& name, @@ -449,8 +447,7 @@ bool HandleCacheMode(cmExecutionStatus& status, const std::string& name, value = status.GetMakefile().GetState()->GetCacheEntryProperty( name, propertyName); } - StoreResult(infoType, status.GetMakefile(), variable, - value ? value->c_str() : nullptr); + StoreResult(infoType, status.GetMakefile(), variable, cmToCStr(value)); return true; } diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h index cc600f4..fac3202 100644 --- a/Source/cmGetPropertyCommand.h +++ b/Source/cmGetPropertyCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGetPropertyCommand_h -#define cmGetPropertyCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmGetPropertyCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h index f0c319b..4f8eab2 100644 --- a/Source/cmGetSourceFilePropertyCommand.h +++ b/Source/cmGetSourceFilePropertyCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGetSourceFilePropertyCommand_h -#define cmGetSourceFilePropertyCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmGetSourceFilePropertyCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h index c13078f..0fbd23d 100644 --- a/Source/cmGetTargetPropertyCommand.h +++ b/Source/cmGetTargetPropertyCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGetTargetPropertyCommand_h -#define cmGetTargetPropertyCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmGetTargetPropertyCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h index 30beb8f..f1d6010 100644 --- a/Source/cmGetTestPropertyCommand.h +++ b/Source/cmGetTestPropertyCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGetTestPropertyCommand_h -#define cmGetTestPropertyCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmGetTestPropertyCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmGhsMultiGpj.h b/Source/cmGhsMultiGpj.h index fbbef5d..1cae660 100644 --- a/Source/cmGhsMultiGpj.h +++ b/Source/cmGhsMultiGpj.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGhsMultiGpj_h -#define cmGhsMultiGpj_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -25,5 +24,3 @@ public: static const char* GetGpjTag(Types gpjType); }; - -#endif // ! cmGhsMultiGpjType_h diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 5f26387..e9d7537 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGhsMultiTargetGenerator_h -#define cmGhsMultiTargetGenerator_h +#pragma once #include <iosfwd> #include <map> @@ -82,5 +81,3 @@ private: std::string ConfigName; /* CMAKE_BUILD_TYPE */ bool const CmdWindowsShell; /* custom commands run in cmd.exe or /bin/sh */ }; - -#endif // ! cmGhsMultiTargetGenerator_h diff --git a/Source/cmGlobVerificationManager.h b/Source/cmGlobVerificationManager.h index 2e7e1ca..b618fb0 100644 --- a/Source/cmGlobVerificationManager.h +++ b/Source/cmGlobVerificationManager.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobVerificationManager_h -#define cmGlobVerificationManager_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -81,5 +80,3 @@ private: // cmGlobVerificationManager should never be used directly. friend class cmState; // allow access to add cache values }; - -#endif diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h index 3c97955..5a4e8c2 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.h +++ b/Source/cmGlobalBorlandMakefileGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalBorlandMakefileGenerator_h -#define cmGlobalBorlandMakefileGenerator_h +#pragma once #include <iosfwd> #include <memory> @@ -58,5 +57,3 @@ protected: void PrintBuildCommandAdvice(std::ostream& os, int jobs) const override; }; - -#endif diff --git a/Source/cmGlobalCommonGenerator.h b/Source/cmGlobalCommonGenerator.h index f97b5f4..2aa9d27 100644 --- a/Source/cmGlobalCommonGenerator.h +++ b/Source/cmGlobalCommonGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalCommonGenerator_h -#define cmGlobalCommonGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -44,5 +43,3 @@ public: bool IsExcludedFromAllInConfig(const DirectoryTarget::Target& t, const std::string& config); }; - -#endif diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index c2c80c2..6ae7e15 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalGenerator_h -#define cmGlobalGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -717,5 +716,3 @@ protected: bool InstallTargetEnabled; bool ConfigureDoneCMP0026AndCMP0024; }; - -#endif diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h index 13cfe4d..3a7f806 100644 --- a/Source/cmGlobalGeneratorFactory.h +++ b/Source/cmGlobalGeneratorFactory.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalGeneratorFactory_h -#define cmGlobalGeneratorFactory_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -95,5 +94,3 @@ public: std::string GetDefaultPlatformName() const override { return std::string(); } }; - -#endif diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index 12ca8b6..7753b31 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGhsMultiGenerator_h -#define cmGhsMultiGenerator_h +#pragma once #include <iosfwd> #include <memory> @@ -158,5 +157,3 @@ public: using TargetDependSet = cmGlobalGenerator::TargetDependSet; OrderedTargetDependSet(TargetDependSet const&, std::string const& first); }; - -#endif diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h index 9f1ec8b..2d58f91 100644 --- a/Source/cmGlobalJOMMakefileGenerator.h +++ b/Source/cmGlobalJOMMakefileGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalJOMMakefileGenerator_h -#define cmGlobalJOMMakefileGenerator_h +#pragma once #include <iosfwd> #include <memory> @@ -53,5 +52,3 @@ private: void PrintCompilerAdvice(std::ostream& os, std::string const& lang, const char* envVar) const override; }; - -#endif diff --git a/Source/cmGlobalMSYSMakefileGenerator.h b/Source/cmGlobalMSYSMakefileGenerator.h index b2de4ff..1a47b4f 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.h +++ b/Source/cmGlobalMSYSMakefileGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalMSYSMakefileGenerator_h -#define cmGlobalMSYSMakefileGenerator_h +#pragma once #include <memory> @@ -42,5 +41,3 @@ public: private: std::string FindMinGW(std::string const& makeloc); }; - -#endif diff --git a/Source/cmGlobalMinGWMakefileGenerator.h b/Source/cmGlobalMinGWMakefileGenerator.h index a9f92a1..ffc9ebe 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.h +++ b/Source/cmGlobalMinGWMakefileGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalMinGWMakefileGenerator_h -#define cmGlobalMinGWMakefileGenerator_h +#pragma once #include <memory> @@ -38,5 +37,3 @@ public: virtual void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*, bool optional); }; - -#endif diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h index fdf6006..abe64ff 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.h +++ b/Source/cmGlobalNMakeMakefileGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalNMakeMakefileGenerator_h -#define cmGlobalNMakeMakefileGenerator_h +#pragma once #include <iosfwd> #include <memory> @@ -59,5 +58,3 @@ private: void PrintCompilerAdvice(std::ostream& os, std::string const& lang, const char* envVar) const override; }; - -#endif diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 0881ce0..884a711 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalNinjaGenerator_h -#define cmGlobalNinjaGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -669,5 +668,3 @@ private: std::unique_ptr<cmGeneratedFileStream> CommonFileStream; std::unique_ptr<cmGeneratedFileStream> DefaultFileStream; }; - -#endif // ! cmGlobalNinjaGenerator_h diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 1caa4b7..77d0827 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalUnixMakefileGenerator3_h -#define cmGlobalUnixMakefileGenerator3_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -259,5 +258,3 @@ private: DirectoryTargetsMap; void InitializeProgressMarks() override; }; - -#endif diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 0c53537..65ea33f 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalVisualStudio10Generator_h -#define cmGlobalVisualStudio10Generator_h +#pragma once #include <memory> #include <set> @@ -244,4 +243,3 @@ private: // We do not use the reload macros for VS >= 10. std::string GetUserMacrosDirectory() override { return ""; } }; -#endif diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index 5f1ff73..6e409cf 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalVisualStudio11Generator_h -#define cmGlobalVisualStudio11Generator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -53,4 +52,3 @@ private: class Factory; friend class Factory; }; -#endif diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h index bdd40ff..c220d40 100644 --- a/Source/cmGlobalVisualStudio12Generator.h +++ b/Source/cmGlobalVisualStudio12Generator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalVisualStudio12Generator_h -#define cmGlobalVisualStudio12Generator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -48,4 +47,3 @@ private: class Factory; friend class Factory; }; -#endif diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h index 2b9a649..1ccd4c7 100644 --- a/Source/cmGlobalVisualStudio14Generator.h +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalVisualStudio14Generator_h -#define cmGlobalVisualStudio14Generator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -60,4 +59,3 @@ private: class Factory; friend class Factory; }; -#endif diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index 7eadaf3..7d38199 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalVisualStudio71Generator_h -#define cmGlobalVisualStudio71Generator_h +#pragma once #include "cmGlobalVisualStudio7Generator.h" @@ -42,4 +41,3 @@ protected: std::string ProjectConfigurationSectionName; }; -#endif diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 73a2caa..84cfaeb 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -381,8 +381,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( std::string location = *expath; cmProp p = target->GetProperty("VS_PROJECT_TYPE"); - this->WriteExternalProject(fout, project, location, - p ? p->c_str() : nullptr, + this->WriteExternalProject(fout, project, location, cmToCStr(p), target->GetUtilities()); written = true; } else { diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 6cc1cf8..148762e 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalVisualStudio7Generator_h -#define cmGlobalVisualStudio7Generator_h +#pragma once #include <memory> @@ -174,5 +173,3 @@ private: }; #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK" - -#endif diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 6ce67d3..96e3553 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalVisualStudio8Generator_h -#define cmGlobalVisualStudio8Generator_h +#pragma once #include "cmGlobalVisualStudio71Generator.h" @@ -78,4 +77,3 @@ protected: std::string Name; std::string WindowsCEVersion; }; -#endif diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h index 53318a6..6f4d159 100644 --- a/Source/cmGlobalVisualStudio9Generator.h +++ b/Source/cmGlobalVisualStudio9Generator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalVisualStudio9Generator_h -#define cmGlobalVisualStudio9Generator_h +#pragma once #include <memory> @@ -38,4 +37,3 @@ private: class Factory; friend class Factory; }; -#endif diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 29a5c2c..3c46408 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalVisualStudioGenerator_h -#define cmGlobalVisualStudioGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -224,5 +223,3 @@ public: OrderedTargetDependSet(TargetDependSet const&, std::string const& first); OrderedTargetDependSet(TargetSet const&, std::string const& first); }; - -#endif diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h index 289c35c..af09cbd 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.h +++ b/Source/cmGlobalVisualStudioVersionedGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalVisualStudioVersionedGenerator_h -#define cmGlobalVisualStudioVersionedGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -69,4 +68,3 @@ private: friend class Factory16; mutable cmVSSetupAPIHelper vsSetupAPIHelper; }; -#endif diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h index c47127f..da39d3f 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.h +++ b/Source/cmGlobalWatcomWMakeGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalWatcomWMakeGenerator_h -#define cmGlobalWatcomWMakeGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -64,5 +63,3 @@ protected: void PrintBuildCommandAdvice(std::ostream& os, int jobs) const override; }; - -#endif diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index c02cc1d..c9f9926 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalXCodeGenerator_h -#define cmGlobalXCodeGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -309,5 +308,3 @@ private: std::map<cmGeneratorTarget const*, std::set<cmSourceFile const*>> CommandsVisited; }; - -#endif diff --git a/Source/cmGraphAdjacencyList.h b/Source/cmGraphAdjacencyList.h index 4e1f128..fe9fbe2 100644 --- a/Source/cmGraphAdjacencyList.h +++ b/Source/cmGraphAdjacencyList.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGraphAdjacencyList_h -#define cmGraphAdjacencyList_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -48,5 +47,3 @@ struct cmGraphNodeList : public std::vector<int> struct cmGraphAdjacencyList : public std::vector<cmGraphEdgeList> { }; - -#endif diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h index d1300ac..0912fc8 100644 --- a/Source/cmGraphVizWriter.h +++ b/Source/cmGraphVizWriter.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef CMGRAPHVIZWRITER_H -#define CMGRAPHVIZWRITER_H +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -136,5 +135,3 @@ private: bool GeneratePerTarget; bool GenerateDependers; }; - -#endif diff --git a/Source/cmHexFileConverter.h b/Source/cmHexFileConverter.h index 26f9ea8..35a91ed 100644 --- a/Source/cmHexFileConverter.h +++ b/Source/cmHexFileConverter.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmHexFileConverter_h -#define cmHexFileConverter_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -25,5 +24,3 @@ public: static bool TryConvert(const std::string& inFileName, const std::string& outFileName); }; - -#endif diff --git a/Source/cmIDEFlagTable.h b/Source/cmIDEFlagTable.h index ff93432..5901771 100644 --- a/Source/cmIDEFlagTable.h +++ b/Source/cmIDEFlagTable.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmIDEFlagTable_h -#define cmIDEFlagTable_h +#pragma once #include <string> @@ -37,5 +36,3 @@ struct cmIDEFlagTable UserValueRequired = UserValue | UserRequired }; }; - -#endif diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h index f949ae3..fbe9c37 100644 --- a/Source/cmIDEOptions.h +++ b/Source/cmIDEOptions.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmIDEOptions_h -#define cmIDEOptions_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -112,5 +111,3 @@ protected: std::string const& new_value); virtual void StoreUnknownFlag(std::string const& flag) = 0; }; - -#endif diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index 820ffa4..f056587 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmIfCommand_h -#define cmIfCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -13,5 +12,3 @@ struct cmListFileArgument; /// Starts an if block bool cmIfCommand(std::vector<cmListFileArgument> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h index b0dd779..af26163 100644 --- a/Source/cmIncludeCommand.h +++ b/Source/cmIncludeCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmIncludeCommand_h -#define cmIncludeCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -18,5 +17,3 @@ class cmExecutionStatus; */ bool cmIncludeCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h index 66caff7..d830dbf 100644 --- a/Source/cmIncludeDirectoryCommand.h +++ b/Source/cmIncludeDirectoryCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmIncludeDirectoryCommand_h -#define cmIncludeDirectoryCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmIncludeDirectoryCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h index 1013c44..fd77407 100644 --- a/Source/cmIncludeExternalMSProjectCommand.h +++ b/Source/cmIncludeExternalMSProjectCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmIncludeExternalMSProjectCommand_h -#define cmIncludeExternalMSProjectCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmIncludeExternalMSProjectCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmIncludeGuardCommand.h b/Source/cmIncludeGuardCommand.h index b86b760..c4de3d4 100644 --- a/Source/cmIncludeGuardCommand.h +++ b/Source/cmIncludeGuardCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmIncludeGuardCommand_h -#define cmIncludeGuardCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -18,5 +17,3 @@ class cmExecutionStatus; */ bool cmIncludeGuardCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h index ca152b0..a402f97 100644 --- a/Source/cmIncludeRegularExpressionCommand.h +++ b/Source/cmIncludeRegularExpressionCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmIncludeRegularExpressionCommand_h -#define cmIncludeRegularExpressionCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmIncludeRegularExpressionCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index 32f00ce..f0ba44e 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmInstallCommand_h -#define cmInstallCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmInstallCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h index 5d2ee0a..f318a1a 100644 --- a/Source/cmInstallCommandArguments.h +++ b/Source/cmInstallCommandArguments.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmInstallCommandArguments_h -#define cmInstallCommandArguments_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -72,5 +71,3 @@ public: private: std::vector<std::string> IncludeDirs; }; - -#endif diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h index bec89df..af310f3 100644 --- a/Source/cmInstallDirectoryGenerator.h +++ b/Source/cmInstallDirectoryGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmInstallDirectoryGenerator_h -#define cmInstallDirectoryGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -48,5 +47,3 @@ protected: std::string const LiteralArguments; bool const Optional; }; - -#endif diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index 43dd00d..dd8624b 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmInstallExportGenerator_h -#define cmInstallExportGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -68,5 +67,3 @@ protected: std::string MainImportFile; std::unique_ptr<cmExportInstallFileGenerator> EFGen; }; - -#endif diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h index f4ebbde..219bb97 100644 --- a/Source/cmInstallFilesCommand.h +++ b/Source/cmInstallFilesCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmInstallFilesCommand_h -#define cmInstallFilesCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmInstallFilesCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h index 8266603..b5a1ef4 100644 --- a/Source/cmInstallFilesGenerator.h +++ b/Source/cmInstallFilesGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmInstallFilesGenerator_h -#define cmInstallFilesGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -48,5 +47,3 @@ protected: bool const Programs; bool const Optional; }; - -#endif diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index d786d24..ee55ee9 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmInstallGenerator_h -#define cmInstallGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -74,5 +73,3 @@ protected: MessageLevel const Message; bool const ExcludeFromAll; }; - -#endif diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h index c567f3b..e3c3e81 100644 --- a/Source/cmInstallProgramsCommand.h +++ b/Source/cmInstallProgramsCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmInstallProgramsCommand_h -#define cmInstallProgramsCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmInstallProgramsCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h index 0a9c4ba..338d866 100644 --- a/Source/cmInstallScriptGenerator.h +++ b/Source/cmInstallScriptGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmInstallScriptGenerator_h -#define cmInstallScriptGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -38,5 +37,3 @@ protected: cmLocalGenerator* LocalGenerator; bool AllowGenex; }; - -#endif diff --git a/Source/cmInstallSubdirectoryGenerator.h b/Source/cmInstallSubdirectoryGenerator.h index f9cd0f1..3e46d6b 100644 --- a/Source/cmInstallSubdirectoryGenerator.h +++ b/Source/cmInstallSubdirectoryGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmInstallSubdirectoryGenerator_h -#define cmInstallSubdirectoryGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -37,5 +36,3 @@ protected: std::string const BinaryDirectory; cmLocalGenerator* LocalGenerator; }; - -#endif diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index e21001f..a53a75a 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmInstallTargetGenerator_h -#define cmInstallTargetGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -114,5 +113,3 @@ protected: bool const Optional; cmListFileBacktrace const Backtrace; }; - -#endif diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h index 0c5850c..716e7ce 100644 --- a/Source/cmInstallTargetsCommand.h +++ b/Source/cmInstallTargetsCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmInstallTargetsCommand_h -#define cmInstallTargetsCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmInstallTargetsCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmInstallType.h b/Source/cmInstallType.h index e2602cb..33fa7a9 100644 --- a/Source/cmInstallType.h +++ b/Source/cmInstallType.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmInstallType_h -#define cmInstallType_h +#pragma once /** * Enumerate types known to file(INSTALL). @@ -16,5 +15,3 @@ enum cmInstallType cmInstallType_PROGRAMS, cmInstallType_DIRECTORY }; - -#endif diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h index 07f7081..82474f5 100644 --- a/Source/cmInstalledFile.h +++ b/Source/cmInstalledFile.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmInstalledFile_h -#define cmInstalledFile_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -76,5 +75,3 @@ private: CompiledGeneratorExpressionPtrType NameExpression; PropertyMapType Properties; }; - -#endif diff --git a/Source/cmJsonObjects.h b/Source/cmJsonObjects.h index 2fd4b26..80a4834 100644 --- a/Source/cmJsonObjects.h +++ b/Source/cmJsonObjects.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmJsonObjects_h -#define cmJsonObjects_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -23,5 +22,3 @@ extern void cmGetCMakeInputs(const cmGlobalGenerator* gg, extern Json::Value cmDumpCodeModel(const cmake* cm); extern Json::Value cmDumpCTestInfo(const cmake* cm); extern Json::Value cmDumpCMakeInputs(const cmake* cm); - -#endif diff --git a/Source/cmLDConfigLDConfigTool.h b/Source/cmLDConfigLDConfigTool.h index 34bf6c6..eeb86dd 100644 --- a/Source/cmLDConfigLDConfigTool.h +++ b/Source/cmLDConfigLDConfigTool.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLDConfigLDConfigTool_h -#define cmLDConfigLDConfigTool_h +#pragma once #include <string> #include <vector> @@ -18,5 +17,3 @@ public: bool GetLDConfigPaths(std::vector<std::string>& paths) override; }; - -#endif diff --git a/Source/cmLDConfigTool.h b/Source/cmLDConfigTool.h index c816562..3116f80 100644 --- a/Source/cmLDConfigTool.h +++ b/Source/cmLDConfigTool.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLDConfigTool_h -#define cmLDConfigTool_h +#pragma once #include <string> #include <vector> @@ -20,5 +19,3 @@ public: protected: cmRuntimeDependencyArchive* Archive; }; - -#endif diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h index a7caa5c..2a3499d 100644 --- a/Source/cmLinkDirectoriesCommand.h +++ b/Source/cmLinkDirectoriesCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLinkDirectoriesCommand_h -#define cmLinkDirectoriesCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmLinkDirectoriesCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h index 3d92935..5a90e7e 100644 --- a/Source/cmLinkItem.h +++ b/Source/cmLinkItem.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLinkItem_h -#define cmLinkItem_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -140,5 +139,3 @@ inline cmTargetLinkLibraryType CMP0003_ComputeLinkType( // The current configuration is not a debug configuration. return OPTIMIZED_LibraryType; } - -#endif diff --git a/Source/cmLinkItemGraphVisitor.h b/Source/cmLinkItemGraphVisitor.h index 21dc659..0d6676a 100644 --- a/Source/cmLinkItemGraphVisitor.h +++ b/Source/cmLinkItemGraphVisitor.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLinkItemGraphVisitor_h -#define cmLinkItemGraphVisitor_h +#pragma once #include <map> #include <set> @@ -71,5 +70,3 @@ private: std::string const& config, DependencyMap& dependencies); }; - -#endif diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h index 3412251..27c410f 100644 --- a/Source/cmLinkLibrariesCommand.h +++ b/Source/cmLinkLibrariesCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLinkLibrariesCommand_h -#define cmLinkLibrariesCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmLinkLibrariesCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h index df42468..a1dafc4 100644 --- a/Source/cmLinkLineComputer.h +++ b/Source/cmLinkLineComputer.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLinkLineComputer_h -#define cmLinkLineComputer_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -73,5 +72,3 @@ protected: bool UseNinjaMulti; bool Relink; }; - -#endif diff --git a/Source/cmLinkLineDeviceComputer.h b/Source/cmLinkLineDeviceComputer.h index a9b01cd..dee625b 100644 --- a/Source/cmLinkLineDeviceComputer.h +++ b/Source/cmLinkLineDeviceComputer.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLinkLineDeviceComputer_h -#define cmLinkLineDeviceComputer_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -42,5 +41,3 @@ public: bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg, const std::string& config); - -#endif diff --git a/Source/cmLinkedTree.h b/Source/cmLinkedTree.h index c7453ea..d70176d 100644 --- a/Source/cmLinkedTree.h +++ b/Source/cmLinkedTree.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLinkedTree_h -#define cmLinkedTree_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -188,5 +187,3 @@ private: std::vector<T> Data; std::vector<PositionType> UpPositions; }; - -#endif diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h index 274d9fd..6efab16 100644 --- a/Source/cmListCommand.h +++ b/Source/cmListCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmListCommand_h -#define cmListCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -16,5 +15,3 @@ class cmExecutionStatus; */ bool cmListCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 0b4414d..c9556ab 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmListFileCache_h -#define cmListFileCache_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -215,5 +214,3 @@ struct cmListFile std::vector<cmListFileFunction> Functions; }; - -#endif diff --git a/Source/cmListFileLexer.h b/Source/cmListFileLexer.h index ec6b3cd..3c89f63 100644 --- a/Source/cmListFileLexer.h +++ b/Source/cmListFileLexer.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmListFileLexer_h -#define cmListFileLexer_h +#pragma once #ifdef __cplusplus extern "C" { @@ -67,5 +66,3 @@ void cmListFileLexer_Delete(cmListFileLexer*); #ifdef __cplusplus } /* extern "C" */ #endif - -#endif diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h index 7cee663..5f5b705 100644 --- a/Source/cmLoadCacheCommand.h +++ b/Source/cmLoadCacheCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLoadCacheCommand_h -#define cmLoadCacheCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmLoadCacheCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h index f5fd754..d30ba16 100644 --- a/Source/cmLoadCommandCommand.h +++ b/Source/cmLoadCommandCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLoadCommandCommand_h -#define cmLoadCommandCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmLoadCommandCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h index 378ca63..f1eaf61 100644 --- a/Source/cmLocalCommonGenerator.h +++ b/Source/cmLocalCommonGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLocalCommonGenerator_h -#define cmLocalCommonGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -47,5 +46,3 @@ protected: friend class cmCommonTargetGenerator; }; - -#endif diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index cf2bce1..c5727d2 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLocalGenerator_h -#define cmLocalGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -596,5 +595,3 @@ void AddUtilityCommand(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt, bool uses_terminal, bool command_expand_lists, const std::string& job_pool, bool stdPipesUTF8); } - -#endif diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h index 2250e57..1b6f109 100644 --- a/Source/cmLocalGhsMultiGenerator.h +++ b/Source/cmLocalGhsMultiGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLocalGhsMultiGenerator_h -#define cmLocalGhsMultiGenerator_h +#pragma once #include <map> #include <string> @@ -43,5 +42,3 @@ private: void GenerateTargetsDepthFirst(cmGeneratorTarget* target, std::vector<cmGeneratorTarget*>& remaining); }; - -#endif diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 2188d7f..ad782ee 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -363,8 +363,7 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os) { cmGlobalNinjaGenerator::WriteDivider(os); os << "# Write statements declared in CMakeLists.txt:\n" - << "# " - << cmToCStr(this->Makefile->GetDefinition("CMAKE_CURRENT_LIST_FILE")) + << "# " << this->Makefile->GetSafeDefinition("CMAKE_CURRENT_LIST_FILE") << '\n'; if (this->IsRootMakefile()) { os << "# Which is the root file.\n"; diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index 73c0cde..e81402c 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLocalNinjaGenerator_h -#define cmLocalNinjaGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -121,5 +120,3 @@ private: CustomCommandTargetMap CustomCommandTargets; std::vector<cmCustomCommand const*> CustomCommands; }; - -#endif // ! cmLocalNinjaGenerator_h diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 2b07952..095836e 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLocalUnixMakefileGenerator3_h -#define cmLocalUnixMakefileGenerator3_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -296,5 +295,3 @@ private: bool SkipPreprocessedSourceRules; bool SkipAssemblySourceRules; }; - -#endif diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h index 5c6400e..84216c8 100644 --- a/Source/cmLocalVisualStudio10Generator.h +++ b/Source/cmLocalVisualStudio10Generator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLocalVisualStudio10Generator_h -#define cmLocalVisualStudio10Generator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -48,4 +47,3 @@ private: std::map<cmGeneratorTarget*, std::set<cmSourceFile const*>> SourcesVisited; }; -#endif diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 8b9b8ad..d76fc82 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLocalVisualStudio7Generator_h -#define cmLocalVisualStudio7Generator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -151,5 +150,3 @@ private: bool WindowsCEProject; std::unique_ptr<cmLocalVisualStudio7GeneratorInternals> Internal; }; - -#endif diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 585eb3c..91fb6b0 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLocalVisualStudioGenerator_h -#define cmLocalVisualStudioGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -56,5 +55,3 @@ protected: std::unique_ptr<cmCustomCommand> MaybeCreateImplibDir( cmGeneratorTarget* target, const std::string& config, bool isFortran); }; - -#endif diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h index 42de20b..dd038b4 100644 --- a/Source/cmLocalXCodeGenerator.h +++ b/Source/cmLocalXCodeGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLocalXCodeGenerator_h -#define cmLocalXCodeGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -40,5 +39,3 @@ public: private: }; - -#endif diff --git a/Source/cmLocale.h b/Source/cmLocale.h index c44a42d..f7636ac 100644 --- a/Source/cmLocale.h +++ b/Source/cmLocale.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmLocale_h -#define cmLocale_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -25,5 +24,3 @@ public: private: std::string OldLocale; }; - -#endif diff --git a/Source/cmMSVC60LinkLineComputer.h b/Source/cmMSVC60LinkLineComputer.h index d767914..0a303ab 100644 --- a/Source/cmMSVC60LinkLineComputer.h +++ b/Source/cmMSVC60LinkLineComputer.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmMSVC60LinkLineComputer_h -#define cmMSVC60LinkLineComputer_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -25,5 +24,3 @@ public: std::string ConvertToLinkReference(std::string const& input) const override; }; - -#endif diff --git a/Source/cmMachO.h b/Source/cmMachO.h index 0c44b55..be92c95 100644 --- a/Source/cmMachO.h +++ b/Source/cmMachO.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmMachO_h -#define cmMachO_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -43,5 +42,3 @@ private: bool Valid() const; std::unique_ptr<cmMachOInternal> Internal; }; - -#endif diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h index 25091ea..b65a887 100644 --- a/Source/cmMacroCommand.h +++ b/Source/cmMacroCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmMacroCommand_h -#define cmMacroCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -13,5 +12,3 @@ class cmExecutionStatus; /// Starts macro() ... endmacro() block bool cmMacroCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h index 2474383..340bca8 100644 --- a/Source/cmMakeDirectoryCommand.h +++ b/Source/cmMakeDirectoryCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmMakeDirectoryCommand_h -#define cmMakeDirectoryCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -21,5 +20,3 @@ class cmExecutionStatus; */ bool cmMakeDirectoryCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 3e95caa..ebbe3e7 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1430,31 +1430,31 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent) { const char* prop = "IMPLICIT_DEPENDS_INCLUDE_TRANSFORM"; cmProp p = parent->GetProperty(prop); - this->SetProperty(prop, p ? p->c_str() : nullptr); + this->SetProperty(prop, cmToCStr(p)); } // compile definitions property and per-config versions cmPolicies::PolicyStatus polSt = this->GetPolicyStatus(cmPolicies::CMP0043); if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) { cmProp p = parent->GetProperty("COMPILE_DEFINITIONS"); - this->SetProperty("COMPILE_DEFINITIONS", p ? p->c_str() : nullptr); + this->SetProperty("COMPILE_DEFINITIONS", cmToCStr(p)); std::vector<std::string> configs = this->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig); for (std::string const& config : configs) { std::string defPropName = cmStrCat("COMPILE_DEFINITIONS_", cmSystemTools::UpperCase(config)); cmProp prop = parent->GetProperty(defPropName); - this->SetProperty(defPropName, prop ? prop->c_str() : nullptr); + this->SetProperty(defPropName, cmToCStr(prop)); } } // labels cmProp p = parent->GetProperty("LABELS"); - this->SetProperty("LABELS", p ? p->c_str() : nullptr); + this->SetProperty("LABELS", cmToCStr(p)); // link libraries p = parent->GetProperty("LINK_LIBRARIES"); - this->SetProperty("LINK_LIBRARIES", p ? p->c_str() : nullptr); + this->SetProperty("LINK_LIBRARIES", cmToCStr(p)); // the initial project name this->StateSnapshot.SetProjectName(parent->StateSnapshot.GetProjectName()); @@ -2684,7 +2684,7 @@ cmProp cmMakefile::GetDefinition(const std::string& name) const vv->VariableAccessed(name, def ? cmVariableWatch::VARIABLE_READ_ACCESS : cmVariableWatch::UNKNOWN_VARIABLE_READ_ACCESS, - (def ? def->c_str() : nullptr), this); + cmToCStr(def), this); if (watch_function_executed) { // A callback was executed and may have caused re-allocation of the diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index fe9e78e..0a6e6e2 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmMakefile_h -#define cmMakefile_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -1157,5 +1156,3 @@ private: bool IsSourceFileTryCompile; mutable bool SuppressSideEffects; }; - -#endif diff --git a/Source/cmMakefileExecutableTargetGenerator.h b/Source/cmMakefileExecutableTargetGenerator.h index b9bbe86..782692a 100644 --- a/Source/cmMakefileExecutableTargetGenerator.h +++ b/Source/cmMakefileExecutableTargetGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmMakefileExecutableTargetGenerator_h -#define cmMakefileExecutableTargetGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -28,5 +27,3 @@ protected: private: std::string DeviceLinkObject; }; - -#endif diff --git a/Source/cmMakefileLibraryTargetGenerator.h b/Source/cmMakefileLibraryTargetGenerator.h index ca22b09..6a38e18 100644 --- a/Source/cmMakefileLibraryTargetGenerator.h +++ b/Source/cmMakefileLibraryTargetGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmMakefileLibraryTargetGenerator_h -#define cmMakefileLibraryTargetGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -39,5 +38,3 @@ protected: private: std::string DeviceLinkObject; }; - -#endif diff --git a/Source/cmMakefileProfilingData.h b/Source/cmMakefileProfilingData.h index 1babd97..a3f128b 100644 --- a/Source/cmMakefileProfilingData.h +++ b/Source/cmMakefileProfilingData.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmMakefileProfilingData_h -#define cmMakefileProfilingData_h +#pragma once #include <memory> #include <string> @@ -26,4 +25,3 @@ private: cmsys::ofstream ProfileStream; std::unique_ptr<Json::StreamWriter> JsonWriter; }; -#endif diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index f38f862..fd6dac8 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmMakefileTargetGenerator_h -#define cmMakefileTargetGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -245,5 +244,3 @@ protected: std::unique_ptr<cmOSXBundleGenerator> OSXBundleGenerator; std::unique_ptr<MacOSXContentGeneratorType> MacOSXContentGenerator; }; - -#endif diff --git a/Source/cmMakefileUtilityTargetGenerator.h b/Source/cmMakefileUtilityTargetGenerator.h index be243a7..d2b4ba5 100644 --- a/Source/cmMakefileUtilityTargetGenerator.h +++ b/Source/cmMakefileUtilityTargetGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmMakefileUtilityTargetGenerator_h -#define cmMakefileUtilityTargetGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -21,5 +20,3 @@ public: protected: }; - -#endif diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h index de7bf08..e420e64 100644 --- a/Source/cmMarkAsAdvancedCommand.h +++ b/Source/cmMarkAsAdvancedCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmMarkAsAdvancedCommand_h -#define cmMarkAsAdvancedCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -17,5 +16,3 @@ class cmExecutionStatus; */ bool cmMarkAsAdvancedCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h index ac1957c..e6b347b 100644 --- a/Source/cmMathCommand.h +++ b/Source/cmMathCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmMathCommand_h -#define cmMathCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -13,5 +12,3 @@ class cmExecutionStatus; /// Mathematical expressions: math(EXPR ...) command. bool cmMathCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h index 7d544c4..c37098c 100644 --- a/Source/cmMessageCommand.h +++ b/Source/cmMessageCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmMessageCommand_h -#define cmMessageCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -16,5 +15,3 @@ class cmExecutionStatus; */ bool cmMessageCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmMessageType.h b/Source/cmMessageType.h index b57b86b..44de429 100644 --- a/Source/cmMessageType.h +++ b/Source/cmMessageType.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmMessageType_h -#define cmMessageType_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -17,5 +16,3 @@ enum class MessageType DEPRECATION_ERROR, DEPRECATION_WARNING }; - -#endif diff --git a/Source/cmMessenger.h b/Source/cmMessenger.h index 8c09782..b6f5712 100644 --- a/Source/cmMessenger.h +++ b/Source/cmMessenger.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmMessenger_h -#define cmMessenger_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -57,5 +56,3 @@ private: bool DevWarningsAsErrors = false; bool DeprecatedWarningsAsErrors = false; }; - -#endif diff --git a/Source/cmNewLineStyle.h b/Source/cmNewLineStyle.h index ab9002e..a2b985b 100644 --- a/Source/cmNewLineStyle.h +++ b/Source/cmNewLineStyle.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmNewLineStyle_h -#define cmNewLineStyle_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -35,5 +34,3 @@ public: private: Style NewLineStyle = Invalid; }; - -#endif diff --git a/Source/cmNinjaLinkLineComputer.h b/Source/cmNinjaLinkLineComputer.h index b2b2e84..5d22f3e 100644 --- a/Source/cmNinjaLinkLineComputer.h +++ b/Source/cmNinjaLinkLineComputer.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmNinjaLinkLineComputer_h -#define cmNinjaLinkLineComputer_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -29,5 +28,3 @@ public: private: cmGlobalNinjaGenerator const* GG; }; - -#endif diff --git a/Source/cmNinjaLinkLineDeviceComputer.h b/Source/cmNinjaLinkLineDeviceComputer.h index 84ced5b..457f036 100644 --- a/Source/cmNinjaLinkLineDeviceComputer.h +++ b/Source/cmNinjaLinkLineDeviceComputer.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmNinjaLinkLineDeviceComputer_h -#define cmNinjaLinkLineDeviceComputer_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -30,5 +29,3 @@ public: private: cmGlobalNinjaGenerator const* GG; }; - -#endif diff --git a/Source/cmNinjaNormalTargetGenerator.h b/Source/cmNinjaNormalTargetGenerator.h index 9de99b9..25e40d0 100644 --- a/Source/cmNinjaNormalTargetGenerator.h +++ b/Source/cmNinjaNormalTargetGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmNinjaNormalTargetGenerator_h -#define cmNinjaNormalTargetGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -46,5 +45,3 @@ private: std::string TargetLinkLanguage(const std::string& config) const; std::string DeviceLinkObject; }; - -#endif // ! cmNinjaNormalTargetGenerator_h diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 8d4372e..9d9ce60 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmNinjaTargetGenerator_h -#define cmNinjaTargetGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -219,5 +218,3 @@ private: std::map<std::string, ByConfig> Configs; }; - -#endif // ! cmNinjaTargetGenerator_h diff --git a/Source/cmNinjaTypes.h b/Source/cmNinjaTypes.h index bd0e83f..320f41b 100644 --- a/Source/cmNinjaTypes.h +++ b/Source/cmNinjaTypes.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmNinjaTypes_h -#define cmNinjaTypes_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -60,5 +59,3 @@ public: cmNinjaVars Variables; std::string RspFile; }; - -#endif // ! cmNinjaTypes_h diff --git a/Source/cmNinjaUtilityTargetGenerator.h b/Source/cmNinjaUtilityTargetGenerator.h index ca3f0a4..24b47f8 100644 --- a/Source/cmNinjaUtilityTargetGenerator.h +++ b/Source/cmNinjaUtilityTargetGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmNinjaUtilityTargetGenerator_h -#define cmNinjaUtilityTargetGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -19,5 +18,3 @@ public: void Generate(const std::string& config) override; }; - -#endif // ! cmNinjaUtilityTargetGenerator_h diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h index 5bf1d98..4c33fcc 100644 --- a/Source/cmOSXBundleGenerator.h +++ b/Source/cmOSXBundleGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmOSXBundleGenerator_h -#define cmOSXBundleGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -69,5 +68,3 @@ private: cmLocalGenerator* LocalGenerator; std::set<std::string>* MacContentFolders; }; - -#endif diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h index cbd1cb8..912e0ee 100644 --- a/Source/cmOptionCommand.h +++ b/Source/cmOptionCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmOptionCommand_h -#define cmOptionCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -17,4 +16,3 @@ class cmExecutionStatus; */ bool cmOptionCommand(std::vector<std::string> const& args, cmExecutionStatus& status); -#endif diff --git a/Source/cmOrderDirectories.h b/Source/cmOrderDirectories.h index 8ce53e0..7788ea8 100644 --- a/Source/cmOrderDirectories.h +++ b/Source/cmOrderDirectories.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmOrderDirectories_h -#define cmOrderDirectories_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -95,5 +94,3 @@ private: friend class cmOrderDirectoriesConstraint; friend class cmOrderDirectoriesConstraintLibrary; }; - -#endif diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index a8b4528..655bc87 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmOutputConverter_h -#define cmOutputConverter_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -117,5 +116,3 @@ private: bool LinkScriptShell; }; - -#endif diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h index 4c11894..9daba8f 100644 --- a/Source/cmOutputRequiredFilesCommand.h +++ b/Source/cmOutputRequiredFilesCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmOutputRequiredFilesCommand_h -#define cmOutputRequiredFilesCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmOutputRequiredFilesCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmParseArgumentsCommand.h b/Source/cmParseArgumentsCommand.h index b2e436d..008977b 100644 --- a/Source/cmParseArgumentsCommand.h +++ b/Source/cmParseArgumentsCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmParseArgumentsCommand_h -#define cmParseArgumentsCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmParseArgumentsCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmPathLabel.h b/Source/cmPathLabel.h index 55dffab..d19d2be 100644 --- a/Source/cmPathLabel.h +++ b/Source/cmPathLabel.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmPathLabel_h -#define cmPathLabel_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -33,5 +32,3 @@ protected: std::string Label; unsigned int Hash; }; - -#endif diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index bf6e531..5b286d4 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmPolicies_h -#define cmPolicies_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -449,5 +448,3 @@ public: std::bitset<cmPolicies::CMPCOUNT * POLICY_STATUS_COUNT> Status; }; }; - -#endif diff --git a/Source/cmProcessOutput.h b/Source/cmProcessOutput.h index 3db47a4..a1f73bd 100644 --- a/Source/cmProcessOutput.h +++ b/Source/cmProcessOutput.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmProcessOutput_h -#define cmProcessOutput_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -84,5 +83,3 @@ private: bool DoDecodeText(std::string raw, std::string& decoded, wchar_t* lastChar); #endif }; - -#endif diff --git a/Source/cmProcessTools.h b/Source/cmProcessTools.h index 21d59c4..74ec5e0 100644 --- a/Source/cmProcessTools.h +++ b/Source/cmProcessTools.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmProcessTools_h -#define cmProcessTools_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -86,5 +85,3 @@ public: OutputParser* err = nullptr, Encoding encoding = cmProcessOutput::Auto); }; - -#endif diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h index c06b459..33f0955 100644 --- a/Source/cmProjectCommand.h +++ b/Source/cmProjectCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmProjectCommand_h -#define cmProjectCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmProjectCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmProperty.h b/Source/cmProperty.h index 47eec93..1e03c3f 100644 --- a/Source/cmProperty.h +++ b/Source/cmProperty.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmProperty_h -#define cmProperty_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -35,5 +34,3 @@ inline const char* cmToCStrSafe(cmProp p) { return p ? p->c_str() : ""; } - -#endif diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h index f83bc4f..fca936e 100644 --- a/Source/cmPropertyDefinition.h +++ b/Source/cmPropertyDefinition.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmPropertyDefinition_h -#define cmPropertyDefinition_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -65,5 +64,3 @@ private: using key_type = std::pair<std::string, cmProperty::ScopeType>; std::map<key_type, cmPropertyDefinition> Map_; }; - -#endif diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h index 5fc46a2..cda585a 100644 --- a/Source/cmPropertyMap.h +++ b/Source/cmPropertyMap.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmPropertyMap_h -#define cmPropertyMap_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -49,5 +48,3 @@ public: private: std::unordered_map<std::string, std::string> Map_; }; - -#endif diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx index 795c2ee..de462db 100644 --- a/Source/cmQTWrapCPPCommand.cxx +++ b/Source/cmQTWrapCPPCommand.cxx @@ -41,7 +41,7 @@ bool cmQTWrapCPPCommand(std::vector<std::string> const& args, cmSourceFile* sf = mf.GetOrCreateSource(newName, true); if (curr) { cmProp p = curr->GetProperty("ABSTRACT"); - sf->SetProperty("ABSTRACT", p ? p->c_str() : nullptr); + sf->SetProperty("ABSTRACT", cmToCStr(p)); } // Compute the name of the header from which to generate the file. diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h index 75fa180..28ceb3a 100644 --- a/Source/cmQTWrapCPPCommand.h +++ b/Source/cmQTWrapCPPCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmQTWrapCPPCommand_h -#define cmQTWrapCPPCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmQTWrapCPPCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h index a17ef54..3f92ea9 100644 --- a/Source/cmQTWrapUICommand.h +++ b/Source/cmQTWrapUICommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmQTWrapUICommand_h -#define cmQTWrapUICommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmQTWrapUICommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h index a740ba3..cf90417 100644 --- a/Source/cmQtAutoGen.h +++ b/Source/cmQtAutoGen.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmQtAutoGen_h -#define cmQtAutoGen_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -141,5 +140,3 @@ public: std::vector<std::string> ListOptions_; }; }; - -#endif diff --git a/Source/cmQtAutoGenGlobalInitializer.h b/Source/cmQtAutoGenGlobalInitializer.h index 2f6e581..cdae137 100644 --- a/Source/cmQtAutoGenGlobalInitializer.h +++ b/Source/cmQtAutoGenGlobalInitializer.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmQtAutoGenGlobalInitializer_h -#define cmQtAutoGenGlobalInitializer_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -82,5 +81,3 @@ private: CompilerFeatures_; Keywords const Keywords_; }; - -#endif diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index 48ec1a0..3ab303a 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmQtAutoGenInitializer_h -#define cmQtAutoGenInitializer_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -249,5 +248,3 @@ private: std::vector<Qrc> Qrcs; } Rcc; }; - -#endif diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h index 83fb3ed..b4f057d 100644 --- a/Source/cmQtAutoGenerator.h +++ b/Source/cmQtAutoGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmQtAutoGenerator_h -#define cmQtAutoGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -177,5 +176,3 @@ private: // -- Directories ProjectDirsT ProjectDirs_; }; - -#endif diff --git a/Source/cmQtAutoMocUic.h b/Source/cmQtAutoMocUic.h index ffcc2db..20f9d6e 100644 --- a/Source/cmQtAutoMocUic.h +++ b/Source/cmQtAutoMocUic.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmQtAutoMocUic_h -#define cmQtAutoMocUic_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ * @return true on success */ bool cmQtAutoMocUic(cm::string_view infoFile, cm::string_view config); - -#endif diff --git a/Source/cmQtAutoRcc.h b/Source/cmQtAutoRcc.h index a74b33a..d525efa 100644 --- a/Source/cmQtAutoRcc.h +++ b/Source/cmQtAutoRcc.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmQtAutoRcc_h -#define cmQtAutoRcc_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ * @return true on success */ bool cmQtAutoRcc(cm::string_view infoFile, cm::string_view config); - -#endif diff --git a/Source/cmRST.h b/Source/cmRST.h index 6b5d416..17cdfe8 100644 --- a/Source/cmRST.h +++ b/Source/cmRST.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef _cmRST_h -#define _cmRST_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -97,5 +96,3 @@ private: std::set<std::string> Replaced; std::string ReplaceName; }; - -#endif diff --git a/Source/cmRange.h b/Source/cmRange.h index 3be5193..30af7d2 100644 --- a/Source/cmRange.h +++ b/Source/cmRange.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmRange_h -#define cmRange_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -235,5 +234,3 @@ auto cmReverseRange(Range const& range) -> cmRange<decltype(range.rbegin())> { return { range.rbegin(), range.rend() }; } - -#endif diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h index fb72ab5..37bfd8c 100644 --- a/Source/cmRemoveCommand.h +++ b/Source/cmRemoveCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmRemoveCommand_h -#define cmRemoveCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -17,5 +16,3 @@ class cmExecutionStatus; */ bool cmRemoveCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h index 868416b..8d0fe18 100644 --- a/Source/cmRemoveDefinitionsCommand.h +++ b/Source/cmRemoveDefinitionsCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmRemoveDefinitionsCommand_h -#define cmRemoveDefinitionsCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmRemoveDefinitionsCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h index 2404a36..abae1a4 100644 --- a/Source/cmReturnCommand.h +++ b/Source/cmReturnCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmReturnCommand_h -#define cmReturnCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -13,5 +12,3 @@ class cmExecutionStatus; /// Return from a directory or function bool cmReturnCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h index 96e731f..dfce8bb 100644 --- a/Source/cmRulePlaceholderExpander.h +++ b/Source/cmRulePlaceholderExpander.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmRulePlaceholderExpander_h -#define cmRulePlaceholderExpander_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -85,5 +84,3 @@ private: std::string CompilerSysroot; std::string LinkerSysroot; }; - -#endif diff --git a/Source/cmRuntimeDependencyArchive.h b/Source/cmRuntimeDependencyArchive.h index 9e2dfb6..7f3b8e9 100644 --- a/Source/cmRuntimeDependencyArchive.h +++ b/Source/cmRuntimeDependencyArchive.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmRuntimeDependencyArchive_h -#define cmRuntimeDependencyArchive_h +#pragma once #include <map> #include <memory> @@ -66,5 +65,3 @@ private: std::map<std::string, std::set<std::string>> ResolvedPaths; std::set<std::string> UnresolvedPaths; }; - -#endif // cmRuntimeDependencyArchive_h diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h index 7d676c9..46d794c 100644 --- a/Source/cmScriptGenerator.h +++ b/Source/cmScriptGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmScriptGenerator_h -#define cmScriptGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -90,5 +89,3 @@ private: void GenerateScriptActionsOnce(std::ostream& os, Indent indent); void GenerateScriptActionsPerConfig(std::ostream& os, Indent indent); }; - -#endif diff --git a/Source/cmSearchPath.h b/Source/cmSearchPath.h index 3ecc73b..c15cb97 100644 --- a/Source/cmSearchPath.h +++ b/Source/cmSearchPath.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmSearchPath_h -#define cmSearchPath_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -50,5 +49,3 @@ protected: cmFindCommon* FC; std::vector<std::string> Paths; }; - -#endif diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h index e000c51..d284a40 100644 --- a/Source/cmSeparateArgumentsCommand.h +++ b/Source/cmSeparateArgumentsCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmSeparateArgumentsCommand_h -#define cmSeparateArgumentsCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -17,5 +16,3 @@ class cmExecutionStatus; */ bool cmSeparateArgumentsCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h index 0973d33..695b185 100644 --- a/Source/cmSetCommand.h +++ b/Source/cmSetCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmSetCommand_h -#define cmSetCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -17,5 +16,3 @@ class cmExecutionStatus; */ bool cmSetCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h index c243dd7..f5b6406 100644 --- a/Source/cmSetDirectoryPropertiesCommand.h +++ b/Source/cmSetDirectoryPropertiesCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmSetDirectoryPropertiesCommand_h -#define cmSetDirectoryPropertiesCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmSetDirectoryPropertiesCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h index af566a3..89fdd9a 100644 --- a/Source/cmSetPropertyCommand.h +++ b/Source/cmSetPropertyCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmSetsPropertiesCommand_h -#define cmSetsPropertiesCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -41,5 +40,3 @@ void MakeSourceFilePathsAbsoluteIfNeeded( std::vector<std::string>::const_iterator files_it_begin, std::vector<std::string>::const_iterator files_it_end, bool needed); } - -#endif diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h index 5eef785..8f88522 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.h +++ b/Source/cmSetSourceFilesPropertiesCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmSetSourceFilesPropertiesCommand_h -#define cmSetSourceFilesPropertiesCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmSetSourceFilesPropertiesCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index 9d40c74..0c04f31 100644 --- a/Source/cmSetTargetPropertiesCommand.h +++ b/Source/cmSetTargetPropertiesCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmSetTargetsPropertiesCommand_h -#define cmSetTargetsPropertiesCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmSetTargetPropertiesCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h index 4b75464..b4f1641 100644 --- a/Source/cmSetTestsPropertiesCommand.h +++ b/Source/cmSetTestsPropertiesCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmSetTestsPropertiesCommand_h -#define cmSetTestsPropertiesCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmSetTestsPropertiesCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h index e8fc608..432ba37 100644 --- a/Source/cmSiteNameCommand.h +++ b/Source/cmSiteNameCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmSiteNameCommand_h -#define cmSiteNameCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -17,5 +16,3 @@ class cmExecutionStatus; */ bool cmSiteNameCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index e669015..39ea8e3 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmSourceFile_h -#define cmSourceFile_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -161,5 +160,3 @@ private: #define CM_PCH_REGEX "cmake_pch(_[^.]+)?\\.(h|hxx)$" #define CM_RESOURCE_REGEX "\\.(pdf|plist|png|jpeg|jpg|storyboard|xcassets)$" - -#endif diff --git a/Source/cmSourceFileLocation.h b/Source/cmSourceFileLocation.h index 87040b8..b373d3d 100644 --- a/Source/cmSourceFileLocation.h +++ b/Source/cmSourceFileLocation.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmSourceFileLocation_h -#define cmSourceFileLocation_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -102,5 +101,3 @@ private: void Update(cmSourceFileLocation const& loc); void UpdateExtension(const std::string& name); }; - -#endif diff --git a/Source/cmSourceFileLocationKind.h b/Source/cmSourceFileLocationKind.h index dd4c6dd..73108f1 100644 --- a/Source/cmSourceFileLocationKind.h +++ b/Source/cmSourceFileLocationKind.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmSourceFileLocationKind_h -#define cmSourceFileLocationKind_h +#pragma once enum class cmSourceFileLocationKind { @@ -11,5 +10,3 @@ enum class cmSourceFileLocationKind // extensions or absolute path. Known }; - -#endif diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h index 623cded..295240d 100644 --- a/Source/cmSourceGroup.h +++ b/Source/cmSourceGroup.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmSourceGroup_h -#define cmSourceGroup_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -125,5 +124,3 @@ private: std::unique_ptr<cmSourceGroupInternals> Internal; }; - -#endif diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h index ad39701..44e1f8e 100644 --- a/Source/cmSourceGroupCommand.h +++ b/Source/cmSourceGroupCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmSourceGroupCommand_h -#define cmSourceGroupCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmSourceGroupCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmStandardLevelResolver.h b/Source/cmStandardLevelResolver.h index 959a5f9..d84fbcb 100644 --- a/Source/cmStandardLevelResolver.h +++ b/Source/cmStandardLevelResolver.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmStandardLevelResolver_h -#define cmStandardLevelResolver_h +#pragma once #include <string> @@ -56,4 +55,3 @@ private: cmMakefile* Makefile; }; -#endif diff --git a/Source/cmStandardLexer.h b/Source/cmStandardLexer.h index e0b2116..0203779 100644 --- a/Source/cmStandardLexer.h +++ b/Source/cmStandardLexer.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmStandardLexer_h -#define cmStandardLexer_h +#pragma once #if defined(__linux) /* Needed for glibc < 2.12 */ @@ -74,5 +73,3 @@ typedef KWIML_INT_int16_t flex_int16_t; typedef KWIML_INT_uint16_t flex_uint16_t; typedef KWIML_INT_int32_t flex_int32_t; typedef KWIML_INT_uint32_t flex_uint32_t; - -#endif diff --git a/Source/cmState.h b/Source/cmState.h index 885496a..14870eb 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmState_h -#define cmState_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -249,5 +248,3 @@ private: bool NinjaMulti = false; Mode CurrentMode = Unknown; }; - -#endif diff --git a/Source/cmStateDirectory.h b/Source/cmStateDirectory.h index 765af6f..56a262d 100644 --- a/Source/cmStateDirectory.h +++ b/Source/cmStateDirectory.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmStateDirectory_h -#define cmStateDirectory_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -104,5 +103,3 @@ private: cmStateSnapshot Snapshot_; friend class cmStateSnapshot; }; - -#endif diff --git a/Source/cmStatePrivate.h b/Source/cmStatePrivate.h index 4efaf97..4892644 100644 --- a/Source/cmStatePrivate.h +++ b/Source/cmStatePrivate.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmStatePrivate_h -#define cmStatePrivate_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -99,5 +98,3 @@ struct cmStateDetail::BuildsystemDirectoryStateType std::vector<cmStateSnapshot> Children; }; - -#endif diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index ddd2222..1e20abb 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -411,8 +411,7 @@ void cmStateSnapshot::InitializeFromParent() parent->BuildSystemDirectory->Properties.GetPropertyValue( "INCLUDE_REGULAR_EXPRESSION"); this->Position->BuildSystemDirectory->Properties.SetProperty( - "INCLUDE_REGULAR_EXPRESSION", - include_regex ? include_regex->c_str() : nullptr); + "INCLUDE_REGULAR_EXPRESSION", cmToCStr(include_regex)); } cmState* cmStateSnapshot::GetState() const diff --git a/Source/cmStateSnapshot.h b/Source/cmStateSnapshot.h index 36d6d3d..d06cba3 100644 --- a/Source/cmStateSnapshot.h +++ b/Source/cmStateSnapshot.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmStateSnapshot_h -#define cmStateSnapshot_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -87,5 +86,3 @@ private: bool operator==(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs); bool operator!=(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs); - -#endif diff --git a/Source/cmStateTypes.h b/Source/cmStateTypes.h index d089ea7..b8c1cca 100644 --- a/Source/cmStateTypes.h +++ b/Source/cmStateTypes.h @@ -1,8 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmStateTypes_h -#define cmStateTypes_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -60,5 +59,3 @@ enum ArtifactType ImportLibraryArtifact }; } - -#endif diff --git a/Source/cmString.hxx b/Source/cmString.hxx index 40fe20d..b41b960 100644 --- a/Source/cmString.hxx +++ b/Source/cmString.hxx @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmString_hxx -#define cmString_hxx +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -928,5 +927,3 @@ struct hash<cm::String> } }; } - -#endif diff --git a/Source/cmStringAlgorithms.cxx b/Source/cmStringAlgorithms.cxx index 71d28a4..e0af281 100644 --- a/Source/cmStringAlgorithms.cxx +++ b/Source/cmStringAlgorithms.cxx @@ -7,6 +7,7 @@ #include <cstddef> // IWYU pragma: keep #include <cstdio> #include <cstdlib> +#include <iterator> std::string cmTrimWhitespace(cm::string_view str) { @@ -323,3 +324,52 @@ bool cmStrToULong(std::string const& str, unsigned long* value) { return cmStrToULong(str.c_str(), value); } + +template <typename Range> +std::size_t getJoinedLength(Range const& rng, cm::string_view separator) +{ + std::size_t rangeLength{}; + for (auto const& item : rng) { + rangeLength += item.size(); + } + + auto const separatorsLength = (rng.size() - 1) * separator.size(); + + return rangeLength + separatorsLength; +} + +template <typename Range> +std::string cmJoinImpl(Range const& rng, cm::string_view separator, + cm::string_view initial) +{ + if (rng.empty()) { + return { std::begin(initial), std::end(initial) }; + } + + std::string result; + result.reserve(initial.size() + getJoinedLength(rng, separator)); + result.append(std::begin(initial), std::end(initial)); + + auto begin = std::begin(rng); + auto end = std::end(rng); + result += *begin; + + for (++begin; begin != end; ++begin) { + result.append(std::begin(separator), std::end(separator)); + result += *begin; + } + + return result; +} + +std::string cmJoin(std::vector<std::string> const& rng, + cm::string_view separator, cm::string_view initial) +{ + return cmJoinImpl(rng, separator, initial); +} + +std::string cmJoin(cmStringRange const& rng, cm::string_view separator, + cm::string_view initial) +{ + return cmJoinImpl(rng, separator, initial); +} diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h index 4b0090b..f3c262b 100644 --- a/Source/cmStringAlgorithms.h +++ b/Source/cmStringAlgorithms.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmStringAlgorithms_h -#define cmStringAlgorithms_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -81,6 +80,17 @@ std::string cmJoin(Range const& rng, cm::string_view separator) return os.str(); } +/** + * Faster overloads for std::string ranges. + * If @a initial is provided, it prepends the resulted string without + * @a separator between them. + */ +std::string cmJoin(std::vector<std::string> const& rng, + cm::string_view separator, cm::string_view initial = {}); + +std::string cmJoin(cmStringRange const& rng, cm::string_view separator, + cm::string_view initial = {}); + /** Extract tokens that are separated by any of the characters in @a sep. */ std::vector<std::string> cmTokenize(cm::string_view str, cm::string_view sep); @@ -306,5 +316,3 @@ bool cmStrToLong(std::string const& str, long* value); * integer */ bool cmStrToULong(const char* str, unsigned long* value); bool cmStrToULong(std::string const& str, unsigned long* value); - -#endif diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 653b383..4000a7d 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -11,6 +11,7 @@ #include <memory> #include <cm/iterator> +#include <cm/string_view> #include <cmext/string_view> #include "cmsys/RegularExpression.hxx" @@ -534,11 +535,14 @@ bool HandleAppendCommand(std::vector<std::string> const& args, return true; } - const std::string& variable = args[1]; + auto const& variableName = args[1]; + + cm::string_view oldView{ status.GetMakefile().GetSafeDefinition( + variableName) }; + + auto const newValue = cmJoin(cmMakeRange(args).advance(2), {}, oldView); + status.GetMakefile().AddDefinition(variableName, newValue); - std::string value = status.GetMakefile().GetSafeDefinition(variable); - value += cmJoin(cmMakeRange(args).advance(2), std::string()); - status.GetMakefile().AddDefinition(variable, value); return true; } diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h index bd71ba2..5320ea5 100644 --- a/Source/cmStringCommand.h +++ b/Source/cmStringCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmStringCommand_h -#define cmStringCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -16,5 +15,3 @@ class cmExecutionStatus; */ bool cmStringCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmStringReplaceHelper.h b/Source/cmStringReplaceHelper.h index 74d481d..fd59d17 100644 --- a/Source/cmStringReplaceHelper.h +++ b/Source/cmStringReplaceHelper.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmStringReplaceHelper_h -#define cmStringReplaceHelper_h +#pragma once #include <string> #include <utility> @@ -64,5 +63,3 @@ private: std::vector<RegexReplacement> Replacements; cmMakefile* Makefile = nullptr; }; - -#endif diff --git a/Source/cmSubcommandTable.h b/Source/cmSubcommandTable.h index 7deaaed..80d8c6d 100644 --- a/Source/cmSubcommandTable.h +++ b/Source/cmSubcommandTable.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmSubcommandTable_h -#define cmSubcommandTable_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -32,5 +31,3 @@ public: private: std::vector<Elem> Impl; }; - -#endif diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h index 3254e84..6770874 100644 --- a/Source/cmSubdirCommand.h +++ b/Source/cmSubdirCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmSubdirCommand_h -#define cmSubdirCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmSubdirCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h index bf99bd1..133d702 100644 --- a/Source/cmSubdirDependsCommand.h +++ b/Source/cmSubdirDependsCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmSubdirDependsCommand_h -#define cmSubdirDependsCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmSubdirDependsCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 3e30b40..1362af8 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmSystemTools_h -#define cmSystemTools_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -465,5 +464,3 @@ private: static bool s_FatalErrorOccured; static bool s_DisableRunCommandOutput; }; - -#endif diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ba648b7..7e8e931 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1330,7 +1330,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) cmStrCat(reusedFrom, ".dir/")); cmProp tmp = reusedTarget->GetProperty("COMPILE_PDB_NAME"); - this->SetProperty("COMPILE_PDB_NAME", tmp ? tmp->c_str() : nullptr); + this->SetProperty("COMPILE_PDB_NAME", cmToCStr(tmp)); this->AddUtility(reusedFrom, false, impl->Makefile); } else if (prop == propC_STANDARD || prop == propCXX_STANDARD || prop == propCUDA_STANDARD || prop == propOBJC_STANDARD || diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 43f1887..d8f66bc 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTarget_h -#define cmTarget_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -291,5 +290,3 @@ private: private: std::unique_ptr<cmTargetInternals> impl; }; - -#endif diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h index 05ff092..54a20fd 100644 --- a/Source/cmTargetCompileDefinitionsCommand.h +++ b/Source/cmTargetCompileDefinitionsCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTargetCompileDefinitionsCommand_h -#define cmTargetCompileDefinitionsCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmTargetCompileDefinitionsCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmTargetCompileFeaturesCommand.h b/Source/cmTargetCompileFeaturesCommand.h index db0c04b..9dbf486 100644 --- a/Source/cmTargetCompileFeaturesCommand.h +++ b/Source/cmTargetCompileFeaturesCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTargetCompileFeaturesCommand_h -#define cmTargetCompileFeaturesCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmTargetCompileFeaturesCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmTargetCompileOptionsCommand.h b/Source/cmTargetCompileOptionsCommand.h index 3ab1a89..1f7c684 100644 --- a/Source/cmTargetCompileOptionsCommand.h +++ b/Source/cmTargetCompileOptionsCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTargetCompileOptionsCommand_h -#define cmTargetCompileOptionsCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmTargetCompileOptionsCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmTargetDepend.h b/Source/cmTargetDepend.h index 5452cc7..36702bd 100644 --- a/Source/cmTargetDepend.h +++ b/Source/cmTargetDepend.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTargetDepend_h -#define cmTargetDepend_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -60,5 +59,3 @@ public: class cmTargetDependSet : public std::set<cmTargetDepend> { }; - -#endif diff --git a/Source/cmTargetExport.h b/Source/cmTargetExport.h index 9304eab..cb4d8da 100644 --- a/Source/cmTargetExport.h +++ b/Source/cmTargetExport.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTargetExport_h -#define cmTargetExport_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -33,5 +32,3 @@ public: std::string InterfaceIncludeDirectories; ///@} }; - -#endif diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h index 9958f41..223da7d 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.h +++ b/Source/cmTargetIncludeDirectoriesCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTargetIncludeDirectoriesCommand_h -#define cmTargetIncludeDirectoriesCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmTargetIncludeDirectoriesCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmTargetLinkDirectoriesCommand.h b/Source/cmTargetLinkDirectoriesCommand.h index 3724d6c..e305709 100644 --- a/Source/cmTargetLinkDirectoriesCommand.h +++ b/Source/cmTargetLinkDirectoriesCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTargetLinkDirectoriesCommand_h -#define cmTargetLinkDirectoriesCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmTargetLinkDirectoriesCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index 4b2deab..bc76f3e 100644 --- a/Source/cmTargetLinkLibrariesCommand.h +++ b/Source/cmTargetLinkLibrariesCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTargetLinkLibrariesCommand_h -#define cmTargetLinkLibrariesCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmTargetLinkLibraryType.h b/Source/cmTargetLinkLibraryType.h index 192c6da..16ac41a 100644 --- a/Source/cmTargetLinkLibraryType.h +++ b/Source/cmTargetLinkLibraryType.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTargetLinkLibraryType_h -#define cmTargetLinkLibraryType_h +#pragma once enum cmTargetLinkLibraryType { @@ -9,5 +8,3 @@ enum cmTargetLinkLibraryType DEBUG_LibraryType, OPTIMIZED_LibraryType }; - -#endif diff --git a/Source/cmTargetLinkOptionsCommand.h b/Source/cmTargetLinkOptionsCommand.h index 13fb40c..fbe7d49 100644 --- a/Source/cmTargetLinkOptionsCommand.h +++ b/Source/cmTargetLinkOptionsCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTargetLinkOptionsCommand_h -#define cmTargetLinkOptionsCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmTargetLinkOptionsCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmTargetPrecompileHeadersCommand.h b/Source/cmTargetPrecompileHeadersCommand.h index 8b0ac97..dd08a6d 100644 --- a/Source/cmTargetPrecompileHeadersCommand.h +++ b/Source/cmTargetPrecompileHeadersCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTargetPrecompileHeadersCommand_h -#define cmTargetPrecompileHeadersCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmTargetPrecompileHeadersCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmTargetPropCommandBase.h b/Source/cmTargetPropCommandBase.h index 601ad01..50ac1aa 100644 --- a/Source/cmTargetPropCommandBase.h +++ b/Source/cmTargetPropCommandBase.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTargetPropCommandBase_h -#define cmTargetPropCommandBase_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -58,5 +57,3 @@ private: cmExecutionStatus& Status; }; - -#endif diff --git a/Source/cmTargetPropertyComputer.h b/Source/cmTargetPropertyComputer.h index bafa43b..f2be318 100644 --- a/Source/cmTargetPropertyComputer.h +++ b/Source/cmTargetPropertyComputer.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTargetPropertyComputer_h -#define cmTargetPropertyComputer_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -101,5 +100,3 @@ private: static cmProp GetSources(Target const* tgt, cmMessenger* messenger, cmListFileBacktrace const& context); }; - -#endif diff --git a/Source/cmTargetSourcesCommand.h b/Source/cmTargetSourcesCommand.h index 5eecf34..306226c 100644 --- a/Source/cmTargetSourcesCommand.h +++ b/Source/cmTargetSourcesCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTargetSourcesCommand_h -#define cmTargetSourcesCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmTargetSourcesCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmTest.h b/Source/cmTest.h index 72d4ed9..f33b7e2 100644 --- a/Source/cmTest.h +++ b/Source/cmTest.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTest_h -#define cmTest_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -66,5 +65,3 @@ private: cmMakefile* Makefile; cmListFileBacktrace Backtrace; }; - -#endif diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h index e388c16..6903140 100644 --- a/Source/cmTestGenerator.h +++ b/Source/cmTestGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTestGenerator_h -#define cmTestGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -56,5 +55,3 @@ protected: cmTest* Test; bool TestGenerated; }; - -#endif diff --git a/Source/cmTimestamp.h b/Source/cmTimestamp.h index 40338f8..8941abe 100644 --- a/Source/cmTimestamp.h +++ b/Source/cmTimestamp.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTimestamp_h -#define cmTimestamp_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -30,5 +29,3 @@ private: std::string AddTimestampComponent(char flag, struct tm& timeStruct, time_t timeT) const; }; - -#endif diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h index e525e85..d8cc16e 100644 --- a/Source/cmTryCompileCommand.h +++ b/Source/cmTryCompileCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTryCompileCommand_h -#define cmTryCompileCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -38,5 +37,3 @@ public: bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus& status) override; }; - -#endif diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h index c53a694..070c63c 100644 --- a/Source/cmTryRunCommand.h +++ b/Source/cmTryRunCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmTryRunCommand_h -#define cmTryRunCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -51,5 +50,3 @@ private: std::string RunOutputVariable; std::string CompileOutputVariable; }; - -#endif diff --git a/Source/cmUVProcessChain.h b/Source/cmUVProcessChain.h index b5ccb19..5e8e7e6 100644 --- a/Source/cmUVProcessChain.h +++ b/Source/cmUVProcessChain.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmUVProcessChain_h -#define cmUVProcessChain_h +#pragma once #include <array> #include <cstddef> // IWYU pragma: keep @@ -96,5 +95,3 @@ private: struct InternalData; std::unique_ptr<InternalData> Data; }; - -#endif diff --git a/Source/cmUVStreambuf.h b/Source/cmUVStreambuf.h index 50faede..efe45de 100644 --- a/Source/cmUVStreambuf.h +++ b/Source/cmUVStreambuf.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmUVStreambuf_h -#define cmUVStreambuf_h +#pragma once #include <algorithm> #include <cstring> @@ -215,5 +214,3 @@ void cmBasicUVStreambuf<CharT, Traits>::StreamRead(ssize_t nread) } using cmUVStreambuf = cmBasicUVStreambuf<char>; - -#endif diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h index be4c166..3faa053 100644 --- a/Source/cmUnsetCommand.h +++ b/Source/cmUnsetCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmUnsetCommand_h -#define cmUnsetCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -17,5 +16,3 @@ class cmExecutionStatus; */ bool cmUnsetCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h index 215e4a3..5670c5d 100644 --- a/Source/cmUseMangledMesaCommand.h +++ b/Source/cmUseMangledMesaCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmUseMangledMesaCommand_h -#define cmUseMangledMesaCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmUseMangledMesaCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h index 934d539..8cf7e7f 100644 --- a/Source/cmUtilitySourceCommand.h +++ b/Source/cmUtilitySourceCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmUtilitySourceCommand_h -#define cmUtilitySourceCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmUtilitySourceCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmUtils.hxx b/Source/cmUtils.hxx index a7a3e81..733e72f 100644 --- a/Source/cmUtils.hxx +++ b/Source/cmUtils.hxx @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmUtils_hxx -#define cmUtils_hxx +#pragma once #include "cmsys/SystemTools.hxx" @@ -13,5 +12,3 @@ inline bool isCMakeVerbose() return (cmSystemTools::HasEnv("VERBOSE") && !cmSystemTools::HasEnv("CMAKE_NO_VERBOSE")); } - -#endif diff --git a/Source/cmUuid.h b/Source/cmUuid.h index 7de20dd..f5f724d 100644 --- a/Source/cmUuid.h +++ b/Source/cmUuid.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmUuid_h -#define cmUuid_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -41,5 +40,3 @@ private: bool IntFromHexDigit(char input, char& output) const; }; - -#endif diff --git a/Source/cmVSSetupHelper.h b/Source/cmVSSetupHelper.h index a926eee..04ea46d 100644 --- a/Source/cmVSSetupHelper.h +++ b/Source/cmVSSetupHelper.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmVSSetupHelper_h -#define cmVSSetupHelper_h +#pragma once #ifndef NOMINMAX # define NOMINMAX // Undefine min and max defined by windows.h @@ -136,5 +135,3 @@ private: std::string SpecifiedVSInstallLocation; }; - -#endif diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h index fb0520e..c6bfe8a 100644 --- a/Source/cmVariableRequiresCommand.h +++ b/Source/cmVariableRequiresCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmVariableRequiresCommand_h -#define cmVariableRequiresCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -12,5 +11,3 @@ class cmExecutionStatus; bool cmVariableRequiresCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h index 6c418ed..349ce0e 100644 --- a/Source/cmVariableWatch.h +++ b/Source/cmVariableWatch.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmVariableWatch_h -#define cmVariableWatch_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -81,5 +80,3 @@ protected: StringToVectorOfPairs WatchMap; }; - -#endif diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h index 3f9f244..4477cb7 100644 --- a/Source/cmVariableWatchCommand.h +++ b/Source/cmVariableWatchCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmVariableWatchCommand_h -#define cmVariableWatchCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -16,5 +15,3 @@ class cmExecutionStatus; */ bool cmVariableWatchCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmVersion.h b/Source/cmVersion.h index 932ef04..9072c9f 100644 --- a/Source/cmVersion.h +++ b/Source/cmVersion.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmVersion_h -#define cmVersion_h +#pragma once #include <cm3p/kwiml/int.h> @@ -30,5 +29,3 @@ public: ((((major)*1000u) * CMake_VERSION_ENCODE__BASE) + \ (((minor) % 1000u) * CMake_VERSION_ENCODE__BASE) + \ (((patch) % CMake_VERSION_ENCODE__BASE))) - -#endif diff --git a/Source/cmVersionMacros.h b/Source/cmVersionMacros.h index e8ac4f8..f33f0df 100644 --- a/Source/cmVersionMacros.h +++ b/Source/cmVersionMacros.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmVersionMacros_h -#define cmVersionMacros_h +#pragma once #include "cmVersionConfig.h" @@ -9,5 +8,3 @@ #if CMake_VERSION_PATCH_IS_RELEASE(CMake_VERSION_PATCH) # define CMake_VERSION_IS_RELEASE 1 #endif - -#endif diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index dc61def..0b2b5d9 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -515,7 +515,7 @@ void cmVisualStudio10TargetGenerator::Generate() p = this->GeneratorTarget->GetProperty( "DOTNET_TARGET_FRAMEWORK_VERSION"); } - const char* targetFrameworkVersion = p ? p->c_str() : nullptr; + const char* targetFrameworkVersion = cmToCStr(p); if (!targetFrameworkVersion && this->ProjectType == csproj && this->GlobalGenerator->TargetsWindowsCE() && this->GlobalGenerator->GetVersion() == diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index c54057a..35dbba8 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmVisualStudioTargetGenerator_h -#define cmVisualStudioTargetGenerator_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -259,5 +258,3 @@ private: ConfigToSettings& toolSettings); std::string GetCMakeFilePath(const char* name) const; }; - -#endif diff --git a/Source/cmVisualStudio10ToolsetOptions.h b/Source/cmVisualStudio10ToolsetOptions.h index 875a35b..85cc2b6 100644 --- a/Source/cmVisualStudio10ToolsetOptions.h +++ b/Source/cmVisualStudio10ToolsetOptions.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmVisualStudio10ToolsetOptions_h -#define cmVisualStudio10ToolsetOptions_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -30,4 +29,3 @@ public: std::string GetToolsetName(std::string const& name, std::string const& toolset) const; }; -#endif diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h index f9b50a7..b123019 100644 --- a/Source/cmVisualStudioGeneratorOptions.h +++ b/Source/cmVisualStudioGeneratorOptions.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmVisualStudioGeneratorOptions_h -#define cmVisualStudioGeneratorOptions_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -100,5 +99,3 @@ private: FlagValue TakeFlag(std::string const& key); }; - -#endif diff --git a/Source/cmVisualStudioSlnData.h b/Source/cmVisualStudioSlnData.h index 5ce7d74..b217bd8 100644 --- a/Source/cmVisualStudioSlnData.h +++ b/Source/cmVisualStudioSlnData.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmVisualStudioSlnData_h -#define cmVisualStudioSlnData_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -50,5 +49,3 @@ private: using ProjectStringIndex = std::map<std::string, ProjectStorage::iterator>; ProjectStringIndex ProjectNameIndex; }; - -#endif diff --git a/Source/cmVisualStudioSlnParser.h b/Source/cmVisualStudioSlnParser.h index 4557cdb..1c33759 100644 --- a/Source/cmVisualStudioSlnParser.h +++ b/Source/cmVisualStudioSlnParser.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmVisualStudioSlnParser_h -#define cmVisualStudioSlnParser_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -103,5 +102,3 @@ protected: bool ParseValue(const std::string& value, ParsedLine& parsedLine); }; - -#endif diff --git a/Source/cmVisualStudioWCEPlatformParser.h b/Source/cmVisualStudioWCEPlatformParser.h index 60a6611..eb4e978 100644 --- a/Source/cmVisualStudioWCEPlatformParser.h +++ b/Source/cmVisualStudioWCEPlatformParser.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmVisualStudioWCEPlatformParser_h -#define cmVisualStudioWCEPlatformParser_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -67,5 +66,3 @@ private: std::string VcInstallDir; std::string VsInstallDir; }; - -#endif diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h index beca652..5b8f078 100644 --- a/Source/cmWhileCommand.h +++ b/Source/cmWhileCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmWhileCommand_h -#define cmWhileCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -13,5 +12,3 @@ struct cmListFileArgument; /// \brief Starts a while loop bool cmWhileCommand(std::vector<cmListFileArgument> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmWorkerPool.h b/Source/cmWorkerPool.h index 9179922..0fb6707 100644 --- a/Source/cmWorkerPool.h +++ b/Source/cmWorkerPool.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmWorkerPool_h -#define cmWorkerPool_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -221,5 +220,3 @@ private: unsigned int ThreadCount_ = 1; std::unique_ptr<cmWorkerPoolInternal> Int_; }; - -#endif diff --git a/Source/cmWorkingDirectory.h b/Source/cmWorkingDirectory.h index 4c7576d..c8adea9 100644 --- a/Source/cmWorkingDirectory.h +++ b/Source/cmWorkingDirectory.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmWorkingDirectory_h -#define cmWorkingDirectory_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -43,5 +42,3 @@ private: std::string OldDir; int ResultCode; }; - -#endif diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h index 3e0e043..0225e4f 100644 --- a/Source/cmWriteFileCommand.h +++ b/Source/cmWriteFileCommand.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmWriteFileCommand_h -#define cmWriteFileCommand_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -16,5 +15,3 @@ class cmExecutionStatus; */ bool cmWriteFileCommand(std::vector<std::string> const& args, cmExecutionStatus& status); - -#endif diff --git a/Source/cmXCode21Object.h b/Source/cmXCode21Object.h index 76fad23..eb017447 100644 --- a/Source/cmXCode21Object.h +++ b/Source/cmXCode21Object.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmXCode21Object_h -#define cmXCode21Object_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -21,4 +20,3 @@ public: static void PrintList(std::vector<std::unique_ptr<cmXCodeObject>> const&, std::ostream& out); }; -#endif diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index 282cca5..78d4727 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmXCodeObject_h -#define cmXCodeObject_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -171,4 +170,3 @@ protected: std::map<std::string, StringVec> DependTargets; std::map<std::string, cmXCodeObject*> ObjectAttributes; }; -#endif diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h index da40856..11f043e 100644 --- a/Source/cmXCodeScheme.h +++ b/Source/cmXCodeScheme.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmXCodeScheme_h -#define cmXCodeScheme_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -74,5 +73,3 @@ private: static bool IsExecutable(const cmXCodeObject* target); }; - -#endif diff --git a/Source/cmXMLParser.h b/Source/cmXMLParser.h index 1bc8d64..7e805d7 100644 --- a/Source/cmXMLParser.h +++ b/Source/cmXMLParser.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmXMLParser_h -#define cmXMLParser_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -107,5 +106,3 @@ protected: friend void cmXMLParserEndElement(void*, const char*); friend void cmXMLParserCharacterDataHandler(void*, const char*, int); }; - -#endif diff --git a/Source/cmXMLSafe.h b/Source/cmXMLSafe.h index 9aaf2d1..9b4c539 100644 --- a/Source/cmXMLSafe.h +++ b/Source/cmXMLSafe.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmXMLSafe_h -#define cmXMLSafe_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -33,5 +32,3 @@ private: bool DoQuotes; friend std::ostream& operator<<(std::ostream&, cmXMLSafe const&); }; - -#endif diff --git a/Source/cmXMLWriter.h b/Source/cmXMLWriter.h index 00ea08c..a16c4c8 100644 --- a/Source/cmXMLWriter.h +++ b/Source/cmXMLWriter.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmXMLWiter_h -#define cmXMLWiter_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -196,5 +195,3 @@ public: private: cmXMLWriter& xmlwr; }; - -#endif diff --git a/Source/cm_codecvt.hxx b/Source/cm_codecvt.hxx index b2cb9e6..1860211 100644 --- a/Source/cm_codecvt.hxx +++ b/Source/cm_codecvt.hxx @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_codecvt_hxx -#define cm_codecvt_hxx +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -62,5 +61,3 @@ private: #endif }; - -#endif diff --git a/Source/cm_get_date.h b/Source/cm_get_date.h index 38a690e..65722df 100644 --- a/Source/cm_get_date.h +++ b/Source/cm_get_date.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_get_date_h -#define cm_get_date_h +#pragma once #include <time.h> /* NOLINT(modernize-deprecated-headers) */ @@ -15,5 +14,3 @@ time_t cm_get_date(time_t now, const char* str); #ifdef __cplusplus } /* extern "C" */ #endif - -#endif diff --git a/Source/cm_sys_stat.h b/Source/cm_sys_stat.h index 9194286..c4e3d84 100644 --- a/Source/cm_sys_stat.h +++ b/Source/cm_sys_stat.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_sys_stat_h -#define cm_sys_stat_h +#pragma once #if defined(_MSC_VER) using mode_t = unsigned short; @@ -10,5 +9,3 @@ using mode_t = unsigned short; #include <sys/types.h> // include sys/stat.h after sys/types.h #include <sys/stat.h> // IWYU pragma: export - -#endif diff --git a/Source/cm_utf8.h b/Source/cm_utf8.h index 27dc559..fa9ed3a 100644 --- a/Source/cm_utf8.h +++ b/Source/cm_utf8.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_utf8_h -#define cm_utf8_h +#pragma once #ifdef __cplusplus extern "C" { @@ -20,5 +19,3 @@ int cm_utf8_is_valid(const char* s); #ifdef __cplusplus } /* extern "C" */ #endif - -#endif diff --git a/Source/cmake.h b/Source/cmake.h index 06ab8ac..44c35c2 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmake_h -#define cmake_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -782,5 +781,3 @@ private: F(cuda_std_14) \ F(cuda_std_17) \ F(cuda_std_20) - -#endif diff --git a/Source/cmcmd.h b/Source/cmcmd.h index 5b6c813..605df23 100644 --- a/Source/cmcmd.h +++ b/Source/cmcmd.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmcmd_h -#define cmcmd_h +#pragma once #include "cmConfigure.h" // IWYU pragma: keep @@ -36,5 +35,3 @@ protected: static int RunLLVMRC(std::vector<std::string> const& args); static int VisualStudioLink(std::vector<std::string> const& args, int type); }; - -#endif diff --git a/Tests/CMakeLib/testOptional.cxx b/Tests/CMakeLib/testOptional.cxx index c6bc9c2..de09c0f 100644 --- a/Tests/CMakeLib/testOptional.cxx +++ b/Tests/CMakeLib/testOptional.cxx @@ -29,6 +29,13 @@ public: CONST_RVALUE_REFERENCE, SWAP, + + COMPARE_EE_EQ, + COMPARE_EE_NE, + COMPARE_EE_LT, + COMPARE_EE_LE, + COMPARE_EE_GT, + COMPARE_EE_GE, }; EventType Type; @@ -75,6 +82,14 @@ public: int Value = 0; }; +#define ASSERT_TRUE(x) \ + do { \ + if (!(x)) { \ + std::cout << "ASSERT_TRUE(" #x ") failed on line " << __LINE__ << "\n"; \ + return false; \ + } \ + } while (false) + // Certain builds of GCC generate false -Wmaybe-uninitialized warnings when // doing a release build with the system version of std::optional. These // warnings do not manifest when using our own cm::optional implementation. @@ -153,6 +168,42 @@ EventLogger& EventLogger::operator=(int value) return *this; } +bool operator==(const EventLogger& lhs, const EventLogger& rhs) +{ + events.push_back({ Event::COMPARE_EE_EQ, &lhs, &rhs, lhs.Value }); + return lhs.Value == rhs.Value; +} + +bool operator!=(const EventLogger& lhs, const EventLogger& rhs) +{ + events.push_back({ Event::COMPARE_EE_NE, &lhs, &rhs, lhs.Value }); + return lhs.Value != rhs.Value; +} + +bool operator<(const EventLogger& lhs, const EventLogger& rhs) +{ + events.push_back({ Event::COMPARE_EE_LT, &lhs, &rhs, lhs.Value }); + return lhs.Value < rhs.Value; +} + +bool operator<=(const EventLogger& lhs, const EventLogger& rhs) +{ + events.push_back({ Event::COMPARE_EE_LE, &lhs, &rhs, lhs.Value }); + return lhs.Value <= rhs.Value; +} + +bool operator>(const EventLogger& lhs, const EventLogger& rhs) +{ + events.push_back({ Event::COMPARE_EE_GT, &lhs, &rhs, lhs.Value }); + return lhs.Value > rhs.Value; +} + +bool operator>=(const EventLogger& lhs, const EventLogger& rhs) +{ + events.push_back({ Event::COMPARE_EE_GE, &lhs, &rhs, lhs.Value }); + return lhs.Value >= rhs.Value; +} + void EventLogger::Reference() & { events.push_back({ Event::REFERENCE, this, nullptr, this->Value }); @@ -368,42 +419,23 @@ static bool testDereference(std::vector<Event>& expected) static bool testHasValue(std::vector<Event>& expected) { - bool retval = true; - const cm::optional<EventLogger> o1{ 4 }; const cm::optional<EventLogger> o2{}; - if (!o1.has_value()) { - std::cout << "o1 should have a value" << std::endl; - retval = false; - } - - if (!o1) { - std::cout << "(bool)o1 should be true" << std::endl; - retval = false; - } - - if (o2.has_value()) { - std::cout << "o2 should not have a value" << std::endl; - retval = false; - } - - if (o2) { - std::cout << "(bool)o2 should be false" << std::endl; - retval = false; - } + ASSERT_TRUE(o1.has_value()); + ASSERT_TRUE(o1); + ASSERT_TRUE(!o2.has_value()); + ASSERT_TRUE(!o2); expected = { { Event::VALUE_CONSTRUCT, &*o1, nullptr, 4 }, { Event::DESTRUCT, &*o1, nullptr, 4 }, }; - return retval; + return true; } static bool testValue(std::vector<Event>& expected) { - bool retval = true; - cm::optional<EventLogger> o1{ 4 }; const cm::optional<EventLogger> o2{ 5 }; cm::optional<EventLogger> o3{}; @@ -418,10 +450,7 @@ static bool testValue(std::vector<Event>& expected) } catch (cm::bad_optional_access&) { thrown = true; } - if (!thrown) { - std::cout << "o3.value() did not throw" << std::endl; - retval = false; - } + ASSERT_TRUE(thrown); thrown = false; try { @@ -429,10 +458,7 @@ static bool testValue(std::vector<Event>& expected) } catch (cm::bad_optional_access&) { thrown = true; } - if (!thrown) { - std::cout << "o4.value() did not throw" << std::endl; - retval = false; - } + ASSERT_TRUE(thrown); expected = { { Event::VALUE_CONSTRUCT, &*o1, nullptr, 4 }, @@ -442,13 +468,11 @@ static bool testValue(std::vector<Event>& expected) { Event::DESTRUCT, &*o2, nullptr, 5 }, { Event::DESTRUCT, &*o1, nullptr, 4 }, }; - return retval; + return true; } static bool testValueOr() { - bool retval = true; - const cm::optional<EventLogger> o1{ 4 }; cm::optional<EventLogger> o2{ 5 }; const cm::optional<EventLogger> o3{}; @@ -460,33 +484,133 @@ static bool testValueOr() EventLogger e4{ 9 }; EventLogger r1 = o1.value_or(e1); - if (r1.Value != 4) { - std::cout << "r1.Value should be 4" << std::endl; - retval = false; - } + ASSERT_TRUE(r1.Value == 4); EventLogger r2 = std::move(o2).value_or(e2); - if (r2.Value != 5) { - std::cout << "r2.Value should be 5" << std::endl; - retval = false; - } + ASSERT_TRUE(r2.Value == 5); EventLogger r3 = o3.value_or(e3); - if (r3.Value != 8) { - std::cout << "r3.Value should be 8" << std::endl; - retval = false; - } + ASSERT_TRUE(r3.Value == 8); EventLogger r4 = std::move(o4).value_or(e4); - if (r4.Value != 9) { - std::cout << "r4.Value should be 9" << std::endl; - retval = false; - } + ASSERT_TRUE(r4.Value == 9); - return retval; + return true; } -static bool testSwap(std::vector<Event>& expected) +static bool testComparison(std::vector<Event>& expected) { - bool retval = true; + const cm::optional<EventLogger> o1{ 1 }; + const cm::optional<EventLogger> o2{ 2 }; + const cm::optional<EventLogger> o3{ 2 }; + const cm::optional<EventLogger> o4{}; + const cm::optional<EventLogger> o5{}; + const EventLogger e1{ 2 }; + + ASSERT_TRUE(!(o1 == o2) && o1 != o2); + ASSERT_TRUE(o1 < o2 && !(o1 >= o2)); + ASSERT_TRUE(!(o1 > o2) && o1 <= o2); + + ASSERT_TRUE(o2 == o3 && !(o2 != o3)); + ASSERT_TRUE(!(o2 < o3) && o2 >= o3); + ASSERT_TRUE(!(o2 > o3) && o2 <= o3); + + ASSERT_TRUE(!(o3 == o4) && o3 != o4); + ASSERT_TRUE(!(o3 < o4) && o3 >= o4); + ASSERT_TRUE(o3 > o4 && !(o3 <= o4)); + + ASSERT_TRUE(o4 == o5 && !(o4 != o5)); + ASSERT_TRUE(!(o4 < o5) && o4 >= o5); + ASSERT_TRUE(!(o4 > o5) && o4 <= o5); + + ASSERT_TRUE(!(o1 == cm::nullopt) && o1 != cm::nullopt); + ASSERT_TRUE(!(o1 < cm::nullopt) && o1 >= cm::nullopt); + ASSERT_TRUE(o1 > cm::nullopt && !(o1 <= cm::nullopt)); + + ASSERT_TRUE(!(cm::nullopt == o1) && cm::nullopt != o1); + ASSERT_TRUE(cm::nullopt < o1 && !(cm::nullopt >= o1)); + ASSERT_TRUE(!(cm::nullopt > o1) && cm::nullopt <= o1); + + ASSERT_TRUE(o4 == cm::nullopt && !(o4 != cm::nullopt)); + ASSERT_TRUE(!(o4 < cm::nullopt) && o4 >= cm::nullopt); + ASSERT_TRUE(!(o4 > cm::nullopt) && o4 <= cm::nullopt); + + ASSERT_TRUE(cm::nullopt == o4 && !(cm::nullopt != o4)); + ASSERT_TRUE(!(cm::nullopt < o4) && cm::nullopt >= o4); + ASSERT_TRUE(!(cm::nullopt > o4) && cm::nullopt <= o4); + + ASSERT_TRUE(!(o1 == e1) && o1 != e1); + ASSERT_TRUE(o1 < e1 && !(o1 >= e1)); + ASSERT_TRUE(!(o1 > e1) && o1 <= e1); + + ASSERT_TRUE(o2 == e1 && !(o2 != e1)); + ASSERT_TRUE(!(o2 < e1) && o2 >= e1); + ASSERT_TRUE(!(o2 > e1) && o2 <= e1); + ASSERT_TRUE(!(o4 == e1) && o4 != e1); + ASSERT_TRUE(o4 < e1 && !(o4 >= e1)); + ASSERT_TRUE(!(o4 > e1) && o4 <= e1); + + ASSERT_TRUE(!(e1 == o1) && e1 != o1); + ASSERT_TRUE(!(e1 < o1) && e1 >= o1); + ASSERT_TRUE(e1 > o1 && !(e1 <= o1)); + + ASSERT_TRUE(e1 == o2 && !(e1 != o2)); + ASSERT_TRUE(!(e1 < o2) && e1 >= o2); + ASSERT_TRUE(!(e1 > o2) && e1 <= o2); + + ASSERT_TRUE(!(e1 == o4) && e1 != o4); + ASSERT_TRUE(!(e1 < o4) && e1 >= o4); + ASSERT_TRUE(e1 > o4 && !(e1 <= o4)); + + expected = { + { Event::VALUE_CONSTRUCT, &*o1, nullptr, 1 }, + { Event::VALUE_CONSTRUCT, &*o2, nullptr, 2 }, + { Event::VALUE_CONSTRUCT, &*o3, nullptr, 2 }, + { Event::VALUE_CONSTRUCT, &e1, nullptr, 2 }, + { Event::COMPARE_EE_EQ, &*o1, &*o2, 1 }, + { Event::COMPARE_EE_NE, &*o1, &*o2, 1 }, + { Event::COMPARE_EE_LT, &*o1, &*o2, 1 }, + { Event::COMPARE_EE_GE, &*o1, &*o2, 1 }, + { Event::COMPARE_EE_GT, &*o1, &*o2, 1 }, + { Event::COMPARE_EE_LE, &*o1, &*o2, 1 }, + { Event::COMPARE_EE_EQ, &*o2, &*o3, 2 }, + { Event::COMPARE_EE_NE, &*o2, &*o3, 2 }, + { Event::COMPARE_EE_LT, &*o2, &*o3, 2 }, + { Event::COMPARE_EE_GE, &*o2, &*o3, 2 }, + { Event::COMPARE_EE_GT, &*o2, &*o3, 2 }, + { Event::COMPARE_EE_LE, &*o2, &*o3, 2 }, + { Event::COMPARE_EE_EQ, &*o1, &e1, 1 }, + { Event::COMPARE_EE_NE, &*o1, &e1, 1 }, + { Event::COMPARE_EE_LT, &*o1, &e1, 1 }, + { Event::COMPARE_EE_GE, &*o1, &e1, 1 }, + { Event::COMPARE_EE_GT, &*o1, &e1, 1 }, + { Event::COMPARE_EE_LE, &*o1, &e1, 1 }, + { Event::COMPARE_EE_EQ, &*o2, &e1, 2 }, + { Event::COMPARE_EE_NE, &*o2, &e1, 2 }, + { Event::COMPARE_EE_LT, &*o2, &e1, 2 }, + { Event::COMPARE_EE_GE, &*o2, &e1, 2 }, + { Event::COMPARE_EE_GT, &*o2, &e1, 2 }, + { Event::COMPARE_EE_LE, &*o2, &e1, 2 }, + { Event::COMPARE_EE_EQ, &e1, &*o1, 2 }, + { Event::COMPARE_EE_NE, &e1, &*o1, 2 }, + { Event::COMPARE_EE_LT, &e1, &*o1, 2 }, + { Event::COMPARE_EE_GE, &e1, &*o1, 2 }, + { Event::COMPARE_EE_GT, &e1, &*o1, 2 }, + { Event::COMPARE_EE_LE, &e1, &*o1, 2 }, + { Event::COMPARE_EE_EQ, &e1, &*o2, 2 }, + { Event::COMPARE_EE_NE, &e1, &*o2, 2 }, + { Event::COMPARE_EE_LT, &e1, &*o2, 2 }, + { Event::COMPARE_EE_GE, &e1, &*o2, 2 }, + { Event::COMPARE_EE_GT, &e1, &*o2, 2 }, + { Event::COMPARE_EE_LE, &e1, &*o2, 2 }, + { Event::DESTRUCT, &e1, nullptr, 2 }, + { Event::DESTRUCT, &*o3, nullptr, 2 }, + { Event::DESTRUCT, &*o2, nullptr, 2 }, + { Event::DESTRUCT, &*o1, nullptr, 1 }, + }; + return true; +} + +static bool testSwap(std::vector<Event>& expected) +{ cm::optional<EventLogger> o1{ 4 }; auto const* v1 = &*o1; cm::optional<EventLogger> o2{}; @@ -494,66 +618,30 @@ static bool testSwap(std::vector<Event>& expected) o1.swap(o2); auto const* v2 = &*o2; - if (o1.has_value()) { - std::cout << "o1 should not have value" << std::endl; - retval = false; - } - if (!o2.has_value()) { - std::cout << "o2 should have value" << std::endl; - retval = false; - } - if (o2.value().Value != 4) { - std::cout << "value of o2 should be 4" << std::endl; - retval = false; - } + ASSERT_TRUE(!o1.has_value()); + ASSERT_TRUE(o2.has_value()); + ASSERT_TRUE(o2.value().Value == 4); o1.swap(o2); - if (!o1.has_value()) { - std::cout << "o1 should have value" << std::endl; - retval = false; - } - if (o1.value().Value != 4) { - std::cout << "value of o1 should be 4" << std::endl; - retval = false; - } - if (o2.has_value()) { - std::cout << "o2 should not have value" << std::endl; - retval = false; - } + ASSERT_TRUE(o1.has_value()); + ASSERT_TRUE(o1.value().Value == 4); + ASSERT_TRUE(!o2.has_value()); o2.emplace(5); o1.swap(o2); - if (!o1.has_value()) { - std::cout << "o1 should have value" << std::endl; - retval = false; - } - if (o1.value().Value != 5) { - std::cout << "value of o1 should be 5" << std::endl; - retval = false; - } - if (!o2.has_value()) { - std::cout << "o2 should not have value" << std::endl; - retval = false; - } - if (o2.value().Value != 4) { - std::cout << "value of o2 should be 4" << std::endl; - retval = false; - } + ASSERT_TRUE(o1.has_value()); + ASSERT_TRUE(o1.value().Value == 5); + ASSERT_TRUE(o2.has_value()); + ASSERT_TRUE(o2.value().Value == 4); o1.reset(); o2.reset(); o1.swap(o2); - if (o1.has_value()) { - std::cout << "o1 should not have value" << std::endl; - retval = false; - } - if (o2.has_value()) { - std::cout << "o2 should not have value" << std::endl; - retval = false; - } + ASSERT_TRUE(!o1.has_value()); + ASSERT_TRUE(!o2.has_value()); expected = { { Event::VALUE_CONSTRUCT, v1, nullptr, 4 }, @@ -566,22 +654,17 @@ static bool testSwap(std::vector<Event>& expected) { Event::DESTRUCT, v1, nullptr, 5 }, { Event::DESTRUCT, v2, nullptr, 4 }, }; - return retval; + return true; } static bool testReset(std::vector<Event>& expected) { - bool retval = true; - cm::optional<EventLogger> o{ 4 }; auto const* v = &*o; o.reset(); - if (o.has_value()) { - std::cout << "o should not have value" << std::endl; - retval = false; - } + ASSERT_TRUE(!o.has_value()); o.reset(); @@ -589,7 +672,7 @@ static bool testReset(std::vector<Event>& expected) { Event::VALUE_CONSTRUCT, v, nullptr, 4 }, { Event::DESTRUCT, v, nullptr, 4 }, }; - return retval; + return true; } static bool testEmplace(std::vector<Event>& expected) @@ -630,8 +713,6 @@ static bool testMakeOptional(std::vector<Event>& expected) static bool testMemoryRange(std::vector<Event>& expected) { - bool retval = true; - cm::optional<EventLogger> o{ 4 }; auto* ostart = &o; @@ -639,17 +720,14 @@ static bool testMemoryRange(std::vector<Event>& expected) auto* estart = &o.value(); auto* eend = estart + 1; - if (static_cast<void*>(estart) < static_cast<void*>(ostart) || - static_cast<void*>(eend) > static_cast<void*>(oend)) { - std::cout << "value is not within memory range of optional" << std::endl; - retval = false; - } + ASSERT_TRUE(static_cast<void*>(estart) >= static_cast<void*>(ostart) && + static_cast<void*>(eend) <= static_cast<void*>(oend)); expected = { { Event::VALUE_CONSTRUCT, &*o, nullptr, 4 }, { Event::DESTRUCT, &*o, nullptr, 4 }, }; - return retval; + return true; } int testOptional(int /*unused*/, char* /*unused*/ []) @@ -691,6 +769,7 @@ int testOptional(int /*unused*/, char* /*unused*/ []) DO_EVENT_TEST(testHasValue); DO_EVENT_TEST(testValue); DO_TEST(testValueOr); + DO_EVENT_TEST(testComparison); DO_EVENT_TEST(testSwap); DO_EVENT_TEST(testReset); DO_EVENT_TEST(testEmplace); diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 35f3fa2..dc8b728 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -305,6 +305,7 @@ add_RunCMake_test(export) add_RunCMake_test(cmake_language) add_RunCMake_test(cmake_minimum_required) add_RunCMake_test(cmake_parse_arguments) +add_RunCMake_test(cmake_path) add_RunCMake_test(continue) add_executable(color_warning color_warning.c) add_RunCMake_test(ctest_build -DCOLOR_WARNING=$<TARGET_FILE:color_warning>) diff --git a/Tests/RunCMake/ExternalProject/DownloadServer.py b/Tests/RunCMake/ExternalProject/DownloadServer.py index 3738317..63b7fa7 100644 --- a/Tests/RunCMake/ExternalProject/DownloadServer.py +++ b/Tests/RunCMake/ExternalProject/DownloadServer.py @@ -8,8 +8,11 @@ import threading args = None outerthread = None +barrier = threading.Barrier(2) + class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): def do_GET(self): + barrier.wait() self.send_response(200) self.end_headers() data = b'D' @@ -46,4 +49,5 @@ if __name__ == "__main__": serverThread = threading.Thread(target=runServer,args=(args.file,)) serverThread.daemon = True serverThread.start() - serverThread.join(15) + barrier.wait(60) + serverThread.join(20) diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake new file mode 100644 index 0000000..4fd3c7d --- /dev/null +++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake @@ -0,0 +1,39 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "../../a/d") +cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f") +if (NOT path STREQUAL "/x/y/a/f/../../a/d") + list (APPEND errors "'${path}' instead of '/x/y/a/f/../../a/d'") +endif() + +set (path "../../a/d") +cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f" NORMALIZE) +if (NOT path STREQUAL "/x/y/a/d") + list (APPEND errors "'${path}' instead of '/x/y/a/d'") +endif() + +set (path "../../a/d") +cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f" NORMALIZE OUTPUT_VARIABLE output) +if (NOT path STREQUAL "../../a/d") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "/x/y/a/d") + list (APPEND errors "'${output}' instead of '/x/y/a/d'") +endif() + +set (path "/a/d/../e") +cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f") +if (NOT path STREQUAL "/a/d/../e") + list (APPEND errors "'${path}' instead of '/a/d/../e'") +endif() + +set (path "/a/d/../e") +cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f" NORMALIZE) +if (NOT path STREQUAL "/a/e") + list (APPEND errors "'${path}' instead of '/a/e'") +endif() + + +check_errors (ABSOLUTE_PATH ${errors}) diff --git a/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/APPEND-wrong-path-result.txt b/Tests/RunCMake/cmake_path/APPEND-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/APPEND-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/APPEND.cmake b/Tests/RunCMake/cmake_path/APPEND.cmake new file mode 100644 index 0000000..565b26d --- /dev/null +++ b/Tests/RunCMake/cmake_path/APPEND.cmake @@ -0,0 +1,77 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +cmake_path (APPEND path "/a/b" "c") +if (NOT path STREQUAL "/a/b/c") + list (APPEND errors "'${path}' instead of '/a/b/c'") +endif() + +set (path "/a/b") +cmake_path (APPEND path "c") +if (NOT path STREQUAL "/a/b/c") + list (APPEND errors "'${path}' instead of '/a/b/c'") +endif() + +cmake_path (APPEND path "x/y" "z" OUTPUT_VARIABLE output) +if (NOT path STREQUAL "/a/b/c") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "/a/b/c/x/y/z") + list (APPEND errors "'${output}' instead of '/a/b/c/x/y/z'") +endif() + +set (path "a") +cmake_path (APPEND path "") +if (NOT path STREQUAL "a/") + list (APPEND errors "'${path}' instead of 'a/'") +endif() + +cmake_path (APPEND path "/b") +if (NOT path STREQUAL "/b") + list (APPEND errors "'${path}' instead of '/b'") +endif() + +if (WIN32) + set (path "a") + cmake_path (APPEND path "c:/b") + if (NOT path STREQUAL "c:/b") + list (APPEND errors "'${path}' instead of 'c:/b'") + endif() + + set (path "a") + cmake_path (APPEND path "c:") + if (NOT path STREQUAL "c:") + list (APPEND errors "'${path}' instead of 'c:'") + endif() + cmake_path (APPEND path "") + if (NOT path STREQUAL "c:") + list (APPEND errors "'${path}' instead of 'c:'") + endif() + + set (path "c:a") + cmake_path (APPEND path "/b") + if (NOT path STREQUAL "c:/b") + list (APPEND errors "'${path}' instead of 'c:/b'") + endif() + + set (path "c:a") + cmake_path (APPEND path "c:b") + if (NOT path STREQUAL "c:a/b") + list (APPEND errors "'${path}' instead of 'c:a/b'") + endif() + + set (path "//host") + cmake_path (APPEND path "b") + if (NOT path STREQUAL "//host/b") + list (APPEND errors "'${path}' instead of '//host/b'") + endif() + + set (path "//host/") + cmake_path (APPEND path "b") + if (NOT path STREQUAL "//host/b") + list (APPEND errors "'${path}' instead of '//host/b'") + endif() +endif() + +check_errors (APPEND ${errors}) diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH.cmake b/Tests/RunCMake/cmake_path/CMAKE_PATH.cmake new file mode 100644 index 0000000..b9320f3 --- /dev/null +++ b/Tests/RunCMake/cmake_path/CMAKE_PATH.cmake @@ -0,0 +1,43 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +cmake_path(CMAKE_PATH path "/x/y/z/../../a/d") +if (NOT path STREQUAL "/x/y/z/../../a/d") + list (APPEND errors "'${path}' instead of '/x/y/z/../../a/d'") +endif() +cmake_path(CMAKE_PATH path NORMALIZE "/x/y/z/../../a/d") +if (NOT path STREQUAL "/x/a/d") + list (APPEND errors "'${path}' instead of '/x/a/d'") +endif() + +if (WIN32) + cmake_path(CMAKE_PATH path "/x\\y/z\\..\\../a/d") + if (NOT path STREQUAL "/x/y/z/../../a/d") + list (APPEND errors "'${path}' instead of '/x/y/z/../../a/d'") + endif() + cmake_path(CMAKE_PATH path NORMALIZE "/x\\y/z\\..\\../a/d") + if (NOT path STREQUAL "/x/a/d") + list (APPEND errors "'${path}' instead of '/x/a/d'") + endif() + + cmake_path(CMAKE_PATH path "//?/c:/x\\y/z\\..\\../a/d") + if (NOT path STREQUAL "c:/x/y/z/../../a/d") + list (APPEND errors "'${path}' instead of 'c:/x/y/z/../../a/d'") + endif() + cmake_path(CMAKE_PATH path NORMALIZE "//?/c:/x\\y/z\\..\\../a/d") + if (NOT path STREQUAL "c:/x/a/d") + list (APPEND errors "'${path}' instead of 'c:/x/a/d'") + endif() + + cmake_path(CMAKE_PATH path "\\\\?\\UNC/host/x\\y/z\\..\\../a/d") + if (NOT path STREQUAL "//host/x/y/z/../../a/d") + list (APPEND errors "'${path}' instead of '//host/x/y/z/../../a/d'") + endif() + cmake_path(CMAKE_PATH path NORMALIZE "\\\\?\\UNC\\host/x\\y/z\\..\\../a/d") + if (NOT path STREQUAL "//host/x/a/d") + list (APPEND errors "'${path}' instead of '//host/x/a/d'") + endif() +endif() + +check_errors (CMAKE_PATH ${errors}) diff --git a/Tests/RunCMake/cmake_path/CMakeLists.txt b/Tests/RunCMake/cmake_path/CMakeLists.txt new file mode 100644 index 0000000..1f195c6 --- /dev/null +++ b/Tests/RunCMake/cmake_path/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.18...3.19) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/cmake_path/COMPARE-EQUAL-invalid-output-result.txt b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/COMPARE-EQUAL-missing-output-result.txt b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/COMPARE-EQUAL-wrong-path-result.txt b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-invalid-output-result.txt b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-missing-output-result.txt b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-wrong-path-result.txt b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-result.txt b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-stderr.txt b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-stderr.txt new file mode 100644 index 0000000..674d942 --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at COMPARE-wrong-operator.cmake:[0-9]+ \(cmake_path\): + cmake_path COMPARE called with an unknown comparison operator: FOO. diff --git a/Tests/RunCMake/cmake_path/COMPARE-wrong-operator.cmake b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator.cmake new file mode 100644 index 0000000..7da5d29 --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator.cmake @@ -0,0 +1,3 @@ + +set (path "/a/b") +cmake_path(COMPARE path FOO "/other" output) diff --git a/Tests/RunCMake/cmake_path/COMPARE.cmake b/Tests/RunCMake/cmake_path/COMPARE.cmake new file mode 100644 index 0000000..bc6b9b4 --- /dev/null +++ b/Tests/RunCMake/cmake_path/COMPARE.cmake @@ -0,0 +1,22 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "a///b/c") +cmake_path(COMPARE path EQUAL "a/b/c" output) +if (NOT output) + list (APPEND errors "'${path}' not equal to 'a/b/c'") +endif() + +set (path "a/b/d/../c") +cmake_path(COMPARE path NOT_EQUAL "a/b/c" output) +if (NOT output) + list (APPEND errors "'${path}' equal to 'a/b/c'") +endif() +cmake_path(NORMAL_PATH path) +cmake_path(COMPARE path EQUAL "a/b/c" output) +if (NOT output) + list (APPEND errors "'${path}' not equal to 'a/b/c'") +endif() + +check_errors (COMPARE ${errors}) diff --git a/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONCAT-wrong-path-result.txt b/Tests/RunCMake/cmake_path/CONCAT-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONCAT-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONCAT.cmake b/Tests/RunCMake/cmake_path/CONCAT.cmake new file mode 100644 index 0000000..62b5eb0 --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONCAT.cmake @@ -0,0 +1,20 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "/a/b") +cmake_path (CONCAT path "cd") +if (NOT path STREQUAL "/a/bcd") + list (APPEND errors "'${path}' instead of 'a/bcd'") +endif() + +set (path "/a/b") +cmake_path (CONCAT path "cd" "ef" OUTPUT_VARIABLE output) +if (NOT path STREQUAL "/a/b") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "/a/bcdef") + list (APPEND errors "'${output}' instead of 'a/bcdef'") +endif() + +check_errors (CONCAT ${errors}) diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-invalid-output-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-missing-output-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-invalid-output-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-missing-output-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-result.txt b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-stderr.txt b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-stderr.txt new file mode 100644 index 0000000..9aa75ec --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at CONVERT-wrong-operator.cmake:[0-9]+ \(cmake_path\): + cmake_path CONVERT called with an unknown action: FOO. diff --git a/Tests/RunCMake/cmake_path/CONVERT-wrong-operator.cmake b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator.cmake new file mode 100644 index 0000000..12ffccc --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator.cmake @@ -0,0 +1,2 @@ + +cmake_path(CONVERT "/a/b" FOO output) diff --git a/Tests/RunCMake/cmake_path/CONVERT.cmake b/Tests/RunCMake/cmake_path/CONVERT.cmake new file mode 100644 index 0000000..b08bc26 --- /dev/null +++ b/Tests/RunCMake/cmake_path/CONVERT.cmake @@ -0,0 +1,110 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +cmake_path(CONVERT "/x/y/z/../../a/d" TO_CMAKE_PATH_LIST output) +if (NOT output STREQUAL "/x/y/z/../../a/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d'") +endif() +cmake_path(CONVERT "/x/y/z/../../a/d" TO_CMAKE_PATH_LIST output NORMALIZE) +if (NOT output STREQUAL "/x/a/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d'") +endif() + +if (WIN32) + cmake_path(CONVERT "/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output) + if (NOT output STREQUAL "/x/y/z/../../a/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d'") + endif() + cmake_path(CONVERT "/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "/x/a/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d'") + endif() + + cmake_path(CONVERT "//?/c:/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output) + if (NOT output STREQUAL "c:/x/y/z/../../a/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of 'c:/x/y/z/../../a/d'") + endif() + cmake_path(CONVERT "//?/c:/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "c:/x/a/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of 'c:/x/a/d'") + endif() + + cmake_path(CONVERT "//?/UNC/host/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output) + if (NOT output STREQUAL "//host/x/y/z/../../a/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '//host/x/y/z/../../a/d'") + endif() + cmake_path(CONVERT "//?/UNC/host/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "//host/x/a/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '//host/x/a/d'") + endif() +endif() + +if (WIN32) + cmake_path(CONVERT "/x\\y/z/..\\../a\\d;c:\\a/b\\c/..\\d" TO_CMAKE_PATH_LIST output) + if (NOT output STREQUAL "/x/y/z/../../a/d;c:/a/b/c/../d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d;c:/a/b/c/../d'") + endif() + cmake_path(CONVERT "/x\\y/z/..\\../a\\d;c:\\a/b\\c/..\\d" TO_CMAKE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "/x/a/d;c:/a/b/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d;c:/a/b/d'") + endif() +else() + cmake_path(CONVERT "/x/y/z/../../a/d:/a/b/c/../d" TO_CMAKE_PATH_LIST output) + if (NOT output STREQUAL "/x/y/z/../../a/d;/a/b/c/../d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${outputh}' instead of '/x/y/z/../../a/d;/a/b/c/../d'") + endif() + cmake_path(CONVERT "/x/y/z/../../a/d:/a/b/c/../d" TO_CMAKE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "/x/a/d;/a/b/d") + list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d;/a/b/d'") + endif() +endif() + + +if (WIN32) + cmake_path(CONVERT "c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output) + if (NOT output STREQUAL "c:\\a\\\\b\\c\\..\\d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of 'c:\\a\\\\b\\c\\..\\d'") + endif() + cmake_path(CONVERT "c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "c:\\a\\b\\d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of 'c:\\a\\b\\d'") + endif() + + cmake_path(CONVERT "//host/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output) + if (NOT output STREQUAL "\\\\host\\a\\\\b\\c\\..\\d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\\\b\\c\\..\\d'") + endif() + cmake_path(CONVERT "//host/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "\\\\host\\a\\b\\d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\b\\d'") + endif() + cmake_path(CONVERT "//host/a//b\\c/..\\d;c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output) + if (NOT output STREQUAL "\\\\host\\a\\\\b\\c\\..\\d;c:\\a\\\\b\\c\\..\\d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\\\b\\c\\..\\d;c:\\a\\\\b\\c\\..\\d'") + endif() + cmake_path(CONVERT "//host/a//b\\c/..\\d;c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "\\\\host\\a\\b\\d;c:\\a\\b\\d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\b\\d;c:\\a\\b\\d'") + endif() +else() + cmake_path(CONVERT "/a//b/c/../d" TO_NATIVE_PATH_LIST output) + if (NOT output STREQUAL "/a//b/c/../d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/a//b/c/../d'") + endif() + cmake_path(CONVERT "/a//b/c/../d" TO_NATIVE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "/a/b/d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/a/b/d'") + endif() + cmake_path(CONVERT "/x/y/z/../../a/d;/a/b/c/../d" TO_NATIVE_PATH_LIST output) + if (NOT output STREQUAL "/x/y/z/../../a/d:/a/b/c/../d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d:/a/b/c/../d'") + endif() + cmake_path(CONVERT "/x/y/z/../../a/d;/a/b/c/../d" TO_NATIVE_PATH_LIST output NORMALIZE) + if (NOT output STREQUAL "/x/a/d:/a/b/d") + list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/x/a/d:/a/b/d'") + endif() +endif() + + +check_errors (CONVERT ${errors}) diff --git a/Tests/RunCMake/cmake_path/GET-EXTENSION-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-EXTENSION-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-EXTENSION-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-EXTENSION-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-EXTENSION-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-EXTENSION-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-EXTENSION-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-EXTENSION-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-EXTENSION-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-EXTENSION-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-EXTENSION-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-EXTENSION-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-FILENAME-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-FILENAME-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-FILENAME-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-FILENAME-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-FILENAME-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-FILENAME-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-FILENAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-FILENAME-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-FILENAME-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-FILENAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-FILENAME-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-FILENAME-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-PARENT_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-PARENT_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-PARENT_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-PARENT_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_NAME-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_NAME-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_NAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_NAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-STEM-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-STEM-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-STEM-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-STEM-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-STEM-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-STEM-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-STEM-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-STEM-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-STEM-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-STEM-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-STEM-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-STEM-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-wrong-operator-result.txt b/Tests/RunCMake/cmake_path/GET-wrong-operator-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-wrong-operator-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/GET-wrong-operator-stderr.txt b/Tests/RunCMake/cmake_path/GET-wrong-operator-stderr.txt new file mode 100644 index 0000000..71afc92 --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-wrong-operator-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at GET-wrong-operator.cmake:[0-9]+ \(cmake_path\): + cmake_path GET called with an unknown action: FOO. diff --git a/Tests/RunCMake/cmake_path/GET-wrong-operator.cmake b/Tests/RunCMake/cmake_path/GET-wrong-operator.cmake new file mode 100644 index 0000000..e09d6d7 --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET-wrong-operator.cmake @@ -0,0 +1,3 @@ + +set (path "/a/b") +cmake_path(GET path FOO output) diff --git a/Tests/RunCMake/cmake_path/GET.cmake b/Tests/RunCMake/cmake_path/GET.cmake new file mode 100644 index 0000000..e68e654 --- /dev/null +++ b/Tests/RunCMake/cmake_path/GET.cmake @@ -0,0 +1,248 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +############################################### +## First test with a path defining all elements +############################################### +if (WIN32) + set (path "C:/aa/bb/cc.ext1.ext2") +else() + set (path "/aa/bb/cc.ext1.ext2") +endif() + +cmake_path(GET path ROOT_NAME output) +if (WIN32) + if (NOT output STREQUAL "C:") + list (APPEND errors "ROOT_NAME returns bad data: ${output}") + endif() +else() + if (NOT output STREQUAL "") + list (APPEND errors "ROOT_NAME returns bad data: ${output}") + endif() +endif() + +cmake_path(GET path ROOT_DIRECTORY output) +if (NOT output STREQUAL "/") + list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}") +endif() + +cmake_path(GET path ROOT_PATH output) +if (WIN32) + if (NOT output STREQUAL "C:/") + list (APPEND errors "ROOT_PATH returns bad data: ${output}") + endif() +else() + if (NOT output STREQUAL "/") + list (APPEND errors "ROOT_PATH returns bad data: ${output}") + endif() +endif() + +cmake_path(GET path FILENAME output) +if (NOT output STREQUAL "cc.ext1.ext2") + list (APPEND errors "FILENAME returns bad data: ${output}") +endif() + +cmake_path(GET path EXTENSION output) +if (NOT output STREQUAL ".ext1.ext2") + list (APPEND errors "EXTENSION returns bad data: ${output}") +endif() +cmake_path(GET path EXTENSION LAST_ONLY output) +if (NOT output STREQUAL ".ext2") + list (APPEND errors "EXTENSION LAST_ONLY returns bad data: ${output}") +endif() + +cmake_path(GET path STEM output) +if (NOT output STREQUAL "cc") + list (APPEND errors "STEM returns bad data: ${output}") +endif() +cmake_path(GET path STEM LAST_ONLY output) +if (NOT output STREQUAL "cc.ext1") + list (APPEND errors "STEM LAST_ONLY returns bad data: ${output}") +endif() + +cmake_path(GET path RELATIVE_PATH output) +if (NOT output STREQUAL "aa/bb/cc.ext1.ext2") + list (APPEND errors "RELATIVE_PATH returns bad data: ${output}") +endif() + +cmake_path(GET path PARENT_PATH output) +if (WIN32) + if (NOT output STREQUAL "C:/aa/bb") + list (APPEND errors "PARENT_PATH returns bad data: ${output}") + endif() +else() + if (NOT output STREQUAL "/aa/bb") + list (APPEND errors "PARENT_PATH returns bad data: ${output}") + endif() +endif() + +###################################### +## second, tests with missing elements +###################################### +set (path "aa/bb/") + +cmake_path(GET path ROOT_NAME output) +if (NOT output STREQUAL "") + list (APPEND errors "ROOT_NAME returns bad data: ${output}") +endif() + +cmake_path(GET path ROOT_DIRECTORY output) +if (NOT output STREQUAL "") + list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}") +endif() + +cmake_path(GET path ROOT_PATH output) +if (NOT output STREQUAL "") + list (APPEND errors "ROOT_PATH returns bad data: ${output}") +endif() + +cmake_path(GET path FILENAME output) +if (NOT output STREQUAL "") + list (APPEND errors "FILENAME returns bad data: ${output}") +endif() + +cmake_path(GET path EXTENSION output) +if (NOT output STREQUAL "") + list (APPEND errors "EXTENSION returns bad data: ${output}") +endif() + +cmake_path(GET path STEM output) +if (NOT output STREQUAL "") + list (APPEND errors "STEM returns bad data: ${output}") +endif() + +cmake_path(GET path RELATIVE_PATH output) +if (NOT output STREQUAL path) + list (APPEND errors "RELATIVE_PATH returns bad data: ${output}") +endif() + +cmake_path(GET path PARENT_PATH output) +if (NOT output STREQUAL "aa/bb") + list (APPEND errors "PARENT_PATH returns bad data: ${output}") +endif() + +################################## +set (path "/aa/bb/") + +cmake_path(GET path ROOT_NAME output) +if (NOT output STREQUAL "") + list (APPEND errors "ROOT_NAME returns bad data: ${output}") +endif() + +cmake_path(GET path ROOT_DIRECTORY output) +if (NOT output STREQUAL "/") + list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}") +endif() + +cmake_path(GET path ROOT_PATH output) +if (NOT output STREQUAL "/") + list (APPEND errors "ROOT_PATH returns bad data: ${output}") +endif() + +################################### +set (path "/") + +cmake_path(GET path ROOT_NAME output) +if (NOT output STREQUAL "") + list (APPEND errors "ROOT_NAME returns bad data: ${output}") +endif() + +cmake_path(GET path ROOT_DIRECTORY output) +if (NOT output STREQUAL "/") + list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}") +endif() + +cmake_path(GET path ROOT_PATH output) +if (NOT output STREQUAL "/") + list (APPEND errors "ROOT_PATH returns bad data: ${output}") +endif() + +cmake_path(GET path FILENAME output) +if (NOT output STREQUAL "") + list (APPEND errors "FILENAME returns bad data: ${output}") +endif() + +cmake_path(GET path EXTENSION output) +if (NOT output STREQUAL "") + list (APPEND errors "EXTENSION returns bad data: ${output}") +endif() + +cmake_path(GET path STEM output) +if (NOT output STREQUAL "") + list (APPEND errors "STEM returns bad data: ${output}") +endif() + +cmake_path(GET path RELATIVE_PATH output) +if (NOT output STREQUAL "") + list (APPEND errors "RELATIVE_PATH returns bad data: ${output}") +endif() + +cmake_path(GET path PARENT_PATH output) +if (NOT output STREQUAL "/") + list (APPEND errors "PARENT_PATH returns bad data: ${output}") +endif() + +################################### +set (path ".file") + +cmake_path(GET path FILENAME output) +if (NOT output STREQUAL ".file") + list (APPEND errors "FILENAME returns bad data: ${output}") +endif() + +cmake_path(GET path EXTENSION output) +if (NOT output STREQUAL "") + list (APPEND errors "EXTENSION returns bad data: ${output}") +endif() + +cmake_path(GET path STEM output) +if (NOT output STREQUAL ".file") + list (APPEND errors "STEM returns bad data: ${output}") +endif() + +################################### +set (path ".file.ext") + +cmake_path(GET path FILENAME output) +if (NOT output STREQUAL ".file.ext") + list (APPEND errors "FILENAME returns bad data: ${output}") +endif() + +cmake_path(GET path EXTENSION output) +if (NOT output STREQUAL ".ext") + list (APPEND errors "EXTENSION returns bad data: ${output}") +endif() +cmake_path(GET path EXTENSION LAST_ONLY output) +if (NOT output STREQUAL ".ext") + list (APPEND errors "EXTENSION returns bad data: ${output}") +endif() + +cmake_path(GET path STEM output) +if (NOT output STREQUAL ".file") + list (APPEND errors "STEM returns bad data: ${output}") +endif() + +################################### +set (path ".file.ext1.ext2") + +cmake_path(GET path FILENAME output) +if (NOT output STREQUAL ".file.ext1.ext2") + list (APPEND errors "FILENAME returns bad data: ${output}") +endif() + +cmake_path(GET path EXTENSION output) +if (NOT output STREQUAL ".ext1.ext2") + list (APPEND errors "EXTENSION returns bad data: ${output}") +endif() +cmake_path(GET path EXTENSION LAST_ONLY output) +if (NOT output STREQUAL ".ext2") + list (APPEND errors "EXTENSION returns bad data: ${output}") +endif() + +cmake_path(GET path STEM output) +if (NOT output STREQUAL ".file") + list (APPEND errors "STEM returns bad data: ${output}") +endif() + +check_errors (GET ${errors}) diff --git a/Tests/RunCMake/cmake_path/HASH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HASH-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HASH-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HASH-missing-output-result.txt b/Tests/RunCMake/cmake_path/HASH-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HASH-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HASH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HASH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HASH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HASH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HASH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HASH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HASH.cmake b/Tests/RunCMake/cmake_path/HASH.cmake new file mode 100644 index 0000000..dfcf2b2 --- /dev/null +++ b/Tests/RunCMake/cmake_path/HASH.cmake @@ -0,0 +1,27 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path1 "a///b/c") +cmake_path(HASH path1 hash1) +set (path2 "a/b////c") +cmake_path(HASH path2 hash2) +if (NOT hash1 STREQUAL hash2) + list (APPEND errors "'hash values not equal for '${path1}' and '${path2}'") +endif() + +set (path1 "a///b/c/../d") +cmake_path(HASH path1 hash1) +set (path2 "a/b////d") +cmake_path(HASH path2 hash2) +if (hash1 STREQUAL hash2) + list (APPEND errors "'hash values equal for '${path1}' and '${path2}'") +endif() +cmake_path(HASH path1 hash1 NORMALIZE) +cmake_path(HASH path2 NORMALIZE hash2) +if (NOT hash1 STREQUAL hash2) + list (APPEND errors "'hash values not equal for '${path1}' and '${path2}'") +endif() + + +check_errors (HASH ${errors}) diff --git a/Tests/RunCMake/cmake_path/HAS_EXTENSION-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_EXTENSION-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_EXTENSION-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_EXTENSION-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_EXTENSION-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_EXTENSION-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_EXTENSION-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_EXTENSION-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_EXTENSION-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_EXTENSION-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_EXTENSION-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_EXTENSION-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_FILENAME-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_FILENAME-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_FILENAME-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_FILENAME-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_FILENAME-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_FILENAME-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_FILENAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_FILENAME-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_FILENAME-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_FILENAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_FILENAME-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_FILENAME-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ITEM.cmake b/Tests/RunCMake/cmake_path/HAS_ITEM.cmake new file mode 100644 index 0000000..eb73bd5 --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ITEM.cmake @@ -0,0 +1,232 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "/a/b") +cmake_path(HAS_ROOT_NAME path output) +if (output) + list (APPEND errors "ROOT_NAME: ${path} has root name") +endif() +cmake_path(HAS_ROOT_DIRECTORY path output) +if (NOT output) + list (APPEND errors "ROOT_DIRECTORY: ${path} does not have root directory") +endif() +cmake_path(HAS_ROOT_PATH path output) +if (NOT output) + list (APPEND errors "ROOT_PATH: ${path} does not have root path") +endif() + +set (path "a/b") +cmake_path(HAS_ROOT_PATH path output) +if (output) + list (APPEND errors "ROOT_PATH: ${path} has root path") +endif() + +set (path "/a/b") +cmake_path(HAS_FILENAME path output) +if (NOT output) + list (APPEND errors "FILENAME: ${path} does not have filename") +endif() +set (path "a.b") +cmake_path(HAS_FILENAME path output) +if (NOT output) + list (APPEND errors "FILENAME: ${path} does not have filename") +endif() +set (path "/a/b/") +cmake_path(HAS_FILENAME path output) +if (output) + list (APPEND errors "FILENAME: ${path} has filename") +endif() +set (path "/") +cmake_path(HAS_FILENAME path output) +if (output) + list (APPEND errors "FILENAME: ${path} has filename") +endif() + +set (path "/a/b") +cmake_path(HAS_STEM path output) +if (NOT output) + list (APPEND errors "STEM: ${path} does not have stem") +endif() +set (path "a.b") +cmake_path(HAS_STEM path output) +if (NOT output) + list (APPEND errors "STEM: ${path} does not have stem") +endif() +set (path ".a") +cmake_path(HAS_STEM path output) +if (NOT output) + list (APPEND errors "STEM: ${path} does not have stem") +endif() +set (path "/a/") +cmake_path(HAS_STEM path output) +if (output) + list (APPEND errors "STEM: ${path} has stem") +endif() +set (path "/") +cmake_path(HAS_STEM path output) +if (output) + list (APPEND errors "STEM: ${path} has stem") +endif() + +set (path "/a/b.c") +cmake_path(HAS_EXTENSION path output) +if (NOT output) + list (APPEND errors "EXTENSION: ${path} does not have extension") +endif() +set (path "b.c") +cmake_path(HAS_EXTENSION path output) +if (NOT output) + list (APPEND errors "EXTENSION: ${path} does not have extension") +endif() +set (path "/.a") +cmake_path(HAS_EXTENSION path output) +if (output) + list (APPEND errors "EXTENSION: ${path} has extension") +endif() +set (path "/a/") +cmake_path(HAS_EXTENSION path output) +if (output) + list (APPEND errors "EXTENSION: ${path} has extension") +endif() +set (path "/") +cmake_path(HAS_EXTENSION path output) +if (output) + list (APPEND errors "EXTENSION: ${path} has extension") +endif() + +set (path "/a/b") +cmake_path(HAS_RELATIVE_PATH path output) +if (NOT output) + list (APPEND errors "RELATIVE_PATH: ${path} does not have relative path") +endif() +set (path "/") +cmake_path(HAS_RELATIVE_PATH path output) +if (output) + list (APPEND errors "RELATIVE_PATH: ${path} has relative path") +endif() + +set (path "/a/b") +cmake_path(HAS_PARENT_PATH path output) +if (NOT output) + list (APPEND errors "PARENT_PATH: ${path} does not have parent path") +endif() +set (path "/") +cmake_path(HAS_PARENT_PATH path output) +if (NOT output) + list (APPEND errors "PARENT_PATH: ${path} does not have parent path") +endif() +set (path "a") +cmake_path(HAS_PARENT_PATH path output) +if (output) + list (APPEND errors "PARENT_PATH: ${path} has parent path") +endif() + +if (WIN32) + set (path "c:/a/b") + cmake_path(HAS_ROOT_NAME path output) + if (NOT output) + list (APPEND errors "ROOT_NAME: ${path} does not have root name") + endif() + cmake_path(HAS_ROOT_DIRECTORY path output) + if (NOT output) + list (APPEND errors "ROOT_DIRECTORY: ${path} does not have root directory") + endif() + cmake_path(HAS_ROOT_PATH path output) + if (NOT output) + list (APPEND errors "ROOT_PATH: ${path} does not have root path") + endif() + + set (path "c:a/b") + cmake_path(HAS_ROOT_NAME path output) + if (NOT output) + list (APPEND errors "ROOT_NAME: ${path} does not have root name") + endif() + cmake_path(HAS_ROOT_DIRECTORY path output) + if (output) + list (APPEND errors "ROOT_DIRECTORY: ${path} has root directory") + endif() + cmake_path(HAS_ROOT_PATH path output) + if (NOT output) + list (APPEND errors "ROOT_PATH: ${path} does not have root path") + endif() + + set (path "//host/b") + cmake_path(HAS_ROOT_NAME path output) + if (NOT output) + list (APPEND errors "ROOT_NAME: ${path} does not have root name") + endif() + cmake_path(HAS_ROOT_DIRECTORY path output) + if (NOT output) + list (APPEND errors "ROOT_DIRECTORY: ${path} does not have root directory") + endif() + cmake_path(HAS_ROOT_PATH path output) + if (NOT output) + list (APPEND errors "ROOT_PATH: ${path} does not have root path") + endif() + + set (path "//host") + cmake_path(HAS_ROOT_NAME path output) + if (NOT output) + list (APPEND errors "ROOT_NAME: ${path} does not have root name") + endif() + cmake_path(HAS_ROOT_DIRECTORY path output) + if (output) + list (APPEND errors "ROOT_DIRECTORY: ${path} has root directory") + endif() + cmake_path(HAS_ROOT_PATH path output) + if (NOT output) + list (APPEND errors "ROOT_PATH: ${path} does not have root path") + endif() + + set (path "c:/a/b") + cmake_path(HAS_RELATIVE_PATH path output) + if (NOT output) + list (APPEND errors "RELATIVE_PATH: ${path} does not have relative path") + endif() + + set (path "c:a/b") + cmake_path(HAS_RELATIVE_PATH path output) + if (NOT output) + list (APPEND errors "RELATIVE_PATH: ${path} does not have relative path") + endif() + + set (path "//host/b") + cmake_path(HAS_RELATIVE_PATH path output) + if (NOT output) + list (APPEND errors "RELATIVE_PATH: ${path} does not have relative path") + endif() + + set (path "c:/a/b") + cmake_path(HAS_PARENT_PATH path output) + if (NOT output) + list (APPEND errors "PARENT_PATH: ${path} does not have parent path") + endif() + + set (path "c:/") + cmake_path(HAS_PARENT_PATH path output) + if (NOT output) + list (APPEND errors "PARENT_PATH: ${path} does not have parent path") + endif() + + set (path "c:") + cmake_path(HAS_PARENT_PATH path output) + if (NOT output) + list (APPEND errors "PARENT_PATH: ${path} does not have parent path") + endif() + + set (path "//host/") + cmake_path(HAS_PARENT_PATH path output) + if (NOT output) + list (APPEND errors "PARENT_PATH: ${path} does not have parent path") + endif() + + set (path "//host") + cmake_path(HAS_PARENT_PATH path output) + if (NOT output) + list (APPEND errors "PARENT_PATH: ${path} does not have parent path") + endif() +endif() + + +check_errors (HAS ${errors}) diff --git a/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_STEM-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_STEM-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_STEM-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_STEM-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_STEM-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_STEM-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_STEM-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_STEM-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_STEM-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/HAS_STEM-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_STEM-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/HAS_STEM-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE-invalid-output-result.txt b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE-missing-output-result.txt b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE-wrong-path-result.txt b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE.cmake b/Tests/RunCMake/cmake_path/IS_ABSOLUTE.cmake new file mode 100644 index 0000000..794e786 --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE.cmake @@ -0,0 +1,48 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +if (WIN32) + set (path "c:/a") +else() + set (path "/a") +endif() +cmake_path(IS_ABSOLUTE path output) +if (NOT output) + list (APPEND errors "'${path} is not absolute") +endif() + +set (path "a/b") +cmake_path(IS_ABSOLUTE path output) +if (output) + list (APPEND errors "'${path} is absolute") +endif() + +if (WIN32) + set (path "c:/a/b") + cmake_path(IS_ABSOLUTE path output) + if (NOT output) + list (APPEND errors "'${path} is not absolute") + endif() + + set (path "//host/b") + cmake_path(IS_ABSOLUTE path output) + if (NOT output) + list (APPEND errors "'${path} is not absolute") + endif() + + set (path "/a") + cmake_path(IS_ABSOLUTE path output) + if (output) + list (APPEND errors "'${path} is absolute") + endif() + + set (path "c:a") + cmake_path(IS_ABSOLUTE path output) + if (output) + list (APPEND errors "'${path} is absolute") + endif() +endif() + + +check_errors (IS_ABSOLUTE ${errors}) diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX-invalid-output-result.txt b/Tests/RunCMake/cmake_path/IS_PREFIX-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_PREFIX-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX-missing-output-result.txt b/Tests/RunCMake/cmake_path/IS_PREFIX-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_PREFIX-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/IS_PREFIX-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_PREFIX-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX-wrong-path-result.txt b/Tests/RunCMake/cmake_path/IS_PREFIX-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_PREFIX-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX.cmake b/Tests/RunCMake/cmake_path/IS_PREFIX.cmake new file mode 100644 index 0000000..53da93b --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_PREFIX.cmake @@ -0,0 +1,22 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "a///b/c") +cmake_path(IS_PREFIX path "a/b/c/d" output) +if (NOT output) + list (APPEND errors "'${path} is not prefix of 'a/b/c/d'") +endif() + +set (path "a///b/c/../d") +cmake_path(IS_PREFIX path "a/b/d/e" output) +if (output) + list (APPEND errors "'${path} is prefix of 'a/b/d/e'") +endif() +cmake_path(IS_PREFIX path "a/b/d/e" NORMALIZE output) +if (NOT output) + list (APPEND errors "'${path} is not prefix of 'a/b/d/e'") +endif() + + +check_errors (IS_PREFIX ${errors}) diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE-invalid-output-result.txt b/Tests/RunCMake/cmake_path/IS_RELATIVE-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_RELATIVE-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE-missing-output-result.txt b/Tests/RunCMake/cmake_path/IS_RELATIVE-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_RELATIVE-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/IS_RELATIVE-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_RELATIVE-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE-wrong-path-result.txt b/Tests/RunCMake/cmake_path/IS_RELATIVE-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_RELATIVE-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE.cmake b/Tests/RunCMake/cmake_path/IS_RELATIVE.cmake new file mode 100644 index 0000000..ad12253 --- /dev/null +++ b/Tests/RunCMake/cmake_path/IS_RELATIVE.cmake @@ -0,0 +1,48 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +if (WIN32) + set (path "c:/a") +else() + set (path "/a") +endif() +cmake_path(IS_RELATIVE path output) +if (output) + list (APPEND errors "'${path} is relative") +endif() + +set (path "a/b") +cmake_path(IS_RELATIVE path output) +if (NOT output) + list (APPEND errors "'${path} is not relative") +endif() + +if (WIN32) + set (path "c:/a/b") + cmake_path(IS_RELATIVE path output) + if (output) + list (APPEND errors "'${path} is relative") + endif() + + set (path "//host/b") + cmake_path(IS_RELATIVE path output) + if (output) + list (APPEND errors "'${path} is relative") + endif() + + set (path "/a") + cmake_path(IS_RELATIVE path output) + if (NOT output) + list (APPEND errors "'${path} is not relative") + endif() + + set (path "c:a") + cmake_path(IS_RELATIVE path output) + if (NOT output) + list (APPEND errors "'${path} is not relative") + endif() +endif() + + +check_errors (IS_RELATIVE ${errors}) diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-invalid-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-invalid-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH.cmake b/Tests/RunCMake/cmake_path/NATIVE_PATH.cmake new file mode 100644 index 0000000..066c44d --- /dev/null +++ b/Tests/RunCMake/cmake_path/NATIVE_PATH.cmake @@ -0,0 +1,37 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +if (WIN32) + set (path "c:/a//b\\c/..\\d") + cmake_path(NATIVE_PATH path output) + if (NOT output STREQUAL "c:\\a\\\\b\\c\\..\\d") + list (APPEND errors "'${output}' instead of 'c:\\a\\\\b\\c\\..\\d'") + endif() + cmake_path(NATIVE_PATH path output NORMALIZE) + if (NOT output STREQUAL "c:\\a\\b\\d") + list (APPEND errors "'${output}' instead of 'c:\\a\\b\\d'") + endif() + + set (path "//host/a//b\\c/..\\d") + cmake_path(NATIVE_PATH path output) + if (NOT output STREQUAL "\\\\host\\a\\\\b\\c\\..\\d") + list (APPEND errors "'${output}' instead of '\\\\host\\a\\\\b\\c\\..\\d'") + endif() + cmake_path(NATIVE_PATH path output NORMALIZE) + if (NOT output STREQUAL "\\\\host\\a\\b\\d") + list (APPEND errors "'${output}' instead of '\\\\host\\a\\b\\d'") + endif() +else() + set (path "/a//b/c/../d") + cmake_path(NATIVE_PATH path output) + if (NOT output STREQUAL "/a//b/c/../d") + list (APPEND errors "'${output}' instead of '/a//b/c/../d'") + endif() + cmake_path(NATIVE_PATH path NORMALIZE output) + if (NOT output STREQUAL "/a/b/d") + list (APPEND errors "'${output}' instead of '/a/b/d'") + endif() +endif() + +check_errors (NATIVE_PATH ${errors}) diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/NORMAL_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/NORMAL_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/NORMAL_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/NORMAL_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH.cmake b/Tests/RunCMake/cmake_path/NORMAL_PATH.cmake new file mode 100644 index 0000000..88db76a --- /dev/null +++ b/Tests/RunCMake/cmake_path/NORMAL_PATH.cmake @@ -0,0 +1,46 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "a/./b/..") +cmake_path(NORMAL_PATH path) +if (NOT path STREQUAL "a/") + list (APPEND errors "'${path}' instead of 'a/'") +endif() + +set (path "a/.///b/../") +cmake_path(NORMAL_PATH path) +if (NOT path STREQUAL "a/") + list (APPEND errors "'${path}' instead of 'a/'") +endif() + +set (path "a/.///b/../") +cmake_path(NORMAL_PATH path OUTPUT_VARIABLE output) +if (NOT path STREQUAL "a/.///b/../") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "a/") + list (APPEND errors "'${output}' instead of 'a/'") +endif() + +if (WIN32) + set (path "//host/./b/..") + cmake_path(NORMAL_PATH path) + if (NOT path STREQUAL "//host/") + list (APPEND errors "'${path}' instead of '//host/'") + endif() + + set (path "//host/./b/../") + cmake_path(NORMAL_PATH path) + if (NOT path STREQUAL "//host/") + list (APPEND errors "'${path}' instead of '//host/'") + endif() + + set (path "c://a/.///b/../") + cmake_path(NORMAL_PATH path) + if (NOT path STREQUAL "c:/a/") + list (APPEND errors "'${path}' instead of 'c:/a/'") + endif() +endif() + +check_errors (NORMAL_PATH ${errors}) diff --git a/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt new file mode 100644 index 0000000..e1d6592 --- /dev/null +++ b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\): + cmake_path OUTPUT_VARIABLE requires an argument. diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH.cmake b/Tests/RunCMake/cmake_path/PROXIMATE_PATH.cmake new file mode 100644 index 0000000..ad23377 --- /dev/null +++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH.cmake @@ -0,0 +1,41 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +if (WIN32) + set (path "c:/a/d") + cmake_path(PROXIMATE_PATH path BASE_DIRECTORY "e/d/c") + if (NOT path STREQUAL "c:/a/d") + list (APPEND errors "'${path}' instead of 'c:/a/d'") + endif() +else() + set (path "/a/d") + cmake_path(PROXIMATE_PATH path BASE_DIRECTORY "e/d/c") + if (NOT path STREQUAL "/a/d") + list (APPEND errors "'${path}' instead of '/a/d'") + endif() +endif() + +set (path "/a/d") +cmake_path(PROXIMATE_PATH path BASE_DIRECTORY "/a/b/c" OUTPUT_VARIABLE output) +if (NOT path STREQUAL "/a/d") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "../../d") + list (APPEND errors "'${output}' instead of '../../d'") +endif() + +set (path "${CMAKE_CURRENT_SOURCE_DIR}/a/d") +cmake_path(PROXIMATE_PATH path) +if (NOT path STREQUAL "a/d") + list (APPEND errors "'${path}' instead of 'a/d'") +endif() + +set (path "a/b/c") +cmake_path(PROXIMATE_PATH path) +if (NOT path STREQUAL "a/b/c") + list (APPEND errors "'${path}' instead of 'a/b/c'") +endif() + + +check_errors (PROXIMATE_PATH ${errors}) diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/RELATIVE_PATH-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/RELATIVE_PATH-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH.cmake b/Tests/RunCMake/cmake_path/RELATIVE_PATH.cmake new file mode 100644 index 0000000..522a899 --- /dev/null +++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH.cmake @@ -0,0 +1,76 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "/a//d") +cmake_path(RELATIVE_PATH path BASE_DIRECTORY "/a/b/c") +if (NOT path STREQUAL "../../d") + list (APPEND errors "'${path}' instead of '../../d'") +endif() + +set (path "/a//b///c") +cmake_path(RELATIVE_PATH path BASE_DIRECTORY "/a/d") +if (NOT path STREQUAL "../b/c") + list (APPEND errors "'${path}' instead of '../b/c'") +endif() + +set (path "a/b/c") +cmake_path(RELATIVE_PATH path BASE_DIRECTORY "a") +if (NOT path STREQUAL "b/c") + list (APPEND errors "'${path}' instead of 'b/c'") +endif() + +set (path "a/b/c") +cmake_path(RELATIVE_PATH path BASE_DIRECTORY "a/b/c/x/y") +if (NOT path STREQUAL "../..") + list (APPEND errors "'${path}' instead of '../..'") +endif() + +set (path "a/b/c") +cmake_path(RELATIVE_PATH path BASE_DIRECTORY "a/b/c") +if (NOT path STREQUAL ".") + list (APPEND errors "'${path}' instead of '.'") +endif() + +set (path "a/b") +cmake_path(RELATIVE_PATH path BASE_DIRECTORY "c/d") +if (NOT path STREQUAL "../../a/b") + list (APPEND errors "'${path}' instead of '../../a/b'") +endif() + +set (path "${CMAKE_CURRENT_SOURCE_DIR}/../../b") +cmake_path(RELATIVE_PATH path) +if (NOT path STREQUAL "../../b") + list (APPEND errors "'${path}' instead of '../../b'") +endif() + +set (path "${CMAKE_CURRENT_SOURCE_DIR}/../../b") +cmake_path(RELATIVE_PATH path OUTPUT_VARIABLE output) +if (NOT path STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/../../b") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "../../b") + list (APPEND errors "'${output}' instead of '../../b'") +endif() + +if (WIN32) + set (path "/a/d") + cmake_path(RELATIVE_PATH path BASE_DIRECTORY "e/d/c") + if (NOT path STREQUAL "/a/d") + list (APPEND errors "'${path}' instead of '/a/d'") + endif() + + set (path "c:/a/d") + cmake_path(RELATIVE_PATH path BASE_DIRECTORY "e/d/c") + if (NOT path STREQUAL "") + list (APPEND errors "'${path}' instead of ''") + endif() +elseif() + set (path "/a/d") + cmake_path(RELATIVE_PATH path BASE_DIRECTORY "e/d/c") + if (NOT path STREQUAL "") + list (APPEND errors "'${path}' instead of ''") + endif() +endif() + +check_errors (RELATIVE_PATH ${errors}) diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-wrong-path-result.txt b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION.cmake b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION.cmake new file mode 100644 index 0000000..ac06fde --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION.cmake @@ -0,0 +1,52 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "a/b/c.e.f") +cmake_path (REMOVE_EXTENSION path) +if (NOT path STREQUAL "a/b/c") + list (APPEND errors "'${path}' instead of 'a/b/c'") +endif() + +set (path "a/b/c.e.f") +cmake_path (REMOVE_EXTENSION path LAST_ONLY) +if (NOT path STREQUAL "a/b/c.e") + list (APPEND errors "'${path}' instead of 'a/b/c.e'") +endif() +cmake_path (REMOVE_EXTENSION path) +if (NOT path STREQUAL "a/b/c") + list (APPEND errors "'${path}' instead of 'a/b/c'") +endif() + +set (path "a/b/c.e.f") +cmake_path (REMOVE_EXTENSION path OUTPUT_VARIABLE output) +if (NOT path STREQUAL "a/b/c.e.f") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "a/b/c") + list (APPEND errors "'${output}' instead of 'a/b/'") +endif() + +set (path "a/b/c") +cmake_path (REMOVE_EXTENSION path) +if (NOT path STREQUAL "a/b/c") + list (APPEND errors "'${path}' instead of 'a/b/c'") +endif() + +set (path "a/b/.c") +cmake_path (REMOVE_EXTENSION path) +if (NOT path STREQUAL "a/b/.c") + list (APPEND errors "'${path}' instead of 'a/b/.c'") +endif() +cmake_path (REMOVE_EXTENSION path LAST_ONLY) +if (NOT path STREQUAL "a/b/.c") + list (APPEND errors "'${path}' instead of 'a/b/.c'") +endif() + +set (path "a/b/.") +cmake_path (REMOVE_EXTENSION path LAST_ONLY) +if (NOT path STREQUAL "a/b/.") + list (APPEND errors "'${path}' instead of 'a/b/.'") +endif() + +check_errors (REMOVE_EXTENSION ${errors}) diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME.cmake b/Tests/RunCMake/cmake_path/REMOVE_FILENAME.cmake new file mode 100644 index 0000000..385dcd0 --- /dev/null +++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME.cmake @@ -0,0 +1,25 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "a/b/c.e.f") +cmake_path (REMOVE_FILENAME path) +if (NOT path STREQUAL "a/b/") + list (APPEND errors "'${path}' instead of 'a/b/'") +endif() + +cmake_path (REMOVE_FILENAME path) +if (NOT path STREQUAL "a/b/") + list (APPEND errors "'${path}' instead of 'a/b/'") +endif() + +set (path "a/b/c.e.f") +cmake_path (REMOVE_FILENAME path OUTPUT_VARIABLE output) +if (NOT path STREQUAL "a/b/c.e.f") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "a/b/") + list (APPEND errors "'${output}' instead of 'a/b/'") +endif() + +check_errors (REMOVE_FILENAME ${errors}) diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-wrong-path-result.txt b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION.cmake b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION.cmake new file mode 100644 index 0000000..45c1575 --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION.cmake @@ -0,0 +1,58 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "a/b/c.e.f") +cmake_path (REPLACE_EXTENSION path ".x") +if (NOT path STREQUAL "a/b/c.x") + list (APPEND errors "'${path}' instead of 'a/b/c.x'") +endif() +cmake_path (REPLACE_EXTENSION path ".y") +if (NOT path STREQUAL "a/b/c.y") + list (APPEND errors "'${path}' instead of 'a/b/c.y'") +endif() +cmake_path (REPLACE_EXTENSION path "") +if (NOT path STREQUAL "a/b/c") + list (APPEND errors "'${path}' instead of 'a/b/c'") +endif() + +set (path "a/b/c.e.f") +cmake_path (REPLACE_EXTENSION path ".x" LAST_ONLY) +if (NOT path STREQUAL "a/b/c.e.x") + list (APPEND errors "'${path}' instead of 'a/b/c.e.x'") +endif() +cmake_path (REPLACE_EXTENSION path ".y" LAST_ONLY) +if (NOT path STREQUAL "a/b/c.e.y") + list (APPEND errors "'${path}' instead of 'a/b/c.e.y'") +endif() +cmake_path (REPLACE_EXTENSION path "" LAST_ONLY) +if (NOT path STREQUAL "a/b/c.e") + list (APPEND errors "'${path}' instead of 'a/b/c.e'") +endif() + +set (path "/a/.b") +cmake_path (REPLACE_EXTENSION path ".x") +if (NOT path STREQUAL "/a/.b.x") + list (APPEND errors "'${path}' instead of '/a/.b.x'") +endif() +cmake_path (REPLACE_EXTENSION path ".x" LAST_ONLY) +if (NOT path STREQUAL "/a/.b.x") + list (APPEND errors "'${path}' instead of '/a/.b.x'") +endif() + +set (path "/a/b") +cmake_path (REPLACE_EXTENSION path ".x") +if (NOT path STREQUAL "/a/b.x") + list (APPEND errors "'${path}' instead of '/a/b.x'") +endif() + +set (path "/a/b/") +cmake_path (REPLACE_EXTENSION path ".x" OUTPUT_VARIABLE output) +if (NOT path STREQUAL "/a/b/") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "/a/b/.x") + list (APPEND errors "'${output}' instead of '/a/b/.x'") +endif() + +check_errors (REPLACE_EXTENSION ${errors}) diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME.cmake b/Tests/RunCMake/cmake_path/REPLACE_FILENAME.cmake new file mode 100644 index 0000000..f7a9600 --- /dev/null +++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME.cmake @@ -0,0 +1,26 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "a/b/c.e.f") +cmake_path (REPLACE_FILENAME path "x.y") +if (NOT path STREQUAL "a/b/x.y") + list (APPEND errors "'${path}' instead of 'a/b/x.y'") +endif() + +set (path "a/b/") +cmake_path (REPLACE_FILENAME path "x.y") +if (NOT path STREQUAL "a/b/") + list (APPEND errors "'${path}' instead of 'a/b/'") +endif() + +set (path "a/b/c.e.f") +cmake_path (REPLACE_FILENAME path "" OUTPUT_VARIABLE output) +if (NOT path STREQUAL "a/b/c.e.f") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "a/b/") + list (APPEND errors "'${output}' instead of 'a/b/'") +endif() + +check_errors (REPLACE_FILENAME ${errors}) diff --git a/Tests/RunCMake/cmake_path/RunCMakeTest.cmake b/Tests/RunCMake/cmake_path/RunCMakeTest.cmake new file mode 100644 index 0000000..ca9cba6 --- /dev/null +++ b/Tests/RunCMake/cmake_path/RunCMakeTest.cmake @@ -0,0 +1,191 @@ +include(RunCMake) + +# Validate parsing arguments + +## input path is not a variable +set (RunCMake-stderr-file "wrong-path-stderr.txt") + +### GET sub-command +foreach (subcommand IN ITEMS ROOT_NAME ROOT_DIRECTORY ROOT_PATH FILENAME EXTENSION + STEM RELATIVE_PATH PARENT_PATH) + run_cmake_command (GET-${subcommand}-wrong-path "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=GET wrong_path ${subcommand} output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +### COMPARE sub-command +foreach (subcommand IN ITEMS EQUAL NOT_EQUAL) + run_cmake_command (COMPARE-${subcommand}-wrong-path "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=COMPARE wrong_path ${subcommand} path2 output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +foreach (command IN ITEMS CONCAT REMOVE_FILENAME REPLACE_FILENAME + REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH + RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH) + run_cmake_command (${command}-wrong-path "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} wrong_path" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +foreach (command IN ITEMS NATIVE_PATH + HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH + HAS_FILENAME HAS_EXTENSION HAS_STEM + HAS_RELATIVE_PATH HAS_PARENT_PATH + IS_ABSOLUTE IS_RELATIVE IS_PREFIX HASH) + if (command STREQUAL "IS_PREFIX") + set (extra_args path2) + else() + unset (extra_args) + endif() + run_cmake_command (${command}-wrong-path "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} wrong_path ${extra_args} output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + + +## missing output parameter +set (RunCMake-stderr-file "missing-output-stderr.txt") + +### GET sub-command +foreach (subcommand IN ITEMS ROOT_NAME ROOT_DIRECTORY ROOT_PATH FILENAME EXTENSION + STEM RELATIVE_PATH PARENT_PATH) + run_cmake_command (GET-${subcommand}-missing-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=GET path ${subcommand}" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +### CONVERT sub-command +foreach (subcommand IN ITEMS TO_CMAKE_PATH_LIST TO_NATIVE_PATH_LIST) + run_cmake_command (CONVERT-${subcommand}-missing-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=CONVERT path ${subcommand}" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +### COMPARE sub-command +foreach (subcommand IN ITEMS EQUAL NOT_EQUAL) + run_cmake_command (COMPARE-${subcommand}-missing-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=COMPARE path ${subcommand} path2" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +foreach (command IN ITEMS CMAKE_PATH NATIVE_PATH + HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH + HAS_FILENAME HAS_EXTENSION HAS_STEM + HAS_RELATIVE_PATH HAS_PARENT_PATH + IS_ABSOLUTE IS_RELATIVE IS_PREFIX HASH) + if (command STREQUAL "IS_PREFIX") + set (extra_args path2) + else() + unset (extra_args) + endif() + run_cmake_command (${command}-missing-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args}" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + + +## OUTPUT_VARIABLE without argument +set (RunCMake-stderr-file "OUTPUT_VARIABLE-no-arg-stderr.txt") + +foreach (command IN ITEMS APPEND CONCAT REMOVE_FILENAME REPLACE_FILENAME + REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH + RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH) + run_cmake_command (${command}-OUTPUT_VARIABLE-no-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path OUTPUT_VARIABLE" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + + +## Invalid output variable +set (RunCMake-stderr-file "invalid-output-var-stderr.txt") + +### GET sub-command +foreach (subcommand IN ITEMS ROOT_NAME ROOT_DIRECTORY ROOT_PATH FILENAME EXTENSION + STEM RELATIVE_PATH PARENT_PATH) + run_cmake_command (GET-${subcommand}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=GET path ${subcommand}" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +### CONVERT sub-command +foreach (subcommand IN ITEMS TO_CMAKE_PATH_LIST TO_NATIVE_PATH_LIST) + run_cmake_command (CONVERT-${subcommand}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=CONVERT path ${subcommand}" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +### COMPARE sub-command +foreach (subcommand IN ITEMS EQUAL NOT_EQUAL) + run_cmake_command (COMPARE-${subcommand}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=COMPARE path ${subcommand} path2" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +foreach (command IN ITEMS CMAKE_PATH NATIVE_PATH + HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH + HAS_FILENAME HAS_EXTENSION HAS_STEM + HAS_RELATIVE_PATH HAS_PARENT_PATH + IS_ABSOLUTE IS_RELATIVE IS_PREFIX HASH) + if (command STREQUAL "IS_PREFIX") + set (extra_args path2) + else() + unset (extra_args) + endif() + run_cmake_command (${command}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args}" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +foreach (command IN ITEMS APPEND CONCAT REMOVE_FILENAME REPLACE_FILENAME + REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH + RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH) + run_cmake_command (${command}-OUTPUT_VARIABLE-invalid-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path OUTPUT_VARIABLE" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + + +## Unexpected arguments +set (RunCMake-stderr-file "unexpected-arg-stderr.txt") + +### GET sub-command +foreach (subcommand IN ITEMS ROOT_NAME ROOT_DIRECTORY ROOT_PATH FILENAME EXTENSION + STEM RELATIVE_PATH PARENT_PATH) + if (subcommand STREQUAL "EXTENSION" OR subcommand STREQUAL "STEM") + set (extra_args LAST_ONLY) + else() + unset (extra_args) + endif() + run_cmake_command (GET-${subcommand}-unexpected-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=GET path ${subcommand} ${extra_args} unexpected output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +### CONVERT sub-command +foreach (subcommand IN ITEMS TO_CMAKE_PATH_LIST TO_NATIVE_PATH_LIST) + run_cmake_command (CONVERT-${subcommand}-unexpected-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=CONVERT path ${subcommand} output unexpected" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +foreach (command IN ITEMS REMOVE_FILENAME REPLACE_FILENAME + REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH + RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH) + if (command STREQUAL "REPLACE_FILENAME" OR command STREQUAL "REPLACE_EXTENSION") + set (extra_args input) + else() + unset (extra_args) + endif() + run_cmake_command (${command}-unexpected-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args} unexpected" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() + +foreach (command IN ITEMS CMAKE_PATH NATIVE_PATH + HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH + HAS_FILENAME HAS_EXTENSION HAS_STEM + HAS_RELATIVE_PATH HAS_PARENT_PATH + IS_ABSOLUTE IS_RELATIVE IS_PREFIX + HASH) + if (command STREQUAL "IS_PREFIX") + set (extra_args input) + else() + unset (extra_args) + endif() + run_cmake_command (${command}-unexpected-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args} unexpected output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") +endforeach() +unset (RunCMake-stderr-file) + +run_cmake(GET-wrong-operator) +run_cmake(CONVERT-wrong-operator) +run_cmake(COMPARE-wrong-operator) + +set (RunCMake_TEST_OPTIONS "-DRunCMake_SOURCE_DIR=${RunCMake_SOURCE_DIR}") + +run_cmake(GET) +run_cmake(APPEND) +run_cmake(CONCAT) +run_cmake(REMOVE_FILENAME) +run_cmake(REPLACE_FILENAME) +run_cmake(REMOVE_EXTENSION) +run_cmake(REPLACE_EXTENSION) +run_cmake(NORMAL_PATH) +run_cmake(RELATIVE_PATH) +run_cmake(PROXIMATE_PATH) +run_cmake(ABSOLUTE_PATH) +run_cmake(CMAKE_PATH) +run_cmake(NATIVE_PATH) +run_cmake(CONVERT) +run_cmake(COMPARE) +run_cmake(HAS_ITEM) +run_cmake(IS_ABSOLUTE) +run_cmake(IS_RELATIVE) +run_cmake(IS_PREFIX) +run_cmake(HASH) diff --git a/Tests/RunCMake/cmake_path/call-cmake_path.cmake b/Tests/RunCMake/cmake_path/call-cmake_path.cmake new file mode 100644 index 0000000..70fd6f5 --- /dev/null +++ b/Tests/RunCMake/cmake_path/call-cmake_path.cmake @@ -0,0 +1,19 @@ + +cmake_minimum_required(VERSION 3.18...3.19) + +# define input variable +set (path "") + +separate_arguments(CMAKE_PATH_ARGUMENTS UNIX_COMMAND "${CMAKE_PATH_ARGUMENTS}") + +if (CHECK_INVALID_OUTPUT) + # special handling for CMAKE_PATH + list(GET CMAKE_PATH_ARGUMENTS 0 command) + if (command STREQUAL "CMAKE_PATH") + cmake_path(CMAKE_PATH "" "input") + else() + cmake_path(${CMAKE_PATH_ARGUMENTS} "") + endif() +else() + cmake_path(${CMAKE_PATH_ARGUMENTS}) +endif() diff --git a/Tests/RunCMake/cmake_path/check_errors.cmake b/Tests/RunCMake/cmake_path/check_errors.cmake new file mode 100644 index 0000000..d136971 --- /dev/null +++ b/Tests/RunCMake/cmake_path/check_errors.cmake @@ -0,0 +1,12 @@ + +function (CHECK_ERRORS command) + set (errors ${ARGN}) + if (errors) + string (LENGTH "${command}" length) + math (EXPR count "${length} + 2") + string (REPEAT " " ${count} shift) + list (TRANSFORM errors PREPEND "${shift}") + list (JOIN errors "\n" msg) + message (FATAL_ERROR "${command}: ${msg}") + endif() +endfunction() diff --git a/Tests/RunCMake/cmake_path/invalid-output-var-stderr.txt b/Tests/RunCMake/cmake_path/invalid-output-var-stderr.txt new file mode 100644 index 0000000..32a8948 --- /dev/null +++ b/Tests/RunCMake/cmake_path/invalid-output-var-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .+/call-cmake_path.cmake:[0-9]+ \(cmake_path\): + cmake_path Invalid name for output variable. diff --git a/Tests/RunCMake/cmake_path/missing-output-stderr.txt b/Tests/RunCMake/cmake_path/missing-output-stderr.txt new file mode 100644 index 0000000..8ac049b --- /dev/null +++ b/Tests/RunCMake/cmake_path/missing-output-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\): + cmake_path [A-Z_]+ must be called with ((at least )?(two|three|four)|two or three|three or four) arguments. diff --git a/Tests/RunCMake/cmake_path/unexpected-arg-stderr.txt b/Tests/RunCMake/cmake_path/unexpected-arg-stderr.txt new file mode 100644 index 0000000..8f0e2f2 --- /dev/null +++ b/Tests/RunCMake/cmake_path/unexpected-arg-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\): + cmake_path [A-Z_]+ (called with unexpected|must be called with two) arguments. diff --git a/Tests/RunCMake/cmake_path/wrong-path-stderr.txt b/Tests/RunCMake/cmake_path/wrong-path-stderr.txt new file mode 100644 index 0000000..c42b5a2 --- /dev/null +++ b/Tests/RunCMake/cmake_path/wrong-path-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\): + cmake_path undefined variable for input path. diff --git a/Utilities/cm3p/Setup.Configuration.h b/Utilities/cm3p/Setup.Configuration.h index a5cf058..9f4190e 100644 --- a/Utilities/cm3p/Setup.Configuration.h +++ b/Utilities/cm3p/Setup.Configuration.h @@ -1,8 +1,5 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm3p_Setup_Configuration_h -#define cm3p_Setup_Configuration_h +#pragma once #include <cmvssetup/Setup.Configuration.h> // IWYU pragma: export - -#endif diff --git a/Utilities/cm3p/archive.h b/Utilities/cm3p/archive.h index 956b3ab..a775400 100644 --- a/Utilities/cm3p/archive.h +++ b/Utilities/cm3p/archive.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm3p_archive_h -#define cm3p_archive_h +#pragma once /* Use the libarchive configured for CMake. */ #include "cmThirdParty.h" @@ -10,5 +9,3 @@ #else # include <cmlibarchive/libarchive/archive.h> // IWYU pragma: export #endif - -#endif diff --git a/Utilities/cm3p/archive_entry.h b/Utilities/cm3p/archive_entry.h index 230e87a..0f8376c 100644 --- a/Utilities/cm3p/archive_entry.h +++ b/Utilities/cm3p/archive_entry.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm3p_archive_entry_h -#define cm3p_archive_entry_h +#pragma once /* Use the libarchive configured for CMake. */ #include "cmThirdParty.h" @@ -10,5 +9,3 @@ #else # include <cmlibarchive/libarchive/archive_entry.h> // IWYU pragma: export #endif - -#endif diff --git a/Utilities/cm3p/bzlib.h b/Utilities/cm3p/bzlib.h index 2a0f4dd..c0eef03 100644 --- a/Utilities/cm3p/bzlib.h +++ b/Utilities/cm3p/bzlib.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm3p_bzlib_h -#define cm3p_bzlib_h +#pragma once /* Use the bzip2 library configured for CMake. */ #include "cmThirdParty.h" @@ -10,5 +9,3 @@ #else # include <cmbzip2/bzlib.h> // IWYU pragma: export #endif - -#endif diff --git a/Utilities/cm3p/curl/curl.h b/Utilities/cm3p/curl/curl.h index 6e2b822..272db8d 100644 --- a/Utilities/cm3p/curl/curl.h +++ b/Utilities/cm3p/curl/curl.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm3p_curl_curl_h -#define cm3p_curl_curl_h +#pragma once /* Use the curl library configured for CMake. */ #include "cmThirdParty.h" @@ -10,5 +9,3 @@ #else # include <cmcurl/include/curl/curl.h> // IWYU pragma: export #endif - -#endif diff --git a/Utilities/cm3p/expat.h b/Utilities/cm3p/expat.h index 32e6fd0..bcf6195 100644 --- a/Utilities/cm3p/expat.h +++ b/Utilities/cm3p/expat.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm3p_expat_h -#define cm3p_expat_h +#pragma once /* Use the expat library configured for CMake. */ #include "cmThirdParty.h" @@ -10,5 +9,3 @@ #else # include <cmexpat/lib/expat.h> // IWYU pragma: export #endif - -#endif diff --git a/Utilities/cm3p/json/reader.h b/Utilities/cm3p/json/reader.h index 0df09ee..9fa8d2d 100644 --- a/Utilities/cm3p/json/reader.h +++ b/Utilities/cm3p/json/reader.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm3p_json_reader_h -#define cm3p_json_reader_h +#pragma once /* Use the jsoncpp library configured for CMake. */ #include "cmThirdParty.h" @@ -10,5 +9,3 @@ #else # include <cmjsoncpp/include/json/reader.h> // IWYU pragma: export #endif - -#endif diff --git a/Utilities/cm3p/json/value.h b/Utilities/cm3p/json/value.h index f59bed6..fc3b5f4 100644 --- a/Utilities/cm3p/json/value.h +++ b/Utilities/cm3p/json/value.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm3p_json_value_h -#define cm3p_json_value_h +#pragma once /* Use the jsoncpp library configured for CMake. */ #include "cmThirdParty.h" @@ -10,5 +9,3 @@ #else # include <cmjsoncpp/include/json/value.h> // IWYU pragma: export #endif - -#endif diff --git a/Utilities/cm3p/json/writer.h b/Utilities/cm3p/json/writer.h index 7fcc3e2..7ee1e43 100644 --- a/Utilities/cm3p/json/writer.h +++ b/Utilities/cm3p/json/writer.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm3p_json_writer_h -#define cm3p_json_writer_h +#pragma once /* Use the jsoncpp library configured for CMake. */ #include "cmThirdParty.h" @@ -10,5 +9,3 @@ #else # include <cmjsoncpp/include/json/writer.h> // IWYU pragma: export #endif - -#endif diff --git a/Utilities/cm3p/kwiml/abi.h b/Utilities/cm3p/kwiml/abi.h index 6d0dedf..8d5189a 100644 --- a/Utilities/cm3p/kwiml/abi.h +++ b/Utilities/cm3p/kwiml/abi.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm3p_kwiml_abi_h -#define cm3p_kwiml_abi_h +#pragma once /* Use the KWIML library configured for CMake. */ #include "cmThirdParty.h" @@ -10,5 +9,3 @@ #else # include <KWIML/include/kwiml/abi.h> // IWYU pragma: export #endif - -#endif diff --git a/Utilities/cm3p/kwiml/int.h b/Utilities/cm3p/kwiml/int.h index 4c7c23d..2669df8 100644 --- a/Utilities/cm3p/kwiml/int.h +++ b/Utilities/cm3p/kwiml/int.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm3p_kwiml_int_h -#define cm3p_kwiml_int_h +#pragma once /* Use the KWIML library configured for CMake. */ #include "cmThirdParty.h" @@ -10,5 +9,3 @@ #else # include <KWIML/include/kwiml/int.h> // IWYU pragma: export #endif - -#endif diff --git a/Utilities/cm3p/lzma.h b/Utilities/cm3p/lzma.h index abfacf3..7842f6b 100644 --- a/Utilities/cm3p/lzma.h +++ b/Utilities/cm3p/lzma.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm3p_lzma_h -#define cm3p_lzma_h +#pragma once /* Use the liblzma configured for CMake. */ #include "cmThirdParty.h" @@ -10,5 +9,3 @@ #else # include <cmliblzma/liblzma/api/lzma.h> // IWYU pragma: export #endif - -#endif diff --git a/Utilities/cm3p/rhash.h b/Utilities/cm3p/rhash.h index 9d5e411..5828557 100644 --- a/Utilities/cm3p/rhash.h +++ b/Utilities/cm3p/rhash.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm3p_rhash_h -#define cm3p_rhash_h +#pragma once /* Use the LibRHash library configured for CMake. */ #include "cmThirdParty.h" @@ -10,5 +9,3 @@ #else # include <cmlibrhash/librhash/rhash.h> // IWYU pragma: export #endif - -#endif diff --git a/Utilities/cm3p/uv.h b/Utilities/cm3p/uv.h index 307a09f..36a86b6 100644 --- a/Utilities/cm3p/uv.h +++ b/Utilities/cm3p/uv.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm3p_uv_h -#define cm3p_uv_h +#pragma once /* Use the libuv library configured for CMake. */ #include "cmThirdParty.h" @@ -10,5 +9,3 @@ #else # include <cmlibuv/include/uv.h> // IWYU pragma: export #endif - -#endif diff --git a/Utilities/cm3p/zlib.h b/Utilities/cm3p/zlib.h index fe7baee..6b82aa2 100644 --- a/Utilities/cm3p/zlib.h +++ b/Utilities/cm3p/zlib.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm3p_zlib_h -#define cm3p_zlib_h +#pragma once /* Use the zlib library configured for CMake. */ #include "cmThirdParty.h" @@ -10,5 +9,3 @@ #else # include <cmzlib/zlib.h> // IWYU pragma: export #endif - -#endif diff --git a/Utilities/cm3p/zstd.h b/Utilities/cm3p/zstd.h index 07cc3e4..51972de 100644 --- a/Utilities/cm3p/zstd.h +++ b/Utilities/cm3p/zstd.h @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm3p_zstd_h -#define cm3p_zstd_h +#pragma once /* Use the libzstd configured for CMake. */ #include "cmThirdParty.h" @@ -10,5 +9,3 @@ #else # include <cmzstd/lib/zstd.h> // IWYU pragma: export #endif - -#endif diff --git a/Utilities/cmThirdParty.h.in b/Utilities/cmThirdParty.h.in index 1456e34..bd0edb7 100644 --- a/Utilities/cmThirdParty.h.in +++ b/Utilities/cmThirdParty.h.in @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmThirdParty_h -#define cmThirdParty_h +#pragma once /* Whether CMake is using its own utility libraries. */ #cmakedefine CMAKE_USE_SYSTEM_CURL @@ -16,5 +15,3 @@ #cmakedefine CMAKE_USE_SYSTEM_LIBRHASH #cmakedefine CMAKE_USE_SYSTEM_LIBUV #cmakedefine CMAKE_USE_SYSTEM_ZSTD - -#endif diff --git a/Utilities/std/cm/algorithm b/Utilities/std/cm/algorithm index 8ade99c..93fe224 100644 --- a/Utilities/std/cm/algorithm +++ b/Utilities/std/cm/algorithm @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_algorithm -#define cm_algorithm +#pragma once #include <algorithm> // IWYU pragma: export #include <cassert> @@ -34,5 +33,3 @@ T const& clamp(T const& v, T const& lo, T const& hi, Comp comp) #endif } // namespace cm - -#endif diff --git a/Utilities/std/cm/bits/erase_if.hxx b/Utilities/std/cm/bits/erase_if.hxx index 8952fb5..354b0c2 100644 --- a/Utilities/std/cm/bits/erase_if.hxx +++ b/Utilities/std/cm/bits/erase_if.hxx @@ -4,8 +4,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_bits_erase_if_hxx -#define cm_bits_erase_if_hxx +#pragma once namespace cm { namespace internals { @@ -25,5 +24,3 @@ void erase_if(Container& cont, Predicate pred) } // namespace internals } // namespace cm - -#endif diff --git a/Utilities/std/cm/bits/fs_path.cxx b/Utilities/std/cm/bits/fs_path.cxx index 8089998..1f52878 100644 --- a/Utilities/std/cm/bits/fs_path.cxx +++ b/Utilities/std/cm/bits/fs_path.cxx @@ -847,7 +847,7 @@ cm::string_view path::get_filename_fragment(filename_fragment fragment) const { auto file = this->get_filename(); - if (file == "." || file == ".." || file.empty()) { + if (file.empty() || file == "." || file == "..") { return fragment == filename_fragment::stem ? file : cm::string_view{}; } diff --git a/Utilities/std/cm/deque b/Utilities/std/cm/deque index 4bb6725..b7b6959 100644 --- a/Utilities/std/cm/deque +++ b/Utilities/std/cm/deque @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_deque -#define cm_deque +#pragma once #include <algorithm> #include <deque> // IWYU pragma: export @@ -36,5 +35,3 @@ inline void erase_if(std::deque<T, Allocator>& cont, Predicate pred) #endif } // namespace cm - -#endif diff --git a/Utilities/std/cm/filesystem b/Utilities/std/cm/filesystem index 6021712..6cbdea9 100644 --- a/Utilities/std/cm/filesystem +++ b/Utilities/std/cm/filesystem @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_filesystem -#define cm_filesystem +#pragma once #include "cmSTL.hxx" // IWYU pragma: keep @@ -1151,6 +1150,8 @@ inline path::iterator path::end() const return iterator(this, true); } +// Non-member functions +// ==================== bool operator==(const path::iterator& lhs, const path::iterator& rhs); inline bool operator!=(const path::iterator& lhs, const path::iterator& rhs) @@ -1158,8 +1159,6 @@ inline bool operator!=(const path::iterator& lhs, const path::iterator& rhs) return !(lhs == rhs); } -// Non-member functions -// ==================== inline void swap(path& lhs, path& rhs) noexcept { lhs.swap(rhs); @@ -1171,5 +1170,3 @@ std::size_t hash_value(const path& p) noexcept; } // namespace filesystem } // namespace cm - -#endif diff --git a/Utilities/std/cm/iomanip b/Utilities/std/cm/iomanip index 6f68530..602b912 100644 --- a/Utilities/std/cm/iomanip +++ b/Utilities/std/cm/iomanip @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_iomanip -#define cm_iomanip +#pragma once #include <iomanip> // IWYU pragma: export #if __cplusplus < 201402L || defined(_MSVC_LANG) && _MSVC_LANG < 201402L @@ -179,5 +178,3 @@ inline internals::quoted_string<cm::string_view, char> quoted( #endif } // namespace cm - -#endif diff --git a/Utilities/std/cm/iterator b/Utilities/std/cm/iterator index 718f1d6..3b38cc7 100644 --- a/Utilities/std/cm/iterator +++ b/Utilities/std/cm/iterator @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_iterator -#define cm_iterator +#pragma once #include <iterator> // IWYU pragma: export @@ -212,5 +211,3 @@ constexpr T* data(T (&arr)[N]) noexcept #endif } // namespace cm - -#endif diff --git a/Utilities/std/cm/list b/Utilities/std/cm/list index ba5d94a..380bff8 100644 --- a/Utilities/std/cm/list +++ b/Utilities/std/cm/list @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_list -#define cm_list +#pragma once #include <list> // IWYU pragma: export @@ -35,5 +34,3 @@ inline void erase_if(std::list<T, Allocator>& cont, Predicate pred) #endif } // namespace cm - -#endif diff --git a/Utilities/std/cm/map b/Utilities/std/cm/map index e348dec..1794cd7 100644 --- a/Utilities/std/cm/map +++ b/Utilities/std/cm/map @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_map -#define cm_map +#pragma once #include <map> // IWYU pragma: export @@ -40,5 +39,3 @@ inline void erase_if(std::multimap<Key, T, Compare, Allocator>& cont, #endif } // namespace cm - -#endif diff --git a/Utilities/std/cm/memory b/Utilities/std/cm/memory index 5611f6b..005e6e2 100644 --- a/Utilities/std/cm/memory +++ b/Utilities/std/cm/memory @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_memory -#define cm_memory +#pragma once #include "cmSTL.hxx" // IWYU pragma: keep @@ -66,5 +65,3 @@ typename internals::make_unique_if<T>::bound_array make_unique(Args&&...) = #endif } // namespace cm - -#endif diff --git a/Utilities/std/cm/optional b/Utilities/std/cm/optional index 80b0951..9a5d840 100644 --- a/Utilities/std/cm/optional +++ b/Utilities/std/cm/optional @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_optional -#define cm_optional +#pragma once #if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) # define CMake_HAVE_CXX_OPTIONAL @@ -219,6 +218,210 @@ optional<T>& optional<T>::operator=(U&& v) return *this; } +template <typename T, typename U> +bool operator==(const optional<T>& lhs, const optional<U>& rhs) +{ + if (lhs.has_value()) { + return rhs.has_value() && *lhs == *rhs; + } + return !rhs.has_value(); +} + +template <typename T, typename U> +bool operator!=(const optional<T>& lhs, const optional<U>& rhs) +{ + if (lhs.has_value()) { + return !rhs.has_value() || *lhs != *rhs; + } + return rhs.has_value(); +} + +template <typename T, typename U> +bool operator<(const optional<T>& lhs, const optional<U>& rhs) +{ + if (rhs.has_value()) { + return !lhs.has_value() || *lhs < *rhs; + } + return false; +} + +template <typename T, typename U> +bool operator<=(const optional<T>& lhs, const optional<U>& rhs) +{ + if (!lhs.has_value()) { + return true; + } + if (rhs.has_value()) { + return *lhs <= *rhs; + } + return false; +} + +template <typename T, typename U> +bool operator>(const optional<T>& lhs, const optional<U>& rhs) +{ + if (lhs.has_value()) { + return !rhs.has_value() || *lhs > *rhs; + } + return false; +} + +template <typename T, typename U> +bool operator>=(const optional<T>& lhs, const optional<U>& rhs) +{ + if (!rhs.has_value()) { + return true; + } + if (lhs.has_value()) { + return *lhs >= *rhs; + } + return false; +} + +template <typename T> +bool operator==(const optional<T>& opt, nullopt_t) noexcept +{ + return !opt.has_value(); +} + +template <typename T> +bool operator!=(const optional<T>& opt, nullopt_t) noexcept +{ + return opt.has_value(); +} + +template <typename T> +bool operator<(const optional<T>& opt, nullopt_t) noexcept +{ + return false; +} + +template <typename T> +bool operator<=(const optional<T>& opt, nullopt_t) noexcept +{ + return !opt.has_value(); +} + +template <typename T> +bool operator>(const optional<T>& opt, nullopt_t) noexcept +{ + return opt.has_value(); +} + +template <typename T> +bool operator>=(const optional<T>& opt, nullopt_t) noexcept +{ + return true; +} + +template <typename T> +bool operator==(nullopt_t, const optional<T>& opt) noexcept +{ + return !opt.has_value(); +} + +template <typename T> +bool operator!=(nullopt_t, const optional<T>& opt) noexcept +{ + return opt.has_value(); +} + +template <typename T> +bool operator<(nullopt_t, const optional<T>& opt) noexcept +{ + return opt.has_value(); +} + +template <typename T> +bool operator<=(nullopt_t, const optional<T>& opt) noexcept +{ + return true; +} + +template <typename T> +bool operator>(nullopt_t, const optional<T>& opt) noexcept +{ + return false; +} + +template <typename T> +bool operator>=(nullopt_t, const optional<T>& opt) noexcept +{ + return !opt.has_value(); +} + +template <typename T, typename U> +bool operator==(const optional<T>& opt, const U& value) +{ + return opt.has_value() && *opt == value; +} + +template <typename T, typename U> +bool operator!=(const optional<T>& opt, const U& value) +{ + return !opt.has_value() || *opt != value; +} + +template <typename T, typename U> +bool operator<(const optional<T>& opt, const U& value) +{ + return !opt.has_value() || *opt < value; +} + +template <typename T, typename U> +bool operator<=(const optional<T>& opt, const U& value) +{ + return !opt.has_value() || *opt <= value; +} + +template <typename T, typename U> +bool operator>(const optional<T>& opt, const U& value) +{ + return opt.has_value() && *opt > value; +} + +template <typename T, typename U> +bool operator>=(const optional<T>& opt, const U& value) +{ + return opt.has_value() && *opt >= value; +} + +template <typename T, typename U> +bool operator==(const T& value, const optional<U>& opt) +{ + return opt.has_value() && value == *opt; +} + +template <typename T, typename U> +bool operator!=(const T& value, const optional<U>& opt) +{ + return !opt.has_value() || value != *opt; +} + +template <typename T, typename U> +bool operator<(const T& value, const optional<U>& opt) +{ + return opt.has_value() && value < *opt; +} + +template <typename T, typename U> +bool operator<=(const T& value, const optional<U>& opt) +{ + return opt.has_value() && value <= *opt; +} + +template <typename T, typename U> +bool operator>(const T& value, const optional<U>& opt) +{ + return !opt.has_value() || value > *opt; +} + +template <typename T, typename U> +bool operator>=(const T& value, const optional<U>& opt) +{ + return !opt.has_value() || value >= *opt; +} + template <typename T> const T* optional<T>::operator->() const { @@ -340,5 +543,3 @@ T& optional<T>::emplace(Args&&... args) #endif } - -#endif diff --git a/Utilities/std/cm/set b/Utilities/std/cm/set index 56dd474..9fd24d3 100644 --- a/Utilities/std/cm/set +++ b/Utilities/std/cm/set @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_set -#define cm_set +#pragma once #include <set> // IWYU pragma: export @@ -39,5 +38,3 @@ inline void erase_if(std::multiset<Key, Compare, Allocator>& cont, #endif } // namespace cm - -#endif diff --git a/Utilities/std/cm/shared_mutex b/Utilities/std/cm/shared_mutex index ec63a7b..a1204fa 100644 --- a/Utilities/std/cm/shared_mutex +++ b/Utilities/std/cm/shared_mutex @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_shared_mutex -#define cm_shared_mutex +#pragma once #if __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L # define CMake_HAVE_CXX_SHARED_LOCK @@ -72,5 +71,3 @@ public: }; #endif } - -#endif diff --git a/Utilities/std/cm/string b/Utilities/std/cm/string index cc4c796..30b1b85 100644 --- a/Utilities/std/cm/string +++ b/Utilities/std/cm/string @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_string -#define cm_string +#pragma once #include <algorithm> #include <string> // IWYU pragma: export @@ -38,5 +37,3 @@ inline void erase_if(std::basic_string<T, Traits, Allocator>& cont, #endif } // namespace cm - -#endif diff --git a/Utilities/std/cm/string_view b/Utilities/std/cm/string_view index 4d359cb..9542bac 100644 --- a/Utilities/std/cm/string_view +++ b/Utilities/std/cm/string_view @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_string_view -#define cm_string_view +#pragma once #if __cplusplus >= 201703L || defined(_MSVC_LANG) && _MSVC_LANG >= 201703L # define CMake_HAVE_CXX_STRING_VIEW @@ -215,4 +214,3 @@ struct hash<cm::string_view> } #endif -#endif diff --git a/Utilities/std/cm/type_traits b/Utilities/std/cm/type_traits index e32c2c6..56ec64f 100644 --- a/Utilities/std/cm/type_traits +++ b/Utilities/std/cm/type_traits @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_type_traits -#define cm_type_traits +#pragma once #include <type_traits> // IWYU pragma: export @@ -59,5 +58,3 @@ using void_t = typename make_void<ArgTypes...>::type; #endif } // namespace cm - -#endif diff --git a/Utilities/std/cm/unordered_map b/Utilities/std/cm/unordered_map index 5b8a456..d21c37e 100644 --- a/Utilities/std/cm/unordered_map +++ b/Utilities/std/cm/unordered_map @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_unordered_map -#define cm_unordered_map +#pragma once #include <unordered_map> // IWYU pragma: export @@ -41,5 +40,3 @@ inline void erase_if( #endif } // namespace cm - -#endif diff --git a/Utilities/std/cm/unordered_set b/Utilities/std/cm/unordered_set index 9debac4..2545ff6 100644 --- a/Utilities/std/cm/unordered_set +++ b/Utilities/std/cm/unordered_set @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_unordered_set -#define cm_unordered_set +#pragma once #include <unordered_set> // IWYU pragma: export @@ -41,5 +40,3 @@ inline void erase_if( #endif } // namespace cm - -#endif diff --git a/Utilities/std/cm/utility b/Utilities/std/cm/utility index 3acac4f..c257fc8 100644 --- a/Utilities/std/cm/utility +++ b/Utilities/std/cm/utility @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_utility -#define cm_utility +#pragma once #if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) # define CMake_HAVE_CXX_IN_PLACE @@ -30,5 +29,3 @@ constexpr in_place_t in_place{}; #endif } - -#endif diff --git a/Utilities/std/cm/vector b/Utilities/std/cm/vector index 2dbe704..33d9365 100644 --- a/Utilities/std/cm/vector +++ b/Utilities/std/cm/vector @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_vector -#define cm_vector +#pragma once #include <algorithm> #include <vector> // IWYU pragma: export @@ -36,5 +35,3 @@ inline void erase_if(std::vector<T, Allocator>& cont, Predicate pred) #endif } // namespace cm - -#endif diff --git a/Utilities/std/cmSTL.hxx.in b/Utilities/std/cmSTL.hxx.in index 9c8605c..5e94864 100644 --- a/Utilities/std/cmSTL.hxx.in +++ b/Utilities/std/cmSTL.hxx.in @@ -1,10 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmSTL_hxx -#define cmSTL_hxx +#pragma once /* Whether CMake is using its own STL implementation. */ #cmakedefine CMake_HAVE_CXX_MAKE_UNIQUE #cmakedefine CMake_HAVE_CXX_FILESYSTEM - -#endif diff --git a/Utilities/std/cmext/algorithm b/Utilities/std/cmext/algorithm index 251c89a..11514fc 100644 --- a/Utilities/std/cmext/algorithm +++ b/Utilities/std/cmext/algorithm @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmext_algorithm -#define cmext_algorithm +#pragma once #include <algorithm> #include <iterator> @@ -247,5 +246,3 @@ bool contains(Range const& range, Key const& key) #endif } // namespace cm - -#endif diff --git a/Utilities/std/cmext/iterator b/Utilities/std/cmext/iterator index ce9462f..83d7890 100644 --- a/Utilities/std/cmext/iterator +++ b/Utilities/std/cmext/iterator @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmext_iterator -#define cmext_iterator +#pragma once #include <iterator> @@ -47,5 +46,3 @@ using is_input_range = #endif } // namespace cm - -#endif diff --git a/Utilities/std/cmext/memory b/Utilities/std/cmext/memory index fa326f0..3681d97 100644 --- a/Utilities/std/cmext/memory +++ b/Utilities/std/cmext/memory @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmext_memory -#define cmext_memory +#pragma once #include <typeinfo> @@ -37,5 +36,3 @@ T& dynamic_reference_cast(O& item) } } // namespace cm - -#endif diff --git a/Utilities/std/cmext/string_view b/Utilities/std/cmext/string_view index ad52b11..369cc90 100644 --- a/Utilities/std/cmext/string_view +++ b/Utilities/std/cmext/string_view @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmext_string_view -#define cmext_string_view +#pragma once #include <cstddef> @@ -38,5 +37,3 @@ inline static_string_view operator"" _s(const char* data, size_t size) } // namespace cm using cm::operator"" _s; - -#endif diff --git a/Utilities/std/cmext/type_traits b/Utilities/std/cmext/type_traits index f02b488..4468e31 100644 --- a/Utilities/std/cmext/type_traits +++ b/Utilities/std/cmext/type_traits @@ -3,8 +3,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmext_type_traits -#define cmext_type_traits +#pragma once #include <memory> @@ -84,5 +83,3 @@ using is_sequence_container = !cm::is_unordered_associative_container<T>::value>; } // namespace cm - -#endif @@ -288,6 +288,8 @@ CMAKE_CXX_SOURCES="\ cmBreakCommand \ cmBuildCommand \ cmCMakeMinimumRequired \ + cmCMakePath \ + cmCMakePathCommand \ cmCMakePolicyCommand \ cmCPackPropertiesGenerator \ cmCacheManager \ @@ -1594,8 +1596,7 @@ for a in ${KWSYS_FILES}; do cmsys_header_files="${cmsys_header_files} cmsys/${a}" done -echo "#ifndef cmThirdParty_h" > "${cmake_bootstrap_dir}/cmThirdParty.h.tmp" -echo "#define cmThirdParty_h" >> "${cmake_bootstrap_dir}/cmThirdParty.h.tmp" +echo "#pragma once" > "${cmake_bootstrap_dir}/cmThirdParty.h.tmp" if test "x${bootstrap_system_libuv}" != "x"; then echo "#define CMAKE_USE_SYSTEM_LIBUV" >> "${cmake_bootstrap_dir}/cmThirdParty.h.tmp" fi @@ -1605,7 +1606,6 @@ fi if test "x${bootstrap_system_librhash}" != "x"; then echo "#define CMAKE_USE_SYSTEM_LIBRHASH" >> "${cmake_bootstrap_dir}/cmThirdParty.h.tmp" fi -echo "#endif" >> "${cmake_bootstrap_dir}/cmThirdParty.h.tmp" cmake_generate_file_tmp "${cmake_bootstrap_dir}/cmThirdParty.h" "${cmake_bootstrap_dir}/cmThirdParty.h.tmp" # Generate Makefile |