diff options
142 files changed, 1501 insertions, 1455 deletions
diff --git a/Help/command/export.rst b/Help/command/export.rst index ffd60e1..2ca7056 100644 --- a/Help/command/export.rst +++ b/Help/command/export.rst @@ -54,7 +54,7 @@ unspecified. export(PACKAGE <PackageName>) Store the current build directory in the CMake user package registry -for package ``<PackageName>``. The find_package command may consider the +for package ``<PackageName>``. The :command:`find_package` command may consider the directory while searching for package ``<PackageName>``. This helps dependent projects find and use a package from the current project's build tree without help from the user. Note that the entry in the package diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index 54d5f68..eb44eb2 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -180,7 +180,7 @@ sets these variables: These variables are checked by the ``find_package`` command to determine whether the configuration file provides an acceptable version. They -are not available after the find_package call returns. If the version +are not available after the ``find_package`` call returns. If the version is acceptable the following variables are set: ``<PackageName>_VERSION`` @@ -220,8 +220,8 @@ Search Procedure CMake constructs a set of possible installation prefixes for the package. Under each prefix several directories are searched for a configuration file. The tables below show the directories searched. -Each entry is meant for installation trees following Windows (W), UNIX -(U), or Apple (A) conventions:: +Each entry is meant for installation trees following Windows (``W``), UNIX +(``U``), or Apple (``A``) conventions:: <prefix>/ (W) <prefix>/(cmake|CMake)/ (W) @@ -234,8 +234,8 @@ Each entry is meant for installation trees following Windows (W), UNIX <prefix>/<name>*/(lib/<arch>|lib*|share)/<name>*/ (W/U) <prefix>/<name>*/(lib/<arch>|lib*|share)/<name>*/(cmake|CMake)/ (W/U) -On systems supporting macOS Frameworks and Application Bundles the -following directories are searched for frameworks or bundles +On systems supporting macOS :prop_tgt:`FRAMEWORK` and :prop_tgt:`BUNDLE`, the +following directories are searched for Frameworks or Application Bundles containing a configuration file:: <prefix>/<name>.framework/Resources/ (A) @@ -262,16 +262,16 @@ that order). * The ``lib`` path is always searched. If ``PATH_SUFFIXES`` is specified, the suffixes are appended to each -(W) or (U) directory entry one-by-one. +(``W``) or (``U``) directory entry one-by-one. This set of directories is intended to work in cooperation with projects that provide configuration files in their installation trees. -Directories above marked with (W) are intended for installations on +Directories above marked with (``W``) are intended for installations on Windows where the prefix may point at the top of an application's -installation directory. Those marked with (U) are intended for +installation directory. Those marked with (``U``) are intended for installations on UNIX platforms where the prefix is shared by multiple -packages. This is merely a convention, so all (W) and (U) directories -are still searched on all platforms. Directories marked with (A) are +packages. This is merely a convention, so all (``W``) and (``U``) directories +are still searched on all platforms. Directories marked with (``A``) are intended for installations on Apple platforms. The :variable:`CMAKE_FIND_FRAMEWORK` and :variable:`CMAKE_FIND_APPBUNDLE` variables determine the order of preference. diff --git a/Help/command/variable_requires.rst b/Help/command/variable_requires.rst index b4742a5..322b154 100644 --- a/Help/command/variable_requires.rst +++ b/Help/command/variable_requires.rst @@ -18,5 +18,5 @@ tested, if that variable is false nothing else is done. If ``TEST_VARIABLE`` is true, then the next argument (``RESULT_VARIABLE``) is a variable that is set to true if all the required variables are set. The rest of the arguments are variables that must be true or not set -to NOTFOUND to avoid an error. If any are not true, an error is +to ``NOTFOUND`` to avoid an error. If any are not true, an error is reported. diff --git a/Help/cpack_gen/nsis.rst b/Help/cpack_gen/nsis.rst index 9f82a04..cd2aea6 100644 --- a/Help/cpack_gen/nsis.rst +++ b/Help/cpack_gen/nsis.rst @@ -1,19 +1,19 @@ CPack NSIS Generator -------------------- -CPack NSIS generator specific options +CPack Nullsoft Scriptable Install System (NSIS) generator specific options Variables specific to CPack NSIS generator ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The following variables are specific to the graphical installers built -on Windows using the Nullsoft Installation System. +on Windows Nullsoft Scriptable Install System. .. variable:: CPACK_NSIS_INSTALL_ROOT The default installation directory presented to the end user by the NSIS installer is under this root dir. The full directory presented to the end - user is: ${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY} + user is: ``${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY}`` .. variable:: CPACK_NSIS_MUI_ICON @@ -31,11 +31,11 @@ on Windows using the Nullsoft Installation System. .. variable:: CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP - The filename of a bitmap to use as the NSIS MUI_WELCOMEFINISHPAGE_BITMAP. + The filename of a bitmap to use as the NSIS ``MUI_WELCOMEFINISHPAGE_BITMAP``. .. variable:: CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP - The filename of a bitmap to use as the NSIS MUI_UNWELCOMEFINISHPAGE_BITMAP. + The filename of a bitmap to use as the NSIS ``MUI_UNWELCOMEFINISHPAGE_BITMAP``. .. variable:: CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS @@ -54,25 +54,25 @@ on Windows using the Nullsoft Installation System. .. variable:: CPACK_NSIS_COMPRESSOR - The arguments that will be passed to the NSIS SetCompressor command. + The arguments that will be passed to the NSIS `SetCompressor` command. .. variable:: CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL - Ask about uninstalling previous versions first. If this is set to "ON", + Ask about uninstalling previous versions first. If this is set to ``ON``, then an installer will look for previous installed versions and if one is found, ask the user whether to uninstall it before proceeding with the install. .. variable:: CPACK_NSIS_MODIFY_PATH - Modify PATH toggle. If this is set to "ON", then an extra page will appear + Modify ``PATH`` toggle. If this is set to ``ON``, then an extra page will appear in the installer that will allow the user to choose whether the program - directory should be added to the system PATH variable. + directory should be added to the system ``PATH`` variable. .. variable:: CPACK_NSIS_DISPLAY_NAME - The display name string that appears in the Windows Add/Remove Program - control panel + The display name string that appears in the Windows `Apps & features` + in `Control Panel` .. variable:: CPACK_NSIS_PACKAGE_NAME @@ -97,21 +97,21 @@ on Windows using the Nullsoft Installation System. .. variable:: CPACK_NSIS_<compName>_INSTALL_DIRECTORY - Custom install directory for the specified component <compName> instead - of $INSTDIR. + Custom install directory for the specified component ``<compName>`` instead + of ``$INSTDIR``. .. variable:: CPACK_NSIS_CREATE_ICONS_EXTRA - Additional NSIS commands for creating start menu shortcuts. + Additional NSIS commands for creating `Start Menu` shortcuts. .. variable:: CPACK_NSIS_DELETE_ICONS_EXTRA - Additional NSIS commands to uninstall start menu shortcuts. + Additional NSIS commands to uninstall `Start Menu` shortcuts. .. variable:: CPACK_NSIS_EXECUTABLES_DIRECTORY - Creating NSIS start menu links assumes that they are in 'bin' unless this - variable is set. For example, you would set this to 'exec' if your + Creating NSIS `Start Menu` links assumes that they are in ``bin`` unless this + variable is set. For example, you would set this to ``exec`` if your executables are in an exec directory. .. variable:: CPACK_NSIS_MUI_FINISHPAGE_RUN @@ -121,8 +121,8 @@ on Windows using the Nullsoft Installation System. .. variable:: CPACK_NSIS_MENU_LINKS - Specify links in [application] menu. This should contain a list of pair - "link" "link name". The link may be a URL or a path relative to + Specify links in ``[application]`` menu. This should contain a list of pair + ``link`` ``link name``. The link may be a URL or a path relative to installation prefix. Like:: set(CPACK_NSIS_MENU_LINKS diff --git a/Help/envvar/ASM_DIALECT.rst b/Help/envvar/ASM_DIALECT.rst index cabb959..a06e3cb 100644 --- a/Help/envvar/ASM_DIALECT.rst +++ b/Help/envvar/ASM_DIALECT.rst @@ -4,8 +4,9 @@ ASM<DIALECT> .. include:: ENV_VAR.txt Preferred executable for compiling a specific dialect of assembly language -files. ``ASM<DIALECT>`` can be ``ASM``, ``ASM_NASM``, ``ASM_MASM`` or -``ASM-ATT``. Will only be used by CMake on the first configuration to determine +files. ``ASM<DIALECT>`` can be ``ASM``, ``ASM_NASM`` (Netwide Assembler), +``ASM_MASM`` (Microsoft Assembler) or ``ASM-ATT`` (Assembler AT&T). +Will only be used by CMake on the first configuration to determine ``ASM<DIALECT>`` compiler, after which the value for ``ASM<DIALECT>`` is stored in the cache as :variable:`CMAKE_ASM<DIALECT>_COMPILER <CMAKE_<LANG>_COMPILER>`. For subsequent diff --git a/Help/envvar/ASM_DIALECTFLAGS.rst b/Help/envvar/ASM_DIALECTFLAGS.rst index 90cbbdb..3c3b02a 100644 --- a/Help/envvar/ASM_DIALECTFLAGS.rst +++ b/Help/envvar/ASM_DIALECTFLAGS.rst @@ -6,8 +6,8 @@ ASM<DIALECT>FLAGS Default compilation flags to be used when compiling a specific dialect of an assembly language. ``ASM<DIALECT>FLAGS`` can be ``ASMFLAGS``, ``ASM_NASMFLAGS``, ``ASM_MASMFLAGS`` or ``ASM-ATTFLAGS``. Will only be used by CMake on the -first configuration to determine ``ASM<DIALECT>`` default compilation flags, after -which the value for ``ASM<DIALECT>FLAGS`` is stored in the cache as -:variable:`CMAKE_ASM<DIALECT>_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration -run (including the first), the environment variable will be ignored if the -:variable:`CMAKE_ASM<DIALECT>_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined. +first configuration to determine ``ASM_<DIALECT>`` default compilation +flags, after which the value for ``ASM<DIALECT>FLAGS`` is stored in the cache +as ``CMAKE_ASM<DIALECT>_FLAGS <CMAKE_<LANG>_FLAGS>``. For any configuration +run (including the first), the environment variable will be ignored, if the +``CMAKE_ASM<DIALECT>_FLAGS <CMAKE_<LANG>_FLAGS>`` variable is defined. diff --git a/Help/envvar/CTEST_INTERACTIVE_DEBUG_MODE.rst b/Help/envvar/CTEST_INTERACTIVE_DEBUG_MODE.rst index b769d51..e1991b2 100644 --- a/Help/envvar/CTEST_INTERACTIVE_DEBUG_MODE.rst +++ b/Help/envvar/CTEST_INTERACTIVE_DEBUG_MODE.rst @@ -4,4 +4,4 @@ CTEST_INTERACTIVE_DEBUG_MODE .. include:: ENV_VAR.txt Environment variable that will exist and be set to ``1`` when a test executed -by CTest is run in interactive mode. +by :manual:`ctest(1)` is run in interactive mode. diff --git a/Help/envvar/CTEST_OUTPUT_ON_FAILURE.rst b/Help/envvar/CTEST_OUTPUT_ON_FAILURE.rst index bf860cb..d8b4262 100644 --- a/Help/envvar/CTEST_OUTPUT_ON_FAILURE.rst +++ b/Help/envvar/CTEST_OUTPUT_ON_FAILURE.rst @@ -4,6 +4,6 @@ CTEST_OUTPUT_ON_FAILURE .. include:: ENV_VAR.txt Boolean environment variable that controls if the output should be logged for -failed tests. Set the value to 1, True, or ON to enable output on failure. +failed tests. Set the value to ``1``, ``True``, or ``ON`` to enable output on failure. See :manual:`ctest(1)` for more information on controlling output of failed tests. diff --git a/Help/envvar/CTEST_PROGRESS_OUTPUT.rst b/Help/envvar/CTEST_PROGRESS_OUTPUT.rst index de23e11..b36a6b8 100644 --- a/Help/envvar/CTEST_PROGRESS_OUTPUT.rst +++ b/Help/envvar/CTEST_PROGRESS_OUTPUT.rst @@ -4,7 +4,7 @@ CTEST_PROGRESS_OUTPUT .. include:: ENV_VAR.txt Boolean environment variable that affects how :manual:`ctest <ctest(1)>` -command output reports overall progress. When set to 1, TRUE, ON or anything +command output reports overall progress. When set to ``1``, ``TRUE``, ``ON`` or anything else that evaluates to boolean true, progress is reported by repeatedly updating the same line. This greatly reduces the overall verbosity, but is only supported when output is sent directly to a terminal. If the environment diff --git a/Help/envvar/DASHBOARD_TEST_FROM_CTEST.rst b/Help/envvar/DASHBOARD_TEST_FROM_CTEST.rst index 2b303a4..6a52d64 100644 --- a/Help/envvar/DASHBOARD_TEST_FROM_CTEST.rst +++ b/Help/envvar/DASHBOARD_TEST_FROM_CTEST.rst @@ -3,5 +3,6 @@ DASHBOARD_TEST_FROM_CTEST .. include:: ENV_VAR.txt -Environment variable that will exist when a test executed by CTest is run -in non-interactive mode. The value will be equal to :variable:`CMAKE_VERSION`. +Environment variable that will exist when a test executed by :manual:`ctest(1)` +is run in non-interactive mode. The value will be equal to +:variable:`CMAKE_VERSION`. diff --git a/Help/envvar/PackageName_ROOT.rst b/Help/envvar/PackageName_ROOT.rst index ecec63b..82b0a06 100644 --- a/Help/envvar/PackageName_ROOT.rst +++ b/Help/envvar/PackageName_ROOT.rst @@ -5,7 +5,7 @@ Calls to :command:`find_package(<PackageName>)` will search in prefixes specified by the ``<PackageName>_ROOT`` environment variable, where -``<PackageName>`` is the name given to the ``find_package`` call +``<PackageName>`` is the name given to the :command:`find_package` call and ``_ROOT`` is literal. For example, ``find_package(Foo)`` will search prefixes specified in the ``Foo_ROOT`` environment variable (if set). See policy :policy:`CMP0074`. diff --git a/Help/manual/LINKS.txt b/Help/manual/LINKS.txt index 8e53c0c..60a260c 100644 --- a/Help/manual/LINKS.txt +++ b/Help/manual/LINKS.txt @@ -14,7 +14,7 @@ Online Documentation and Community Resources Mailing List https://cmake.org/mailing-lists - For help and discussion about using cmake, a mailing list is + For help and discussion about using CMake, a mailing list is provided at cmake@cmake.org. The list is member-post-only but one may sign up on the CMake web page. Please first read the full documentation at https://cmake.org before posting questions to diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt index baa73d5..64fd816 100644 --- a/Help/manual/OPTIONS_BUILD.txt +++ b/Help/manual/OPTIONS_BUILD.txt @@ -9,23 +9,23 @@ ``-C <initial-cache>`` Pre-load a script to populate the cache. - When cmake is first run in an empty build tree, it creates a - CMakeCache.txt file and populates it with customizable settings for + When CMake is first run in an empty build tree, it creates a + ``CMakeCache.txt`` file and populates it with customizable settings for the project. This option may be used to specify a file from which to load cache entries before the first pass through the project's - cmake listfiles. The loaded entries take priority over the + CMake listfiles. The loaded entries take priority over the project's default values. The given file should be a CMake script - containing SET commands that use the CACHE option, not a + containing :command:`set` commands that use the ``CACHE`` option, not a cache-format file. ``-D <var>:<type>=<value>, -D <var>=<value>`` - Create or update a cmake cache entry. + Create or update a CMake ``CACHE`` entry. - When cmake is first run in an empty build tree, it creates a - CMakeCache.txt file and populates it with customizable settings for + When CMake is first run in an empty build tree, it creates a + ``CMakeCache.txt`` file and populates it with customizable settings for the project. This option may be used to specify a setting that takes priority over the project's default value. The option may be - repeated for as many cache entries as desired. + repeated for as many ``CACHE`` entries as desired. If the ``:<type>`` portion is given it must be one of the types specified by the :command:`set` command documentation for its @@ -39,14 +39,14 @@ ``-D<var>:<type>=<value>`` or ``-D<var>=<value>``. ``-U <globbing_expr>`` - Remove matching entries from CMake cache. + Remove matching entries from CMake ``CACHE``. This option may be used to remove one or more variables from the - CMakeCache.txt file, globbing expressions using * and ? are - supported. The option may be repeated for as many cache entries as + ``CMakeCache.txt`` file, globbing expressions using ``*`` and ``?`` are + supported. The option may be repeated for as many ``CACHE`` entries as desired. - Use with care, you can make your CMakeCache.txt non-working. + Use with care, you can make your ``CMakeCache.txt`` non-working. ``-G <generator-name>`` Specify a build system generator. @@ -74,47 +74,47 @@ Suppress developer warnings. Suppress warnings that are meant for the author of the - CMakeLists.txt files. By default this will also turn off + ``CMakeLists.txt`` files. By default this will also turn off deprecation warnings. ``-Wdev`` Enable developer warnings. - Enable warnings that are meant for the author of the CMakeLists.txt + Enable warnings that are meant for the author of the ``CMakeLists.txt`` files. By default this will also turn on deprecation warnings. ``-Werror=dev`` Make developer warnings errors. - Make warnings that are meant for the author of the CMakeLists.txt files + Make warnings that are meant for the author of the ``CMakeLists.txt`` files errors. By default this will also turn on deprecated warnings as errors. ``-Wno-error=dev`` Make developer warnings not errors. - Make warnings that are meant for the author of the CMakeLists.txt files not + Make warnings that are meant for the author of the ``CMakeLists.txt`` files not errors. By default this will also turn off deprecated warnings as errors. ``-Wdeprecated`` Enable deprecated functionality warnings. Enable warnings for usage of deprecated functionality, that are meant - for the author of the CMakeLists.txt files. + for the author of the ``CMakeLists.txt`` files. ``-Wno-deprecated`` Suppress deprecated functionality warnings. Suppress warnings for usage of deprecated functionality, that are meant - for the author of the CMakeLists.txt files. + for the author of the ``CMakeLists.txt`` files. ``-Werror=deprecated`` Make deprecated macro and function warnings errors. Make warnings for usage of deprecated macros and functions, that are meant - for the author of the CMakeLists.txt files, errors. + for the author of the ``CMakeLists.txt`` files, errors. ``-Wno-error=deprecated`` Make deprecated macro and function warnings not errors. Make warnings for usage of deprecated macros and functions, that are meant - for the author of the CMakeLists.txt files, not errors. + for the author of the ``CMakeLists.txt`` files, not errors. diff --git a/Help/manual/ccmake.1.rst b/Help/manual/ccmake.1.rst index 9548471..60d45a3 100644 --- a/Help/manual/ccmake.1.rst +++ b/Help/manual/ccmake.1.rst @@ -20,7 +20,7 @@ when the program is running. CMake is a cross-platform build system generator. Projects specify their build process with platform-independent CMake listfiles included -in each directory of a source tree with the name CMakeLists.txt. +in each directory of a source tree with the name ``CMakeLists.txt``. Users build a project by using CMake to generate a build system for a native tool on their platform. diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index a1328f2..1ad3453 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -21,7 +21,7 @@ Binary Targets Executables and libraries are defined using the :command:`add_executable` and :command:`add_library` commands. The resulting binary files have -appropriate prefixes, suffixes and extensions for the platform targeted. +appropriate :prop_tgt:`PREFIX`, :prop_tgt:`SUFFIX` and extensions for the platform targeted. Dependencies between binary targets are expressed using the :command:`target_link_libraries` command: @@ -31,7 +31,7 @@ Dependencies between binary targets are expressed using the add_executable(zipapp zipapp.cpp) target_link_libraries(zipapp archive) -``archive`` is defined as a static library -- an archive containing objects +``archive`` is defined as a ``STATIC`` library -- an archive containing objects compiled from ``archive.cpp``, ``zip.cpp``, and ``lzma.cpp``. ``zipapp`` is defined as an executable formed by compiling and linking ``zipapp.cpp``. When linking the ``zipapp`` executable, the ``archive`` static library is @@ -59,7 +59,7 @@ Binary Library Types Normal Libraries ^^^^^^^^^^^^^^^^ -By default, the :command:`add_library` command defines a static library, +By default, the :command:`add_library` command defines a ``STATIC`` library, unless a type is specified. A type may be specified when using the command: .. code-block:: cmake @@ -141,8 +141,8 @@ Alternatively, object libraries may be linked into other targets: target_link_libraries(test_exe archive) The link (or archiving) step of those other targets will use the object -files from object libraries that are *directly* linked. Additionally, -usage requirements of the object libraries will be honored when compiling +files from ``OBJECT`` libraries that are *directly* linked. Additionally, +usage requirements of the ``OBJECT`` libraries will be honored when compiling sources in those other targets. Furthermore, those usage requirements will propagate transitively to dependents of those other targets. @@ -365,8 +365,8 @@ non-compatible requirements :manual:`cmake(1)` issues a diagnostic: target_link_libraries(exe2 lib1 lib2) The ``lib1`` requirement ``INTERFACE_POSITION_INDEPENDENT_CODE`` is not -"compatible" with the ``POSITION_INDEPENDENT_CODE`` property of the ``exe1`` -target. The library requires that consumers are built as +"compatible" with the :prop_tgt:`POSITION_INDEPENDENT_CODE` property of +the ``exe1`` target. The library requires that consumers are built as position-independent-code, while the executable specifies to not built as position-independent-code, so a diagnostic is issued. @@ -547,10 +547,10 @@ is not known until build-time. Therefore, code such as target_compile_definitions(exe1 PRIVATE DEBUG_BUILD) endif() -may appear to work for ``Makefile`` based and ``Ninja`` generators, but is not -portable to IDE generators. Additionally, the :prop_tgt:`IMPORTED` -configuration-mappings are not accounted for with code like this, so it should -be avoided. +may appear to work for :ref:`Makefile Generators` and :generator:`Ninja` +generators, but is not portable to IDE generators. Additionally, +the :prop_tgt:`IMPORTED` configuration-mappings are not accounted for +with code like this, so it should be avoided. The unary ``TARGET_PROPERTY`` generator expression and the ``TARGET_POLICY`` generator expression are evaluated with the consuming target context. This @@ -699,7 +699,7 @@ found in those directories. This behavior for :ref:`imported targets` may be controlled by setting the :prop_tgt:`NO_SYSTEM_FROM_IMPORTED` target property on the *consumers* of imported targets. -If a binary target is linked transitively to a Mac OX framework, the +If a binary target is linked transitively to a macOS :prop_tgt:`FRAMEWORK`, the ``Headers`` directory of the framework is also treated as a usage requirement. This has the same effect as passing the framework directory as an include directory. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 8f4c4fc..e3a96bd 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -293,6 +293,8 @@ String Transformations Joins the list with the content of ``string``. ``$<REMOVE_DUPLICATES:list>`` Removes duplicated items in the given ``list``. +``$<FILTER:list,INCLUDE|EXCLUDE,regex>`` + Includes or removes items from ``list`` that match the regular expression ``regex``. ``$<LOWER_CASE:string>`` Content of ``string`` converted to lower case. ``$<UPPER_CASE:string>`` diff --git a/Help/manual/cmake-gui.1.rst b/Help/manual/cmake-gui.1.rst index 856aa2f..ff8311b 100644 --- a/Help/manual/cmake-gui.1.rst +++ b/Help/manual/cmake-gui.1.rst @@ -21,7 +21,7 @@ provided at the bottom of the window when the program is running. CMake is a cross-platform build system generator. Projects specify their build process with platform-independent CMake listfiles included -in each directory of a source tree with the name CMakeLists.txt. +in each directory of a source tree with the name ``CMakeLists.txt``. Users build a project by using CMake to generate a build system for a native tool on their platform. diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst index bbe742e..f5aa42d 100644 --- a/Help/manual/cmake-packages.7.rst +++ b/Help/manual/cmake-packages.7.rst @@ -12,7 +12,7 @@ Introduction Packages provide dependency information to CMake based buildsystems. Packages are found with the :command:`find_package` command. The result of -using ``find_package`` is either a set of :prop_tgt:`IMPORTED` targets, or +using :command:`find_package` is either a set of :prop_tgt:`IMPORTED` targets, or a set of variables corresponding to build-relevant information. Using Packages diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst index ba44b7f..df4531b 100644 --- a/Help/manual/cmake-toolchains.7.rst +++ b/Help/manual/cmake-toolchains.7.rst @@ -26,13 +26,13 @@ built-in variables, such as :variable:`CMAKE_CXX_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` etc are set by invoking the :command:`project` command. If no project command is in the top-level CMakeLists file, one will be implicitly generated. By default -the enabled languages are C and CXX: +the enabled languages are ``C`` and ``CXX``: .. code-block:: cmake project(C_Only C) -A special value of NONE can also be used with the :command:`project` command +A special value of ``NONE`` can also be used with the :command:`project` command to enable no languages: .. code-block:: cmake @@ -468,10 +468,10 @@ The following variables will be computed and provided automatically: The Android ABI detected from the standalone toolchain. :variable:`CMAKE_<LANG>_ANDROID_TOOLCHAIN_PREFIX` - The absolute path prefix to the binutils in the standalone toolchain. + The absolute path prefix to the ``binutils`` in the standalone toolchain. :variable:`CMAKE_<LANG>_ANDROID_TOOLCHAIN_SUFFIX` - The host platform suffix of the binutils in the standalone toolchain. + The host platform suffix of the ``binutils`` in the standalone toolchain. For example, a toolchain file might contain: @@ -533,7 +533,7 @@ generator is recommended. The :generator:`Unix Makefiles` or :generator:`Ninja` generators can also be used, but they require the project to handle more areas like target CPU selection and code signing. -Any of the three systems can be targetted by setting the +Any of the three systems can be targeted by setting the :variable:`CMAKE_SYSTEM_NAME` variable to a value from the table below. By default, the latest Device SDK is chosen. As for all Apple platforms, a different SDK (e.g. a simulator) can be selected by setting the @@ -609,7 +609,7 @@ Code Signing Some build artifacts for the embedded Apple platforms require mandatory code signing. If the :generator:`Xcode` generator is being used and -code signing is required or desired, the developmemt team ID can be +code signing is required or desired, the development team ID can be specified via the ``CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM`` CMake variable. This team ID will then be included in the generated Xcode project. By default, CMake avoids the need for code signing during the internal diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index e9dca47..18dd9d7 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -7,7 +7,7 @@ cmake-variables(7) .. contents:: -This page documents variables that are provided by CMake +This page documents variables that are provided by CMake or have meaning to CMake when set by project code. For general information on variables, see the diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index b67fa3a..5b88694 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -172,12 +172,12 @@ Options ``-L[A][H]`` List non-advanced cached variables. - List cache variables will run CMake and list all the variables from - the CMake cache that are not marked as INTERNAL or ADVANCED. This - will effectively display current CMake settings, which can then be - changed with -D option. Changing some of the variables may result - in more variables being created. If A is specified, then it will - display also advanced variables. If H is specified, it will also + List ``CACHE`` variables will run CMake and list all the variables from + the CMake ``CACHE`` that are not marked as ``INTERNAL`` or :prop_cache:`ADVANCED`. + This will effectively display current CMake settings, which can then be + changed with ``-D`` option. Changing some of the variables may result + in more variables being created. If ``A`` is specified, then it will + display also advanced variables. If ``H`` is specified, it will also display help for each variable. ``-N`` @@ -201,9 +201,10 @@ Options additional information such as the cache, log files etc. ``--debug-trycompile`` - Do not delete the try_compile build tree. Only useful on one try_compile at a time. + Do not delete the :command:`try_compile` build tree. + Only useful on one :command:`try_compile` at a time. - Do not delete the files and directories created for try_compile + Do not delete the files and directories created for :command:`try_compile` calls. This is useful in debugging failed try_compiles. It may however change the results of the try-compiles as old junk from a previous try-compile may cause a different test to either pass or @@ -214,7 +215,7 @@ Options Put cmake in a debug mode. Print extra information during the cmake run like stack traces with - message(send_error ) calls. + :command:`message(SEND_ERROR)` calls. ``--trace`` Put cmake in trace mode. @@ -251,8 +252,8 @@ Options Find problems with variable usage in system files. Normally, unused and uninitialized variables are searched for only - in CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR. This flag tells CMake to - warn about other files as well. + in :variable:`CMAKE_SOURCE_DIR` and :variable:`CMAKE_BINARY_DIR`. + This flag tells CMake to warn about other files as well. .. _`Build Tool Mode`: @@ -329,10 +330,10 @@ The options are: Component-based install. Only install component ``<comp>``. ``--prefix <prefix>`` - The installation prefix CMAKE_INSTALL_PREFIX. + The installation prefix :variable:`CMAKE_INSTALL_PREFIX`. ``--strip`` - Strip before installing by setting CMAKE_INSTALL_DO_STRIP. + Strip before installing by setting ``CMAKE_INSTALL_DO_STRIP``. ``-v, --verbose`` Enable verbose output. @@ -363,8 +364,8 @@ Run a Script Process the given cmake file as a script written in the CMake language. No configure or generate step is performed and the cache -is not modified. If variables are defined using -D, this must be -done before the -P argument. +is not modified. If variables are defined using ``-D``, this must be +done before the ``-P`` argument. Run a Command-Line Tool @@ -421,7 +422,7 @@ Available commands are: ``compare_files [--ignore-eol] <file1> <file2>`` Check if ``<file1>`` is same as ``<file2>``. If files are the same, - then returns 0, if not it returns 1. The ``--ignore-eol`` option + then returns ``0``, if not it returns ``1``. The ``--ignore-eol`` option implies line-wise comparison and ignores LF/CRLF differences. ``copy <file>... <destination>`` diff --git a/Help/manual/cpack.1.rst b/Help/manual/cpack.1.rst index 679c547..10f617e 100644 --- a/Help/manual/cpack.1.rst +++ b/Help/manual/cpack.1.rst @@ -63,7 +63,7 @@ Options details. By default, ``CPackConfig.cmake`` in the current directory will be used. -``--verbose,-V`` +``--verbose, -V`` Run ``cpack`` with verbose output. This can be used to show more details from the package generation tools and is suitable for project developers. diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index d1bd69b..5a6b329 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -22,8 +22,8 @@ Description The **ctest** executable is the CMake test driver program. CMake-generated build trees created for projects that use the -ENABLE_TESTING and ADD_TEST commands have testing support. This -program will run the tests and report results. +:command:`enable_testing` and :command:`add_test` commands have testing support. +This program will run the tests and report results. Options ======= @@ -33,8 +33,8 @@ Options Some CMake-generated build trees can have multiple build configurations in the same tree. This option can be used to specify - which one should be tested. Example configurations are "Debug" and - "Release". + which one should be tested. Example configurations are ``Debug`` and + ``Release``. ``--progress`` Enable short progress output from tests. @@ -108,7 +108,7 @@ Options ``-O <file>, --output-log <file>`` Output to log file. - This option tells CTest to write all its output to a log file. + This option tells CTest to write all its output to a ``<file>`` log file. ``-N,--show-only[=<format>]`` Disable actual execution of tests. @@ -172,9 +172,10 @@ Options Execute dashboard test. This option tells CTest to act as a CDash client and perform a - dashboard test. All tests are <Mode><Test>, where Mode can be - Experimental, Nightly, and Continuous, and Test can be Start, - Update, Configure, Build, Test, Coverage, and Submit. + dashboard test. All tests are ``<Mode><Test>``, where ``<Mode>`` can be + ``Experimental``, ``Nightly``, and ``Continuous``, and ``<Test>`` can be + ``Start``, ``Update``, ``Configure``, ``Build``, ``Test``, + ``Coverage``, and ``Submit``. See `Dashboard Client`_. @@ -229,10 +230,10 @@ Options ``-I [Start,End,Stride,test#,test#|Test file], --tests-information`` Run a specific number of tests by number. - This option causes CTest to run tests starting at number Start, - ending at number End, and incrementing by Stride. Any additional - numbers after Stride are considered individual test numbers. Start, - End,or stride can be empty. Optionally a file can be given that + This option causes CTest to run tests starting at number ``Start``, + ending at number ``End``, and incrementing by ``Stride``. Any additional + numbers after ``Stride`` are considered individual test numbers. ``Start``, + ``End``, or ``Stride`` can be empty. Optionally a file can be given that contains the same syntax as the command line. ``-U, --union`` @@ -264,12 +265,12 @@ Options name which can be very annoying. ``--interactive-debug-mode [0|1]`` - Set the interactive mode to 0 or 1. + Set the interactive mode to ``0`` or ``1``. This option causes CTest to run tests in either an interactive mode or a non-interactive mode. On Windows this means that in non-interactive mode, all system debug pop up windows are blocked. - In dashboard mode (Experimental, Nightly, Continuous), the default + In dashboard mode (``Experimental``, ``Nightly``, ``Continuous``), the default is non-interactive. When just running tests not for a dashboard the default is to allow popups and interactive debugging. @@ -350,7 +351,7 @@ See `Build and Test Mode`_. Label and Subproject Summary ============================ -CTest prints timing summary information for each label and subproject +CTest prints timing summary information for each ``LABEL`` and subproject associated with the tests run. The label time summary will not include labels that are mapped to subprojects. @@ -358,8 +359,8 @@ When the :prop_test:`PROCESSORS` test property is set, CTest will display a weighted test timing result in label and subproject summaries. The time is reported with `sec*proc` instead of just `sec`. -The weighted time summary reported for each label or subproject j is computed -as:: +The weighted time summary reported for each label or subproject ``j`` +is computed as:: Weighted Time Summary for Label/Subproject j = sum(raw_test_time[j,i] * num_processors[j,i], i=1...num_tests[j]) @@ -368,25 +369,25 @@ as:: where: -* raw_test_time[j,i]: Wall-clock time for the ith test for the jth label or - subproject -* num_processors[j,i]: Value of the CTest PROCESSORS property for the ith test - for the jth label or subproject -* num_tests[j]: Number of tests associated with the jth label or subproject -* total: Total number of labels or subprojects that have at least one test run +* ``raw_test_time[j,i]``: Wall-clock time for the ``i`` test + for the ``j`` label or subproject +* ``num_processors[j,i]``: Value of the CTest :prop_test:`PROCESSORS` property + for the ``i`` test for the ``j`` label or subproject +* ``num_tests[j]``: Number of tests associated with the ``j`` label or subproject +* ``total``: Total number of labels or subprojects that have at least one test run Therefore, the weighted time summary for each label or subproject represents the amount of time that CTest gave to run the tests for each label or subproject and gives a good representation of the total expense of the tests for each label or subproject when compared to other labels or subprojects. -For example, if "SubprojectA" showed "100 sec*proc" and "SubprojectB" showed -"10 sec*proc", then CTest allocated approximately 10 times the CPU/core time -to run the tests for "SubprojectA" than for "SubprojectB" (e.g. so if effort +For example, if ``SubprojectA`` showed ``100 sec*proc`` and ``SubprojectB`` showed +``10 sec*proc``, then CTest allocated approximately 10 times the CPU/core time +to run the tests for ``SubprojectA`` than for ``SubprojectB`` (e.g. so if effort is going to be expended to reduce the cost of the test suite for the whole -project, then reducing the cost of the test suite for "SubprojectA" would +project, then reducing the cost of the test suite for ``SubprojectA`` would likely have a larger impact than effort to reduce the cost of the test suite -for "SubprojectB"). +for ``SubprojectB``). .. _`Build and Test Mode`: @@ -449,7 +450,7 @@ this mode include: ``--build-config-sample`` A sample executable to use to determine the configuration that - should be used. e.g. Debug/Release/etc. + should be used. e.g. ``Debug``, ``Release`` etc. ``--build-options`` Additional options for configuring the build (i.e. for CMake, not for @@ -495,7 +496,7 @@ Options for Dashboard Client include: dashboard. ``--tomorrow-tag`` - Nightly or experimental starts with next day tag. + ``Nightly`` or ``Experimental`` starts with next day tag. This is useful if the build will not finish in one day. @@ -505,10 +506,10 @@ Options for Dashboard Client include: This option will submit extra files to the dashboard. ``--http1.0`` - Submit using HTTP 1.0. + Submit using `HTTP 1.0`. - This option will force CTest to use HTTP 1.0 to submit files to the - dashboard, instead of HTTP 1.1. + This option will force CTest to use `HTTP 1.0` to submit files to the + dashboard, instead of `HTTP 1.1`. ``--no-compress-output`` Do not compress test output when submitting. @@ -711,7 +712,7 @@ Configuration settings to specify the version control tool include: The source tree is updated by ``git fetch`` followed by ``git reset --hard`` to the ``FETCH_HEAD``. The result is the same - as ``git pull`` except that any local moficiations are overwritten. + as ``git pull`` except that any local modifications are overwritten. Use ``GITUpdateCustom`` to specify a different approach. ``GITInitSubmodules`` diff --git a/Help/prop_sf/VS_CSHARP_tagname.rst b/Help/prop_sf/VS_CSHARP_tagname.rst index d42159f..91c4a06 100644 --- a/Help/prop_sf/VS_CSHARP_tagname.rst +++ b/Help/prop_sf/VS_CSHARP_tagname.rst @@ -3,8 +3,9 @@ VS_CSHARP_<tagname> Visual Studio and CSharp source-file-specific configuration. -Tell the Visual Studio generator to set the source file tag -``<tagname>`` to a given value in the generated Visual Studio CSharp +Tell the :manual:`Visual Studio generators <cmake-generators(7)>` +to set the source file tag ``<tagname>`` +to a given value in the generated Visual Studio CSharp project. Ignored on other generators and languages. This property can be used to define dependencies between source files or set any other Visual Studio specific parameters. diff --git a/Help/prop_sf/VS_DEPLOYMENT_CONTENT.rst b/Help/prop_sf/VS_DEPLOYMENT_CONTENT.rst index 9fb3ba3..6a38478 100644 --- a/Help/prop_sf/VS_DEPLOYMENT_CONTENT.rst +++ b/Help/prop_sf/VS_DEPLOYMENT_CONTENT.rst @@ -2,7 +2,8 @@ VS_DEPLOYMENT_CONTENT --------------------- Mark a source file as content for deployment with a Windows Phone or -Windows Store application when built with a Visual Studio generator. +Windows Store application when built with a +:manual:`Visual Studio generators <cmake-generators(7)>`. The value must evaluate to either ``1`` or ``0`` and may use :manual:`generator expressions <cmake-generator-expressions(7)>` to make the choice based on the build configuration. diff --git a/Help/prop_sf/VS_DEPLOYMENT_LOCATION.rst b/Help/prop_sf/VS_DEPLOYMENT_LOCATION.rst index 303db95..2ce22fc 100644 --- a/Help/prop_sf/VS_DEPLOYMENT_LOCATION.rst +++ b/Help/prop_sf/VS_DEPLOYMENT_LOCATION.rst @@ -2,7 +2,8 @@ VS_DEPLOYMENT_LOCATION ---------------------- Specifies the deployment location for a content source file with a Windows -Phone or Windows Store application when built with a Visual Studio generator. +Phone or Windows Store application when built +with a :manual:`Visual Studio generators <cmake-generators(7)>`. This property is only applicable when using :prop_sf:`VS_DEPLOYMENT_CONTENT`. The value represent the path relative to the app package and applies to all configurations. diff --git a/Help/prop_sf/VS_INCLUDE_IN_VSIX.rst b/Help/prop_sf/VS_INCLUDE_IN_VSIX.rst index 30f471d..db470ef 100644 --- a/Help/prop_sf/VS_INCLUDE_IN_VSIX.rst +++ b/Help/prop_sf/VS_INCLUDE_IN_VSIX.rst @@ -1,6 +1,6 @@ VS_INCLUDE_IN_VSIX ------------------ -Boolean property to specify if the file should be included within a VSIX -extension package. This is needed for development of Visual Studio -extensions. +Boolean property to specify if the file should be included within a +VSIX (Visual Studio Integration Extension) extension package. +This is needed for development of Visual Studio extensions. diff --git a/Help/prop_sf/VS_SHADER_FLAGS.rst b/Help/prop_sf/VS_SHADER_FLAGS.rst index 0901123..0a53afd 100644 --- a/Help/prop_sf/VS_SHADER_FLAGS.rst +++ b/Help/prop_sf/VS_SHADER_FLAGS.rst @@ -1,4 +1,4 @@ VS_SHADER_FLAGS --------------- -Set additional VS shader flags of a ``.hlsl`` source file. +Set additional Visual Studio shader flags of a ``.hlsl`` source file. diff --git a/Help/prop_sf/VS_SHADER_TYPE.rst b/Help/prop_sf/VS_SHADER_TYPE.rst index 6880256..f104837 100644 --- a/Help/prop_sf/VS_SHADER_TYPE.rst +++ b/Help/prop_sf/VS_SHADER_TYPE.rst @@ -1,4 +1,4 @@ VS_SHADER_TYPE -------------- -Set the VS shader type of a ``.hlsl`` source file. +Set the Visual Studio shader type of a ``.hlsl`` source file. diff --git a/Help/prop_sf/VS_XAML_TYPE.rst b/Help/prop_sf/VS_XAML_TYPE.rst index 190a639..1a274ba 100644 --- a/Help/prop_sf/VS_XAML_TYPE.rst +++ b/Help/prop_sf/VS_XAML_TYPE.rst @@ -1,6 +1,7 @@ VS_XAML_TYPE ------------ -Mark a XAML source file as a different type than the default ``Page``. +Mark a Extensible Application Markup Language (XAML) source file +as a different type than the default ``Page``. The most common usage would be to set the default ``App.xaml`` file as ``ApplicationDefinition``. diff --git a/Help/prop_sf/WRAP_EXCLUDE.rst b/Help/prop_sf/WRAP_EXCLUDE.rst index 5f41c28..638ff03 100644 --- a/Help/prop_sf/WRAP_EXCLUDE.rst +++ b/Help/prop_sf/WRAP_EXCLUDE.rst @@ -4,7 +4,8 @@ WRAP_EXCLUDE Exclude this source file from any code wrapping techniques. Some packages can wrap source files into alternate languages to -provide additional functionality. For example, C++ code can be -wrapped into Java or Python etc using SWIG etc. If ``WRAP_EXCLUDE`` is -set to ``True``, that indicates that this source file should not be -wrapped. +provide additional functionality. + +For example, C++ code can be wrapped into Java or Python, using SWIG. +If ``WRAP_EXCLUDE`` is set to ``True``, that indicates that this +source file should not be wrapped. diff --git a/Help/release/3.9.rst b/Help/release/3.9.rst index ffa95aa..89da627 100644 --- a/Help/release/3.9.rst +++ b/Help/release/3.9.rst @@ -150,7 +150,7 @@ Modules * The :module:`CMakeFindDependencyMacro` module ``find_dependency`` macro now forwards all arguments to the underlying :command:`find_package` call. Existing uses will continue to function as before, but callers can - now access the full suite of arguments that ``find_package`` accepts. + now access the full suite of arguments that :command:`find_package` accepts. * The :module:`FeatureSummary` module :command:`feature_summary` command now accepts the new ``DEFAULT_DESCRIPTION`` option that will print the default diff --git a/Help/release/dev/genex_filter.rst b/Help/release/dev/genex_filter.rst new file mode 100644 index 0000000..ad23134 --- /dev/null +++ b/Help/release/dev/genex_filter.rst @@ -0,0 +1,6 @@ +genex_filter +------------ + +* A new ``$<FILTER:list,INCLUDE|EXCLUDE,regex>`` + :manual:`generator expression <cmake-generator-expressions(7)>` + has been added. diff --git a/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst b/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst index 95d2c7f..e7774f2 100644 --- a/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst +++ b/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst @@ -6,7 +6,7 @@ should point to a command on the host system that can run executable built for the target system. The command will be used to run :command:`try_run` generated executables, -which avoids manual population of the TryRunResults.cmake file. +which avoids manual population of the ``TryRunResults.cmake`` file. It is also used as the default value for the :prop_tgt:`CROSSCOMPILING_EMULATOR` target property of executables. diff --git a/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst b/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst index 72e8e66..eea2c4f 100644 --- a/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst +++ b/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst @@ -2,6 +2,6 @@ CMAKE_CUDA_HOST_COMPILER ------------------------ Executable to use when compiling host code when compiling ``CUDA`` language -files. Maps to the nvcc -ccbin option. Will only be used by CMake on the first +files. Maps to the ``nvcc -ccbin`` option. Will only be used by CMake on the first configuration to determine a valid host compiler for ``CUDA``. After a valid host compiler has been found, this value is read-only. diff --git a/Help/variable/CMAKE_SKIP_INSTALL_RULES.rst b/Help/variable/CMAKE_SKIP_INSTALL_RULES.rst index 44966f3..b77bb68 100644 --- a/Help/variable/CMAKE_SKIP_INSTALL_RULES.rst +++ b/Help/variable/CMAKE_SKIP_INSTALL_RULES.rst @@ -3,6 +3,6 @@ CMAKE_SKIP_INSTALL_RULES Whether to disable generation of installation rules. -If ``TRUE``, cmake will neither generate installaton rules nor +If ``TRUE``, CMake will neither generate installation rules nor will it generate ``cmake_install.cmake`` files. This variable is ``FALSE`` by default. diff --git a/Help/variable/CMAKE_SOURCE_DIR.rst b/Help/variable/CMAKE_SOURCE_DIR.rst index 416fbe1..d1f1798 100644 --- a/Help/variable/CMAKE_SOURCE_DIR.rst +++ b/Help/variable/CMAKE_SOURCE_DIR.rst @@ -7,7 +7,7 @@ This is the full path to the top level of the current CMake source tree. For an in-source build, this would be the same as :variable:`CMAKE_BINARY_DIR`. -When run in -P script mode, CMake sets the variables +When run in ``-P`` script mode, CMake sets the variables :variable:`CMAKE_BINARY_DIR`, :variable:`CMAKE_SOURCE_DIR`, :variable:`CMAKE_CURRENT_BINARY_DIR` and :variable:`CMAKE_CURRENT_SOURCE_DIR` to the current working directory. diff --git a/Help/variable/CMAKE_STAGING_PREFIX.rst b/Help/variable/CMAKE_STAGING_PREFIX.rst index 1310e94..bdb97fa 100644 --- a/Help/variable/CMAKE_STAGING_PREFIX.rst +++ b/Help/variable/CMAKE_STAGING_PREFIX.rst @@ -5,10 +5,10 @@ This variable may be set to a path to install to when cross-compiling. This can be useful if the path in :variable:`CMAKE_SYSROOT` is read-only, or otherwise should remain pristine. -The ``CMAKE_STAGING_PREFIX`` location is also used as a search prefix by the -``find_*`` commands. This can be controlled by setting the +The :variable:`CMAKE_STAGING_PREFIX` location is also used as a search prefix +by the ``find_*`` commands. This can be controlled by setting the :variable:`CMAKE_FIND_NO_INSTALL_PREFIX` variable. -If any RPATH/RUNPATH entries passed to the linker contain the -``CMAKE_STAGING_PREFIX``, the matching path fragments are replaced with the -:variable:`CMAKE_INSTALL_PREFIX`. +If any ``RPATH``/``RUNPATH`` entries passed to the linker contain the +:variable:`CMAKE_STAGING_PREFIX`, the matching path fragments are replaced +with the :variable:`CMAKE_INSTALL_PREFIX`. diff --git a/Help/variable/CMAKE_SUPPRESS_REGENERATION.rst b/Help/variable/CMAKE_SUPPRESS_REGENERATION.rst index ed47e1a..96184dd 100644 --- a/Help/variable/CMAKE_SUPPRESS_REGENERATION.rst +++ b/Help/variable/CMAKE_SUPPRESS_REGENERATION.rst @@ -1,10 +1,10 @@ CMAKE_SUPPRESS_REGENERATION --------------------------- -If CMAKE_SUPPRESS_REGENERATION is ``OFF``, which is default, then CMake adds a -special target on which all other targets depend that checks the build system -and optionally re-runs CMake to regenerate the build system when the target -specification source changes. +If ``CMAKE_SUPPRESS_REGENERATION`` is ``OFF``, which is default, then CMake +adds a special target on which all other targets depend that checks the build +system and optionally re-runs CMake to regenerate the build system when +the target specification source changes. If this variable evaluates to ``ON`` at the end of the top-level ``CMakeLists.txt`` file, CMake will not add the regeneration target to the diff --git a/Help/variable/CMAKE_SYSROOT.rst b/Help/variable/CMAKE_SYSROOT.rst index 64f81bb..35b944f 100644 --- a/Help/variable/CMAKE_SYSROOT.rst +++ b/Help/variable/CMAKE_SYSROOT.rst @@ -4,8 +4,8 @@ CMAKE_SYSROOT Path to pass to the compiler in the ``--sysroot`` flag. The ``CMAKE_SYSROOT`` content is passed to the compiler in the ``--sysroot`` -flag, if supported. The path is also stripped from the RPATH/RUNPATH if -necessary on installation. The ``CMAKE_SYSROOT`` is also used to prefix +flag, if supported. The path is also stripped from the ``RPATH``/``RUNPATH`` +if necessary on installation. The ``CMAKE_SYSROOT`` is also used to prefix paths searched by the ``find_*`` commands. This variable may only be set in a toolchain file specified by diff --git a/Help/variable/CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst b/Help/variable/CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst index 5dad6bd..30ae236 100644 --- a/Help/variable/CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst +++ b/Help/variable/CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst @@ -5,7 +5,7 @@ Ask CPack to error out as soon as a file with absolute ``INSTALL DESTINATION`` is encountered. The fatal error is emitted before the installation of the offending -file takes place. Some CPack generators, like NSIS, enforce this +file takes place. Some CPack generators, like ``NSIS``, enforce this internally. This variable triggers the definition of :variable:`CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION` when CPack runs. diff --git a/Help/variable/PackageName_ROOT.rst b/Help/variable/PackageName_ROOT.rst index c5b07ae..1c2fd34 100644 --- a/Help/variable/PackageName_ROOT.rst +++ b/Help/variable/PackageName_ROOT.rst @@ -3,7 +3,7 @@ Calls to :command:`find_package(<PackageName>)` will search in prefixes specified by the ``<PackageName>_ROOT`` CMake variable, where -``<PackageName>`` is the name given to the ``find_package`` call +``<PackageName>`` is the name given to the :command:`find_package` call and ``_ROOT`` is literal. For example, ``find_package(Foo)`` will search prefixes specified in the ``Foo_ROOT`` CMake variable (if set). See policy :policy:`CMP0074`. diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index 8c7646e..f94fc5c 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -7,7 +7,7 @@ BundleUtilities Functions to help assemble a standalone bundle application. -A collection of CMake utility functions useful for dealing with .app +A collection of CMake utility functions useful for dealing with ``.app`` bundles on the Mac and bundle-like directories on any OS. The following functions are provided by this module: @@ -33,7 +33,7 @@ The following functions are provided by this module: verify_bundle_symlinks Requires CMake 2.6 or greater because it uses function, break and -PARENT_SCOPE. Also depends on GetPrerequisites.cmake. +``PARENT_SCOPE``. Also depends on ``GetPrerequisites.cmake``. DO NOT USE THESE FUNCTIONS AT CONFIGURE TIME (from ``CMakeLists.txt``)! Instead, invoke them from an :command:`install(CODE)` or @@ -43,55 +43,57 @@ Instead, invoke them from an :command:`install(CODE)` or fixup_bundle(<app> <libs> <dirs>) -Fix up a bundle in-place and make it standalone, such that it can be +Fix up ``<app>`` bundle in-place and make it standalone, such that it can be drag-n-drop copied to another machine and run on that machine as long as all of the system libraries are compatible. -If you pass plugins to fixup_bundle as the libs parameter, you should -install them or copy them into the bundle before calling fixup_bundle. -The "libs" parameter is a list of libraries that must be fixed up, but -that cannot be determined by otool output analysis. (i.e., plugins) +If you pass plugins to ``fixup_bundle`` as the libs parameter, you should +install them or copy them into the bundle before calling ``fixup_bundle``. +The ``<libs>`` parameter is a list of libraries that must be fixed up, but +that cannot be determined by ``otool`` output analysis (i.e. ``plugins``). Gather all the keys for all the executables and libraries in a bundle, and then, for each key, copy each prerequisite into the bundle. Then fix each one up according to its own list of prerequisites. -Then clear all the keys and call verify_app on the final bundle to +Then clear all the keys and call ``verify_app`` on the final bundle to ensure that it is truly standalone. -As an optional parameter (IGNORE_ITEM) a list of file names can be passed, -which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe") +As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed, +which are then ignored +(e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``). .. code-block:: cmake copy_and_fixup_bundle(<src> <dst> <libs> <dirs>) -Makes a copy of the bundle <src> at location <dst> and then fixes up -the new copied bundle in-place at <dst>... +Makes a copy of the bundle ``<src>`` at location ``<dst>`` and then fixes up +the new copied bundle in-place at ``<dst>``. .. code-block:: cmake verify_app(<app>) -Verifies that an application <app> appears valid based on running -analysis tools on it. Calls "message(FATAL_ERROR" if the application +Verifies that an application ``<app>`` appears valid based on running +analysis tools on it. Calls :command:`message(FATAL_ERROR)` if the application is not verified. -As an optional parameter (IGNORE_ITEM) a list of file names can be passed, -which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe") +As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed, +which are then ignored +(e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``) .. code-block:: cmake get_bundle_main_executable(<bundle> <result_var>) The result will be the full path name of the bundle's main executable -file or an "error:" prefixed string if it could not be determined. +file or an ``error:`` prefixed string if it could not be determined. .. code-block:: cmake get_dotapp_dir(<exe> <dotapp_dir_var>) -Returns the nearest parent dir whose name ends with ".app" given the +Returns the nearest parent dir whose name ends with ``.app`` given the full path to an executable. If there is no such parent dir, then simply return the dir containing the executable. @@ -101,26 +103,26 @@ The returned directory may or may not exist. get_bundle_and_executable(<app> <bundle_var> <executable_var> <valid_var>) -Takes either a ".app" directory name or the name of an executable -nested inside a ".app" directory and returns the path to the ".app" -directory in <bundle_var> and the path to its main executable in -<executable_var> +Takes either a ``.app`` directory name or the name of an executable +nested inside a ``.app`` directory and returns the path to the ``.app`` +directory in ``<bundle_var>`` and the path to its main executable in +``<executable_var>``. .. code-block:: cmake get_bundle_all_executables(<bundle> <exes_var>) -Scans the given bundle recursively for all executable files and -accumulates them into a variable. +Scans ``<bundle>`` bundle recursively for all ``<exes_var>`` executable +files and accumulates them into a variable. .. code-block:: cmake get_item_key(<item> <key_var>) -Given a file (item) name, generate a key that should be unique +Given ``<item>`` file name, generate ``<key_var>`` key that should be unique considering the set of libraries that need copying or fixing up to make a bundle standalone. This is essentially the file name including -extension with "." replaced by "_" +extension with ``.`` replaced by ``_`` This key is used as a prefix for CMake variables so that we can associate a set of variables with a given item based on its key. @@ -129,10 +131,10 @@ associate a set of variables with a given item based on its key. clear_bundle_keys(<keys_var>) -Loop over the list of keys, clearing all the variables associated with -each key. After the loop, clear the list of keys itself. +Loop over the ``<keys_var>`` list of keys, clearing all the variables +associated with each key. After the loop, clear the list of keys itself. -Caller of get_bundle_keys should call clear_bundle_keys when done with +Caller of ``get_bundle_keys`` should call ``clear_bundle_keys`` when done with list of keys. .. code-block:: cmake @@ -140,86 +142,88 @@ list of keys. set_bundle_key_values(<keys_var> <context> <item> <exepath> <dirs> <copyflag> [<rpaths>]) -Add a key to the list (if necessary) for the given item. If added, -also set all the variables associated with that key. +Add ``<keys_var>`` key to the list (if necessary) for the given item. +If added, also set all the variables associated with that key. .. code-block:: cmake get_bundle_keys(<app> <libs> <dirs> <keys_var>) -Loop over all the executable and library files within the bundle (and -given as extra <libs>) and accumulate a list of keys representing +Loop over all the executable and library files within ``<app>`` bundle (and +given as extra ``<libs>``) and accumulate a list of keys representing them. Set values associated with each key such that we can loop over all of them and copy prerequisite libs into the bundle and then do -appropriate install_name_tool fixups. +appropriate ``install_name_tool`` fixups. -As an optional parameter (IGNORE_ITEM) a list of file names can be passed, -which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe") +As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed, +which are then ignored +(e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``) .. code-block:: cmake copy_resolved_item_into_bundle(<resolved_item> <resolved_embedded_item>) -Copy a resolved item into the bundle if necessary. Copy is not -necessary if the resolved_item is "the same as" the -resolved_embedded_item. +Copy a resolved item into the bundle if necessary. +Copy is not necessary, if the ``<resolved_item>`` is "the same as" the +``<resolved_embedded_item>``. .. code-block:: cmake copy_resolved_framework_into_bundle(<resolved_item> <resolved_embedded_item>) -Copy a resolved framework into the bundle if necessary. Copy is not -necessary if the resolved_item is "the same as" the -resolved_embedded_item. +Copy a resolved framework into the bundle if necessary. +Copy is not necessary, if the ``<resolved_item>`` is "the same as" the +``<resolved_embedded_item>``. -By default, BU_COPY_FULL_FRAMEWORK_CONTENTS is not set. If you want +By default, ``BU_COPY_FULL_FRAMEWORK_CONTENTS`` is not set. If you want full frameworks embedded in your bundles, set -BU_COPY_FULL_FRAMEWORK_CONTENTS to ON before calling fixup_bundle. By -default, COPY_RESOLVED_FRAMEWORK_INTO_BUNDLE copies the framework -dylib itself plus the framework Resources directory. +``BU_COPY_FULL_FRAMEWORK_CONTENTS`` to ``ON`` before calling fixup_bundle. By +default, ``COPY_RESOLVED_FRAMEWORK_INTO_BUNDLE`` copies the framework +dylib itself plus the framework ``Resources`` directory. .. code-block:: cmake fixup_bundle_item(<resolved_embedded_item> <exepath> <dirs>) -Get the direct/non-system prerequisites of the resolved embedded item. +Get the direct/non-system prerequisites of the ``<resolved_embedded_item>``. For each prerequisite, change the way it is referenced to the value of -the _EMBEDDED_ITEM keyed variable for that prerequisite. (Most likely -changing to an "@executable_path" style reference.) +the ``_EMBEDDED_ITEM`` keyed variable for that prerequisite. (Most likely +changing to an ``@executable_path`` style reference.) -This function requires that the resolved_embedded_item be "inside" the -bundle already. In other words, if you pass plugins to fixup_bundle +This function requires that the ``<resolved_embedded_item>`` be ``inside`` +the bundle already. In other words, if you pass plugins to ``fixup_bundle`` as the libs parameter, you should install them or copy them into the -bundle before calling fixup_bundle. The "libs" parameter is a list of +bundle before calling ``fixup_bundle``. The ``libs`` parameter is a list of libraries that must be fixed up, but that cannot be determined by -otool output analysis. (i.e., plugins) +otool output analysis. (i.e., ``plugins``) Also, change the id of the item being fixed up to its own -_EMBEDDED_ITEM value. +``_EMBEDDED_ITEM`` value. Accumulate changes in a local variable and make *one* call to -install_name_tool at the end of the function with all the changes at +``install_name_tool`` at the end of the function with all the changes at once. -If the BU_CHMOD_BUNDLE_ITEMS variable is set then bundle items will be -marked writable before install_name_tool tries to change them. +If the ``BU_CHMOD_BUNDLE_ITEMS`` variable is set then bundle items will be +marked writable before ``install_name_tool`` tries to change them. .. code-block:: cmake verify_bundle_prerequisites(<bundle> <result_var> <info_var>) Verifies that the sum of all prerequisites of all files inside the -bundle are contained within the bundle or are "system" libraries, +bundle are contained within the bundle or are ``system`` libraries, presumed to exist everywhere. -As an optional parameter (IGNORE_ITEM) a list of file names can be passed, -which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe") +As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed, +which are then ignored +(e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``) .. code-block:: cmake verify_bundle_symlinks(<bundle> <result_var> <info_var>) -Verifies that any symlinks found in the bundle point to other files +Verifies that any symlinks found in the ``<bundle>`` bundle point to other files that are already also in the bundle... Anything that points to an external file causes this function to fail the verification. #]=======================================================================] diff --git a/Modules/CMakeParseImplicitIncludeInfo.cmake b/Modules/CMakeParseImplicitIncludeInfo.cmake index 977debb..176b3ff 100644 --- a/Modules/CMakeParseImplicitIncludeInfo.cmake +++ b/Modules/CMakeParseImplicitIncludeInfo.cmake @@ -218,6 +218,14 @@ function(cmake_parse_implicit_include_info text lang dir_var log_var state_var) get_filename_component(dir "${d}" ABSOLUTE) list(APPEND implicit_dirs "${dir}") string(APPEND log " collapse include dir [${d}] ==> [${dir}]\n") + elseif("${d}" MATCHES [[^\.\.[\/]\.\.[\/](.*)$]]) + # This relative path is deep enough to get out of the CMakeFiles/CMakeTmp + # directory where the ABI check is done. Assume that the compiler has + # computed this path adaptively based on the current working directory + # such that the effective result is absolute. + get_filename_component(dir "${CMAKE_BINARY_DIR}/${CMAKE_MATCH_1}" ABSOLUTE) + list(APPEND implicit_dirs "${dir}") + string(APPEND log " collapse relative include dir [${d}] ==> [${dir}]\n") else() string(APPEND log " skipping relative include dir [${d}]\n") endif() diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake index d100704..3a111ca 100644 --- a/Modules/CTest.cmake +++ b/Modules/CTest.cmake @@ -118,7 +118,7 @@ if(BUILD_TESTING) endif() string(APPEND SUBMIT_URL "@") endif() - string(APPEND SUBMIT_URL "${DROP_SITE}${DROP_SITE_LOCATION}") + string(APPEND SUBMIT_URL "${DROP_SITE}${DROP_LOCATION}") endif() find_program(CVSCOMMAND cvs ) diff --git a/Modules/Compiler/CMakeCommonCompilerMacros.cmake b/Modules/Compiler/CMakeCommonCompilerMacros.cmake index 9c62e10..96537f8 100644 --- a/Modules/Compiler/CMakeCommonCompilerMacros.cmake +++ b/Modules/Compiler/CMakeCommonCompilerMacros.cmake @@ -94,18 +94,43 @@ endmacro() macro(cmake_record_cxx_compile_features) set(_result 0) if(_result EQUAL 0 AND DEFINED CMAKE_CXX20_STANDARD_COMPILE_OPTION) - _record_compiler_features_cxx(20) + if(CMAKE_CXX20_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_cxx(20) + else() + _record_compiler_features_cxx(20) + endif() + unset(CMAKE_CXX20_STANDARD__HAS_FULL_SUPPORT) endif() if(_result EQUAL 0 AND DEFINED CMAKE_CXX17_STANDARD_COMPILE_OPTION) - _record_compiler_features_cxx(17) + if(CMAKE_CXX17_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_cxx(17) + else() + _record_compiler_features_cxx(17) + endif() + unset(CMAKE_CXX17_STANDARD__HAS_FULL_SUPPORT) endif() if(_result EQUAL 0 AND DEFINED CMAKE_CXX14_STANDARD_COMPILE_OPTION) - _record_compiler_features_cxx(14) + if(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_cxx(14) + else() + _record_compiler_features_cxx(14) + endif() + unset(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT) endif() if(_result EQUAL 0 AND DEFINED CMAKE_CXX11_STANDARD_COMPILE_OPTION) - _record_compiler_features_cxx(11) + if(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_cxx(11) + else() + _record_compiler_features_cxx(11) + endif() + unset(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT) endif() if(_result EQUAL 0 AND DEFINED CMAKE_CXX98_STANDARD_COMPILE_OPTION) - _record_compiler_features_cxx(98) + if(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_cxx(98) + else() + _record_compiler_features_cxx(98) + endif() + unset(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT) endif() endmacro() diff --git a/Modules/Compiler/Cray-CXX.cmake b/Modules/Compiler/Cray-CXX.cmake index 85a3167..38c8b1e 100644 --- a/Modules/Compiler/Cray-CXX.cmake +++ b/Modules/Compiler/Cray-CXX.cmake @@ -10,13 +10,16 @@ string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG") if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION -h conform) set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -h gnu) + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.4) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION -h std=c++11) set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -h std=c++11,gnu) + set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) endif() if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.6) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION -h std=c++14) set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION -h std=c++14,gnu) + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) endif () endif () diff --git a/Modules/Compiler/PGI-CXX.cmake b/Modules/Compiler/PGI-CXX.cmake index 35076bb..c77de36 100644 --- a/Modules/Compiler/PGI-CXX.cmake +++ b/Modules/Compiler/PGI-CXX.cmake @@ -6,15 +6,19 @@ string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG") if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.10) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION -A) set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION --gnu_extensions) + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.10) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION --c++11 -A) set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION --c++11 --gnu_extensions) + set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15.7) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION --c++14 -A) set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION --c++14 --gnu_extensions) + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.1) set(CMAKE_CXX17_STANDARD_COMPILE_OPTION --c++17 -A) set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION --c++17 --gnu_extensions) + set(CMAKE_CXX17_STANDARD__HAS_FULL_SUPPORT ON) endif() endif() endif() diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake index 0026b4a..ec3f1f8 100644 --- a/Modules/Compiler/XL-CXX.cmake +++ b/Modules/Compiler/XL-CXX.cmake @@ -16,6 +16,8 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) endif() set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) endif () __compiler_check_default_language_standard(CXX 10.1 98) diff --git a/Modules/Compiler/XLClang-CXX.cmake b/Modules/Compiler/XLClang-CXX.cmake index f535ebc..03c7c7b 100644 --- a/Modules/Compiler/XLClang-CXX.cmake +++ b/Modules/Compiler/XLClang-CXX.cmake @@ -4,13 +4,16 @@ __compiler_xlclang(CXX) if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "") + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") + set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) endif () endif() diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 948b921..8f1e194 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -202,23 +202,24 @@ External Project Definition :command:`file(DOWNLOAD)`) ``NETRC <level>`` - Specify whether the .netrc file is to be used for operation. If this - option is not specified, the value of the ``CMAKE_NETRC`` variable - will be used instead (see :command:`file(DOWNLOAD)`) + Specify whether the ``.netrc`` file is to be used for operation. + If this option is not specified, the value of the ``CMAKE_NETRC`` + variable will be used instead (see :command:`file(DOWNLOAD)`) Valid levels are: ``IGNORED`` - The .netrc file is ignored. + The ``.netrc`` file is ignored. This is the default. ``OPTIONAL`` - The .netrc file is optional, and information in the URL is preferred. - The file will be scanned to find which ever information is not specified - in the URL. + The ``.netrc`` file is optional, and information in the URL + is preferred. The file will be scanned to find which ever + information is not specified in the URL. ``REQUIRED`` - The .netrc file is required, and information in the URL is ignored. + The ``.netrc`` file is required, and information in the URL + is ignored. ``NETRC_FILE <file>`` - Specify an alternative .netrc file to the one in your home directory + Specify an alternative ``.netrc`` file to the one in your home directory if the ``NETRC`` level is ``OPTIONAL`` or ``REQUIRED``. If this option is not specified, the value of the ``CMAKE_NETRC_FILE`` variable will be used instead (see :command:`file(DOWNLOAD)`) diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index 06ac2d9..b0e25dc 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -19,7 +19,7 @@ The module defines the following variables: true if the program was found The minimum required version of ``bison`` can be specified using the -standard CMake syntax, e.g. ``find_package(BISON 2.1.3)``. +standard CMake syntax, e.g. :command:`find_package(BISON 2.1.3)`. If ``bison`` is found, the module defines the macro:: @@ -55,7 +55,7 @@ The options are: The macro defines the following variables: ``BISON_<Name>_DEFINED`` - true is the macro ran successfully + ``True`` is the macro ran successfully ``BISON_<Name>_INPUT`` The input source file, an alias for <YaccInput> diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index bfa449f..77e689f 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -5,12 +5,12 @@ FindBLAS -------- -Find BLAS library +Find Basic Linear Algebra Subprograms (BLAS) library -This module finds an installed fortran library that implements the +This module finds an installed Fortran library that implements the BLAS linear-algebra interface (see http://www.netlib.org/blas/). The -list of libraries searched for is taken from the autoconf macro file, -acx_blas.m4 (distributed at +list of libraries searched for is taken from the ``autoconf`` macro file, +``acx_blas.m4`` (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_blas.html). Input Variables @@ -52,7 +52,7 @@ The following variables may be set to influence this module's behavior: if ``ON`` tries to find the BLAS95 interfaces ``BLA_PREFER_PKGCONFIG`` - if set pkg-config will be used to search for a BLAS library first + if set ``pkg-config`` will be used to search for a BLAS library first and if one is found that is preferred Result Variables @@ -63,7 +63,7 @@ This module defines the following variables: ``BLAS_FOUND`` library implementing the BLAS interface is found ``BLAS_LINKER_FLAGS`` - uncached list of required linker flags (excluding -l and -L). + uncached list of required linker flags (excluding ``-l`` and ``-L``). ``BLAS_LIBRARIES`` uncached list of libraries (using full path name) to link against to use BLAS (may be empty if compiler implicitly links BLAS) @@ -75,7 +75,7 @@ This module defines the following variables: .. note:: - C or CXX must be enabled to use Intel MKL + C or CXX must be enabled to use Intel Math Kernel Library (MKL) For example, to use Intel MKL libraries and/or Intel compiler: diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 1231ff1..53be493 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -85,33 +85,33 @@ The following :prop_tgt:`IMPORTED` targets are also defined:: Boost::dynamic_linking - interface target to enable dynamic linking linking with MSVC (adds BOOST_ALL_DYN_LINK) -Implicit dependencies such as Boost::filesystem requiring -Boost::system will be automatically detected and satisfied, even -if system is not specified when using find_package and if -Boost::system is not added to target_link_libraries. If using -Boost::thread, then Threads::Threads will also be added automatically. +Implicit dependencies such as ``Boost::filesystem`` requiring +``Boost::system`` will be automatically detected and satisfied, even +if system is not specified when using :command:`find_package` and if +``Boost::system`` is not added to :command:`target_link_libraries`. If using +``Boost::thread``, then ``Threads::Threads`` will also be added automatically. It is important to note that the imported targets behave differently than variables created by this module: multiple calls to -find_package(Boost) in the same directory or sub-directories with +:command:`find_package(Boost)` in the same directory or sub-directories with different options (e.g. static or shared) will not override the values of the targets created by the first call. -Users may set these hints or results as cache entries. Projects +Users may set these hints or results as ``CACHE`` entries. Projects should not read these entries directly but instead use the above result variables. Note that some hint names start in upper-case "BOOST". One may specify these as environment variables if they are not specified as CMake variables or cache entries. -This module first searches for the Boost header files using the above -hint variables (excluding BOOST_LIBRARYDIR) and saves the result in -Boost_INCLUDE_DIR. Then it searches for requested component libraries -using the above hints (excluding BOOST_INCLUDEDIR and -Boost_ADDITIONAL_VERSIONS), "lib" directories near Boost_INCLUDE_DIR, +This module first searches for the ``Boost`` header files using the above +hint variables (excluding ``BOOST_LIBRARYDIR``) and saves the result in +``Boost_INCLUDE_DIR``. Then it searches for requested component libraries +using the above hints (excluding ``BOOST_INCLUDEDIR`` and +``Boost_ADDITIONAL_VERSIONS``), "lib" directories near ``Boost_INCLUDE_DIR``, and the library name configuration settings below. It saves the -library directories in Boost_LIBRARY_DIR_DEBUG and -Boost_LIBRARY_DIR_RELEASE and individual library -locations in Boost_<C>_LIBRARY_DEBUG and Boost_<C>_LIBRARY_RELEASE. +library directories in ``Boost_LIBRARY_DIR_DEBUG`` and +``Boost_LIBRARY_DIR_RELEASE`` and individual library +locations in ``Boost_<C>_LIBRARY_DEBUG`` and ``Boost_<C>_LIBRARY_RELEASE``. When one changes settings used by previous searches in the same build tree (excluding environment variables) this module discards previous search results affected by the changes and searches again. @@ -179,9 +179,9 @@ Other variables one may set to control this module are:: On Visual Studio and Borland compilers Boost headers request automatic linking to corresponding libraries. This requires matching libraries to be linked explicitly or available in the link library search path. -In this case setting Boost_USE_STATIC_LIBS to OFF may not achieve +In this case setting ``Boost_USE_STATIC_LIBS`` to ``OFF`` may not achieve dynamic linking. Boost automatic linking typically requests static -libraries with a few exceptions (such as Boost.Python). Use:: +libraries with a few exceptions (such as ``Boost.Python``). Use:: add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) @@ -230,12 +230,12 @@ Boost CMake If Boost was built using the boost-cmake project it provides a package configuration file for use with find_package's Config mode. This module looks for the package configuration file called -BoostConfig.cmake or boost-config.cmake and stores the result in cache -entry "Boost_DIR". If found, the package configuration file is loaded +``BoostConfig.cmake`` or ``boost-config.cmake`` and stores the result in +``CACHE`` entry "Boost_DIR". If found, the package configuration file is loaded and this module returns with no further action. See documentation of the Boost CMake package configuration for details on what it provides. -Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake. +Set ``Boost_NO_BOOST_CMAKE`` to ``ON``, to disable the search for boost-cmake. #]=======================================================================] # Save project's policies diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake index 27105b9..2c79911 100644 --- a/Modules/FindCups.cmake +++ b/Modules/FindCups.cmake @@ -7,8 +7,8 @@ FindCups Find the CUPS printing system. -Set CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE to TRUE if you need a version which -features this function (i.e. at least 1.1.19) +Set ``CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE`` to ``TRUE`` if you need a version which +features this function (i.e. at least ``1.1.19``) Imported targets ^^^^^^^^^^^^^^^^ diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake index edebe75..68eb9c8 100644 --- a/Modules/FindFLEX.cmake +++ b/Modules/FindFLEX.cmake @@ -13,7 +13,7 @@ The module defines the following variables: :: - FLEX_FOUND - true is flex executable is found + FLEX_FOUND - True is flex executable is found FLEX_EXECUTABLE - the path to the flex executable FLEX_VERSION - the version of flex FLEX_LIBRARIES - The flex libraries @@ -35,10 +35,10 @@ If flex is found on the system, the module provides the macro: [DEFINES_FILE <string>] ) -which creates a custom command to generate the <FlexOutput> file from -the <FlexInput> file. If COMPILE_FLAGS option is specified, the next +which creates a custom command to generate the ``FlexOutput`` file from +the ``FlexInput`` file. If ``COMPILE_FLAGS`` option is specified, the next parameter is added to the flex command line. If flex is configured to -output a header file, the DEFINES_FILE option may be used to specify its +output a header file, the ``DEFINES_FILE`` option may be used to specify its name. Name is an alias used to get details of this custom command. Indeed the macro defines the following variables: @@ -61,8 +61,8 @@ defines a macro: ADD_FLEX_BISON_DEPENDENCY(FlexTarget BisonTarget) which adds the required dependency between a scanner and a parser -where <FlexTarget> and <BisonTarget> are the first parameters of -respectively FLEX_TARGET and BISON_TARGET macros. +where ``FlexTarget`` and ``BisonTarget`` are the first parameters of +respectively ``FLEX_TARGET`` and ``BISON_TARGET`` macros. :: diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake index 9300522..49f303e 100644 --- a/Modules/FindSWIG.cmake +++ b/Modules/FindSWIG.cmake @@ -19,11 +19,11 @@ This module finds an installed SWIG. It sets the following variables: The minimum required version of SWIG can be specified using the -standard syntax, e.g. find_package(SWIG 1.1) +standard syntax, e.g. :command:`find_package(SWIG 1.1)` -All information is collected from the SWIG_EXECUTABLE so the version +All information is collected from the ``SWIG_EXECUTABLE``, so the version to be found can be changed from the command line by means of setting -SWIG_EXECUTABLE +``SWIG_EXECUTABLE`` #]=======================================================================] find_program(SWIG_EXECUTABLE NAMES swig3.0 swig2.0 swig) diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake index 63ca936..00a3a41 100644 --- a/Modules/FindTIFF.cmake +++ b/Modules/FindTIFF.cmake @@ -5,7 +5,7 @@ FindTIFF -------- -Find the TIFF library (libtiff). +Find the TIFF library (``libtiff``). Imported targets ^^^^^^^^^^^^^^^^ diff --git a/Modules/FindUnixCommands.cmake b/Modules/FindUnixCommands.cmake index 3a735f7..2513f5c 100644 --- a/Modules/FindUnixCommands.cmake +++ b/Modules/FindUnixCommands.cmake @@ -7,8 +7,9 @@ FindUnixCommands Find Unix commands, including the ones from Cygwin -This module looks for the Unix commands bash, cp, gzip, mv, rm, and tar -and stores the result in the variables BASH, CP, GZIP, MV, RM, and TAR. +This module looks for the Unix commands ``bash``, ``cp``, ``gzip``, +``mv``, ``rm``, and ``tar`` and stores the result in the variables +``BASH``, ``CP``, ``GZIP``, ``MV``, ``RM``, and ``TAR``. #]=======================================================================] include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake) diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index f2e4527..e4481f6 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -7,7 +7,7 @@ GenerateExportHeader Function for generation of export macros for libraries -This module provides the function GENERATE_EXPORT_HEADER(). +This module provides the function ``GENERATE_EXPORT_HEADER()``. The ``GENERATE_EXPORT_HEADER`` function can be used to generate a file suitable for preprocessor inclusion which contains EXPORT macros to be diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake index f7b3e96..75be473 100644 --- a/Modules/Internal/FeatureTesting.cmake +++ b/Modules/Internal/FeatureTesting.cmake @@ -99,3 +99,7 @@ macro(_has_compiler_features_c std) list(APPEND CMAKE_C${std}_COMPILE_FEATURES c_std_${std}) _has_compiler_features(C ${std} "${CMAKE_C${std}_STANDARD_COMPILE_OPTION}" CMAKE_C${std}_COMPILE_FEATURES) endmacro() +macro(_has_compiler_features_cxx std) + list(APPEND CMAKE_CXX${std}_COMPILE_FEATURES cxx_std_${std}) + _has_compiler_features(CXX ${std} "${CMAKE_CXX${std}_STANDARD_COMPILE_OPTION}" CMAKE_CXX${std}_COMPILE_FEATURES) +endmacro() diff --git a/Modules/UseQt4.cmake b/Modules/UseQt4.cmake index dc2348e..8fec717 100644 --- a/Modules/UseQt4.cmake +++ b/Modules/UseQt4.cmake @@ -7,8 +7,8 @@ UseQt4 Use Module for QT4 -Sets up C and C++ to use Qt 4. It is assumed that FindQt.cmake has -already been loaded. See FindQt.cmake for information on how to load +Sets up C and C++ to use Qt 4. It is assumed that :module:`FindQt` has +already been loaded. See :module:`FindQt` for information on how to load Qt 4 into your CMake project. #]=======================================================================] @@ -105,4 +105,3 @@ foreach(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN endif () endforeach() - diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake index 21ccd7c..23d81b5 100644 --- a/Modules/WriteCompilerDetectionHeader.cmake +++ b/Modules/WriteCompilerDetectionHeader.cmake @@ -5,7 +5,7 @@ WriteCompilerDetectionHeader ---------------------------- -This module provides the function write_compiler_detection_header(). +This module provides the function ``write_compiler_detection_header()``. This function can be used to generate a file suitable for preprocessor inclusion which contains macros to be used in source code:: diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 3a12120..924d997 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -143,6 +143,8 @@ set(SRCS cmAffinity.cxx cmAffinity.h cmArchiveWrite.cxx + cmArgumentParser.cxx + cmArgumentParser.h cmBase32.cxx cmCacheManager.cxx cmCacheManager.h @@ -443,8 +445,6 @@ set(SRCS cmCMakeMinimumRequired.h cmCMakePolicyCommand.cxx cmCMakePolicyCommand.h - cmCommandArgumentsHelper.cxx - cmCommandArgumentsHelper.h cmConditionEvaluator.cxx cmConditionEvaluator.h cmConfigureFileCommand.cxx diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9ff8d5c..70c44e1 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 14) -set(CMake_VERSION_PATCH 20190408) +set(CMake_VERSION_PATCH 20190412) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/bills-comments.txt b/Source/CPack/bills-comments.txt deleted file mode 100644 index 1aaf9af..0000000 --- a/Source/CPack/bills-comments.txt +++ /dev/null @@ -1,68 +0,0 @@ -cpack.cxx - -cmCPackGenerators -- creates cmCPackGenericGenerator's via NewGenerator - - a cmCPackGenericGenerator factory - - -cmCPackGenericGenerator::Initialize - this->InitializeInternal - CPACK_INCLUDE_TOPLEVEL_DIRECTORY = 0 turns off - - -// binary package run -cmCPackGenericGenerator::ProcessGenerator // DoPackage - cmCPackGenericGenerator::PrepareNames -- sets a bunch of CPACK_vars - cmCPackGenericGenerator::InstallProject - run preinstall (make preinstall/fast) - call ReadListFile(cmake_install.cmake) - glob recurse in install directory to get list of files - this->CompressFiles with the list of files - - -// source package run -cmCPackGenericGenerator::ProcessGenerator // DoPackage - cmCPackGenericGenerator::PrepareNames -- sets a bunch of CPACK_vars - cmCPackGenericGenerator::InstallProject --> - if set CPACK_INSTALLED_DIRECTORIES - glob the files in that directory - copy those files to the tmp install directory _CPack something - glob recurse in install directory to get list of files - this->CompressFiles with the list of files - - -cmCPackGenericGenerator::InstallProject is used for both source and binary -packages. It is controlled based on values set in CPACK_ variables. - - -InstallProject - 1. CPACK_INSTALL_COMMANDS - a list of commands used to install the package - - 2. CPACK_INSTALLED_DIRECTORIES - copy this directory to CPACK_TEMPORARY_DIRECTORY - - 3. CPACK_INSTALL_CMAKE_PROJECTS - a cmake install script - - run make preinstall - - run cmake_install.cmake - - set CMAKE_INSTALL_PREFIX to the temp directory - - CPACK_BUILD_CONFIG check this and set the BUILD_TYPE to it - - ReadListFile on the install script cmake_install.cmake - - run strip on the executables and libraries if CPACK_STRIP_FILES is TRUE - -Recommendations: - -rename cmCPackGenerators to cmCPackGeneratorFactory - -rename cmCPackGenericGenerator --> cmCPackGenerator - -rename cmCPackGenericGenerator::ProcessGenerator -> cmCPackGenerator::DoPackage - - -break up cmCPackGenerator::InstallProject so it calls the following: - -// run user provided install commands - cmCPackGenerator::RunInstallCommands(); -// copy entire directories that need no processing like source trees - cmCPackGenerator::CopyPreInstalledDirectories(); -// run the cmake install scripts if provided - cmCPackGenerator::RunCMakeInstallScripts() - -- diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index cd30ad5..8d9a50c 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -48,6 +48,9 @@ Q_IMPORT_PLUGIN(QXcbIntegrationPlugin); #if defined(USE_QWindowsIntegrationPlugin) Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin); +# if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) +Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin); +# endif #endif int main(int argc, char** argv) diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 72cce9f..5f6ccca 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -303,7 +303,6 @@ void CMakeSetupDialog::initialize() #ifdef QT_WINEXTRAS this->TaskbarButton = new QWinTaskbarButton(this); this->TaskbarButton->setWindow(this->windowHandle()); - this->TaskbarButton->setOverlayIcon(QIcon(":/loading.png")); #endif } diff --git a/Source/cmArgumentParser.cxx b/Source/cmArgumentParser.cxx new file mode 100644 index 0000000..751d117 --- /dev/null +++ b/Source/cmArgumentParser.cxx @@ -0,0 +1,93 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmArgumentParser.h" + +#include <algorithm> +#include <type_traits> + +namespace ArgumentParser { + +auto ActionMap::Emplace(cm::string_view name, Action action) + -> std::pair<iterator, bool> +{ + auto const it = + std::lower_bound(this->begin(), this->end(), name, + [](value_type const& elem, cm::string_view const& k) { + return elem.first < k; + }); + return (it != this->end() && it->first == name) + ? std::make_pair(it, false) + : std::make_pair(this->emplace(it, name, std::move(action)), true); +} + +auto ActionMap::Find(cm::string_view name) const -> const_iterator +{ + auto const it = + std::lower_bound(this->begin(), this->end(), name, + [](value_type const& elem, cm::string_view const& k) { + return elem.first < k; + }); + return (it != this->end() && it->first == name) ? it : this->end(); +} + +void Instance::Bind(bool& val) +{ + val = true; + this->CurrentString = nullptr; + this->CurrentList = nullptr; + this->ExpectValue = false; +} + +void Instance::Bind(std::string& val) +{ + this->CurrentString = &val; + this->CurrentList = nullptr; + this->ExpectValue = true; +} + +void Instance::Bind(StringList& val) +{ + this->CurrentString = nullptr; + this->CurrentList = &val; + this->ExpectValue = true; +} + +void Instance::Bind(MultiStringList& val) +{ + this->CurrentString = nullptr; + this->CurrentList = (static_cast<void>(val.emplace_back()), &val.back()); + this->ExpectValue = false; +} + +void Instance::Consume(cm::string_view arg, void* result, + std::vector<std::string>* unparsedArguments, + std::vector<std::string>* keywordsMissingValue) +{ + auto const it = this->Bindings.Find(arg); + if (it != this->Bindings.end()) { + it->second(*this, result); + if (this->ExpectValue && keywordsMissingValue != nullptr) { + keywordsMissingValue->emplace_back(arg); + } + return; + } + + if (this->CurrentString != nullptr) { + this->CurrentString->assign(std::string(arg)); + this->CurrentString = nullptr; + this->CurrentList = nullptr; + } else if (this->CurrentList != nullptr) { + this->CurrentList->emplace_back(arg); + } else if (unparsedArguments != nullptr) { + unparsedArguments->emplace_back(arg); + } + + if (this->ExpectValue) { + if (keywordsMissingValue != nullptr) { + keywordsMissingValue->pop_back(); + } + this->ExpectValue = false; + } +} + +} // namespace ArgumentParser diff --git a/Source/cmArgumentParser.h b/Source/cmArgumentParser.h new file mode 100644 index 0000000..6cfe946 --- /dev/null +++ b/Source/cmArgumentParser.h @@ -0,0 +1,143 @@ +/* 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 + +#include "cmConfigure.h" // IWYU pragma: keep + +#include "cm_static_string_view.hxx" +#include "cm_string_view.hxx" + +#include <cassert> +#include <functional> +#include <string> +#include <utility> +#include <vector> + +namespace ArgumentParser { + +using StringList = std::vector<std::string>; +using MultiStringList = std::vector<StringList>; + +class Instance; +using Action = std::function<void(Instance&, void*)>; + +// using ActionMap = cm::flat_map<cm::string_view, Action>; +class ActionMap : public std::vector<std::pair<cm::string_view, Action>> +{ +public: + std::pair<iterator, bool> Emplace(cm::string_view name, Action action); + const_iterator Find(cm::string_view name) const; +}; + +class Instance +{ +public: + Instance(ActionMap const& bindings) + : Bindings(bindings) + { + } + + void Bind(bool& val); + void Bind(std::string& val); + void Bind(StringList& val); + void Bind(MultiStringList& val); + + void Consume(cm::string_view arg, void* result, + std::vector<std::string>* unparsedArguments, + std::vector<std::string>* keywordsMissingValue); + +private: + ActionMap const& Bindings; + std::string* CurrentString = nullptr; + StringList* CurrentList = nullptr; + bool ExpectValue = false; +}; + +} // namespace ArgumentParser + +template <typename Result> +class cmArgumentParser +{ +public: + // I *think* this function could be made `constexpr` when the code is + // compiled as C++20. This would allow building a parser at compile time. + template <typename T> + cmArgumentParser& Bind(cm::static_string_view name, T Result::*member) + { + bool const inserted = + this->Bindings + .Emplace(name, + [member](ArgumentParser::Instance& instance, void* result) { + instance.Bind(static_cast<Result*>(result)->*member); + }) + .second; + assert(inserted), (void)inserted; + return *this; + } + + template <typename Range> + void Parse(Result& result, Range const& args, + std::vector<std::string>* unparsedArguments = nullptr, + std::vector<std::string>* keywordsMissingValue = nullptr) const + { + ArgumentParser::Instance instance(this->Bindings); + for (cm::string_view arg : args) { + instance.Consume(arg, &result, unparsedArguments, keywordsMissingValue); + } + } + + template <typename Range> + Result Parse(Range const& args, + std::vector<std::string>* unparsedArguments = nullptr, + std::vector<std::string>* keywordsMissingValue = nullptr) const + { + Result result; + this->Parse(result, args, unparsedArguments, keywordsMissingValue); + return result; + } + +private: + ArgumentParser::ActionMap Bindings; +}; + +template <> +class cmArgumentParser<void> +{ +public: + template <typename T> + cmArgumentParser& Bind(cm::static_string_view name, T& ref) + { + bool const inserted = this->Bind(cm::string_view(name), ref); + assert(inserted), (void)inserted; + return *this; + } + + template <typename Range> + void Parse(Range const& args, + std::vector<std::string>* unparsedArguments = nullptr, + std::vector<std::string>* keywordsMissingValue = nullptr) const + { + ArgumentParser::Instance instance(this->Bindings); + for (cm::string_view arg : args) { + instance.Consume(arg, nullptr, unparsedArguments, keywordsMissingValue); + } + } + +protected: + template <typename T> + bool Bind(cm::string_view name, T& ref) + { + return this->Bindings + .Emplace(name, + [&ref](ArgumentParser::Instance& instance, void*) { + instance.Bind(ref); + }) + .second; + } + +private: + ArgumentParser::ActionMap Bindings; +}; + +#endif diff --git a/Source/cmCommandArgumentsHelper.cxx b/Source/cmCommandArgumentsHelper.cxx deleted file mode 100644 index 968b17c..0000000 --- a/Source/cmCommandArgumentsHelper.cxx +++ /dev/null @@ -1,233 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmCommandArgumentsHelper.h" - -cmCommandArgument::cmCommandArgument(cmCommandArgumentsHelper* args, - const char* key, - cmCommandArgumentGroup* group) - : Key(key) - , Group(group) - , WasActive(false) - , ArgumentsBeforeEmpty(true) - , CurrentIndex(0) -{ - if (args != nullptr) { - args->AddArgument(this); - } - - if (this->Group != nullptr) { - this->Group->ContainedArguments.push_back(this); - } -} - -void cmCommandArgument::Reset() -{ - this->WasActive = false; - this->CurrentIndex = 0; - this->DoReset(); -} - -void cmCommandArgument::Follows(const cmCommandArgument* arg) -{ - this->ArgumentsBeforeEmpty = false; - this->ArgumentsBefore.insert(arg); -} - -void cmCommandArgument::FollowsGroup(const cmCommandArgumentGroup* group) -{ - if (group != nullptr) { - this->ArgumentsBeforeEmpty = false; - this->ArgumentsBefore.insert(group->ContainedArguments.begin(), - group->ContainedArguments.end()); - } -} - -bool cmCommandArgument::MayFollow(const cmCommandArgument* current) const -{ - if (this->ArgumentsBeforeEmpty) { - return true; - } - return this->ArgumentsBefore.find(current) != this->ArgumentsBefore.end(); -} - -bool cmCommandArgument::KeyMatches(const std::string& key) const -{ - if ((this->Key == nullptr) || (this->Key[0] == '\0')) { - return true; - } - return (key == this->Key); -} - -void cmCommandArgument::ApplyOwnGroup() -{ - if (this->Group != nullptr) { - for (cmCommandArgument* cargs : this->Group->ContainedArguments) { - if (cargs != this) { - this->ArgumentsBefore.insert(cargs); - } - } - } -} - -void cmCommandArgument::Activate() -{ - this->WasActive = true; - this->CurrentIndex = 0; -} - -bool cmCommandArgument::Consume(const std::string& arg) -{ - bool res = this->DoConsume(arg, this->CurrentIndex); - this->CurrentIndex++; - return res; -} - -cmCAStringVector::cmCAStringVector(cmCommandArgumentsHelper* args, - const char* key, - cmCommandArgumentGroup* group) - : cmCommandArgument(args, key, group) - , Ignore(nullptr) -{ - if ((key == nullptr) || (*key == 0)) { - this->DataStart = 0; - } else { - this->DataStart = 1; - } -} - -bool cmCAStringVector::DoConsume(const std::string& arg, unsigned int index) -{ - if (index >= this->DataStart) { - if ((this->Ignore == nullptr) || (arg != this->Ignore)) { - this->Vector.push_back(arg); - } - } - - return false; -} - -void cmCAStringVector::DoReset() -{ - this->Vector.clear(); -} - -cmCAString::cmCAString(cmCommandArgumentsHelper* args, const char* key, - cmCommandArgumentGroup* group) - : cmCommandArgument(args, key, group) -{ - if ((key == nullptr) || (*key == 0)) { - this->DataStart = 0; - } else { - this->DataStart = 1; - } -} - -bool cmCAString::DoConsume(const std::string& arg, unsigned int index) -{ - if (index == this->DataStart) { - this->String = arg; - } - - return index >= this->DataStart; -} - -void cmCAString::DoReset() -{ - this->String.clear(); -} - -cmCAEnabler::cmCAEnabler(cmCommandArgumentsHelper* args, const char* key, - cmCommandArgumentGroup* group) - : cmCommandArgument(args, key, group) - , Enabled(false) -{ -} - -bool cmCAEnabler::DoConsume(const std::string&, unsigned int index) -{ - if (index == 0) { - this->Enabled = true; - } - return true; -} - -void cmCAEnabler::DoReset() -{ - this->Enabled = false; -} - -cmCADisabler::cmCADisabler(cmCommandArgumentsHelper* args, const char* key, - cmCommandArgumentGroup* group) - : cmCommandArgument(args, key, group) - , Enabled(true) -{ -} - -bool cmCADisabler::DoConsume(const std::string&, unsigned int index) -{ - if (index == 0) { - this->Enabled = false; - } - return true; -} - -void cmCADisabler::DoReset() -{ - this->Enabled = true; -} - -void cmCommandArgumentGroup::Follows(const cmCommandArgument* arg) -{ - for (cmCommandArgument* ca : this->ContainedArguments) { - ca->Follows(arg); - } -} - -void cmCommandArgumentGroup::FollowsGroup(const cmCommandArgumentGroup* group) -{ - for (cmCommandArgument* ca : this->ContainedArguments) { - ca->FollowsGroup(group); - } -} - -void cmCommandArgumentsHelper::Parse(const std::vector<std::string>* args, - std::vector<std::string>* unconsumedArgs) -{ - if (args == nullptr) { - return; - } - - for (cmCommandArgument* ca : this->Arguments) { - ca->ApplyOwnGroup(); - ca->Reset(); - } - - cmCommandArgument* activeArgument = nullptr; - const cmCommandArgument* previousArgument = nullptr; - for (std::string const& it : *args) { - for (cmCommandArgument* ca : this->Arguments) { - if (ca->KeyMatches(it) && (ca->MayFollow(previousArgument))) { - activeArgument = ca; - activeArgument->Activate(); - break; - } - } - - if (activeArgument) { - bool argDone = activeArgument->Consume(it); - previousArgument = activeArgument; - if (argDone) { - activeArgument = nullptr; - } - } else { - if (unconsumedArgs != nullptr) { - unconsumedArgs->push_back(it); - } - } - } -} - -void cmCommandArgumentsHelper::AddArgument(cmCommandArgument* arg) -{ - this->Arguments.push_back(arg); -} diff --git a/Source/cmCommandArgumentsHelper.h b/Source/cmCommandArgumentsHelper.h deleted file mode 100644 index dc934be..0000000 --- a/Source/cmCommandArgumentsHelper.h +++ /dev/null @@ -1,194 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCommandArgumentsHelper_h -#define cmCommandArgumentsHelper_h - -#include "cmConfigure.h" // IWYU pragma: keep - -#include <set> -#include <string> -#include <vector> - -class cmCommandArgumentGroup; -class cmCommandArgumentsHelper; - -/* cmCommandArgumentsHelper, cmCommandArgumentGroup and cmCommandArgument (i.e. -its derived classes cmCAXXX can be used to simplify the processing of -arguments to cmake commands. Maybe they can also be used to generate -documentation. - -For every argument supported by a command one cmCommandArgument is created -and added to cmCommandArgumentsHelper. cmCommand has a cmCommandArgumentsHelper -as member variable so this should be used. - -The order of the arguments is defined using the Follows(arg) method. It says -that this argument follows immediateley the given argument. It can be used -with multiple arguments if the argument can follow after different arguments. - -Arguments can be arranged in groups using cmCommandArgumentGroup. Every -member of a group can follow any other member of the group. These groups -can also be used to define the order. - -Once all arguments and groups are set up, cmCommandArgumentsHelper::Parse() -is called and afterwards the values of the arguments can be evaluated. - -For an example see cmExportCommand.cxx. -*/ -class cmCommandArgument -{ -public: - cmCommandArgument(cmCommandArgumentsHelper* args, const char* key, - cmCommandArgumentGroup* group = nullptr); - virtual ~cmCommandArgument() = default; - - /// this argument may follow after arg. 0 means it comes first. - void Follows(const cmCommandArgument* arg); - - /// this argument may follow after any of the arguments in the given group - void FollowsGroup(const cmCommandArgumentGroup* group); - - /// Returns true if the argument was found in the argument list - bool WasFound() const { return this->WasActive; } - - // The following methods are only called from - // cmCommandArgumentsHelper::Parse(), but making this a friend would - // give it access to everything - - /// Make the current argument the currently active argument - void Activate(); - /// Consume the current string - bool Consume(const std::string& arg); - - /// Return true if this argument may follow after the given argument. - bool MayFollow(const cmCommandArgument* current) const; - - /** Returns true if the given key matches the key for this argument. - If this argument has an empty key everything matches. */ - bool KeyMatches(const std::string& key) const; - - /// Make this argument follow all members of the own group - void ApplyOwnGroup(); - - /// Reset argument, so it's back to its initial state - void Reset(); - -private: - const char* Key; - std::set<const cmCommandArgument*> ArgumentsBefore; - cmCommandArgumentGroup* Group; - bool WasActive; - bool ArgumentsBeforeEmpty; - unsigned int CurrentIndex; - - virtual bool DoConsume(const std::string& arg, unsigned int index) = 0; - virtual void DoReset() = 0; -}; - -/** cmCAStringVector is to be used for arguments which can consist of more -than one string, e.g. the FILES argument in INSTALL(FILES f1 f2 f3 ...). */ -class cmCAStringVector : public cmCommandArgument -{ -public: - cmCAStringVector(cmCommandArgumentsHelper* args, const char* key, - cmCommandArgumentGroup* group = nullptr); - - /// Return the vector of strings - const std::vector<std::string>& GetVector() const { return this->Vector; } - - /** Is there a keyword which should be skipped in - the arguments (e.g. ARGS for ADD_CUSTOM_COMMAND) ? */ - void SetIgnore(const char* ignore) { this->Ignore = ignore; } - -private: - std::vector<std::string> Vector; - unsigned int DataStart; - const char* Ignore; - bool DoConsume(const std::string& arg, unsigned int index) override; - void DoReset() override; -}; - -/** cmCAString is to be used for arguments which consist of one value, -e.g. the executable name in ADD_EXECUTABLE(). */ -class cmCAString : public cmCommandArgument -{ -public: - cmCAString(cmCommandArgumentsHelper* args, const char* key, - cmCommandArgumentGroup* group = nullptr); - - /// Return the string - const std::string& GetString() const { return this->String; } - const char* GetCString() const { return this->String.c_str(); } - -private: - std::string String; - unsigned int DataStart; - bool DoConsume(const std::string& arg, unsigned int index) override; - void DoReset() override; -}; - -/** cmCAEnabler is to be used for options which are off by default and can be -enabled using a special argument, e.g. EXCLUDE_FROM_ALL in ADD_EXECUTABLE(). */ -class cmCAEnabler : public cmCommandArgument -{ -public: - cmCAEnabler(cmCommandArgumentsHelper* args, const char* key, - cmCommandArgumentGroup* group = nullptr); - - /// Has it been enabled ? - bool IsEnabled() const { return this->Enabled; } - -private: - bool Enabled; - bool DoConsume(const std::string& arg, unsigned int index) override; - void DoReset() override; -}; - -/** cmCADisable is to be used for options which are on by default and can be -disabled using a special argument.*/ -class cmCADisabler : public cmCommandArgument -{ -public: - cmCADisabler(cmCommandArgumentsHelper* args, const char* key, - cmCommandArgumentGroup* group = nullptr); - - /// Is it still enabled ? - bool IsEnabled() const { return this->Enabled; } - -private: - bool Enabled; - bool DoConsume(const std::string& arg, unsigned int index) override; - void DoReset() override; -}; - -/** Group of arguments, needed for ordering. E.g. WIN32, EXCLUDE_FROM_ALL and -MACSOX_BUNDLE from ADD_EXECUTABLE() are a group. -*/ -class cmCommandArgumentGroup -{ - friend class cmCommandArgument; - -public: - /// All members of this group may follow the given argument - void Follows(const cmCommandArgument* arg); - - /// All members of this group may follow all members of the given group - void FollowsGroup(const cmCommandArgumentGroup* group); - -private: - std::vector<cmCommandArgument*> ContainedArguments; -}; - -class cmCommandArgumentsHelper -{ -public: - /// Parse the argument list - void Parse(const std::vector<std::string>* args, - std::vector<std::string>* unconsumedArgs); - /// Add an argument. - void AddArgument(cmCommandArgument* arg); - -private: - std::vector<cmCommandArgument*> Arguments; -}; - -#endif diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index 03eac5b..ff6340f 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -2,12 +2,14 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmExecuteProcessCommand.h" +#include "cm_static_string_view.hxx" #include "cmsys/Process.h" +#include <algorithm> #include <ctype.h> /* isspace */ -#include <sstream> #include <stdio.h> #include "cmAlgorithms.h" +#include "cmArgumentParser.h" #include "cmMakefile.h" #include "cmProcessOutput.h" #include "cmSystemTools.h" @@ -32,157 +34,85 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args, this->SetError("called with incorrect number of arguments"); return false; } - std::vector<std::vector<const char*>> cmds; - std::string arguments; - bool doing_command = false; - size_t command_index = 0; - bool output_quiet = false; - bool error_quiet = false; - bool output_strip_trailing_whitespace = false; - bool error_strip_trailing_whitespace = false; - std::string timeout_string; - std::string input_file; - std::string output_file; - std::string error_file; - std::string output_variable; - std::string error_variable; - std::string result_variable; - std::string results_variable; - std::string working_directory; - cmProcessOutput::Encoding encoding = cmProcessOutput::None; - for (size_t i = 0; i < args.size(); ++i) { - if (args[i] == "COMMAND") { - doing_command = true; - command_index = cmds.size(); - cmds.emplace_back(); - } else if (args[i] == "OUTPUT_VARIABLE") { - doing_command = false; - if (++i < args.size()) { - output_variable = args[i]; - } else { - this->SetError(" called with no value for OUTPUT_VARIABLE."); - return false; - } - } else if (args[i] == "ERROR_VARIABLE") { - doing_command = false; - if (++i < args.size()) { - error_variable = args[i]; - } else { - this->SetError(" called with no value for ERROR_VARIABLE."); - return false; - } - } else if (args[i] == "RESULT_VARIABLE") { - doing_command = false; - if (++i < args.size()) { - result_variable = args[i]; - } else { - this->SetError(" called with no value for RESULT_VARIABLE."); - return false; - } - } else if (args[i] == "RESULTS_VARIABLE") { - doing_command = false; - if (++i < args.size()) { - results_variable = args[i]; - } else { - this->SetError(" called with no value for RESULTS_VARIABLE."); - return false; - } - } else if (args[i] == "WORKING_DIRECTORY") { - doing_command = false; - if (++i < args.size()) { - working_directory = args[i]; - } else { - this->SetError(" called with no value for WORKING_DIRECTORY."); - return false; - } - } else if (args[i] == "INPUT_FILE") { - doing_command = false; - if (++i < args.size()) { - input_file = args[i]; - } else { - this->SetError(" called with no value for INPUT_FILE."); - return false; - } - } else if (args[i] == "OUTPUT_FILE") { - doing_command = false; - if (++i < args.size()) { - output_file = args[i]; - } else { - this->SetError(" called with no value for OUTPUT_FILE."); - return false; - } - } else if (args[i] == "ERROR_FILE") { - doing_command = false; - if (++i < args.size()) { - error_file = args[i]; - } else { - this->SetError(" called with no value for ERROR_FILE."); - return false; - } - } else if (args[i] == "TIMEOUT") { - doing_command = false; - if (++i < args.size()) { - timeout_string = args[i]; - } else { - this->SetError(" called with no value for TIMEOUT."); - return false; - } - } else if (args[i] == "OUTPUT_QUIET") { - doing_command = false; - output_quiet = true; - } else if (args[i] == "ERROR_QUIET") { - doing_command = false; - error_quiet = true; - } else if (args[i] == "OUTPUT_STRIP_TRAILING_WHITESPACE") { - doing_command = false; - output_strip_trailing_whitespace = true; - } else if (args[i] == "ERROR_STRIP_TRAILING_WHITESPACE") { - doing_command = false; - error_strip_trailing_whitespace = true; - } else if (args[i] == "ENCODING") { - doing_command = false; - if (++i < args.size()) { - encoding = cmProcessOutput::FindEncoding(args[i]); - } else { - this->SetError(" called with no value for ENCODING."); - return false; - } - } else if (doing_command) { - cmds[command_index].push_back(args[i].c_str()); - } else { - std::ostringstream e; - e << " given unknown argument \"" << args[i] << "\"."; - this->SetError(e.str()); - return false; - } + + struct Arguments + { + std::vector<std::vector<std::string>> Commands; + std::string OutputVariable; + std::string ErrorVariable; + std::string ResultVariable; + std::string ResultsVariable; + std::string WorkingDirectory; + std::string InputFile; + std::string OutputFile; + std::string ErrorFile; + std::string Timeout; + bool OutputQuiet = false; + bool ErrorQuiet = false; + bool OutputStripTrailingWhitespace = false; + bool ErrorStripTrailingWhitespace = false; + std::string Encoding; + }; + + static auto const parser = + cmArgumentParser<Arguments>{} + .Bind("COMMAND"_s, &Arguments::Commands) + .Bind("OUTPUT_VARIABLE"_s, &Arguments::OutputVariable) + .Bind("ERROR_VARIABLE"_s, &Arguments::ErrorVariable) + .Bind("RESULT_VARIABLE"_s, &Arguments::ResultVariable) + .Bind("RESULTS_VARIABLE"_s, &Arguments::ResultsVariable) + .Bind("WORKING_DIRECTORY"_s, &Arguments::WorkingDirectory) + .Bind("INPUT_FILE"_s, &Arguments::InputFile) + .Bind("OUTPUT_FILE"_s, &Arguments::OutputFile) + .Bind("ERROR_FILE"_s, &Arguments::ErrorFile) + .Bind("TIMEOUT"_s, &Arguments::Timeout) + .Bind("OUTPUT_QUIET"_s, &Arguments::OutputQuiet) + .Bind("ERROR_QUIET"_s, &Arguments::ErrorQuiet) + .Bind("OUTPUT_STRIP_TRAILING_WHITESPACE"_s, + &Arguments::OutputStripTrailingWhitespace) + .Bind("ERROR_STRIP_TRAILING_WHITESPACE"_s, + &Arguments::ErrorStripTrailingWhitespace) + .Bind("ENCODING"_s, &Arguments::Encoding); + + std::vector<std::string> unparsedArguments; + std::vector<std::string> keywordsMissingValue; + Arguments const arguments = + parser.Parse(args, &unparsedArguments, &keywordsMissingValue); + + if (!keywordsMissingValue.empty()) { + this->SetError(" called with no value for " + + keywordsMissingValue.front() + "."); + return false; + } + if (!unparsedArguments.empty()) { + this->SetError(" given unknown argument \"" + unparsedArguments.front() + + "\"."); + return false; } - if (!this->Makefile->CanIWriteThisFile(output_file)) { - std::string e = "attempted to output into a file: " + output_file + - " into a source directory."; - this->SetError(e); + if (!this->Makefile->CanIWriteThisFile(arguments.OutputFile)) { + this->SetError("attempted to output into a file: " + arguments.OutputFile + + " into a source directory."); cmSystemTools::SetFatalErrorOccured(); return false; } // Check for commands given. - if (cmds.empty()) { + if (arguments.Commands.empty()) { this->SetError(" called with no COMMAND argument."); return false; } - for (auto& cmd : cmds) { + for (std::vector<std::string> const& cmd : arguments.Commands) { if (cmd.empty()) { this->SetError(" given COMMAND argument with no value."); return false; } - // Add the null terminating pointer to the command argument list. - cmd.push_back(nullptr); } // Parse the timeout string. double timeout = -1; - if (!timeout_string.empty()) { - if (sscanf(timeout_string.c_str(), "%lg", &timeout) != 1) { + if (!arguments.Timeout.empty()) { + if (sscanf(arguments.Timeout.c_str(), "%lg", &timeout) != 1) { this->SetError(" called with TIMEOUT value that could not be parsed."); return false; } @@ -192,13 +122,17 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args, cmsysProcess* cp = cmsysProcess_New(); // Set the command sequence. - for (auto const& cmd : cmds) { - cmsysProcess_AddCommand(cp, cmd.data()); + for (std::vector<std::string> const& cmd : arguments.Commands) { + std::vector<const char*> argv(cmd.size() + 1); + std::transform(cmd.begin(), cmd.end(), argv.begin(), + [](std::string const& s) { return s.c_str(); }); + argv.back() = nullptr; + cmsysProcess_AddCommand(cp, argv.data()); } // Set the process working directory. - if (!working_directory.empty()) { - cmsysProcess_SetWorkingDirectory(cp, working_directory.c_str()); + if (!arguments.WorkingDirectory.empty()) { + cmsysProcess_SetWorkingDirectory(cp, arguments.WorkingDirectory.c_str()); } // Always hide the process window. @@ -206,22 +140,24 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args, // Check the output variables. bool merge_output = false; - if (!input_file.empty()) { - cmsysProcess_SetPipeFile(cp, cmsysProcess_Pipe_STDIN, input_file.c_str()); + if (!arguments.InputFile.empty()) { + cmsysProcess_SetPipeFile(cp, cmsysProcess_Pipe_STDIN, + arguments.InputFile.c_str()); } - if (!output_file.empty()) { + if (!arguments.OutputFile.empty()) { cmsysProcess_SetPipeFile(cp, cmsysProcess_Pipe_STDOUT, - output_file.c_str()); + arguments.OutputFile.c_str()); } - if (!error_file.empty()) { - if (error_file == output_file) { + if (!arguments.ErrorFile.empty()) { + if (arguments.ErrorFile == arguments.OutputFile) { merge_output = true; } else { cmsysProcess_SetPipeFile(cp, cmsysProcess_Pipe_STDERR, - error_file.c_str()); + arguments.ErrorFile.c_str()); } } - if (!output_variable.empty() && output_variable == error_variable) { + if (!arguments.OutputVariable.empty() && + arguments.OutputVariable == arguments.ErrorVariable) { merge_output = true; } if (merge_output) { @@ -242,19 +178,20 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args, int length; char* data; int p; - cmProcessOutput processOutput(encoding); + cmProcessOutput processOutput( + cmProcessOutput::FindEncoding(arguments.Encoding)); std::string strdata; while ((p = cmsysProcess_WaitForData(cp, &data, &length, nullptr))) { // Put the output in the right place. - if (p == cmsysProcess_Pipe_STDOUT && !output_quiet) { - if (output_variable.empty()) { + if (p == cmsysProcess_Pipe_STDOUT && !arguments.OutputQuiet) { + if (arguments.OutputVariable.empty()) { processOutput.DecodeText(data, length, strdata, 1); cmSystemTools::Stdout(strdata); } else { cmExecuteProcessCommandAppend(tempOutput, data, length); } - } else if (p == cmsysProcess_Pipe_STDERR && !error_quiet) { - if (error_variable.empty()) { + } else if (p == cmsysProcess_Pipe_STDERR && !arguments.ErrorQuiet) { + if (arguments.ErrorVariable.empty()) { processOutput.DecodeText(data, length, strdata, 2); cmSystemTools::Stderr(strdata); } else { @@ -262,13 +199,13 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args, } } } - if (!output_quiet && output_variable.empty()) { + if (!arguments.OutputQuiet && arguments.OutputVariable.empty()) { processOutput.DecodeText(std::string(), strdata, 1); if (!strdata.empty()) { cmSystemTools::Stdout(strdata); } } - if (!error_quiet && error_variable.empty()) { + if (!arguments.ErrorQuiet && arguments.ErrorVariable.empty()) { processOutput.DecodeText(std::string(), strdata, 2); if (!strdata.empty()) { cmSystemTools::Stderr(strdata); @@ -281,46 +218,49 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args, processOutput.DecodeText(tempError, tempError); // Fix the text in the output strings. - cmExecuteProcessCommandFixText(tempOutput, output_strip_trailing_whitespace); - cmExecuteProcessCommandFixText(tempError, error_strip_trailing_whitespace); + cmExecuteProcessCommandFixText(tempOutput, + arguments.OutputStripTrailingWhitespace); + cmExecuteProcessCommandFixText(tempError, + arguments.ErrorStripTrailingWhitespace); // Store the output obtained. - if (!output_variable.empty() && !tempOutput.empty()) { - this->Makefile->AddDefinition(output_variable, tempOutput.data()); + if (!arguments.OutputVariable.empty() && !tempOutput.empty()) { + this->Makefile->AddDefinition(arguments.OutputVariable, tempOutput.data()); } - if (!merge_output && !error_variable.empty() && !tempError.empty()) { - this->Makefile->AddDefinition(error_variable, tempError.data()); + if (!merge_output && !arguments.ErrorVariable.empty() && + !tempError.empty()) { + this->Makefile->AddDefinition(arguments.ErrorVariable, tempError.data()); } // Store the result of running the process. - if (!result_variable.empty()) { + if (!arguments.ResultVariable.empty()) { switch (cmsysProcess_GetState(cp)) { case cmsysProcess_State_Exited: { int v = cmsysProcess_GetExitValue(cp); char buf[16]; sprintf(buf, "%d", v); - this->Makefile->AddDefinition(result_variable, buf); + this->Makefile->AddDefinition(arguments.ResultVariable, buf); } break; case cmsysProcess_State_Exception: - this->Makefile->AddDefinition(result_variable, + this->Makefile->AddDefinition(arguments.ResultVariable, cmsysProcess_GetExceptionString(cp)); break; case cmsysProcess_State_Error: - this->Makefile->AddDefinition(result_variable, + this->Makefile->AddDefinition(arguments.ResultVariable, cmsysProcess_GetErrorString(cp)); break; case cmsysProcess_State_Expired: - this->Makefile->AddDefinition(result_variable, + this->Makefile->AddDefinition(arguments.ResultVariable, "Process terminated due to timeout"); break; } } // Store the result of running the processes. - if (!results_variable.empty()) { + if (!arguments.ResultsVariable.empty()) { switch (cmsysProcess_GetState(cp)) { case cmsysProcess_State_Exited: { std::vector<std::string> res; - for (size_t i = 0; i < cmds.size(); ++i) { + for (size_t i = 0; i < arguments.Commands.size(); ++i) { switch (cmsysProcess_GetStateByIndex(cp, static_cast<int>(i))) { case kwsysProcess_StateByIndex_Exited: { int exitCode = @@ -339,19 +279,19 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args, break; } } - this->Makefile->AddDefinition(results_variable, + this->Makefile->AddDefinition(arguments.ResultsVariable, cmJoin(res, ";").c_str()); } break; case cmsysProcess_State_Exception: - this->Makefile->AddDefinition(results_variable, + this->Makefile->AddDefinition(arguments.ResultsVariable, cmsysProcess_GetExceptionString(cp)); break; case cmsysProcess_State_Error: - this->Makefile->AddDefinition(results_variable, + this->Makefile->AddDefinition(arguments.ResultsVariable, cmsysProcess_GetErrorString(cp)); break; case cmsysProcess_State_Expired: - this->Makefile->AddDefinition(results_variable, + this->Makefile->AddDefinition(arguments.ResultsVariable, "Process terminated due to timeout"); break; } diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index c25e1f4..5b611c0 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -2,10 +2,13 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmExportCommand.h" +#include "cm_static_string_view.hxx" #include "cmsys/RegularExpression.hxx" #include <map> #include <sstream> +#include <utility> +#include "cmArgumentParser.h" #include "cmExportBuildAndroidMKGenerator.h" #include "cmExportBuildFileGenerator.h" #include "cmExportSetMap.h" @@ -18,6 +21,7 @@ #include "cmSystemTools.h" #include "cmTarget.h" +class cmExportSet; class cmExecutionStatus; #if defined(__HAIKU__) @@ -25,19 +29,6 @@ class cmExecutionStatus; # include <StorageDefs.h> #endif -cmExportCommand::cmExportCommand() - : Targets(&Helper, "TARGETS") - , Append(&Helper, "APPEND", &ArgumentGroup) - , ExportSetName(&Helper, "EXPORT", &ArgumentGroup) - , Namespace(&Helper, "NAMESPACE", &ArgumentGroup) - , Filename(&Helper, "FILE", &ArgumentGroup) - , ExportOld(&Helper, "EXPORT_LINK_INTERFACE_LIBRARIES", &ArgumentGroup) - , AndroidMKFile(&Helper, "ANDROID_MK") -{ - this->ExportSet = nullptr; -} - -// cmExportCommand bool cmExportCommand::InitialPass(std::vector<std::string> const& args, cmExecutionStatus&) { @@ -49,45 +40,62 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args, if (args[0] == "PACKAGE") { return this->HandlePackage(args); } + + struct Arguments + { + std::string ExportSetName; + std::vector<std::string> Targets; + std::string Namespace; + std::string Filename; + std::string AndroidMKFile; + bool Append = false; + bool ExportOld = false; + }; + + auto parser = cmArgumentParser<Arguments>{} + .Bind("NAMESPACE"_s, &Arguments::Namespace) + .Bind("FILE"_s, &Arguments::Filename); + if (args[0] == "EXPORT") { - this->ExportSetName.Follows(nullptr); - this->ArgumentGroup.Follows(&this->ExportSetName); + parser.Bind("EXPORT"_s, &Arguments::ExportSetName); } else { - this->Targets.Follows(nullptr); - this->ArgumentGroup.Follows(&this->Targets); + parser.Bind("TARGETS"_s, &Arguments::Targets); + parser.Bind("ANDROID_MK"_s, &Arguments::AndroidMKFile); + parser.Bind("APPEND"_s, &Arguments::Append); + parser.Bind("EXPORT_LINK_INTERFACE_LIBRARIES"_s, &Arguments::ExportOld); } std::vector<std::string> unknownArgs; - this->Helper.Parse(&args, &unknownArgs); + Arguments const arguments = parser.Parse(args, &unknownArgs); if (!unknownArgs.empty()) { - this->SetError("Unknown arguments."); + this->SetError("Unknown argument: \"" + unknownArgs.front() + "\"."); return false; } std::string fname; bool android = false; - if (this->AndroidMKFile.WasFound()) { - fname = this->AndroidMKFile.GetString(); + if (!arguments.AndroidMKFile.empty()) { + fname = arguments.AndroidMKFile; android = true; } - if (!this->Filename.WasFound() && fname.empty()) { + if (arguments.Filename.empty() && fname.empty()) { if (args[0] != "EXPORT") { this->SetError("FILE <filename> option missing."); return false; } - fname = this->ExportSetName.GetString() + ".cmake"; + fname = arguments.ExportSetName + ".cmake"; } else if (fname.empty()) { // Make sure the file has a .cmake extension. - if (cmSystemTools::GetFilenameLastExtension(this->Filename.GetCString()) != + if (cmSystemTools::GetFilenameLastExtension(arguments.Filename) != ".cmake") { std::ostringstream e; - e << "FILE option given filename \"" << this->Filename.GetString() + e << "FILE option given filename \"" << arguments.Filename << "\" which does not have an extension of \".cmake\".\n"; this->SetError(e.str()); return false; } - fname = this->Filename.GetString(); + fname = arguments.Filename; } // Get the file to write. @@ -109,33 +117,19 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args, cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); + cmExportSet* ExportSet = nullptr; if (args[0] == "EXPORT") { - if (this->Append.IsEnabled()) { - std::ostringstream e; - e << "EXPORT signature does not recognise the APPEND option."; - this->SetError(e.str()); - return false; - } - - if (this->ExportOld.IsEnabled()) { - std::ostringstream e; - e << "EXPORT signature does not recognise the " - "EXPORT_LINK_INTERFACE_LIBRARIES option."; - this->SetError(e.str()); - return false; - } - cmExportSetMap& setMap = gg->GetExportSets(); - std::string setName = this->ExportSetName.GetString(); - if (setMap.find(setName) == setMap.end()) { + auto const it = setMap.find(arguments.ExportSetName); + if (it == setMap.end()) { std::ostringstream e; - e << "Export set \"" << setName << "\" not found."; + e << "Export set \"" << arguments.ExportSetName << "\" not found."; this->SetError(e.str()); return false; } - this->ExportSet = setMap[setName]; - } else if (this->Targets.WasFound()) { - for (std::string const& currentTarget : this->Targets.GetVector()) { + ExportSet = it->second; + } else if (!arguments.Targets.empty()) { + for (std::string const& currentTarget : arguments.Targets) { if (this->Makefile->IsAlias(currentTarget)) { std::ostringstream e; e << "given ALIAS target \"" << currentTarget @@ -159,7 +153,7 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args, } targets.push_back(currentTarget); } - if (this->Append.IsEnabled()) { + if (arguments.Append) { if (cmExportBuildFileGenerator* ebfg = gg->GetExportedTargetsFile(fname)) { ebfg->AppendTargets(targets); @@ -179,15 +173,15 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args, ebfg = new cmExportBuildFileGenerator; } ebfg->SetExportFile(fname.c_str()); - ebfg->SetNamespace(this->Namespace.GetCString()); - ebfg->SetAppendMode(this->Append.IsEnabled()); - if (this->ExportSet) { - ebfg->SetExportSet(this->ExportSet); + ebfg->SetNamespace(arguments.Namespace); + ebfg->SetAppendMode(arguments.Append); + if (ExportSet != nullptr) { + ebfg->SetExportSet(ExportSet); } else { ebfg->SetTargets(targets); } this->Makefile->AddExportBuildFileGenerator(ebfg); - ebfg->SetExportOld(this->ExportOld.IsEnabled()); + ebfg->SetExportOld(arguments.ExportOld); // Compute the set of configurations exported. std::vector<std::string> configurationTypes; @@ -198,7 +192,7 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args, for (std::string const& ct : configurationTypes) { ebfg->AddConfiguration(ct); } - if (this->ExportSet) { + if (ExportSet != nullptr) { gg->AddBuildExportExportSet(ebfg); } else { gg->AddBuildExportSet(ebfg); diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h index a5c6751..99f9932 100644 --- a/Source/cmExportCommand.h +++ b/Source/cmExportCommand.h @@ -9,21 +9,12 @@ #include <vector> #include "cmCommand.h" -#include "cmCommandArgumentsHelper.h" class cmExecutionStatus; -class cmExportSet; -/** \class cmExportLibraryDependenciesCommand - * \brief Add a test to the lists of tests to run. - * - * cmExportLibraryDependenciesCommand adds a test to the list of tests to run - * - */ class cmExportCommand : public cmCommand { public: - cmExportCommand(); /** * This is a virtual constructor for the command. */ @@ -37,21 +28,6 @@ public: cmExecutionStatus& status) override; private: - cmCommandArgumentsHelper Helper; - cmCommandArgumentGroup ArgumentGroup; - cmCAStringVector Targets; - cmCAEnabler Append; - cmCAString ExportSetName; - cmCAString Namespace; - cmCAString Filename; - cmCAEnabler ExportOld; - cmCAString AndroidMKFile; - - cmExportSet* ExportSet; - - friend class cmExportBuildFileGenerator; - std::string ErrorMessage; - bool HandlePackage(std::vector<std::string> const& args); void StorePackageRegistryWin(std::string const& package, const char* content, const char* hash); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index d2bc851..f5ec9fe 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3,6 +3,7 @@ #include "cmFileCommand.h" #include "cm_kwiml.h" +#include "cm_static_string_view.hxx" #include "cmsys/FStream.hxx" #include "cmsys/Glob.hxx" #include "cmsys/RegularExpression.hxx" @@ -19,7 +20,7 @@ #include <vector> #include "cmAlgorithms.h" -#include "cmCommandArgumentsHelper.h" +#include "cmArgumentParser.h" #include "cmCryptoHash.h" #include "cmFileCopier.h" #include "cmFileInstaller.h" @@ -268,36 +269,34 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args) return false; } - cmCommandArgumentsHelper argHelper; - cmCommandArgumentGroup group; + std::string const& fileNameArg = args[1]; + std::string const& variable = args[2]; - cmCAString readArg(&argHelper, "READ"); - cmCAString fileNameArg(&argHelper, nullptr); - cmCAString resultArg(&argHelper, nullptr); + struct Arguments + { + std::string Offset; + std::string Limit; + bool Hex = false; + }; + + static auto const parser = cmArgumentParser<Arguments>{} + .Bind("OFFSET"_s, &Arguments::Offset) + .Bind("LIMIT"_s, &Arguments::Limit) + .Bind("HEX"_s, &Arguments::Hex); - cmCAString offsetArg(&argHelper, "OFFSET", &group); - cmCAString limitArg(&argHelper, "LIMIT", &group); - cmCAEnabler hexOutputArg(&argHelper, "HEX", &group); - readArg.Follows(nullptr); - fileNameArg.Follows(&readArg); - resultArg.Follows(&fileNameArg); - group.Follows(&resultArg); - argHelper.Parse(&args, nullptr); + Arguments const arguments = parser.Parse(cmMakeRange(args).advance(3)); - std::string fileName = fileNameArg.GetString(); + std::string fileName = fileNameArg; if (!cmsys::SystemTools::FileIsFullPath(fileName)) { fileName = this->Makefile->GetCurrentSourceDirectory(); - fileName += "/" + fileNameArg.GetString(); + fileName += "/" + fileNameArg; } - std::string variable = resultArg.GetString(); - // Open the specified file. #if defined(_WIN32) || defined(__CYGWIN__) - cmsys::ifstream file( - fileName.c_str(), - std::ios::in | - (hexOutputArg.IsEnabled() ? std::ios::binary : std::ios::in)); + cmsys::ifstream file(fileName.c_str(), + arguments.Hex ? (std::ios::binary | std::ios::in) + : std::ios::in); #else cmsys::ifstream file(fileName.c_str()); #endif @@ -313,21 +312,21 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args) // is there a limit? long sizeLimit = -1; - if (!limitArg.GetString().empty()) { - sizeLimit = atoi(limitArg.GetCString()); + if (!arguments.Limit.empty()) { + sizeLimit = atoi(arguments.Limit.c_str()); } // is there an offset? long offset = 0; - if (!offsetArg.GetString().empty()) { - offset = atoi(offsetArg.GetCString()); + if (!arguments.Offset.empty()) { + offset = atoi(arguments.Offset.c_str()); } file.seekg(offset, std::ios::beg); // explicit ios::beg for IBM VisualAge 6 std::string output; - if (hexOutputArg.IsEnabled()) { + if (arguments.Hex) { // Convert part of the file into hex code char c; while ((sizeLimit != 0) && (file.get(c))) { @@ -1272,55 +1271,54 @@ bool cmFileCommand::HandleReadElfCommand(std::vector<std::string> const& args) return false; } - cmCommandArgumentsHelper argHelper; - cmCommandArgumentGroup group; - - cmCAString readArg(&argHelper, "READ_ELF"); - cmCAString fileNameArg(&argHelper, nullptr); + std::string const& fileNameArg = args[1]; - cmCAString rpathArg(&argHelper, "RPATH", &group); - cmCAString runpathArg(&argHelper, "RUNPATH", &group); - cmCAString errorArg(&argHelper, "CAPTURE_ERROR", &group); + struct Arguments + { + std::string RPath; + std::string RunPath; + std::string Error; + }; - readArg.Follows(nullptr); - fileNameArg.Follows(&readArg); - group.Follows(&fileNameArg); - argHelper.Parse(&args, nullptr); + static auto const parser = cmArgumentParser<Arguments>{} + .Bind("RPATH"_s, &Arguments::RPath) + .Bind("RUNPATH"_s, &Arguments::RunPath) + .Bind("CAPTURE_ERROR"_s, &Arguments::Error); + Arguments const arguments = parser.Parse(cmMakeRange(args).advance(2)); - if (!cmSystemTools::FileExists(fileNameArg.GetString(), true)) { + if (!cmSystemTools::FileExists(fileNameArg, true)) { std::ostringstream e; - e << "READ_ELF given FILE \"" << fileNameArg.GetString() - << "\" that does not exist."; + e << "READ_ELF given FILE \"" << fileNameArg << "\" that does not exist."; this->SetError(e.str()); return false; } #if defined(CMAKE_USE_ELF_PARSER) - cmELF elf(fileNameArg.GetCString()); + cmELF elf(fileNameArg.c_str()); - if (!rpathArg.GetString().empty()) { + if (!arguments.RPath.empty()) { if (cmELF::StringEntry const* se_rpath = elf.GetRPath()) { std::string rpath(se_rpath->Value); std::replace(rpath.begin(), rpath.end(), ':', ';'); - this->Makefile->AddDefinition(rpathArg.GetString(), rpath.c_str()); + this->Makefile->AddDefinition(arguments.RPath, rpath.c_str()); } } - if (!runpathArg.GetString().empty()) { + if (!arguments.RunPath.empty()) { if (cmELF::StringEntry const* se_runpath = elf.GetRunPath()) { std::string runpath(se_runpath->Value); std::replace(runpath.begin(), runpath.end(), ':', ';'); - this->Makefile->AddDefinition(runpathArg.GetString(), runpath.c_str()); + this->Makefile->AddDefinition(arguments.RunPath, runpath.c_str()); } } return true; #else std::string error = "ELF parser not available on this platform."; - if (errorArg.GetString().empty()) { + if (arguments.Error.empty()) { this->SetError(error); return false; } - this->Makefile->AddDefinition(errorArg.GetString(), error.c_str()); + this->Makefile->AddDefinition(arguments.Error, error.c_str()); return true; #endif } @@ -2597,44 +2595,39 @@ bool cmFileCommand::HandleCreateLinkCommand( return false; } - cmCommandArgumentsHelper argHelper; - cmCommandArgumentGroup group; - - cmCAString linkArg(&argHelper, "CREATE_LINK"); - cmCAString fileArg(&argHelper, nullptr); - cmCAString newFileArg(&argHelper, nullptr); + std::string const& fileName = args[1]; + std::string const& newFileName = args[2]; - cmCAString resultArg(&argHelper, "RESULT", &group); - cmCAEnabler copyOnErrorArg(&argHelper, "COPY_ON_ERROR", &group); - cmCAEnabler symbolicArg(&argHelper, "SYMBOLIC", &group); + struct Arguments + { + std::string Result; + bool CopyOnError = false; + bool Symbolic = false; + }; - linkArg.Follows(nullptr); - fileArg.Follows(&linkArg); - newFileArg.Follows(&fileArg); - group.Follows(&newFileArg); + static auto const parser = + cmArgumentParser<Arguments>{} + .Bind("RESULT"_s, &Arguments::Result) + .Bind("COPY_ON_ERROR"_s, &Arguments::CopyOnError) + .Bind("SYMBOLIC"_s, &Arguments::Symbolic); std::vector<std::string> unconsumedArgs; - argHelper.Parse(&args, &unconsumedArgs); + Arguments const arguments = + parser.Parse(cmMakeRange(args).advance(3), &unconsumedArgs); if (!unconsumedArgs.empty()) { this->SetError("unknown argument: \"" + unconsumedArgs.front() + '\"'); return false; } - std::string fileName = fileArg.GetString(); - std::string newFileName = newFileArg.GetString(); - - // Output variable for storing the result. - const std::string& resultVar = resultArg.GetString(); - // The system error message generated in the operation. std::string result; // Check if the paths are distinct. if (fileName == newFileName) { result = "CREATE_LINK cannot use same file and newfile"; - if (!resultVar.empty()) { - this->Makefile->AddDefinition(resultVar, result.c_str()); + if (!arguments.Result.empty()) { + this->Makefile->AddDefinition(arguments.Result, result.c_str()); return true; } this->SetError(result); @@ -2642,10 +2635,10 @@ bool cmFileCommand::HandleCreateLinkCommand( } // Hard link requires original file to exist. - if (!symbolicArg.IsEnabled() && !cmSystemTools::FileExists(fileName)) { + if (!arguments.Symbolic && !cmSystemTools::FileExists(fileName)) { result = "Cannot hard link \'" + fileName + "\' as it does not exist."; - if (!resultVar.empty()) { - this->Makefile->AddDefinition(resultVar, result.c_str()); + if (!arguments.Result.empty()) { + this->Makefile->AddDefinition(arguments.Result, result.c_str()); return true; } this->SetError(result); @@ -2661,8 +2654,8 @@ bool cmFileCommand::HandleCreateLinkCommand( << "' because existing path cannot be removed: " << cmSystemTools::GetLastSystemError() << "\n"; - if (!resultVar.empty()) { - this->Makefile->AddDefinition(resultVar, e.str().c_str()); + if (!arguments.Result.empty()) { + this->Makefile->AddDefinition(arguments.Result, e.str().c_str()); return true; } this->SetError(e.str()); @@ -2673,14 +2666,14 @@ bool cmFileCommand::HandleCreateLinkCommand( bool completed = false; // Check if the command requires a symbolic link. - if (symbolicArg.IsEnabled()) { + if (arguments.Symbolic) { completed = cmSystemTools::CreateSymlink(fileName, newFileName, &result); } else { completed = cmSystemTools::CreateLink(fileName, newFileName, &result); } // Check if copy-on-error is enabled in the arguments. - if (!completed && copyOnErrorArg.IsEnabled()) { + if (!completed && arguments.CopyOnError) { completed = cmsys::SystemTools::CopyFileAlways(fileName, newFileName); if (!completed) { result = "Copy failed: " + cmSystemTools::GetLastSystemError(); @@ -2690,14 +2683,14 @@ bool cmFileCommand::HandleCreateLinkCommand( // Check if the operation was successful. if (completed) { result = "0"; - } else if (resultVar.empty()) { + } else if (arguments.Result.empty()) { // The operation failed and the result is not reported in a variable. this->SetError(result); return false; } - if (!resultVar.empty()) { - this->Makefile->AddDefinition(resultVar, result.c_str()); + if (!arguments.Result.empty()) { + this->Makefile->AddDefinition(arguments.Result, result.c_str()); } return true; diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index cef36fc..d8e1c42 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -28,6 +28,7 @@ #include <algorithm> #include <assert.h> #include <errno.h> +#include <iterator> #include <map> #include <memory> // IWYU pragma: keep #include <set> @@ -327,6 +328,51 @@ static const struct InListNode : public cmGeneratorExpressionNode } } inListNode; +static const struct FilterNode : public cmGeneratorExpressionNode +{ + FilterNode() {} // NOLINT(modernize-use-equals-default) + + int NumExpectedParameters() const override { return 3; } + + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override + { + if (parameters.size() != 3) { + reportError(context, content->GetOriginalExpression(), + "$<FILTER:...> expression requires three parameters"); + return {}; + } + + if (parameters[1] != "INCLUDE" && parameters[1] != "EXCLUDE") { + reportError( + context, content->GetOriginalExpression(), + "$<FILTER:...> second parameter must be either INCLUDE or EXCLUDE"); + return {}; + } + + const bool exclude = parameters[1] == "EXCLUDE"; + + cmsys::RegularExpression re; + if (!re.compile(parameters[2])) { + reportError(context, content->GetOriginalExpression(), + "$<FILTER:...> failed to compile regex"); + return {}; + } + + std::vector<std::string> values, result; + cmSystemTools::ExpandListArgument(parameters.front(), values, true); + + std::copy_if(values.cbegin(), values.cend(), std::back_inserter(result), + [&re, exclude](std::string const& input) { + return exclude ^ re.find(input); + }); + return cmJoin(cmMakeRange(result.cbegin(), result.cend()), ";"); + } +} filterNode; + static const struct RemoveDuplicatesNode : public cmGeneratorExpressionNode { RemoveDuplicatesNode() {} // NOLINT(modernize-use-equals-default) @@ -2331,6 +2377,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( { "STREQUAL", &strEqualNode }, { "EQUAL", &equalNode }, { "IN_LIST", &inListNode }, + { "FILTER", &filterNode }, { "REMOVE_DUPLICATES", &removeDuplicatesNode }, { "LOWER_CASE", &lowerCaseNode }, { "UPPER_CASE", &upperCaseNode }, diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 2fc6121..db673bb 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1146,6 +1146,13 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( // Add CMakeLists.txt file for user convenience. this->AddXCodeProjBuildRule(gtgt, classes); + // Add the Info.plist we are about to generate for an App Bundle. + if (gtgt->GetPropertyAsBool("MACOSX_BUNDLE")) { + std::string plist = this->ComputeInfoPListLocation(gtgt); + cmSourceFile* sf = gtgt->Makefile->GetOrCreateSource(plist, true); + classes.push_back(sf); + } + std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare()); gtgt->ComputeObjectMapping(); @@ -2862,13 +2869,13 @@ bool cmGlobalXCodeGenerator::CreateGroups( continue; } - // add the soon to be generated Info.plist file as a source for a - // MACOSX_BUNDLE file - if (gtgt->GetPropertyAsBool("MACOSX_BUNDLE")) { - std::string plist = this->ComputeInfoPListLocation(gtgt); - mf->GetOrCreateSource(plist, true); - gtgt->AddSource(plist); - } + auto addSourceToGroup = [this, mf, gtgt, + &sourceGroups](std::string const& source) { + cmSourceGroup* sourceGroup = mf->FindSourceGroup(source, sourceGroups); + cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(gtgt, sourceGroup); + std::string key = GetGroupMapKeyFromPath(gtgt, source); + this->GroupMap[key] = pbxgroup; + }; // Put cmSourceFile instances in proper groups: for (auto const& si : gtgt->GetAllConfigSources()) { @@ -2877,12 +2884,7 @@ bool cmGlobalXCodeGenerator::CreateGroups( // Object library files go on the link line instead. continue; } - // Add the file to the list of sources. - std::string const& source = sf->GetFullPath(); - cmSourceGroup* sourceGroup = mf->FindSourceGroup(source, sourceGroups); - cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(gtgt, sourceGroup); - std::string key = GetGroupMapKeyFromPath(gtgt, source); - this->GroupMap[key] = pbxgroup; + addSourceToGroup(sf->GetFullPath()); } // Add CMakeLists.txt file for user convenience. @@ -2891,11 +2893,14 @@ bool cmGlobalXCodeGenerator::CreateGroups( gtgt->GetLocalGenerator()->GetCurrentSourceDirectory(); listfile += "/CMakeLists.txt"; cmSourceFile* sf = gtgt->Makefile->GetOrCreateSource(listfile); - std::string const& source = sf->GetFullPath(); - cmSourceGroup* sourceGroup = mf->FindSourceGroup(source, sourceGroups); - cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(gtgt, sourceGroup); - std::string key = GetGroupMapKeyFromPath(gtgt, source); - this->GroupMap[key] = pbxgroup; + addSourceToGroup(sf->GetFullPath()); + } + + // Add the Info.plist we are about to generate for an App Bundle. + if (gtgt->GetPropertyAsBool("MACOSX_BUNDLE")) { + std::string plist = this->ComputeInfoPListLocation(gtgt); + cmSourceFile* sf = gtgt->Makefile->GetOrCreateSource(plist, true); + addSourceToGroup(sf->GetFullPath()); } } } diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 65875dc..dba4bbb 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmInstallCommand.h" +#include "cm_static_string_view.hxx" #include "cmsys/Glob.hxx" #include <set> #include <sstream> @@ -9,7 +10,7 @@ #include <utility> #include "cmAlgorithms.h" -#include "cmCommandArgumentsHelper.h" +#include "cmArgumentParser.h" #include "cmExportSet.h" #include "cmExportSetMap.h" #include "cmGeneratorExpression.h" @@ -219,49 +220,51 @@ bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args) return true; } -/*struct InstallPart -{ - InstallPart(cmCommandArgumentsHelper* helper, const char* key, - cmCommandArgumentGroup* group); - cmCAStringVector argVector; - cmInstallCommandArguments args; -};*/ - bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) { // This is the TARGETS mode. std::vector<cmTarget*> targets; - cmCommandArgumentsHelper argHelper; - cmCommandArgumentGroup group; - cmCAStringVector genericArgVector(&argHelper, nullptr); - cmCAStringVector archiveArgVector(&argHelper, "ARCHIVE", &group); - cmCAStringVector libraryArgVector(&argHelper, "LIBRARY", &group); - cmCAStringVector runtimeArgVector(&argHelper, "RUNTIME", &group); - cmCAStringVector objectArgVector(&argHelper, "OBJECTS", &group); - cmCAStringVector frameworkArgVector(&argHelper, "FRAMEWORK", &group); - cmCAStringVector bundleArgVector(&argHelper, "BUNDLE", &group); - cmCAStringVector includesArgVector(&argHelper, "INCLUDES", &group); - cmCAStringVector privateHeaderArgVector(&argHelper, "PRIVATE_HEADER", - &group); - cmCAStringVector publicHeaderArgVector(&argHelper, "PUBLIC_HEADER", &group); - cmCAStringVector resourceArgVector(&argHelper, "RESOURCE", &group); - genericArgVector.Follows(nullptr); - group.Follows(&genericArgVector); - - argHelper.Parse(&args, nullptr); + struct ArgVectors + { + std::vector<std::string> Archive; + std::vector<std::string> Library; + std::vector<std::string> Runtime; + std::vector<std::string> Object; + std::vector<std::string> Framework; + std::vector<std::string> Bundle; + std::vector<std::string> Includes; + std::vector<std::string> PrivateHeader; + std::vector<std::string> PublicHeader; + std::vector<std::string> Resource; + }; + + static auto const argHelper = + cmArgumentParser<ArgVectors>{} + .Bind("ARCHIVE"_s, &ArgVectors::Archive) + .Bind("LIBRARY"_s, &ArgVectors::Library) + .Bind("RUNTIME"_s, &ArgVectors::Runtime) + .Bind("OBJECTS"_s, &ArgVectors::Object) + .Bind("FRAMEWORK"_s, &ArgVectors::Framework) + .Bind("BUNDLE"_s, &ArgVectors::Bundle) + .Bind("INCLUDES"_s, &ArgVectors::Includes) + .Bind("PRIVATE_HEADER"_s, &ArgVectors::PrivateHeader) + .Bind("PUBLIC_HEADER"_s, &ArgVectors::PublicHeader) + .Bind("RESOURCE"_s, &ArgVectors::Resource); + + std::vector<std::string> genericArgVector; + ArgVectors const argVectors = argHelper.Parse(args, &genericArgVector); // now parse the generic args (i.e. the ones not specialized on LIBRARY/ // ARCHIVE, RUNTIME etc. (see above) // These generic args also contain the targets and the export stuff + std::vector<std::string> targetList; + std::string exports; std::vector<std::string> unknownArgs; cmInstallCommandArguments genericArgs(this->DefaultComponentName); - cmCAStringVector targetList(&genericArgs.Parser, "TARGETS"); - cmCAString exports(&genericArgs.Parser, "EXPORT", - &genericArgs.ArgumentGroup); - targetList.Follows(nullptr); - genericArgs.ArgumentGroup.Follows(&targetList); - genericArgs.Parse(&genericArgVector.GetVector(), &unknownArgs); + genericArgs.Bind("TARGETS"_s, targetList); + genericArgs.Bind("EXPORT"_s, exports); + genericArgs.Parse(genericArgVector, &unknownArgs); bool success = genericArgs.Finalize(); cmInstallCommandArguments archiveArgs(this->DefaultComponentName); @@ -277,16 +280,16 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) // now parse the args for specific parts of the target (e.g. LIBRARY, // RUNTIME, ARCHIVE etc. - archiveArgs.Parse(&archiveArgVector.GetVector(), &unknownArgs); - libraryArgs.Parse(&libraryArgVector.GetVector(), &unknownArgs); - runtimeArgs.Parse(&runtimeArgVector.GetVector(), &unknownArgs); - objectArgs.Parse(&objectArgVector.GetVector(), &unknownArgs); - frameworkArgs.Parse(&frameworkArgVector.GetVector(), &unknownArgs); - bundleArgs.Parse(&bundleArgVector.GetVector(), &unknownArgs); - privateHeaderArgs.Parse(&privateHeaderArgVector.GetVector(), &unknownArgs); - publicHeaderArgs.Parse(&publicHeaderArgVector.GetVector(), &unknownArgs); - resourceArgs.Parse(&resourceArgVector.GetVector(), &unknownArgs); - includesArgs.Parse(&includesArgVector.GetVector(), &unknownArgs); + archiveArgs.Parse(argVectors.Archive, &unknownArgs); + libraryArgs.Parse(argVectors.Library, &unknownArgs); + runtimeArgs.Parse(argVectors.Runtime, &unknownArgs); + objectArgs.Parse(argVectors.Object, &unknownArgs); + frameworkArgs.Parse(argVectors.Framework, &unknownArgs); + bundleArgs.Parse(argVectors.Bundle, &unknownArgs); + privateHeaderArgs.Parse(argVectors.PrivateHeader, &unknownArgs); + publicHeaderArgs.Parse(argVectors.PublicHeader, &unknownArgs); + resourceArgs.Parse(argVectors.Resource, &unknownArgs); + includesArgs.Parse(&argVectors.Includes, &unknownArgs); if (!unknownArgs.empty()) { // Unknown argument. @@ -382,7 +385,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) } // Check if there is something to do. - if (targetList.GetVector().empty()) { + if (targetList.empty()) { return true; } @@ -390,7 +393,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) bool dll_platform = !this->Makefile->GetSafeDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX").empty(); - for (std::string const& tgt : targetList.GetVector()) { + for (std::string const& tgt : targetList) { if (this->Makefile->IsAlias(tgt)) { std::ostringstream e; @@ -747,7 +750,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) // Add this install rule to an export if one was specified and // this is not a namelink-only rule. - if (!exports.GetString().empty() && !namelinkOnly) { + if (!exports.empty() && !namelinkOnly) { cmTargetExport* te = new cmTargetExport; te->TargetName = target.GetName(); te->ArchiveGenerator = archiveGenerator; @@ -758,7 +761,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) te->RuntimeGenerator = runtimeGenerator; te->ObjectsGenerator = objectGenerator; this->Makefile->GetGlobalGenerator() - ->GetExportSets()[exports.GetString()] + ->GetExportSets()[exports] ->AddTargetExport(te); te->InterfaceIncludeDirectories = @@ -817,11 +820,10 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args) // This is the FILES mode. bool programs = (args[0] == "PROGRAMS"); cmInstallCommandArguments ica(this->DefaultComponentName); - cmCAStringVector files(&ica.Parser, programs ? "PROGRAMS" : "FILES"); - files.Follows(nullptr); - ica.ArgumentGroup.Follows(&files); + std::vector<std::string> files; + ica.Bind(programs ? "PROGRAMS"_s : "FILES"_s, files); std::vector<std::string> unknownArgs; - ica.Parse(&args, &unknownArgs); + ica.Parse(args, &unknownArgs); if (!unknownArgs.empty()) { // Unknown argument. @@ -839,7 +841,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args) return false; } - const std::vector<std::string>& filesVector = files.GetVector(); + const std::vector<std::string>& filesVector = files; // Check if there is something to do. if (filesVector.empty()) { @@ -1270,16 +1272,19 @@ bool cmInstallCommand::HandleExportAndroidMKMode( #ifdef CMAKE_BUILD_WITH_CMAKE // This is the EXPORT mode. cmInstallCommandArguments ica(this->DefaultComponentName); - cmCAString exp(&ica.Parser, "EXPORT_ANDROID_MK"); - cmCAString name_space(&ica.Parser, "NAMESPACE", &ica.ArgumentGroup); - cmCAEnabler exportOld(&ica.Parser, "EXPORT_LINK_INTERFACE_LIBRARIES", - &ica.ArgumentGroup); - cmCAString filename(&ica.Parser, "FILE", &ica.ArgumentGroup); - exp.Follows(nullptr); - - ica.ArgumentGroup.Follows(&exp); + + std::string exp; + std::string name_space; + bool exportOld = false; + std::string filename; + + ica.Bind("EXPORT_ANDROID_MK"_s, exp); + ica.Bind("NAMESPACE"_s, name_space); + ica.Bind("EXPORT_LINK_INTERFACE_LIBRARIES"_s, exportOld); + ica.Bind("FILE"_s, filename); + std::vector<std::string> unknownArgs; - ica.Parse(&args, &unknownArgs); + ica.Parse(args, &unknownArgs); if (!unknownArgs.empty()) { // Unknown argument. @@ -1303,7 +1308,7 @@ bool cmInstallCommand::HandleExportAndroidMKMode( } // Check the file name. - std::string fname = filename.GetString(); + std::string fname = filename; if (fname.find_first_of(":/\\") != std::string::npos) { std::ostringstream e; e << args[0] << " given invalid export file name \"" << fname << "\". " @@ -1324,7 +1329,7 @@ bool cmInstallCommand::HandleExportAndroidMKMode( } if (fname.find_first_of(":/\\") != std::string::npos) { std::ostringstream e; - e << args[0] << " given export name \"" << exp.GetString() << "\". " + e << args[0] << " given export name \"" << exp << "\". " << "This name cannot be safely converted to a file name. " << "Specify a different export name or use the FILE option to set " << "a file name explicitly."; @@ -1337,7 +1342,7 @@ bool cmInstallCommand::HandleExportAndroidMKMode( } cmExportSet* exportSet = - this->Makefile->GetGlobalGenerator()->GetExportSets()[exp.GetString()]; + this->Makefile->GetGlobalGenerator()->GetExportSets()[exp]; cmInstallGenerator::MessageLevel message = cmInstallGenerator::SelectMessageLevel(this->Makefile); @@ -1346,8 +1351,8 @@ bool cmInstallCommand::HandleExportAndroidMKMode( cmInstallExportGenerator* exportGenerator = new cmInstallExportGenerator( exportSet, ica.GetDestination().c_str(), ica.GetPermissions().c_str(), ica.GetConfigurations(), ica.GetComponent().c_str(), message, - ica.GetExcludeFromAll(), fname.c_str(), name_space.GetCString(), - exportOld.IsEnabled(), true); + ica.GetExcludeFromAll(), fname.c_str(), name_space.c_str(), exportOld, + true); this->Makefile->AddInstallGenerator(exportGenerator); return true; @@ -1362,16 +1367,19 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) { // This is the EXPORT mode. cmInstallCommandArguments ica(this->DefaultComponentName); - cmCAString exp(&ica.Parser, "EXPORT"); - cmCAString name_space(&ica.Parser, "NAMESPACE", &ica.ArgumentGroup); - cmCAEnabler exportOld(&ica.Parser, "EXPORT_LINK_INTERFACE_LIBRARIES", - &ica.ArgumentGroup); - cmCAString filename(&ica.Parser, "FILE", &ica.ArgumentGroup); - exp.Follows(nullptr); - - ica.ArgumentGroup.Follows(&exp); + + std::string exp; + std::string name_space; + bool exportOld = false; + std::string filename; + + ica.Bind("EXPORT"_s, exp); + ica.Bind("NAMESPACE"_s, name_space); + ica.Bind("EXPORT_LINK_INTERFACE_LIBRARIES"_s, exportOld); + ica.Bind("FILE"_s, filename); + std::vector<std::string> unknownArgs; - ica.Parse(&args, &unknownArgs); + ica.Parse(args, &unknownArgs); if (!unknownArgs.empty()) { // Unknown argument. @@ -1395,7 +1403,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) } // Check the file name. - std::string fname = filename.GetString(); + std::string fname = filename; if (fname.find_first_of(":/\\") != std::string::npos) { std::ostringstream e; e << args[0] << " given invalid export file name \"" << fname << "\". " @@ -1417,12 +1425,12 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) // Construct the file name. if (fname.empty()) { - fname = exp.GetString(); + fname = exp; fname += ".cmake"; if (fname.find_first_of(":/\\") != std::string::npos) { std::ostringstream e; - e << args[0] << " given export name \"" << exp.GetString() << "\". " + e << args[0] << " given export name \"" << exp << "\". " << "This name cannot be safely converted to a file name. " << "Specify a different export name or use the FILE option to set " << "a file name explicitly."; @@ -1432,8 +1440,8 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) } cmExportSet* exportSet = - this->Makefile->GetGlobalGenerator()->GetExportSets()[exp.GetString()]; - if (exportOld.IsEnabled()) { + this->Makefile->GetGlobalGenerator()->GetExportSets()[exp]; + if (exportOld) { for (cmTargetExport* te : *exportSet->GetTargetExports()) { cmTarget* tgt = this->Makefile->GetGlobalGenerator()->FindTarget(te->TargetName); @@ -1460,8 +1468,8 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) cmInstallExportGenerator* exportGenerator = new cmInstallExportGenerator( exportSet, ica.GetDestination().c_str(), ica.GetPermissions().c_str(), ica.GetConfigurations(), ica.GetComponent().c_str(), message, - ica.GetExcludeFromAll(), fname.c_str(), name_space.GetCString(), - exportOld.IsEnabled(), false); + ica.GetExcludeFromAll(), fname.c_str(), name_space.c_str(), exportOld, + false); this->Makefile->AddInstallGenerator(exportGenerator); return true; diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx index c64bd8a..8b33782 100644 --- a/Source/cmInstallCommandArguments.cxx +++ b/Source/cmInstallCommandArguments.cxx @@ -4,6 +4,7 @@ #include "cmRange.h" #include "cmSystemTools.h" +#include "cm_static_string_view.hxx" #include <utility> @@ -18,20 +19,19 @@ const std::string cmInstallCommandArguments::EmptyString; cmInstallCommandArguments::cmInstallCommandArguments( std::string defaultComponent) - : Destination(&Parser, "DESTINATION", &ArgumentGroup) - , Component(&Parser, "COMPONENT", &ArgumentGroup) - , NamelinkComponent(&Parser, "NAMELINK_COMPONENT", &ArgumentGroup) - , ExcludeFromAll(&Parser, "EXCLUDE_FROM_ALL", &ArgumentGroup) - , Rename(&Parser, "RENAME", &ArgumentGroup) - , Permissions(&Parser, "PERMISSIONS", &ArgumentGroup) - , Configurations(&Parser, "CONFIGURATIONS", &ArgumentGroup) - , Optional(&Parser, "OPTIONAL", &ArgumentGroup) - , NamelinkOnly(&Parser, "NAMELINK_ONLY", &ArgumentGroup) - , NamelinkSkip(&Parser, "NAMELINK_SKIP", &ArgumentGroup) - , Type(&Parser, "TYPE", &ArgumentGroup) - , GenericArguments(nullptr) - , DefaultComponentName(std::move(defaultComponent)) + : DefaultComponentName(std::move(defaultComponent)) { + this->Bind("DESTINATION"_s, this->Destination); + this->Bind("COMPONENT"_s, this->Component); + this->Bind("NAMELINK_COMPONENT"_s, this->NamelinkComponent); + this->Bind("EXCLUDE_FROM_ALL"_s, this->ExcludeFromAll); + this->Bind("RENAME"_s, this->Rename); + this->Bind("PERMISSIONS"_s, this->Permissions); + this->Bind("CONFIGURATIONS"_s, this->Configurations); + this->Bind("OPTIONAL"_s, this->Optional); + this->Bind("NAMELINK_ONLY"_s, this->NamelinkOnly); + this->Bind("NAMELINK_SKIP"_s, this->NamelinkSkip); + this->Bind("TYPE"_s, this->Type); } const std::string& cmInstallCommandArguments::GetDestination() const @@ -47,8 +47,8 @@ const std::string& cmInstallCommandArguments::GetDestination() const const std::string& cmInstallCommandArguments::GetComponent() const { - if (!this->Component.GetString().empty()) { - return this->Component.GetString(); + if (!this->Component.empty()) { + return this->Component; } if (this->GenericArguments != nullptr) { return this->GenericArguments->GetComponent(); @@ -62,16 +62,16 @@ const std::string& cmInstallCommandArguments::GetComponent() const const std::string& cmInstallCommandArguments::GetNamelinkComponent() const { - if (!this->NamelinkComponent.GetString().empty()) { - return this->NamelinkComponent.GetString(); + if (!this->NamelinkComponent.empty()) { + return this->NamelinkComponent; } return this->GetComponent(); } const std::string& cmInstallCommandArguments::GetRename() const { - if (!this->Rename.GetString().empty()) { - return this->Rename.GetString(); + if (!this->Rename.empty()) { + return this->Rename; } if (this->GenericArguments != nullptr) { return this->GenericArguments->GetRename(); @@ -92,7 +92,7 @@ const std::string& cmInstallCommandArguments::GetPermissions() const bool cmInstallCommandArguments::GetOptional() const { - if (this->Optional.IsEnabled()) { + if (this->Optional) { return true; } if (this->GenericArguments != nullptr) { @@ -103,7 +103,7 @@ bool cmInstallCommandArguments::GetOptional() const bool cmInstallCommandArguments::GetExcludeFromAll() const { - if (this->ExcludeFromAll.IsEnabled()) { + if (this->ExcludeFromAll) { return true; } if (this->GenericArguments != nullptr) { @@ -114,7 +114,7 @@ bool cmInstallCommandArguments::GetExcludeFromAll() const bool cmInstallCommandArguments::GetNamelinkOnly() const { - if (this->NamelinkOnly.IsEnabled()) { + if (this->NamelinkOnly) { return true; } if (this->GenericArguments != nullptr) { @@ -125,7 +125,7 @@ bool cmInstallCommandArguments::GetNamelinkOnly() const bool cmInstallCommandArguments::GetNamelinkSkip() const { - if (this->NamelinkSkip.IsEnabled()) { + if (this->NamelinkSkip) { return true; } if (this->GenericArguments != nullptr) { @@ -136,7 +136,7 @@ bool cmInstallCommandArguments::GetNamelinkSkip() const bool cmInstallCommandArguments::HasNamelinkComponent() const { - if (!this->NamelinkComponent.GetString().empty()) { + if (!this->NamelinkComponent.empty()) { return true; } if (this->GenericArguments != nullptr) { @@ -147,19 +147,19 @@ bool cmInstallCommandArguments::HasNamelinkComponent() const const std::string& cmInstallCommandArguments::GetType() const { - return this->Type.GetString(); + return this->Type; } const std::vector<std::string>& cmInstallCommandArguments::GetConfigurations() const { - if (!this->Configurations.GetVector().empty()) { - return this->Configurations.GetVector(); + if (!this->Configurations.empty()) { + return this->Configurations; } if (this->GenericArguments != nullptr) { return this->GenericArguments->GetConfigurations(); } - return this->Configurations.GetVector(); + return this->Configurations; } bool cmInstallCommandArguments::Finalize() @@ -167,21 +167,15 @@ bool cmInstallCommandArguments::Finalize() if (!this->CheckPermissions()) { return false; } - this->DestinationString = this->Destination.GetString(); + this->DestinationString = this->Destination; cmSystemTools::ConvertToUnixSlashes(this->DestinationString); return true; } -void cmInstallCommandArguments::Parse(const std::vector<std::string>* args, - std::vector<std::string>* unconsumedArgs) -{ - this->Parser.Parse(args, unconsumedArgs); -} - bool cmInstallCommandArguments::CheckPermissions() { this->PermissionsString.clear(); - for (std::string const& perm : this->Permissions.GetVector()) { + for (std::string const& perm : this->Permissions) { if (!cmInstallCommandArguments::CheckPermissions( perm, this->PermissionsString)) { return false; diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h index 9c0d417..5d2ee0a 100644 --- a/Source/cmInstallCommandArguments.h +++ b/Source/cmInstallCommandArguments.h @@ -8,9 +8,9 @@ #include <string> #include <vector> -#include "cmCommandArgumentsHelper.h" +#include "cmArgumentParser.h" -class cmInstallCommandArguments +class cmInstallCommandArguments : public cmArgumentParser<void> { public: cmInstallCommandArguments(std::string defaultComponent); @@ -18,8 +18,6 @@ public: { this->GenericArguments = args; } - void Parse(const std::vector<std::string>* args, - std::vector<std::string>* unconsumedArgs); // Compute destination path.and check permissions bool Finalize(); @@ -37,30 +35,25 @@ public: bool HasNamelinkComponent() const; const std::string& GetType() const; - // once HandleDirectoryMode() is also switched to using - // cmInstallCommandArguments then these two functions can become non-static - // private member functions without arguments static bool CheckPermissions(const std::string& onePerm, std::string& perm); - cmCommandArgumentsHelper Parser; - cmCommandArgumentGroup ArgumentGroup; private: - cmCAString Destination; - cmCAString Component; - cmCAString NamelinkComponent; - cmCAEnabler ExcludeFromAll; - cmCAString Rename; - cmCAStringVector Permissions; - cmCAStringVector Configurations; - cmCAEnabler Optional; - cmCAEnabler NamelinkOnly; - cmCAEnabler NamelinkSkip; - cmCAString Type; + std::string Destination; + std::string Component; + std::string NamelinkComponent; + bool ExcludeFromAll = false; + std::string Rename; + std::vector<std::string> Permissions; + std::vector<std::string> Configurations; + bool Optional = false; + bool NamelinkOnly = false; + bool NamelinkSkip = false; + std::string Type; std::string DestinationString; std::string PermissionsString; - cmInstallCommandArguments* GenericArguments; + cmInstallCommandArguments* GenericArguments = nullptr; static const char* PermissionsTable[]; static const std::string EmptyString; std::string DefaultComponentName; diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx index ab8d103..5213432 100644 --- a/Source/cmParseArgumentsCommand.cxx +++ b/Source/cmParseArgumentsCommand.cxx @@ -8,10 +8,12 @@ #include <utility> #include "cmAlgorithms.h" +#include "cmArgumentParser.h" #include "cmMakefile.h" #include "cmMessageType.h" #include "cmRange.h" #include "cmSystemTools.h" +#include "cm_string_view.hxx" class cmExecutionStatus; @@ -28,42 +30,43 @@ static std::string EscapeArg(const std::string& arg) return escapedArg; } -namespace { -enum insideValues +static std::string JoinList(std::vector<std::string> const& arg, bool escape) { - NONE, - SINGLE, - MULTI -}; + return escape ? cmJoin(cmMakeRange(arg).transform(EscapeArg), ";") + : cmJoin(cmMakeRange(arg), ";"); +} + +namespace { typedef std::map<std::string, bool> options_map; typedef std::map<std::string, std::string> single_map; typedef std::map<std::string, std::vector<std::string>> multi_map; typedef std::set<std::string> options_set; -} -// function to be called every time, a new key word was parsed or all -// parameters where parsed. -static void DetectKeywordsMissingValues(insideValues currentState, - const std::string& currentArgName, - int& argumentsFound, - options_set& keywordsMissingValues) +struct UserArgumentParser : public cmArgumentParser<void> { - if (currentState == SINGLE || - (currentState == MULTI && argumentsFound == 0)) { - keywordsMissingValues.insert(currentArgName); + template <typename T, typename H> + void Bind(std::vector<std::string> const& names, + std::map<std::string, T>& ref, H duplicateKey) + { + for (std::string const& key : names) { + auto const it = ref.emplace(key, T{}).first; + bool const inserted = this->cmArgumentParser<void>::Bind( + cm::string_view(it->first), it->second); + if (!inserted) { + duplicateKey(key); + } + } } +}; - argumentsFound = 0; -} +} // namespace -static void PassParsedArguments(const std::string& prefix, - cmMakefile& makefile, - const options_map& options, - const single_map& singleValArgs, - const multi_map& multiValArgs, - const std::vector<std::string>& unparsed, - const options_set& keywordsMissingValues) +static void PassParsedArguments( + const std::string& prefix, cmMakefile& makefile, const options_map& options, + const single_map& singleValArgs, const multi_map& multiValArgs, + const std::vector<std::string>& unparsed, + const options_set& keywordsMissingValues, bool parseFromArgV) { for (auto const& iter : options) { makefile.AddDefinition(prefix + iter.first, @@ -81,7 +84,7 @@ static void PassParsedArguments(const std::string& prefix, for (auto const& iter : multiValArgs) { if (!iter.second.empty()) { makefile.AddDefinition(prefix + iter.first, - cmJoin(cmMakeRange(iter.second), ";").c_str()); + JoinList(iter.second, parseFromArgV).c_str()); } else { makefile.RemoveDefinition(prefix + iter.first); } @@ -89,7 +92,7 @@ static void PassParsedArguments(const std::string& prefix, if (!unparsed.empty()) { makefile.AddDefinition(prefix + "UNPARSED_ARGUMENTS", - cmJoin(cmMakeRange(unparsed), ";").c_str()); + JoinList(unparsed, parseFromArgV).c_str()); } else { makefile.RemoveDefinition(prefix + "UNPARSED_ARGUMENTS"); } @@ -141,6 +144,8 @@ bool cmParseArgumentsCommand::InitialPass(std::vector<std::string> const& args, // the first argument is the prefix const std::string prefix = (*argIter++) + "_"; + UserArgumentParser parser; + // define the result maps holding key/value pairs for // options, single values and multi values options_map options; @@ -150,45 +155,25 @@ bool cmParseArgumentsCommand::InitialPass(std::vector<std::string> const& args, // anything else is put into a vector of unparsed strings std::vector<std::string> unparsed; - // remember already defined keywords - std::set<std::string> used_keywords; - const std::string dup_warning = "keyword defined more than once: "; + auto const duplicateKey = [this](std::string const& key) { + this->GetMakefile()->IssueMessage( + MessageType::WARNING, "keyword defined more than once: " + key); + }; // the second argument is a (cmake) list of options without argument std::vector<std::string> list; cmSystemTools::ExpandListArgument(*argIter++, list); - for (std::string const& iter : list) { - if (!used_keywords.insert(iter).second) { - this->GetMakefile()->IssueMessage(MessageType::WARNING, - dup_warning + iter); - } - options[iter]; // default initialize - } + parser.Bind(list, options, duplicateKey); // the third argument is a (cmake) list of single argument options list.clear(); cmSystemTools::ExpandListArgument(*argIter++, list); - for (std::string const& iter : list) { - if (!used_keywords.insert(iter).second) { - this->GetMakefile()->IssueMessage(MessageType::WARNING, - dup_warning + iter); - } - singleValArgs[iter]; // default initialize - } + parser.Bind(list, singleValArgs, duplicateKey); // the fourth argument is a (cmake) list of multi argument options list.clear(); cmSystemTools::ExpandListArgument(*argIter++, list); - for (std::string const& iter : list) { - if (!used_keywords.insert(iter).second) { - this->GetMakefile()->IssueMessage(MessageType::WARNING, - dup_warning + iter); - } - multiValArgs[iter]; // default initialize - } - - insideValues insideValues = NONE; - std::string currentArgName; + parser.Bind(list, multiValArgs, duplicateKey); list.clear(); if (!parseFromArgV) { @@ -223,68 +208,14 @@ bool cmParseArgumentsCommand::InitialPass(std::vector<std::string> const& args, } } - options_set keywordsMissingValues; - int multiArgumentsFound = 0; - - // iterate over the arguments list and fill in the values where applicable - for (std::string const& arg : list) { - const options_map::iterator optIter = options.find(arg); - if (optIter != options.end()) { - DetectKeywordsMissingValues(insideValues, currentArgName, - multiArgumentsFound, keywordsMissingValues); - insideValues = NONE; - optIter->second = true; - continue; - } - - const single_map::iterator singleIter = singleValArgs.find(arg); - if (singleIter != singleValArgs.end()) { - DetectKeywordsMissingValues(insideValues, currentArgName, - multiArgumentsFound, keywordsMissingValues); - insideValues = SINGLE; - currentArgName = arg; - continue; - } - - const multi_map::iterator multiIter = multiValArgs.find(arg); - if (multiIter != multiValArgs.end()) { - DetectKeywordsMissingValues(insideValues, currentArgName, - multiArgumentsFound, keywordsMissingValues); - insideValues = MULTI; - currentArgName = arg; - continue; - } - - switch (insideValues) { - case SINGLE: - singleValArgs[currentArgName] = arg; - insideValues = NONE; - break; - case MULTI: - ++multiArgumentsFound; - if (parseFromArgV) { - multiValArgs[currentArgName].push_back(EscapeArg(arg)); - } else { - multiValArgs[currentArgName].push_back(arg); - } - break; - default: - multiArgumentsFound = 0; - - if (parseFromArgV) { - unparsed.push_back(EscapeArg(arg)); - } else { - unparsed.push_back(arg); - } - break; - } - } + std::vector<std::string> keywordsMissingValues; - DetectKeywordsMissingValues(insideValues, currentArgName, - multiArgumentsFound, keywordsMissingValues); + parser.Parse(list, &unparsed, &keywordsMissingValues); - PassParsedArguments(prefix, *this->Makefile, options, singleValArgs, - multiValArgs, unparsed, keywordsMissingValues); + PassParsedArguments( + prefix, *this->Makefile, options, singleValArgs, multiValArgs, unparsed, + options_set(keywordsMissingValues.begin(), keywordsMissingValues.end()), + parseFromArgV); return true; } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index d201061..212608d 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -3023,6 +3023,12 @@ bool cmSystemTools::StringToULong(const char* str, unsigned long* value) { errno = 0; char* endp; + while (isspace(*str)) { + ++str; + } + if (*str == '-') { + return false; + } *value = strtoul(str, &endp, 10); return (*endp == '\0') && (endp != str) && (errno == 0); } diff --git a/Tests/BundleTest/BundleSubDir/CMakeLists.txt b/Tests/BundleTest/BundleSubDir/CMakeLists.txt index 43c366a..2f7f2c4 100644 --- a/Tests/BundleTest/BundleSubDir/CMakeLists.txt +++ b/Tests/BundleTest/BundleSubDir/CMakeLists.txt @@ -1,3 +1,5 @@ +project(BundleSubDir) + add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist" COMMAND /bin/cp @@ -34,3 +36,8 @@ install(TARGETS SecondBundle DESTINATION Applications) # bundle does not respect the name. Also the executable will not be found by # the test driver if this does not work. set_target_properties(SecondBundle PROPERTIES OUTPUT_NAME SecondBundleExe) + +# Express one app bundle in terms of another's SOURCES to verify that +# the generators do not expose the Info.plist of one to the other. +add_executable(SubdirBundle1 MACOSX_BUNDLE EXCLUDE_FROM_ALL ../BundleTest.cxx) +add_executable(SubdirBundle2 MACOSX_BUNDLE EXCLUDE_FROM_ALL $<TARGET_PROPERTY:SubdirBundle1,SOURCES>) diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index 91f7e25..031ab01 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -5,6 +5,7 @@ include_directories( ) set(CMakeLib_TESTS + testArgumentParser.cxx testGeneratedFileStream.cxx testRST.cxx testRange.cxx diff --git a/Tests/CMakeLib/testArgumentParser.cxx b/Tests/CMakeLib/testArgumentParser.cxx new file mode 100644 index 0000000..788fece --- /dev/null +++ b/Tests/CMakeLib/testArgumentParser.cxx @@ -0,0 +1,148 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +#include "cmArgumentParser.h" + +#include "cm_static_string_view.hxx" +#include "cm_string_view.hxx" + +#include <initializer_list> +#include <iostream> +#include <string> +#include <vector> + +namespace { + +struct Result +{ + bool Option1 = false; + bool Option2 = false; + + std::string String1; + std::string String2; + + std::vector<std::string> List1; + std::vector<std::string> List2; + std::vector<std::string> List3; + + std::vector<std::vector<std::string>> Multi1; + std::vector<std::vector<std::string>> Multi2; + std::vector<std::vector<std::string>> Multi3; +}; + +std::initializer_list<cm::string_view> const args = { + /* clang-format off */ + "OPTION_1", // option + "STRING_1", // string arg missing value + "STRING_2", "foo", "bar", // string arg + unparsed value + "LIST_1", // list arg missing values + "LIST_2", "foo", "bar", // list arg with 2 elems + "LIST_3", "bar", // list arg ... + "LIST_3", "foo", // ... with continuation + "MULTI_2", // multi list with 0 lists + "MULTI_3", "foo", "bar", // multi list with first list with two elems + "MULTI_3", "bar", "foo", // multi list with second list with two elems + /* clang-format on */ +}; + +bool verifyResult(Result const& result, + std::vector<std::string> const& unparsedArguments, + std::vector<std::string> const& keywordsMissingValue) +{ + static std::vector<std::string> const foobar = { "foo", "bar" }; + static std::vector<std::string> const barfoo = { "bar", "foo" }; + static std::vector<std::string> const missing = { "STRING_1", "LIST_1" }; + +#define ASSERT_TRUE(x) \ + do { \ + if (!(x)) { \ + std::cout << "ASSERT_TRUE(" #x ") failed on line " << __LINE__ << "\n"; \ + return false; \ + } \ + } while (false) + + ASSERT_TRUE(result.Option1); + ASSERT_TRUE(!result.Option2); + + ASSERT_TRUE(result.String1.empty()); + ASSERT_TRUE(result.String2 == "foo"); + + ASSERT_TRUE(result.List1.empty()); + ASSERT_TRUE(result.List2 == foobar); + ASSERT_TRUE(result.List3 == barfoo); + + ASSERT_TRUE(result.Multi1.empty()); + ASSERT_TRUE(result.Multi2.size() == 1); + ASSERT_TRUE(result.Multi2[0].empty()); + ASSERT_TRUE(result.Multi3.size() == 2); + ASSERT_TRUE(result.Multi3[0] == foobar); + ASSERT_TRUE(result.Multi3[1] == barfoo); + + ASSERT_TRUE(unparsedArguments.size() == 1); + ASSERT_TRUE(unparsedArguments[0] == "bar"); + ASSERT_TRUE(keywordsMissingValue == missing); + + return true; +} + +bool testArgumentParserDynamic() +{ + Result result; + std::vector<std::string> unparsedArguments; + std::vector<std::string> keywordsMissingValue; + + cmArgumentParser<void>{} + .Bind("OPTION_1"_s, result.Option1) + .Bind("OPTION_2"_s, result.Option2) + .Bind("STRING_1"_s, result.String1) + .Bind("STRING_2"_s, result.String2) + .Bind("LIST_1"_s, result.List1) + .Bind("LIST_2"_s, result.List2) + .Bind("LIST_3"_s, result.List3) + .Bind("MULTI_1"_s, result.Multi1) + .Bind("MULTI_2"_s, result.Multi2) + .Bind("MULTI_3"_s, result.Multi3) + .Parse(args, &unparsedArguments, &keywordsMissingValue); + + return verifyResult(result, unparsedArguments, keywordsMissingValue); +} + +bool testArgumentParserStatic() +{ + static auto const parser = // + cmArgumentParser<Result>{} + .Bind("OPTION_1"_s, &Result::Option1) + .Bind("OPTION_2"_s, &Result::Option2) + .Bind("STRING_1"_s, &Result::String1) + .Bind("STRING_2"_s, &Result::String2) + .Bind("LIST_1"_s, &Result::List1) + .Bind("LIST_2"_s, &Result::List2) + .Bind("LIST_3"_s, &Result::List3) + .Bind("MULTI_1"_s, &Result::Multi1) + .Bind("MULTI_2"_s, &Result::Multi2) + .Bind("MULTI_3"_s, &Result::Multi3); + + std::vector<std::string> unparsedArguments; + std::vector<std::string> keywordsMissingValue; + Result const result = + parser.Parse(args, &unparsedArguments, &keywordsMissingValue); + + return verifyResult(result, unparsedArguments, keywordsMissingValue); +} + +} // namespace + +int testArgumentParser(int /*unused*/, char* /*unused*/ []) +{ + if (!testArgumentParserDynamic()) { + std::cout << "While executing testArgumentParserDynamic().\n"; + return -1; + } + + if (!testArgumentParserStatic()) { + std::cout << "While executing testArgumentParserStatic().\n"; + return -1; + } + + return 0; +} diff --git a/Tests/CMakeLib/testSystemTools.cxx b/Tests/CMakeLib/testSystemTools.cxx index 96a4819..121e639 100644 --- a/Tests/CMakeLib/testSystemTools.cxx +++ b/Tests/CMakeLib/testSystemTools.cxx @@ -93,5 +93,22 @@ int testSystemTools(int /*unused*/, char* /*unused*/ []) if (!failed) { cmPassed("cmSystemTools::strverscmp working"); } + + // ---------------------------------------------------------------------- + // Test cmSystemTools::StringToULong + { + unsigned long value; + cmAssert(cmSystemTools::StringToULong("1", &value) && value == 1, + "StringToULong parses a decimal integer."); + cmAssert(cmSystemTools::StringToULong(" 1", &value) && value == 1, + "StringToULong parses a decimal integer after whitespace."); + cmAssert(!cmSystemTools::StringToULong("-1", &value), + "StringToULong rejects a negative number."); + cmAssert(!cmSystemTools::StringToULong(" -1", &value), + "StringToULong rejects a negative number after whitespace."); + cmAssert(!cmSystemTools::StringToULong("1x", &value), + "StringToULong rejects trailing content."); + } + return failed; } diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index 6ccdcc3..2dd8917 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -15,17 +15,21 @@ macro(run_test feature lang) endif() endmacro() -get_property(c_features GLOBAL PROPERTY CMAKE_C_KNOWN_FEATURES) -list(FILTER c_features EXCLUDE REGEX "^c_std_[0-9][0-9]") -foreach(feature ${c_features}) - run_test(${feature} C) -endforeach() +if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Cray|PGI|XL|XLClang)$") + get_property(c_features GLOBAL PROPERTY CMAKE_C_KNOWN_FEATURES) + list(FILTER c_features EXCLUDE REGEX "^c_std_[0-9][0-9]") + foreach(feature ${c_features}) + run_test(${feature} C) + endforeach() +endif() -get_property(cxx_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES) -list(FILTER cxx_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]") -foreach(feature ${cxx_features}) - run_test(${feature} CXX) -endforeach() +if(NOT CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|XL|XLClang)$") + get_property(cxx_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES) + list(FILTER cxx_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]") + foreach(feature ${cxx_features}) + run_test(${feature} CXX) + endforeach() +endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1) diff --git a/Tests/CompileFeatures/genex_test.cpp b/Tests/CompileFeatures/genex_test.cpp index 4539789..53dce62 100644 --- a/Tests/CompileFeatures/genex_test.cpp +++ b/Tests/CompileFeatures/genex_test.cpp @@ -31,17 +31,6 @@ # if !EXPECT_OVERRIDE_CONTROL # error "Expect no override control feature" # endif - -struct A -{ - virtual int getA() { return 7; } -}; - -struct B final : A -{ - int getA() override { return 42; } -}; - #endif #if !HAVE_AUTO_TYPE diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt index b584e16..cffef5a 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt +++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt @@ -52,8 +52,10 @@ endmacro() # detailed features tables, not just meta-features if (CMAKE_C_COMPILE_FEATURES) - set(C_expected_features ${CMAKE_C_COMPILE_FEATURES}) - list(FILTER C_expected_features EXCLUDE REGEX "^c_std_[0-9][0-9]") + if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Cray|PGI|XL|XLClang)$") + set(C_expected_features ${CMAKE_C_COMPILE_FEATURES}) + list(FILTER C_expected_features EXCLUDE REGEX "^c_std_[0-9][0-9]") + endif() endif() if (C_expected_features) string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" COMPILER_VERSION_MAJOR "${CMAKE_C_COMPILER_VERSION}") @@ -93,8 +95,10 @@ if (C_expected_features) endif() if (CMAKE_CXX_COMPILE_FEATURES) - set(CXX_expected_features ${CMAKE_CXX_COMPILE_FEATURES}) - list(FILTER CXX_expected_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]") + if(NOT CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|XL|XLClang)$") + set(CXX_expected_features ${CMAKE_CXX_COMPILE_FEATURES}) + list(FILTER CXX_expected_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]") + endif() endif() if (NOT CXX_expected_features) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp" diff --git a/Tests/QtAutogen/GlobalAutogenTarget/CMakeLists.txt b/Tests/QtAutogen/GlobalAutogenTarget/CMakeLists.txt index cff7022..81fd8db 100644 --- a/Tests/QtAutogen/GlobalAutogenTarget/CMakeLists.txt +++ b/Tests/QtAutogen/GlobalAutogenTarget/CMakeLists.txt @@ -69,6 +69,9 @@ file(MAKE_DIRECTORY ${GAT_BDIR}) message("___ Configuring GAT project ___") execute_process( COMMAND "${CMAKE_COMMAND}" "${GAT_SDIR}" + -G "${CMAKE_GENERATOR}" + -A "${CMAKE_GENERATOR_PLATFORM}" + -T "${CMAKE_GENERATOR_TOOLSET}" "-DQT_TEST_VERSION=${QT_TEST_VERSION}" "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}" "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index afa8df7..68411d6 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -192,6 +192,9 @@ add_RunCMake_test(GoogleTest) # Note: does not actually depend on Google Test add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) add_RunCMake_test(LinkStatic) +if(CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|XL|XLClang)$") + add_RunCMake_test(MetaCompileFeatures) +endif() add_RunCMake_test(ObjectLibrary) add_RunCMake_test(ParseImplicitIncludeInfo) if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF") diff --git a/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt b/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt index 0ca5a0a..fc62914 100644 --- a/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt +++ b/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt @@ -1,4 +1,5 @@ -cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.14) +project(ExplicitDirs NONE) add_custom_command( OUTPUT output.txt COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 3deabd0..ea749ea 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -82,23 +82,27 @@ project(ExplicitDirsMissing LANGUAGES NONE) set(source_dir ${RunCMake_SOURCE_DIR}/ExplicitDirs) set(binary_dir ${RunCMake_BINARY_DIR}/ExplicitDirs-build) + set(RunCMake_TEST_SOURCE_DIR "${source_dir}") + set(RunCMake_TEST_BINARY_DIR "${binary_dir}") + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_NO_SOURCE_DIR 1) + file(REMOVE_RECURSE "${binary_dir}") - file(MAKE_DIRECTORY "${binary_dir}") - run_cmake_command(S-arg ${CMAKE_COMMAND} -S ${source_dir} ${binary_dir}) - run_cmake_command(S-arg-reverse-order ${CMAKE_COMMAND} ${binary_dir} -S${source_dir} ) - run_cmake_command(S-no-arg ${CMAKE_COMMAND} -S ) - run_cmake_command(S-no-arg2 ${CMAKE_COMMAND} -S -T) - run_cmake_command(S-B ${CMAKE_COMMAND} -S ${source_dir} -B ${binary_dir}) + run_cmake_with_options(S-arg -S ${source_dir} ${binary_dir}) + run_cmake_with_options(S-arg-reverse-order ${binary_dir} -S${source_dir} ) + run_cmake_with_options(S-no-arg -S ) + run_cmake_with_options(S-no-arg2 -S -T) + run_cmake_with_options(S-B -S ${source_dir} -B ${binary_dir}) # make sure that -B can explicitly construct build directories file(REMOVE_RECURSE "${binary_dir}") - run_cmake_command(B-arg ${CMAKE_COMMAND} -B ${binary_dir} ${source_dir}) + run_cmake_with_options(B-arg -B ${binary_dir} ${source_dir}) file(REMOVE_RECURSE "${binary_dir}") - run_cmake_command(B-arg-reverse-order ${CMAKE_COMMAND} ${source_dir} -B${binary_dir}) - run_cmake_command(B-no-arg ${CMAKE_COMMAND} -B ) - run_cmake_command(B-no-arg2 ${CMAKE_COMMAND} -B -T) + run_cmake_with_options(B-arg-reverse-order ${source_dir} -B${binary_dir}) + run_cmake_with_options(B-no-arg -B ) + run_cmake_with_options(B-no-arg2 -B -T) file(REMOVE_RECURSE "${binary_dir}") - run_cmake_command(B-S ${CMAKE_COMMAND} -B${binary_dir} -S${source_dir}) + run_cmake_with_options(B-S -B${binary_dir} -S${source_dir}) endfunction() run_ExplicitDirs() diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-Exclude-check.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-Exclude-check.cmake new file mode 100644 index 0000000..605ae4d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-Exclude-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/FILTER-generated.txt" content) + +set(expected "DO_NOT_FILTER_THIS;thisisanitem") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-Exclude.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-Exclude.cmake new file mode 100644 index 0000000..b879be2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-Exclude.cmake @@ -0,0 +1,4 @@ +cmake_policy(VERSION 3.11) + +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +file(GENERATE OUTPUT "FILTER-generated.txt" CONTENT "$<FILTER:${mylist},EXCLUDE,^FILTER_THIS_.+>") diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-Include-check.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-Include-check.cmake new file mode 100644 index 0000000..9d48d98 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-Include-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/FILTER-generated.txt" content) + +set(expected "FILTER_THIS_BIT;FILTER_THIS_THING") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-Include.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-Include.cmake new file mode 100644 index 0000000..5e0260a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-Include.cmake @@ -0,0 +1,4 @@ +cmake_policy(VERSION 3.11) + +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +file(GENERATE OUTPUT "FILTER-generated.txt" CONTENT "$<FILTER:${mylist},INCLUDE,^FILTER_THIS_.+>") diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-result.txt b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-stderr.txt b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-stderr.txt new file mode 100644 index 0000000..dd10925 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at FILTER-InvalidOperator.cmake:3 \(file\): + Error evaluating generator expression: + + \$<FILTER:,RM,> + + \$<FILTER:...> second parameter must be either INCLUDE or EXCLUDE +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator.cmake new file mode 100644 index 0000000..26f3917 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-InvalidOperator.cmake @@ -0,0 +1,3 @@ +cmake_policy(VERSION 3.11) + +file(GENERATE OUTPUT "FILTER-generated.txt" CONTENT "$<FILTER:,RM,>") diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-empty-check.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-empty-check.cmake new file mode 100644 index 0000000..2844484 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-empty-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/FILTER-generated.txt" content) + +set(expected "") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/FILTER-empty.cmake b/Tests/RunCMake/GeneratorExpression/FILTER-empty.cmake new file mode 100644 index 0000000..e0fc671 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/FILTER-empty.cmake @@ -0,0 +1,3 @@ +cmake_policy(VERSION 3.11) + +file(GENERATE OUTPUT "FILTER-generated.txt" CONTENT "$<FILTER:,INCLUDE,>") diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 68bffa7..4202064 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -62,6 +62,10 @@ run_cmake(REMOVE_DUPLICATES-1) run_cmake(REMOVE_DUPLICATES-2) run_cmake(REMOVE_DUPLICATES-3) run_cmake(REMOVE_DUPLICATES-4) +run_cmake(FILTER-empty) +run_cmake(FILTER-InvalidOperator) +run_cmake(FILTER-Exclude) +run_cmake(FILTER-Include) run_cmake(ImportedTarget-TARGET_BUNDLE_DIR) run_cmake(ImportedTarget-TARGET_BUNDLE_CONTENT_DIR) diff --git a/Tests/RunCMake/MetaCompileFeatures/C.cmake b/Tests/RunCMake/MetaCompileFeatures/C.cmake new file mode 100644 index 0000000..3bb6181 --- /dev/null +++ b/Tests/RunCMake/MetaCompileFeatures/C.cmake @@ -0,0 +1,27 @@ + +enable_language(C) + +function(check_language_feature_flags lang level) + if(CMAKE_${lang}${level}_STANDARD_COMPILE_OPTION) + #this property is an internal implementation detail of CMake + get_property(known_features GLOBAL PROPERTY CMAKE_${lang}${level}_KNOWN_FEATURES) + list(LENGTH known_features len) + if(len LESS 1) + message(FATAL_ERROR "unable to find known features of ${lang}${level}") + endif() + + string(TOLOWER ${lang} lang_lower) + set(known_name ${lang_lower}${level}_known_features) + set(meta_name ${lang_lower}${level}_meta_feature) + + add_library(${known_name} STATIC a.c) + target_compile_features(${known_name} PUBLIC ${known_features}) + add_library(${meta_name} STATIC a.c) + target_compile_features(${meta_name} PUBLIC ${lang_lower}_std_${level}) + endif() +endfunction() + + +check_language_feature_flags(C 90) +check_language_feature_flags(C 99) +check_language_feature_flags(C 11) diff --git a/Tests/RunCMake/MetaCompileFeatures/CMakeLists.txt b/Tests/RunCMake/MetaCompileFeatures/CMakeLists.txt new file mode 100644 index 0000000..3e470a2 --- /dev/null +++ b/Tests/RunCMake/MetaCompileFeatures/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.14) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/MetaCompileFeatures/CXX.cmake b/Tests/RunCMake/MetaCompileFeatures/CXX.cmake new file mode 100644 index 0000000..ef3b9d4 --- /dev/null +++ b/Tests/RunCMake/MetaCompileFeatures/CXX.cmake @@ -0,0 +1,27 @@ + +enable_language(CXX) + +function(check_language_feature_flags lang level) + if(CMAKE_${lang}${level}_STANDARD_COMPILE_OPTION) + #this property is an internal implementation detail of CMake + get_property(known_features GLOBAL PROPERTY CMAKE_${lang}${level}_KNOWN_FEATURES) + list(LENGTH known_features len) + if(len LESS 1) + message(FATAL_ERROR "unable to find known features of ${lang}${level}") + endif() + + string(TOLOWER ${lang} lang_lower) + set(known_name ${lang_lower}${level}_known_features) + set(meta_name ${lang_lower}${level}_meta_feature) + + add_library(${known_name} STATIC a.cxx) + target_compile_features(${known_name} PUBLIC ${known_features}) + add_library(${meta_name} STATIC a.cxx) + target_compile_features(${meta_name} PUBLIC ${lang_lower}_std_${level}) + endif() +endfunction() + + +check_language_feature_flags(CXX 98) +check_language_feature_flags(CXX 11) +check_language_feature_flags(CXX 14) diff --git a/Tests/RunCMake/MetaCompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/MetaCompileFeatures/RunCMakeTest.cmake new file mode 100644 index 0000000..009cde4 --- /dev/null +++ b/Tests/RunCMake/MetaCompileFeatures/RunCMakeTest.cmake @@ -0,0 +1,4 @@ +include(RunCMake) + +run_cmake(C) +run_cmake(CXX) diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.output b/Tests/RunCMake/MetaCompileFeatures/a.c index e69de29..e69de29 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.output +++ b/Tests/RunCMake/MetaCompileFeatures/a.c diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.output b/Tests/RunCMake/MetaCompileFeatures/a.cxx index e69de29..e69de29 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.output +++ b/Tests/RunCMake/MetaCompileFeatures/a.cxx diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake index 9e2e50d..b495d98 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake @@ -18,8 +18,9 @@ set(targets darwin-C-AppleClang-8.0.0.8000042 darwin-CXX-AppleClang-8.0.0.8000042 darwin_nostdinc-C-AppleClang-8.0.0.8000042 darwin_nostdinc-CXX-AppleClang-8.0.0.8000042 - empty-C empty-CXX freebsd-C-Clang-3.3.0 freebsd-CXX-Clang-3.3.0 freebsd-Fortran-GNU-4.6.4 + hand-C-empty hand-CXX-empty + hand-C-relative hand-CXX-relative linux-C-GNU-7.3.0 linux-CXX-GNU-7.3.0 linux-Fortran-GNU-7.3.0 linux-C-Intel-18.0.0.20170811 linux-CXX-Intel-18.0.0.20170811 linux-C-PGI-18.10.1 linux-CXX-PGI-18.10.1 @@ -105,12 +106,12 @@ foreach(t ${targets}) file(READ ${outfile} output) string(STRIP "${output}" output) cmake_parse_implicit_include_info("${input}" "${lang}" idirs log state) - if(t MATCHES "^empty-") # empty isn't supposed to parse + if(t MATCHES "-empty$") # empty isn't supposed to parse if("${state}" STREQUAL "done") message("empty parse failed: ${idirs}, log=${log}") endif() - elseif(NOT "${state}" STREQUAL "done" OR NOT "${output}" STREQUAL "${idirs}") - message("parse failed: state=${state}, ${output} != ${idirs}, log=${log}") + elseif(NOT "${state}" STREQUAL "done" OR NOT "${idirs}" MATCHES "^${output}$") + message("parse failed: state=${state}, '${idirs}' does not match '^${output}$', log=${log}") endif() unload_compiler_info("${cmvars}") endforeach(t) diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XLClang-16.1.0.1.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XLClang-16.1.0.1.output index e462894..7666f7e 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XLClang-16.1.0.1.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XLClang-16.1.0.1.output @@ -1 +1 @@ -/opt/IBM/xlC/16.1.0/include2/c++;/opt/IBM/xlC/16.1.0/include2;/opt/IBM/xlC/16.1.0/include2/aix;/opt/IBM/xlmass/9.1.0/include;/usr/include +/opt/IBM/xlC/16.1.0/include2/c\+\+;/opt/IBM/xlC/16.1.0/include2;/opt/IBM/xlC/16.1.0/include2/aix;/opt/IBM/xlmass/9.1.0/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.output index 259c42a..263f8cb 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.output @@ -1 +1 @@ -/opt/cray/pe/cce/8.7.4/cce/x86_64/include/craylibs;/opt/gcc/6.1.0/snos/include/g++;/opt/gcc/6.1.0/snos/include/g++/x86_64-suse-linux;/opt/gcc/6.1.0/snos/include/g++/backward;/opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include;/opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include-fixed;/opt/cray/pe/cce/8.7.4/cce/x86_64/include/c++;/opt/cray/pe/cce/8.7.4/cce/x86_64/include/basic;/opt/gcc/6.1.0/snos/include;/usr/include;/opt/cray/pe/libsci/18.07.1/CRAY/8.6/x86_64/include;/opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/include;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include;/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include;/opt/cray/dmapp/7.1.1-6.0.5.0_49.8__g1125556.ari/include;/opt/cray/pe/pmi/5.0.14/include;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include;/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include;/opt/cray-hss-devel/8.0.0/include +/opt/cray/pe/cce/8.7.4/cce/x86_64/include/craylibs;/opt/gcc/6.1.0/snos/include/g\+\+;/opt/gcc/6.1.0/snos/include/g\+\+/x86_64-suse-linux;/opt/gcc/6.1.0/snos/include/g\+\+/backward;/opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include;/opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include-fixed;/opt/cray/pe/cce/8.7.4/cce/x86_64/include/c\+\+;/opt/cray/pe/cce/8.7.4/cce/x86_64/include/basic;/opt/gcc/6.1.0/snos/include;/usr/include;/opt/cray/pe/libsci/18.07.1/CRAY/8.6/x86_64/include;/opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/include;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include;/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include;/opt/cray/dmapp/7.1.1-6.0.5.0_49.8__g1125556.ari/include;/opt/cray/pe/pmi/5.0.14/include;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include;/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include;/opt/cray-hss-devel/8.0.0/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.output index d9095f7..b76c5db 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.output @@ -1 +1 @@ -/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include;/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include;/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include;/opt/cray/pe/pmi/5.0.14/include;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include;/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include;/opt/cray-hss-devel/8.0.0/include;/opt/gcc/7.3.0/snos/include/g++;/opt/gcc/7.3.0/snos/include/g++/x86_64-suse-linux;/opt/gcc/7.3.0/snos/include/g++/backward;/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include;/usr/local/include;/opt/gcc/7.3.0/snos/include;/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include-fixed;/usr/include +/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include;/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include;/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include;/opt/cray/pe/pmi/5.0.14/include;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include;/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include;/opt/cray-hss-devel/8.0.0/include;/opt/gcc/7.3.0/snos/include/g\+\+;/opt/gcc/7.3.0/snos/include/g\+\+/x86_64-suse-linux;/opt/gcc/7.3.0/snos/include/g\+\+/backward;/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include;/usr/local/include;/opt/gcc/7.3.0/snos/include;/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include-fixed;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.output index 31f8a11..031c324 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.output @@ -1 +1 @@ -/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/include;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/intel64;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/icc;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include;/opt/gcc/6.3.0/snos/include/g++;/opt/gcc/6.3.0/snos/include/g++/x86_64-suse-linux;/opt/gcc/6.3.0/snos/include/g++/backward;/usr/local/include;/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include;/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include-fixed;/opt/gcc/6.3.0/snos/include;/usr/include +/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/include;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/intel64;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/icc;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include;/opt/gcc/6.3.0/snos/include/g\+\+;/opt/gcc/6.3.0/snos/include/g\+\+/x86_64-suse-linux;/opt/gcc/6.3.0/snos/include/g\+\+/backward;/usr/local/include;/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include;/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include-fixed;/opt/gcc/6.3.0/snos/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.output index b10b2af..de0f91f 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.output @@ -1 +1 @@ -/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.0.0/include;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include;/usr/include +/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c\+\+/v1;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.0.0/include;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.output index cd64264..97410f2 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.output @@ -1 +1 @@ -/usr/include/c++/v1;/usr/include/c++/4.2;/usr/include/c++/4.2/backward;/usr/include/clang/3.3;/usr/include +/usr/include/c\+\+/v1;/usr/include/c\+\+/4.2;/usr/include/c\+\+/4.2/backward;/usr/include/clang/3.3;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-empty.input index b27eb02..b27eb02 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.input +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-empty.input diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-empty.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-empty.output new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-empty.output diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.input new file mode 100644 index 0000000..dd846e3 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.input @@ -0,0 +1,21 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI=ELF +CMAKE_C_COMPILER_AR=/usr/bin/gcc-ar-7 +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=GNU +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB=/usr/bin/gcc-ranlib-7 +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=7.3.0 +CMAKE_C_COMPILER_VERSION_INTERAL= + +This is a hand-written test case. + +#include "..." search starts here: +#include <...> search starts here: + /usr/local/include + ../../../adaptive/relative/include + /usr/include +End of search list. diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.output new file mode 100644 index 0000000..e43139b --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-C-relative.output @@ -0,0 +1 @@ + /usr/local/include;[^;]*/Tests/RunCMake/ParseImplicitIncludeInfo/adaptive/relative/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-empty.input index b983d6b..b983d6b 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.input +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-empty.input diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-empty.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-empty.output new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-empty.output diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.input new file mode 100644 index 0000000..54cc4db --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.input @@ -0,0 +1,21 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI=ELF +CMAKE_CXX_COMPILER_AR=/usr/bin/gcc-ar-7 +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=GNU +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB=/usr/bin/gcc-ranlib-7 +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=7.3.0 +CMAKE_CXX_COMPILER_VERSION_INTERAL= + +This is a hand-written test case. + +#include "..." search starts here: +#include <...> search starts here: + /usr/local/include + ../../../adaptive/relative/include + /usr/include +End of search list. diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.output new file mode 100644 index 0000000..e43139b --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/hand-CXX-relative.output @@ -0,0 +1 @@ + /usr/local/include;[^;]*/Tests/RunCMake/ParseImplicitIncludeInfo/adaptive/relative/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.output index 4f49cd1..497fb88 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.output @@ -1 +1 @@ -/usr/include/c++/5;/usr/include/x86_64-linux-gnu/c++/5;/usr/include/c++/5/backward;/usr/lib/gcc/x86_64-linux-gnu/5/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include +/usr/include/c\+\+/5;/usr/include/x86_64-linux-gnu/c\+\+/5;/usr/include/c\+\+/5/backward;/usr/lib/gcc/x86_64-linux-gnu/5/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.output index 6f5d071..af33ba8 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.output @@ -1 +1 @@ -/usr/include/c++/7;/usr/include/x86_64-linux-gnu/c++/7;/usr/include/c++/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include +/usr/include/c\+\+/7;/usr/include/x86_64-linux-gnu/c\+\+/7;/usr/include/c\+\+/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.output index 1bf5711..95bdf99 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.output @@ -1 +1 @@ -/opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/pstl/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/intel64;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/icc;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include;/usr/include/c++/4.8.5;/usr/include/c++/4.8.5/x86_64-redhat-linux;/usr/include/c++/4.8.5/backward;/usr/local/include;/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include;/usr/include +/opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/pstl/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/intel64;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/icc;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include;/usr/include/c\+\+/4.8.5;/usr/include/c\+\+/4.8.5/x86_64-redhat-linux;/usr/include/c\+\+/4.8.5/backward;/usr/local/include;/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-PGI-18.10.1.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-PGI-18.10.1.output index 8c9d24a..8eb97c8 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-PGI-18.10.1.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-PGI-18.10.1.output @@ -1 +1 @@ -/mnt/pgi/linux86-64/18.10/include-gcc70;/mnt/pgi/linux86-64/18.10/include;/usr/include/c++/7;/usr/include/x86_64-linux-gnu/c++/7;/usr/include/c++/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include +/mnt/pgi/linux86-64/18.10/include-gcc70;/mnt/pgi/linux86-64/18.10/include;/usr/include/c\+\+/7;/usr/include/x86_64-linux-gnu/c\+\+/7;/usr/include/c\+\+/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.output index a2d8c26..d6d3e58 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.output @@ -1 +1 @@ -/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include;/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include;/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/include;/usr/include/c++/4.4.7;/usr/include/c++/4.4.7/ppc64-redhat-linux;/usr/include/c++/4.4.7/backward;/usr/local/include;/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include;/usr/include +/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include;/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include;/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/include;/usr/include/c\+\+/4.4.7;/usr/include/c\+\+/4.4.7/ppc64-redhat-linux;/usr/include/c\+\+/4.4.7/backward;/usr/local/include;/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.output index 6994f3c..9e118fc 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.output @@ -1 +1 @@ -/opt/ibm/xlsmp/5.1.0/include;/opt/ibm/xlmass/9.1.0/include;/opt/ibm/xlC/16.1.0/include;/usr/include/c++/4.8.5;/usr/include/c++/4.8.5/ppc64le-redhat-linux;/usr/include/c++/4.8.5/backward;/usr/local/include;/usr/include +/opt/ibm/xlsmp/5.1.0/include;/opt/ibm/xlmass/9.1.0/include;/opt/ibm/xlC/16.1.0/include;/usr/include/c\+\+/4.8.5;/usr/include/c\+\+/4.8.5/ppc64le-redhat-linux;/usr/include/c\+\+/4.8.5/backward;/usr/local/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-PGI-18.10.1.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-PGI-18.10.1.output index 8c9d24a..8eb97c8 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-PGI-18.10.1.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-PGI-18.10.1.output @@ -1 +1 @@ -/mnt/pgi/linux86-64/18.10/include-gcc70;/mnt/pgi/linux86-64/18.10/include;/usr/include/c++/7;/usr/include/x86_64-linux-gnu/c++/7;/usr/include/c++/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include +/mnt/pgi/linux86-64/18.10/include-gcc70;/mnt/pgi/linux86-64/18.10/include;/usr/include/c\+\+/7;/usr/include/x86_64-linux-gnu/c\+\+/7;/usr/include/c\+\+/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.output index 7a5e447..9996940 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.output @@ -1 +1 @@ -C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include/c++;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include/c++/mingw32;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include/c++/backward;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include;C:/DoesNotExist/mingw/include;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include-fixed +C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include/c\+\+;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include/c\+\+/mingw32;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include/c\+\+/backward;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include;C:/DoesNotExist/mingw/include;C:/DoesNotExist/mingw/lib/gcc/mingw32/4.9.3/include-fixed diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.output index 7b1e11e..d2289eb 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.output @@ -1 +1 @@ -/usr/include/g++;/usr/include/g++/backward;/usr/include/gcc-4.8;/usr/include +/usr/include/g\+\+;/usr/include/g\+\+/backward;/usr/include/gcc-4.8;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.output index 6da1398..d77687b 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.output @@ -1 +1 @@ -/usr/include/c++/v1;/usr/lib/clang/5.0.1/include;/usr/include +/usr/include/c\+\+/v1;/usr/lib/clang/5.0.1/include;/usr/include diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index ce71677..ad3f8f6 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -98,8 +98,14 @@ function(run_cmake test) else() set(_D_CMAKE_GENERATOR_INSTANCE "") endif() + if(NOT RunCMake_TEST_NO_SOURCE_DIR) + set(maybe_source_dir "${RunCMake_TEST_SOURCE_DIR}") + else() + set(maybe_source_dir "") + endif() execute_process( - COMMAND ${CMAKE_COMMAND} "${RunCMake_TEST_SOURCE_DIR}" + COMMAND ${CMAKE_COMMAND} + ${maybe_source_dir} -G "${RunCMake_GENERATOR}" -A "${RunCMake_GENERATOR_PLATFORM}" -T "${RunCMake_GENERATOR_TOOLSET}" @@ -182,5 +188,10 @@ function(run_cmake_command test) run_cmake(${test}) endfunction() +function(run_cmake_with_options test) + set(RunCMake_TEST_OPTIONS "${ARGN}") + run_cmake(${test}) +endfunction() + # Protect RunCMake tests from calling environment. unset(ENV{MAKEFLAGS}) diff --git a/Tests/RunCMake/export/AppendExport-stderr.txt b/Tests/RunCMake/export/AppendExport-stderr.txt index d71620e..d12124c 100644 --- a/Tests/RunCMake/export/AppendExport-stderr.txt +++ b/Tests/RunCMake/export/AppendExport-stderr.txt @@ -1,4 +1,4 @@ CMake Error at AppendExport.cmake:[0-9]+ \(export\): - export EXPORT signature does not recognise the APPEND option. + export Unknown argument: "APPEND". Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/export/OldIface-stderr.txt b/Tests/RunCMake/export/OldIface-stderr.txt index 818c2cb..3cc1033 100644 --- a/Tests/RunCMake/export/OldIface-stderr.txt +++ b/Tests/RunCMake/export/OldIface-stderr.txt @@ -1,5 +1,4 @@ CMake Error at OldIface.cmake:[0-9]+ \(export\): - export EXPORT signature does not recognise the - EXPORT_LINK_INTERFACE_LIBRARIES option. + export Unknown argument: "EXPORT_LINK_INTERFACE_LIBRARIES". Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Utilities/IWYU/mapping.imp b/Utilities/IWYU/mapping.imp index 482a08d..0393ff1 100644 --- a/Utilities/IWYU/mapping.imp +++ b/Utilities/IWYU/mapping.imp @@ -68,6 +68,7 @@ { symbol: [ "std::__decay_and_strip<cmGeneratorTarget *&>::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip<cmFindCommon::PathLabel &>::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip<cmSearchPath>::__type", private, "\"cmConfigure.h\"", public ] }, + { symbol: [ "std::__decay_and_strip<cm::string_view>::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip<std::basic_string<char> &>::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip<const std::basic_string<char> &>::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip<cmFindPackageCommand::PathLabel &>::__type", private, "\"cmConfigure.h\"", public ] }, diff --git a/Utilities/Release/win32_release.cmake b/Utilities/Release/win32_release.cmake index 1e4421c..974c402 100644 --- a/Utilities/Release/win32_release.cmake +++ b/Utilities/Release/win32_release.cmake @@ -11,6 +11,7 @@ set(MAKE "${MAKE_PROGRAM} -j16") set(qt_prefix "c:/Qt/5.12.1/msvc2017-32-w7-mt") set(qt_win_libs ${qt_prefix}/plugins/platforms/qwindows.lib + ${qt_prefix}/plugins/styles/qwindowsvistastyle.lib ${qt_prefix}/lib/Qt5EventDispatcherSupport.lib ${qt_prefix}/lib/Qt5FontDatabaseSupport.lib ${qt_prefix}/lib/Qt5ThemeSupport.lib diff --git a/Utilities/Release/win64_release.cmake b/Utilities/Release/win64_release.cmake index 98eaf19..20529f0 100644 --- a/Utilities/Release/win64_release.cmake +++ b/Utilities/Release/win64_release.cmake @@ -11,6 +11,7 @@ set(MAKE "${MAKE_PROGRAM} -j16") set(qt_prefix "c:/Qt/5.12.1/msvc2017-64-w7-mt") set(qt_win_libs ${qt_prefix}/plugins/platforms/qwindows.lib + ${qt_prefix}/plugins/styles/qwindowsvistastyle.lib ${qt_prefix}/lib/Qt5EventDispatcherSupport.lib ${qt_prefix}/lib/Qt5FontDatabaseSupport.lib ${qt_prefix}/lib/Qt5ThemeSupport.lib @@ -260,6 +260,7 @@ CMAKE_CXX_SOURCES="\ cmAddLibraryCommand \ cmAddSubDirectoryCommand \ cmAddTestCommand \ + cmArgumentParser \ cmBreakCommand \ cmBuildCommand \ cmCMakeMinimumRequired \ @@ -268,7 +269,6 @@ CMAKE_CXX_SOURCES="\ cmCacheManager \ cmCommand \ cmCommandArgumentParserHelper \ - cmCommandArgumentsHelper \ cmCommands \ cmCommonTargetGenerator \ cmComputeComponentGraph \ |