diff options
-rw-r--r-- | Help/command/if.rst | 58 | ||||
-rw-r--r-- | Help/manual/cmake-presets.7.rst | 46 | ||||
-rw-r--r-- | Help/manual/ctest.1.rst | 2 | ||||
-rw-r--r-- | Help/manual/presets/example.json | 18 | ||||
-rw-r--r-- | Modules/CMakeDetermineCCompiler.cmake | 2 | ||||
-rw-r--r-- | Modules/ExternalProject.cmake | 2 | ||||
-rw-r--r-- | Source/cmcmd.cxx | 1 | ||||
-rw-r--r-- | Tests/RunCMake/FetchContent/MultiCommand-stdout.txt | 6 | ||||
-rw-r--r-- | Tests/RunCMake/FetchContent/MultiCommand.cmake | 18 | ||||
-rw-r--r-- | Tests/RunCMake/FetchContent/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Utilities/Sphinx/conf.py.in | 1 |
11 files changed, 125 insertions, 30 deletions
diff --git a/Help/command/if.rst b/Help/command/if.rst index 5dabe00..f327ca9 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -39,13 +39,13 @@ the ``if``, ``elseif`` and :command:`while` clauses. Compound conditions are evaluated in the following order of precedence: Innermost parentheses are evaluated first. Next come unary tests such -as ``EXISTS``, ``COMMAND``, and ``DEFINED``. Then binary tests such as -``EQUAL``, ``LESS``, ``LESS_EQUAL``, ``GREATER``, ``GREATER_EQUAL``, -``STREQUAL``, ``STRLESS``, ``STRLESS_EQUAL``, ``STRGREATER``, -``STRGREATER_EQUAL``, ``VERSION_EQUAL``, ``VERSION_LESS``, -``VERSION_LESS_EQUAL``, ``VERSION_GREATER``, ``VERSION_GREATER_EQUAL``, -and ``MATCHES``. Then the boolean operators in the order ``NOT``, ``AND``, -and finally ``OR``. +as `EXISTS`_, `COMMAND`_, and `DEFINED`_. Then binary tests such as +`EQUAL`_, `LESS`_, `LESS_EQUAL`_, `GREATER`_, `GREATER_EQUAL`_, +`STREQUAL`_, `STRLESS`_, `STRLESS_EQUAL`_, `STRGREATER`_, +`STRGREATER_EQUAL`_, `VERSION_EQUAL`_, `VERSION_LESS`_, +`VERSION_LESS_EQUAL`_, `VERSION_GREATER`_, `VERSION_GREATER_EQUAL`_, +and `MATCHES`_. Then the boolean operators in the order `NOT`_, `AND`_, +and finally `OR`_. Basic Expressions """"""""""""""""" @@ -66,12 +66,18 @@ Basic Expressions Logic Operators """"""""""""""" +.. _NOT: + ``if(NOT <condition>)`` True if the condition is not true. +.. _AND: + ``if(<cond1> AND <cond2>)`` True if both conditions would be considered true individually. +.. _OR: + ``if(<cond1> OR <cond2>)`` True if either condition would be considered true individually. @@ -84,6 +90,8 @@ Logic Operators Existence Checks """""""""""""""" +.. _COMMAND: + ``if(COMMAND command-name)`` True if the given name is a command, macro or function that can be invoked. @@ -102,6 +110,8 @@ Existence Checks True if the given name is an existing test name created by the :command:`add_test` command. +.. _DEFINED: + ``if(DEFINED <name>|CACHE{<name>}|ENV{<name>})`` True if a variable, cache variable or environment variable with given ``<name>`` is defined. The value of the variable @@ -117,6 +127,8 @@ Existence Checks File Operations """"""""""""""" +.. _EXISTS: + ``if(EXISTS path-to-file-or-directory)`` True if the named file or directory exists. Behavior is well-defined only for explicit full paths (a leading ``~/`` is not expanded as @@ -146,6 +158,8 @@ File Operations Comparisons """"""""""" +.. _MATCHES: + ``if(<variable|string> MATCHES regex)`` True if the given string or variable's value matches the given regular condition. See :ref:`Regex Specification` for regex format. @@ -153,45 +167,65 @@ Comparisons .. versionadded:: 3.9 ``()`` groups are captured in :variable:`CMAKE_MATCH_<n>` variables. +.. _LESS: + ``if(<variable|string> LESS <variable|string>)`` True if the given string or variable's value is a valid number and less than that on the right. +.. _GREATER: + ``if(<variable|string> GREATER <variable|string>)`` True if the given string or variable's value is a valid number and greater than that on the right. +.. _EQUAL: + ``if(<variable|string> EQUAL <variable|string>)`` True if the given string or variable's value is a valid number and equal to that on the right. +.. _LESS_EQUAL: + ``if(<variable|string> LESS_EQUAL <variable|string>)`` .. versionadded:: 3.7 True if the given string or variable's value is a valid number and less than or equal to that on the right. +.. _GREATER_EQUAL: + ``if(<variable|string> GREATER_EQUAL <variable|string>)`` .. versionadded:: 3.7 True if the given string or variable's value is a valid number and greater than or equal to that on the right. +.. _STRLESS: + ``if(<variable|string> STRLESS <variable|string>)`` True if the given string or variable's value is lexicographically less than the string or variable on the right. +.. _STRGREATER: + ``if(<variable|string> STRGREATER <variable|string>)`` True if the given string or variable's value is lexicographically greater than the string or variable on the right. +.. _STREQUAL: + ``if(<variable|string> STREQUAL <variable|string>)`` True if the given string or variable's value is lexicographically equal to the string or variable on the right. +.. _STRLESS_EQUAL: + ``if(<variable|string> STRLESS_EQUAL <variable|string>)`` .. versionadded:: 3.7 True if the given string or variable's value is lexicographically less than or equal to the string or variable on the right. +.. _STRGREATER_EQUAL: + ``if(<variable|string> STRGREATER_EQUAL <variable|string>)`` .. versionadded:: 3.7 True if the given string or variable's value is lexicographically greater @@ -200,24 +234,32 @@ Comparisons Version Comparisons """"""""""""""""""" +.. _VERSION_LESS: + ``if(<variable|string> VERSION_LESS <variable|string>)`` Component-wise integer version number comparison (version format is ``major[.minor[.patch[.tweak]]]``, omitted components are treated as zero). Any non-integer version component or non-integer trailing part of a version component effectively truncates the string at that point. +.. _VERSION_GREATER: + ``if(<variable|string> VERSION_GREATER <variable|string>)`` Component-wise integer version number comparison (version format is ``major[.minor[.patch[.tweak]]]``, omitted components are treated as zero). Any non-integer version component or non-integer trailing part of a version component effectively truncates the string at that point. +.. _VERSION_EQUAL: + ``if(<variable|string> VERSION_EQUAL <variable|string>)`` Component-wise integer version number comparison (version format is ``major[.minor[.patch[.tweak]]]``, omitted components are treated as zero). Any non-integer version component or non-integer trailing part of a version component effectively truncates the string at that point. +.. _VERSION_LESS_EQUAL: + ``if(<variable|string> VERSION_LESS_EQUAL <variable|string>)`` .. versionadded:: 3.7 Component-wise integer version number comparison (version format is @@ -225,6 +267,8 @@ Version Comparisons Any non-integer version component or non-integer trailing part of a version component effectively truncates the string at that point. +.. _VERSION_GREATER_EQUAL: + ``if(<variable|string> VERSION_GREATER_EQUAL <variable|string>)`` .. versionadded:: 3.7 Component-wise integer version number comparison (version format is diff --git a/Help/manual/cmake-presets.7.rst b/Help/manual/cmake-presets.7.rst index 49eb157..55a9947 100644 --- a/Help/manual/cmake-presets.7.rst +++ b/Help/manual/cmake-presets.7.rst @@ -29,7 +29,10 @@ is using Git, ``CMakePresets.json`` may be tracked, and Format ====== -The files are a JSON document with an object as the root: +The files are JSON documents. C-style comments are allowed using +line-wise ``//`` syntax or block ``/*...*/`` syntax. + +Each document has an object as the root: .. literalinclude:: presets/example.json :language: json @@ -38,8 +41,8 @@ The root object recognizes the following fields: ``version`` - A required integer representing the version of the JSON schema. Currently, - the only supported version is 1. + A required integer representing the version of the JSON schema. + The supported versions are ``1`` and ``2``. ``cmakeMinimumRequired`` @@ -70,14 +73,17 @@ The root object recognizes the following fields: ``configurePresets`` An optional array of `Configure Preset`_ objects. + This is allowed in preset files specifying version 1 or above. ``buildPresets`` An optional array of `Build Preset`_ objects. + This is allowed in preset files specifying version 2 or above. ``testPresets`` An optional array of `Test Preset`_ objects. + This is allowed in preset files specifying version 2 or above. Configure Preset ^^^^^^^^^^^^^^^^ @@ -88,9 +94,10 @@ that may contain the following fields: ``name`` A required string representing the machine-friendly name of the preset. - This identifier is used in the ``--preset`` argument. There must not be - two presets in the union of ``CMakePresets.json`` and - ``CMakeUserPresets.json`` in the same directory with the same name. + This identifier is used in the :ref:`cmake --preset <CMake Options>` option. + There must not be two configure presets in the union of ``CMakePresets.json`` + and ``CMakeUserPresets.json`` in the same directory with the same name. + However, a configure preset may have the same name as a build or test preset. ``hidden`` @@ -306,10 +313,11 @@ that may contain the following fields: ``name`` A required string representing the machine-friendly name of the preset. - This identifier is used in the ``--preset`` argument. There must not be - two presets (configure, build, or test) in the union of - ``CMakePresets.json`` and ``CMakeUserPresets.json`` in the same - directory with the same name. + This identifier is used in the + :ref:`cmake --build --preset <Build Tool Mode>` option. + There must not be two build presets in the union of ``CMakePresets.json`` + and ``CMakeUserPresets.json`` in the same directory with the same name. + However, a build preset may have the same name as a configure or test preset. ``hidden`` @@ -373,8 +381,9 @@ that may contain the following fields: An optional string specifying the name of a configure preset to associate with this build preset. If ``configurePreset`` is not specified, it must be inherited from the inherits preset (unless this - preset is hidden). The build tree directory is inferred from the - configure preset. + preset is hidden). The build directory is inferred from the configure + preset, so the build will take place in the same ``binaryDir`` that the + configuration did. ``inheritConfigureEnvironment`` @@ -424,10 +433,10 @@ that may contain the following fields: ``name`` A required string representing the machine-friendly name of the preset. - This identifier is used in the ``--preset`` argument. There must not be - two presets (configure, build, or test) in the union of - ``CMakePresets.json`` and ``CMakeUserPresets.json`` in the same - directory with the same name. + This identifier is used in the :ref:`ctest --preset <CTest Options>` option. + There must not be two test presets in the union of ``CMakePresets.json`` + and ``CMakeUserPresets.json`` in the same directory with the same name. + However, a test preset may have the same name as a configure or build preset. ``hidden`` @@ -491,8 +500,9 @@ that may contain the following fields: An optional string specifying the name of a configure preset to associate with this test preset. If ``configurePreset`` is not specified, it must be inherited from the inherits preset (unless this - preset is hidden). The build tree directory is inferred from the - configure preset. + preset is hidden). The build directory is inferred from the configure + preset, so tests will run in the same ``binaryDir`` that the + configuration did and build did. ``inheritConfigureEnvironment`` diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index 43157b6..0a3614f 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -25,6 +25,8 @@ CMake-generated build trees created for projects that use the :command:`enable_testing` and :command:`add_test` commands have testing support. This program will run the tests and report results. +.. _`CTest Options`: + Options ======= diff --git a/Help/manual/presets/example.json b/Help/manual/presets/example.json index d3b6f4a..dfc2910 100644 --- a/Help/manual/presets/example.json +++ b/Help/manual/presets/example.json @@ -1,8 +1,8 @@ { - "version": 1, + "version": 2, "cmakeMinimumRequired": { "major": 3, - "minor": 19, + "minor": 20, "patch": 0 }, "configurePresets": [ @@ -37,6 +37,20 @@ "generator": "Ninja Multi-Config" } ], + "buildPresets": [ + { + "name": "default", + "configurePreset": "default" + } + ], + "testPresets": [ + { + "name": "default", + "configurePreset": "default", + "output": {"outputOnFailure": true}, + "execution": {"noTestsAction": "error", "stopOnFailure": true} + } + ], "vendor": { "example.com/ExampleIDE/1.0": { "autoFormat": false diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 59c0574..cd07ba9 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -135,7 +135,7 @@ else() # They pre-date our support for the GNU-like variant targeting the # MSVC ABI so we do not consider that here. if(CMAKE_C_COMPILER_ID STREQUAL "Clang" - OR "x${CMAKE_${lang}_COMPILER_ID" STREQUAL "xIntelLLVM") + OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xIntelLLVM") if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_C_COMPILER_FRONTEND_VARIANT "MSVC") else() diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 2b413c2..4a9809b 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -3897,7 +3897,7 @@ function(_ep_do_preconfigure_steps_now name) # Once any step has to run, all later steps have to be run too set(need_to_run FALSE) - foreach(step IN ITEMS download update parse) + foreach(step IN ITEMS download update patch) if(update_disconnected AND "${step}" STREQUAL "update") continue() endif() diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 5791c05..6713cc3 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -754,7 +754,6 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args, std::string const& a = args[4]; if (cmHasLiteralPrefix(a, "--nm=")) { deffile.SetNmPath(a.substr(5)); - std::cerr << a.substr(5) << "\n"; } else { std::cerr << "unknown argument: " << a << "\n"; } diff --git a/Tests/RunCMake/FetchContent/MultiCommand-stdout.txt b/Tests/RunCMake/FetchContent/MultiCommand-stdout.txt new file mode 100644 index 0000000..7f2c0f8 --- /dev/null +++ b/Tests/RunCMake/FetchContent/MultiCommand-stdout.txt @@ -0,0 +1,6 @@ +.* *download 1 +.* *download 2 +.* *update 1 +.* *update 2 +.* *patch 1 +.* *patch 2 diff --git a/Tests/RunCMake/FetchContent/MultiCommand.cmake b/Tests/RunCMake/FetchContent/MultiCommand.cmake new file mode 100644 index 0000000..92e08e4 --- /dev/null +++ b/Tests/RunCMake/FetchContent/MultiCommand.cmake @@ -0,0 +1,18 @@ +include(FetchContent) + +# Verify COMMAND keyword is recognised after various *_COMMAND options +FetchContent_Declare(multiCommand + DOWNLOAD_COMMAND "${CMAKE_COMMAND}" -E echo "download 1" + COMMAND "${CMAKE_COMMAND}" -E echo "download 2" + UPDATE_COMMAND "${CMAKE_COMMAND}" -E echo "update 1" + COMMAND "${CMAKE_COMMAND}" -E echo "update 2" + PATCH_COMMAND "${CMAKE_COMMAND}" -E echo "patch 1" + COMMAND "${CMAKE_COMMAND}" -E echo "patch 2" +) + +# Force all steps to be re-run by removing timestamps, scripts, etc. from any +# previous run +file(REMOVE_RECURSE "${FETCHCONTENT_BASE_DIR}/multiCommand-subbuild") + +set(FETCHCONTENT_QUIET FALSE) +FetchContent_MakeAvailable(multiCommand) diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake index b497382..13013fa 100644 --- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake +++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake @@ -2,6 +2,7 @@ include(RunCMake) unset(RunCMake_TEST_NO_CLEAN) +run_cmake(MultiCommand) run_cmake(MissingDetails) run_cmake(DirectIgnoresDetails) run_cmake(FirstDetailsWin) diff --git a/Utilities/Sphinx/conf.py.in b/Utilities/Sphinx/conf.py.in index 42b0951..5def681 100644 --- a/Utilities/Sphinx/conf.py.in +++ b/Utilities/Sphinx/conf.py.in @@ -29,6 +29,7 @@ extensions = ['cmake'] templates_path = ['@conf_path@/templates'] nitpicky = True +smartquotes = False cmake_manuals = sorted(glob.glob(r'@conf_docs@/manual/*.rst')) cmake_manual_description = re.compile('^\.\. cmake-manual-description:(.*)$') |