diff options
53 files changed, 501 insertions, 158 deletions
diff --git a/Copyright.txt b/Copyright.txt index bd45dd1..515e403 100644 --- a/Copyright.txt +++ b/Copyright.txt @@ -1,5 +1,5 @@ CMake - Cross Platform Makefile Generator -Copyright 2000-2022 Kitware, Inc. and Contributors +Copyright 2000-2023 Kitware, Inc. and Contributors All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/Help/command/add_subdirectory.rst b/Help/command/add_subdirectory.rst index fe17b56..ae063e6 100644 --- a/Help/command/add_subdirectory.rst +++ b/Help/command/add_subdirectory.rst @@ -7,16 +7,16 @@ Add a subdirectory to the build. add_subdirectory(source_dir [binary_dir] [EXCLUDE_FROM_ALL] [SYSTEM]) -Adds a subdirectory to the build. The source_dir specifies the -directory in which the source CMakeLists.txt and code files are -located. If it is a relative path it will be evaluated with respect +Adds a subdirectory to the build. The ``source_dir`` specifies the +directory in which the source ``CMakeLists.txt`` and code files are +located. If it is a relative path, it will be evaluated with respect to the current directory (the typical usage), but it may also be an absolute path. The ``binary_dir`` specifies the directory in which to -place the output files. If it is a relative path it will be evaluated +place the output files. If it is a relative path, it will be evaluated with respect to the current output directory, but it may also be an absolute path. If ``binary_dir`` is not specified, the value of ``source_dir``, before expanding any relative path, will be used (the -typical usage). The CMakeLists.txt file in the specified source +typical usage). The ``CMakeLists.txt`` file in the specified source directory will be processed immediately by CMake before processing in the current input file continues beyond this command. @@ -28,9 +28,9 @@ meant for use when the subdirectory contains a separate part of the project that is useful but not necessary, such as a set of examples. Typically the subdirectory should contain its own :command:`project` command invocation so that a full build system will be generated in the -subdirectory (such as a VS IDE solution file). Note that inter-target -dependencies supersede this exclusion. If a target built by the -parent project depends on a target in the subdirectory, the dependee +subdirectory (such as a Visual Studio IDE solution file). Note that +inter-target dependencies supersede this exclusion. If a target built by +the parent project depends on a target in the subdirectory, the dependee target will be included in the parent project build system to satisfy the dependency. @@ -38,6 +38,4 @@ the dependency. If the ``SYSTEM`` argument is provided, the :prop_dir:`SYSTEM` directory property of the subdirectory will be set to true. This property is used to initialize the :prop_tgt:`SYSTEM` property of each non-imported - target created in that subdirectory. The include directories of targets - with :prop_tgt:`SYSTEM` set to true will be treated as ``SYSTEM`` when - compiling consumers. + target created in that subdirectory. diff --git a/Help/command/configure_file.rst b/Help/command/configure_file.rst index 7fa2941..adc2a66 100644 --- a/Help/command/configure_file.rst +++ b/Help/command/configure_file.rst @@ -58,7 +58,7 @@ or #define VAR 1 Input lines of the form ``#cmakedefine01 VAR ...`` will expand -as ``#cmakedefine01 VAR ... 0`` or ``#cmakedefine01 VAR ... 0``, +as ``#cmakedefine01 VAR ... 0`` or ``#cmakedefine01 VAR ... 1``, which may lead to undefined behavior. .. versionadded:: 3.10 diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index 0990320..9e467bf 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -672,14 +672,14 @@ This is equivalent to appending ``${CMAKE_INSTALL_PREFIX}/include`` to the When the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of an :ref:`imported target <Imported targets>` is consumed, the entries in the -property are treated as ``SYSTEM`` include directories, as if they were -listed in the :prop_tgt:`INTERFACE_SYSTEM_INCLUDE_DIRECTORIES` of the -dependency. This can result in omission of compiler warnings for headers -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, or by setting the -:prop_tgt:`IMPORTED_NO_SYSTEM` target property on the imported targets -themselves. +property may be treated as system include directories. The effects of that +are toolchain-dependent, but one common effect is to omit compiler warnings +for headers found in those directories. The :prop_tgt:`SYSTEM` property of +the installed target determines this behavior (see the +:prop_tgt:`EXPORT_NO_SYSTEM` property for how to modify the installed value +for a target). It is also possible to change how consumers interpret the +system behavior of consumed imported targets by setting the +:prop_tgt:`NO_SYSTEM_FROM_IMPORTED` target property on the *consumer*. 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. diff --git a/Help/manual/cmake-configure-log.7.rst b/Help/manual/cmake-configure-log.7.rst index 7f395f5..f909717 100644 --- a/Help/manual/cmake-configure-log.7.rst +++ b/Help/manual/cmake-configure-log.7.rst @@ -73,6 +73,16 @@ they do not understand: * If an existing build tree is re-configured with a different version of CMake, the log may contain different versions of the same event kind. +* If :manual:`cmake-file-api(7)` queries request one or more + :ref:`configureLog <file-api configureLog>` object versions, + the log may contain multiple entries for the same event, each + with a different version of its event kind. + +IDEs should write a :manual:`cmake-file-api(7)` query requesting a +specific :ref:`configureLog <file-api configureLog>` object version, +before running CMake, and then read the configure log only as described +by the file-api reply. + Text Block Encoding ------------------- diff --git a/Help/manual/cmake-file-api.7.rst b/Help/manual/cmake-file-api.7.rst index cdc86ec..7ff9728 100644 --- a/Help/manual/cmake-file-api.7.rst +++ b/Help/manual/cmake-file-api.7.rst @@ -1298,6 +1298,45 @@ elsewhere in the containing object. The backtrace graph object members are: directory then the path is specified relative to that directory. Otherwise the path is absolute. +.. _`file-api configureLog`: + +Object Kind "configureLog" +-------------------------- + +The ``configureLog`` object kind describes the location and contents of +a :manual:`cmake-configure-log(7)` file. + +There is only one ``configureLog`` object major version, version 1. + +"configureLog" version 1 +^^^^^^^^^^^^^^^^^^^^^^^^ + +``configureLog`` object version 1 is a JSON object: + +.. code-block:: json + + { + "kind": "configureLog", + "version": { "major": 1, "minor": 0 }, + "path": "/path/to/top-level-build-dir/CMakeFiles/CMakeConfigureLog.yaml", + "eventKindNames": [ "try_compile-v1", "try_run-v1" ] + } + +The members specific to ``configureLog`` objects are: + +``path`` + A string specifying the path to the configure log file. + Clients must read the log file from this path, which may be + different than the path documented by :manual:`cmake-configure-log(7)`. + The log file may not exist if no events are logged. + +``eventKindNames`` + A JSON array whose entries are each a JSON string naming one + of the :manual:`cmake-configure-log(7)` versioned event kinds. + At most one version of each configure log event kind will be listed. + Although the configure log may contain other (versioned) event kinds, + clients must ignore those that are not listed in this field. + Object Kind "cache" ------------------- diff --git a/Help/prop_tgt/EXPORT_NO_SYSTEM.rst b/Help/prop_tgt/EXPORT_NO_SYSTEM.rst index 61f0a8d..f86abd3 100644 --- a/Help/prop_tgt/EXPORT_NO_SYSTEM.rst +++ b/Help/prop_tgt/EXPORT_NO_SYSTEM.rst @@ -3,8 +3,10 @@ EXPORT_NO_SYSTEM .. versionadded:: 3.25 -Specifies that :command:`install(EXPORT)` and :command:`export` commands will -generate an imported target with :prop_tgt:`SYSTEM` property `OFF`. +This property affects the behavior of the :command:`install(EXPORT)` and +:command:`export` commands when they install or export the target respectively. +When ``EXPORT_NO_SYSTEM`` is set to true, those commands generate an imported +target with :prop_tgt:`SYSTEM` property set to false. See the :prop_tgt:`NO_SYSTEM_FROM_IMPORTED` target property to set this behavior on the target *consuming* the include directories rather than the diff --git a/Help/prop_tgt/FOLDER.rst b/Help/prop_tgt/FOLDER.rst index f6be9e6..3155d90 100644 --- a/Help/prop_tgt/FOLDER.rst +++ b/Help/prop_tgt/FOLDER.rst @@ -11,3 +11,6 @@ separating folder levels. This property is initialized by the value of the variable :variable:`CMAKE_FOLDER` if it is set when a target is created. + +The global property :prop_gbl:`USE_FOLDERS` must be set to ON, otherwise +the ``FOLDER`` property is ignored. diff --git a/Help/prop_tgt/IMPORTED_NO_SYSTEM.rst b/Help/prop_tgt/IMPORTED_NO_SYSTEM.rst index 913d9f2..c8ec8b5 100644 --- a/Help/prop_tgt/IMPORTED_NO_SYSTEM.rst +++ b/Help/prop_tgt/IMPORTED_NO_SYSTEM.rst @@ -5,27 +5,31 @@ IMPORTED_NO_SYSTEM .. deprecated:: 3.25 - ``IMPORTED_NO_SYSTEM`` is deprecated. Set :prop_tgt:`SYSTEM` to `OFF` - instead if you don't want target's include directories to be ``SYSTEM`` - when compiling consumers. Set :prop_tgt:`EXPORT_NO_SYSTEM` to `ON` instead - if you don't want the include directories of the imported target generated - by :command:`install(EXPORT)` and :command:`export` commands to be - ``SYSTEM`` when compiling consumers. + ``IMPORTED_NO_SYSTEM`` is deprecated. Please use the following alternatives + instead: -Specifies that an :ref:`Imported Target <Imported Targets>` is not -a ``SYSTEM`` library. This has the following effects: + * Set :prop_tgt:`SYSTEM` to false if you don't want a target's include + directories to be treated as system directories when compiling consumers. + * Set :prop_tgt:`EXPORT_NO_SYSTEM` to true if you don't want the include + directories of the imported target generated by :command:`install(EXPORT)` + and :command:`export` commands to be treated as system directories when + compiling consumers. + +Setting ``IMPORTED_NO_SYSTEM`` to true on an +:ref:`imported target <Imported Targets>` specifies that it is not a +system target. This has the following effects: * Entries of :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` are not treated - as ``SYSTEM`` include directories when compiling consumers (regardless of + as system include directories when compiling consumers (regardless of the value of the consumed target's :prop_tgt:`SYSTEM` property), as they would be by default. Entries of :prop_tgt:`INTERFACE_SYSTEM_INCLUDE_DIRECTORIES` are not affected, - and will always be treated as ``SYSTEM`` include directories. + and will always be treated as system include directories. This property can also be enabled on a non-imported target. Doing so does not affect the build system, but does tell the :command:`install(EXPORT)` and :command:`export` commands to enable it on the imported targets they generate. See the :prop_tgt:`NO_SYSTEM_FROM_IMPORTED` target property to set this -behavior on the target consuming the include directories rather than -providing them. +behavior on the target *consuming* the include directories rather than +the one *providing* them. diff --git a/Help/prop_tgt/INTERFACE_SYSTEM_INCLUDE_DIRECTORIES.rst b/Help/prop_tgt/INTERFACE_SYSTEM_INCLUDE_DIRECTORIES.rst index b37bb0c..2ded46f 100644 --- a/Help/prop_tgt/INTERFACE_SYSTEM_INCLUDE_DIRECTORIES.rst +++ b/Help/prop_tgt/INTERFACE_SYSTEM_INCLUDE_DIRECTORIES.rst @@ -8,17 +8,17 @@ which contain system headers, and therefore should not result in compiler warnings. Additionally, system include directories are searched after normal include directories regardless of the order specified. -The :command:`target_include_directories(SYSTEM)` command signature -populates this property with values given to the ``PUBLIC`` and -``INTERFACE`` keywords. +When the :command:`target_include_directories` command is given the +``SYSTEM`` keyword, it populates this property with values provided after the +``PUBLIC`` and ``INTERFACE`` keywords. Projects may also get and set the property directly, but must be aware that adding directories to this property does not make those directories used during compilation. Adding directories to this property marks directories -as ``SYSTEM`` which otherwise would be used in a non-``SYSTEM`` manner. This -can appear similar to 'duplication', so prefer the -high-level :command:`target_include_directories(SYSTEM)` command and avoid -setting the property by low-level means. +as system directories which otherwise would be used in a non-system manner. +This can appear similar to duplication, so prefer the high-level +:command:`target_include_directories` command with the ``SYSTEM`` keyword +and avoid setting the property directly. When target dependencies are specified using :command:`target_link_libraries`, CMake will read this property from all target dependencies to mark the diff --git a/Help/prop_tgt/NO_SYSTEM_FROM_IMPORTED.rst b/Help/prop_tgt/NO_SYSTEM_FROM_IMPORTED.rst index 39a13ee..a4c9b9f 100644 --- a/Help/prop_tgt/NO_SYSTEM_FROM_IMPORTED.rst +++ b/Help/prop_tgt/NO_SYSTEM_FROM_IMPORTED.rst @@ -2,19 +2,27 @@ NO_SYSTEM_FROM_IMPORTED ----------------------- Do not treat include directories from the interfaces of consumed -:ref:`imported targets` as ``SYSTEM``. +:ref:`imported targets` as system directories. The contents of the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` target property -of imported targets are treated as ``SYSTEM`` includes by default. If this -property is enabled on a target, compilation of sources in that target will -not treat the contents of the ``INTERFACE_INCLUDE_DIRECTORIES`` of consumed -imported targets as system includes. Either way, entries of -:prop_tgt:`INTERFACE_SYSTEM_INCLUDE_DIRECTORIES` are not affected, -and will always be treated as ``SYSTEM`` include directories. +are treated as system includes when the consumed target's :prop_tgt:`SYSTEM` +property is set to true. By default, :prop_tgt:`SYSTEM` is true for imported +targets and false for other target types. If the ``NO_SYSTEM_FROM_IMPORTED`` +property is set to true on a *consuming* target, compilation of sources in that +consuming target will not treat the contents of the +:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of consumed imported targets as +system includes, even if that imported target's :prop_tgt:`SYSTEM` property +is false. + +Directories listed in the :prop_tgt:`INTERFACE_SYSTEM_INCLUDE_DIRECTORIES` +property of consumed targets are not affected by ``NO_SYSTEM_FROM_IMPORTED``. +Those directories will always be treated as system include directories by +consumers. This property is initialized by the value of the :variable:`CMAKE_NO_SYSTEM_FROM_IMPORTED` variable if it is set when a target is created. -See the :prop_tgt:`IMPORTED_NO_SYSTEM` target property to set this behavior -on the target providing the include directories rather than consuming them. +See the :prop_tgt:`EXPORT_NO_SYSTEM` target property to set this behavior +on the target providing the include directories rather than the target +consuming them. diff --git a/Help/prop_tgt/SYSTEM.rst b/Help/prop_tgt/SYSTEM.rst index 6399d24..c7ae27e 100644 --- a/Help/prop_tgt/SYSTEM.rst +++ b/Help/prop_tgt/SYSTEM.rst @@ -3,20 +3,20 @@ SYSTEM .. versionadded:: 3.25 -Specifies that a target is a ``SYSTEM`` library. This has the following +Specifies that a target is a system target. This has the following effects: * Entries of :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` are treated as - ``SYSTEM`` include directories when compiling consumers. + system include directories when compiling consumers. Entries of :prop_tgt:`INTERFACE_SYSTEM_INCLUDE_DIRECTORIES` are not - affected, and will always be treated as ``SYSTEM`` include directories. + affected, and will always be treated as system include directories. For imported targets, this property defaults to true, which means that their :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` are treated -as ``SYSTEM`` by default. If their ``SYSTEM`` property is false, +as system directories by default. If their ``SYSTEM`` property is false, then their :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` will not be -treated as ``SYSTEM``, regardless of the value of the -:prop_tgt:`IMPORTED_NO_SYSTEM` property. +treated as system. Use the :prop_tgt:`EXPORT_NO_SYSTEM` property to change +how a target's ``SYSTEM`` property is set when it is installed. For non-imported targets, this target property is initialized from the :prop_dir:`SYSTEM` directory property when the target is created. diff --git a/Help/release/3.25.rst b/Help/release/3.25.rst index e76a308..dea8de8 100644 --- a/Help/release/3.25.rst +++ b/Help/release/3.25.rst @@ -159,9 +159,10 @@ Properties Modules ------- -* The :module:`FetchContent` module :command:`FetchContent_Declare` - command gained a ``SYSTEM`` option to enable the :prop_dir:`SYSTEM` - directory property in the subdirectory. +* The :module:`FetchContent` module's :command:`FetchContent_Declare` + command gained a ``SYSTEM`` option which sets the :prop_dir:`SYSTEM` + directory property on subdirectories created by + :command:`FetchContent_MakeAvailable`. * The :module:`FindCUDAToolkit` module now provides a target for :ref:`nvtx3 <cuda_toolkit_nvtx3>` for CUDA 10.0+, which supersedes diff --git a/Help/release/dev/configure-log.rst b/Help/release/dev/configure-log.rst index 8518b21..34b8fb3 100644 --- a/Help/release/dev/configure-log.rst +++ b/Help/release/dev/configure-log.rst @@ -3,3 +3,6 @@ Configure Log * CMake now writes a YAML log of configure-time checks. See the :manual:`cmake-configure-log(7)` manual. + +* The :manual:`cmake-file-api(7)` gained a new "configureLog" object kind + that enables stable access to the :manual:`cmake-configure-log(7)`. diff --git a/Help/release/dev/frontend-variant-always.rst b/Help/release/dev/frontend-variant-always.rst new file mode 100644 index 0000000..111175c --- /dev/null +++ b/Help/release/dev/frontend-variant-always.rst @@ -0,0 +1,6 @@ +frontend-variant-always +----------------------- + +* The :variable:`CMAKE_<LANG>_COMPILER_FRONTEND_VARIANT` variable is now + set for ``GNU``, ``MSVC``, and ``AppleClang`` compilers that have only + one frontend variant. diff --git a/Help/variable/CMAKE_LANG_COMPILER_FRONTEND_VARIANT.rst b/Help/variable/CMAKE_LANG_COMPILER_FRONTEND_VARIANT.rst index 128b1fb..a414463 100644 --- a/Help/variable/CMAKE_LANG_COMPILER_FRONTEND_VARIANT.rst +++ b/Help/variable/CMAKE_LANG_COMPILER_FRONTEND_VARIANT.rst @@ -16,3 +16,7 @@ the compiler whose frontend it resembles. .. note:: In other words, this variable describes what command line options and language extensions the compiler frontend expects. + +.. versionchanged:: 3.26 + This variable is set for ``GNU``, ``MSVC``, and ``AppleClang`` + compilers that have only one frontend variant. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 73c775a..7f392c8 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -243,8 +243,12 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) else() set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "GNU") endif() - elseif("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xFujitsuClang") + elseif("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xGNU" + OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xAppleClang" + OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xFujitsuClang") set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "GNU") + elseif("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xMSVC") + set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "MSVC") else() set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "") endif() diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index c9f1a09..9c828b4 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -233,12 +233,12 @@ Commands .. versionadded:: 3.25 ``SYSTEM`` - If the ``SYSTEM`` argument is provided, targets created by - the dependency will have their :prop_tgt:`SYSTEM` property - set to true when populated by :command:`FetchContent_MakeAvailable`. - The entries in their :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` - will be treated as ``SYSTEM`` include directories when - compiling consumers. + If the ``SYSTEM`` argument is provided, the :prop_dir:`SYSTEM` directory + property of a subdirectory added by + :command:`FetchContent_MakeAvailable` will be set to true. This will + affect non-imported targets created as part of that command. + See the :prop_tgt:`SYSTEM` target property documentation for a more + detailed discussion of the effects. .. command:: FetchContent_MakeAvailable @@ -353,6 +353,11 @@ Commands adding a project that contains a ``CMakeLists.txt`` file in its top directory. + .. versionadded:: 3.25 + If the ``SYSTEM`` keyword was included in the call to + :command:`FetchContent_Declare`, the ``SYSTEM`` keyword will be + added to the :command:`add_subdirectory` command as well. + Projects should aim to declare the details of all dependencies they might use before they call ``FetchContent_MakeAvailable()`` for any of them. This ensures that if any of the dependencies are also sub-dependencies of diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 0cea239..72a9a4c 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1380,7 +1380,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_TIMER_DEPENDENCIES chrono) set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.81.0 AND NOT Boost_NO_WARN_NEW_VERSIONS) + if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.82.0 AND NOT Boost_NO_WARN_NEW_VERSIONS) message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets") endif() endif() @@ -1466,6 +1466,7 @@ function(_Boost_COMPONENT_HEADERS component _hdrs) set(_Boost_TIMER_HEADERS "boost/timer.hpp") set(_Boost_TYPE_ERASURE_HEADERS "boost/type_erasure/config.hpp") set(_Boost_UNIT_TEST_FRAMEWORK_HEADERS "boost/test/framework.hpp") + set(_Boost_URL_HEADERS "boost/url.hpp") set(_Boost_WAVE_HEADERS "boost/wave.hpp") set(_Boost_WSERIALIZATION_HEADERS "boost/archive/text_wiarchive.hpp") set(_Boost_BZIP2_HEADERS "boost/iostreams/filter/bzip2.hpp") @@ -1653,7 +1654,7 @@ else() # _Boost_COMPONENT_HEADERS. See the instructions at the top of # _Boost_COMPONENT_DEPENDENCIES. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.80.0" "1.80" "1.79.0" "1.79" + "1.81.0" "1.81" "1.80.0" "1.80" "1.79.0" "1.79" "1.78.0" "1.78" "1.77.0" "1.77" "1.76.0" "1.76" "1.75.0" "1.75" "1.74.0" "1.74" "1.73.0" "1.73" "1.72.0" "1.72" "1.71.0" "1.71" "1.70.0" "1.70" "1.69.0" "1.69" "1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 07a9adf..fe8f198 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -1187,7 +1187,7 @@ function(matlab_add_mex) ${${prefix}_UNPARSED_ARGUMENTS}) endif() - target_include_directories(${${prefix}_NAME} PRIVATE ${Matlab_INCLUDE_DIRS}) + target_include_directories(${${prefix}_NAME} SYSTEM PRIVATE ${Matlab_INCLUDE_DIRS}) if(NOT ${prefix}_NO_IMPLICIT_LINK_TO_MATLAB_LIBRARIES) if(Matlab_HAS_CPP_API) diff --git a/Modules/FindwxWindows.cmake b/Modules/FindwxWindows.cmake index 2d46dbd..15dacbb 100644 --- a/Modules/FindwxWindows.cmake +++ b/Modules/FindwxWindows.cmake @@ -648,7 +648,7 @@ else() # set CXXFLAGS to be fed into CMAKE_CXX_FLAGS by the user: if (HAVE_ISYSTEM) # does the compiler support -isystem ? - if (NOT APPLE) # -isystem seem sto be unsuppored on Mac + if (NOT APPLE) # -isystem seems to be unsupported on Mac if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX ) if (CMAKE_CXX_COMPILER MATCHES g\\+\\+) set(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags|sed -e s/-I/-isystem/g`") diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index e0e01f5..ca16bc2 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -8,7 +8,14 @@ UseSWIG This file provides support for ``SWIG``. It is assumed that :module:`FindSWIG` module has already been loaded. -Defines the following command for use with ``SWIG``: +.. only:: html + + .. contents:: + +CMake Commands +^^^^^^^^^^^^^^ + +The following command is defined for use with ``SWIG``: .. command:: swig_add_library @@ -125,20 +132,8 @@ Defines the following command for use with ``SWIG``: to prevent interference between targets or losing other important files, each target should have its own dedicated output directory. -.. command:: swig_link_libraries - - Link libraries to swig module:: - - swig_link_libraries(<name> <item>...) - - This command has same capabilities as :command:`target_link_libraries` - command. - - .. note:: - - If variable ``UseSWIG_TARGET_NAME_PREFERENCE`` is set to ``STANDARD``, this - command is deprecated and :command:`target_link_libraries` command must be - used instead. +Properties on Source Files +^^^^^^^^^^^^^^^^^^^^^^^^^^ Source file properties on module files **must** be set before the invocation of the ``swig_add_library`` command to specify special behavior of SWIG and @@ -233,6 +228,9 @@ ensure generated files will receive the required settings. other ways to define output file directory applies (see ``OUTFILE_DIR`` option of ``swig_add_library()`` command). +Properties on Targets +^^^^^^^^^^^^^^^^^^^^^ + Target library properties can be set to apply same configuration to all SWIG input files. @@ -271,6 +269,9 @@ input files. Add dependencies to all SWIG input files. +Read-only Target Properties +""""""""""""""""""""""""""" + The following target properties are output properties and can be used to get information about support files generated by ``SWIG`` interface compilation. @@ -303,6 +304,9 @@ information about support files generated by ``SWIG`` interface compilation. When source property ``OUTPUT_DIR`` is defined, multiple directories can be specified as part of ``SWIG_SUPPORT_FILES_DIRECTORY``. +CMake Variables +^^^^^^^^^^^^^^^ + Some variables can be set to customize the behavior of ``swig_add_library`` as well as ``SWIG``: @@ -361,6 +365,34 @@ as well as ``SWIG``: .. versionadded:: 3.22 Added the support of :ref:`Visual Studio Generators`. +Deprecated Commands +^^^^^^^^^^^^^^^^^^^ + +.. command:: swig_link_libraries + + .. deprecated:: 3.13 + Use :command:`target_link_libraries` with the standard target name, + or with ``${SWIG_MODULE_<name>_REAL_NAME}`` for legacy target naming. + + Link libraries to swig module:: + + swig_link_libraries(<name> <item>...) + + This command has same capabilities as :command:`target_link_libraries` + command. + + .. note:: + When policy :policy:`CMP0078` is set to ``NEW``, + :command:`swig_add_library` creates a standard target with the + specified ``<name>`` and :command:`target_link_libraries` must be used + instead of this command. + + With the legacy behavior (when :policy:`CMP0078` is set to ``OLD`` and + the ``UseSWIG_TARGET_NAME_PREFERENCE`` variable is set to ``"LEGACY"``, + or in CMake versions prior to 3.12), it is preferable to use + ``target_link_libraries(${SWIG_MODULE_<name>_REAL_NAME} ...)`` + instead of this command. + #]=======================================================================] cmake_policy(PUSH) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index db928fc..e99da49 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -237,6 +237,8 @@ add_library( cmFileAPICache.h cmFileAPICodemodel.cxx cmFileAPICodemodel.h + cmFileAPIConfigureLog.cxx + cmFileAPIConfigureLog.h cmFileAPICMakeFiles.cxx cmFileAPICMakeFiles.h cmFileAPIToolchains.cxx diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 75360e4..8aad0ae 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 25) -set(CMake_VERSION_PATCH 20221218) +set(CMake_VERSION_PATCH 20230112) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index a39c52f..643bc6f 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -165,7 +165,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) if (outstring) { *outstring = "--build-and-test requires that the generator " "be provided using the --build-generator " - "command line option. "; + "command line option.\n"; } return 1; } diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx index 69c5793..84161f9 100644 --- a/Source/CTest/cmCTestCurl.cxx +++ b/Source/CTest/cmCTestCurl.cxx @@ -112,7 +112,7 @@ bool cmCTestCurl::UploadFile(std::string const& local_file, { response.clear(); if (!this->InitCurl()) { - cmCTestLog(this->CTest, ERROR_MESSAGE, "Initialization of curl failed"); + cmCTestLog(this->CTest, ERROR_MESSAGE, "Initialization of curl failed\n"); return false; } /* enable uploading */ @@ -176,7 +176,7 @@ bool cmCTestCurl::UploadFile(std::string const& local_file, if (response.empty()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "No response from server.\n" - << curlDebug); + << curlDebug << std::endl); return false; } return true; @@ -192,7 +192,7 @@ bool cmCTestCurl::HttpRequest(std::string const& url, << "fields " << fields << "\n", this->Quiet); if (!this->InitCurl()) { - cmCTestLog(this->CTest, ERROR_MESSAGE, "Initialization of curl failed"); + cmCTestLog(this->CTest, ERROR_MESSAGE, "Initialization of curl failed\n"); return false; } curl_easy_setopt(this->Curl, CURLOPT_POST, 1); diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index 1c292c7..dd69968 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -26,13 +26,8 @@ namespace { * is non-null, otherwise removing key `op` (if it exists). */ void SetMapValue(cmCTestGenericHandler::t_StringToString& map, - const std::string& op, const char* value) + const std::string& op, const std::string& value) { - if (!value) { - map.erase(op); - return; - } - map[op] = value; } void SetMapValue(cmCTestGenericHandler::t_StringToString& map, @@ -47,7 +42,8 @@ void SetMapValue(cmCTestGenericHandler::t_StringToString& map, } } -void cmCTestGenericHandler::SetOption(const std::string& op, const char* value) +void cmCTestGenericHandler::SetOption(const std::string& op, + const std::string& value) { SetMapValue(this->Options, op, value); } @@ -57,7 +53,7 @@ void cmCTestGenericHandler::SetOption(const std::string& op, cmValue value) } void cmCTestGenericHandler::SetPersistentOption(const std::string& op, - const char* value) + const std::string& value) { this->SetOption(op, value); SetMapValue(this->PersistentOptions, op, value); @@ -121,7 +117,7 @@ bool cmCTestGenericHandler::StartResultingXML(cmCTest::Part part, if (!name) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create resulting XML file without providing the name" - << std::endl;); + << std::endl); return false; } std::ostringstream ostr; @@ -157,7 +153,7 @@ bool cmCTestGenericHandler::StartLogFile(const char* name, if (!name) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create log file without providing the name" - << std::endl;); + << std::endl); return false; } std::ostringstream ostr; diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index 4bdb9c2..a0197d6 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -85,17 +85,9 @@ public: * so calling a single-getter for a key that has only been set * as a multi-value will return nullptr. */ - void SetPersistentOption(const std::string& op, const char* value); - void SetPersistentOption(const std::string& op, const std::string& value) - { - this->SetPersistentOption(op, cmValue(value)); - } + void SetPersistentOption(const std::string& op, const std::string& value); void SetPersistentOption(const std::string& op, cmValue value); - void SetOption(const std::string& op, const char* value); - void SetOption(const std::string& op, const std::string& value) - { - this->SetOption(op, cmValue(value)); - } + void SetOption(const std::string& op, const std::string& value); void SetOption(const std::string& op, cmValue value); cmValue GetOption(const std::string& op); diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index be952cd..c377d68 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -143,7 +143,7 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args, "BuildDirectory", cmSystemTools::CollapseFullPath(bdir), this->Quiet); } else { cmCTestLog(this->CTest, ERROR_MESSAGE, - "CTEST_BINARY_DIRECTORY not set" << std::endl;); + "CTEST_BINARY_DIRECTORY not set" << std::endl); } } if (!this->Source.empty()) { @@ -164,7 +164,7 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args, this->CTest->SetCTestConfiguration("ChangeId", *changeId, this->Quiet); } - cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl;); + cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl); cmCTestGenericHandler* handler = this->InitializeHandler(); if (!handler) { cmCTestLog(this->CTest, ERROR_MESSAGE, diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index f60a1e9..b00fa73 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -410,7 +410,8 @@ cmCTest::Part cmCTest::GetPartFromName(const std::string& name) return PartCount; } -int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) +int cmCTest::Initialize(const std::string& binary_dir, + cmCTestStartCommand* command) { bool quiet = false; if (command && command->ShouldBeQuiet()) { @@ -683,7 +684,7 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) this->SetCTestConfigurationFromCMakeVariable( mf, "BuildName", "CTEST_BUILD_NAME", command->ShouldBeQuiet()); - if (!this->Initialize(bld_dir.c_str(), command)) { + if (!this->Initialize(bld_dir, command)) { return false; } cmCTestOptionalLog(this, OUTPUT, @@ -943,8 +944,7 @@ int cmCTest::ProcessSteps() (this->GetRemainingTimeAllowed() > std::chrono::minutes(2))) { cmCTestUpdateHandler* uphandler = this->GetUpdateHandler(); uphandler->SetPersistentOption( - "SourceDirectory", - this->GetCTestConfiguration("SourceDirectory").c_str()); + "SourceDirectory", this->GetCTestConfiguration("SourceDirectory")); update_count = uphandler->ProcessHandler(); if (update_count < 0) { res |= cmCTest::UPDATE_ERRORS; @@ -1691,7 +1691,7 @@ bool cmCTest::SubmitExtraFiles(std::vector<std::string> const& files) if (!cmSystemTools::FileExists(file)) { cmCTestLog(this, ERROR_MESSAGE, "Cannot find extra file: " << file << " to submit." - << std::endl;); + << std::endl); return false; } this->AddSubmitFile(PartExtraFiles, file); @@ -2139,9 +2139,9 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, i < args.size() - 1) { i++; this->GetTestHandler()->SetPersistentOption("TestsToRunInformation", - args[i].c_str()); + args[i]); this->GetMemCheckHandler()->SetPersistentOption("TestsToRunInformation", - args[i].c_str()); + args[i]); } else if (this->CheckArgument(arg, "-U"_s, "--union")) { this->GetTestHandler()->SetPersistentOption("UseUnion", "true"); this->GetMemCheckHandler()->SetPersistentOption("UseUnion", "true"); @@ -2149,9 +2149,9 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, i < args.size() - 1) { i++; this->GetTestHandler()->SetPersistentOption("IncludeRegularExpression", - args[i].c_str()); + args[i]); this->GetMemCheckHandler()->SetPersistentOption("IncludeRegularExpression", - args[i].c_str()); + args[i]); } else if (this->CheckArgument(arg, "-L"_s, "--label-regex") && i < args.size() - 1) { i++; @@ -2172,41 +2172,40 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, i < args.size() - 1) { i++; this->GetTestHandler()->SetPersistentOption("ExcludeRegularExpression", - args[i].c_str()); + args[i]); this->GetMemCheckHandler()->SetPersistentOption("ExcludeRegularExpression", - args[i].c_str()); + args[i]); } else if (this->CheckArgument(arg, "-FA"_s, "--fixture-exclude-any") && i < args.size() - 1) { i++; this->GetTestHandler()->SetPersistentOption( - "ExcludeFixtureRegularExpression", args[i].c_str()); + "ExcludeFixtureRegularExpression", args[i]); this->GetMemCheckHandler()->SetPersistentOption( - "ExcludeFixtureRegularExpression", args[i].c_str()); + "ExcludeFixtureRegularExpression", args[i]); } else if (this->CheckArgument(arg, "-FS"_s, "--fixture-exclude-setup") && i < args.size() - 1) { i++; this->GetTestHandler()->SetPersistentOption( - "ExcludeFixtureSetupRegularExpression", args[i].c_str()); + "ExcludeFixtureSetupRegularExpression", args[i]); this->GetMemCheckHandler()->SetPersistentOption( - "ExcludeFixtureSetupRegularExpression", args[i].c_str()); + "ExcludeFixtureSetupRegularExpression", args[i]); } else if (this->CheckArgument(arg, "-FC"_s, "--fixture-exclude-cleanup") && i < args.size() - 1) { i++; this->GetTestHandler()->SetPersistentOption( - "ExcludeFixtureCleanupRegularExpression", args[i].c_str()); + "ExcludeFixtureCleanupRegularExpression", args[i]); this->GetMemCheckHandler()->SetPersistentOption( - "ExcludeFixtureCleanupRegularExpression", args[i].c_str()); + "ExcludeFixtureCleanupRegularExpression", args[i]); } else if (this->CheckArgument(arg, "--resource-spec-file"_s) && i < args.size() - 1) { i++; - this->GetTestHandler()->SetPersistentOption("ResourceSpecFile", - args[i].c_str()); + this->GetTestHandler()->SetPersistentOption("ResourceSpecFile", args[i]); this->GetMemCheckHandler()->SetPersistentOption("ResourceSpecFile", - args[i].c_str()); + args[i]); } else if (this->CheckArgument(arg, "--rerun-failed"_s)) { @@ -2314,8 +2313,8 @@ void cmCTest::SetPersistentOptionIfNotEmpty(const std::string& value, const std::string& optionName) { if (!value.empty()) { - this->GetTestHandler()->SetPersistentOption(optionName, value.c_str()); - this->GetMemCheckHandler()->SetPersistentOption(optionName, value.c_str()); + this->GetTestHandler()->SetPersistentOption(optionName, value); + this->GetMemCheckHandler()->SetPersistentOption(optionName, value); } } @@ -2758,8 +2757,9 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output) // intended for (auto& handler : this->Impl->GetTestingHandlers()) { if (!handler->ProcessCommandLineArguments(arg, i, args)) { - cmCTestLog(this, ERROR_MESSAGE, - "Problem parsing command line arguments within a handler"); + cmCTestLog( + this, ERROR_MESSAGE, + "Problem parsing command line arguments within a handler\n"); return 0; } } @@ -2903,7 +2903,7 @@ int cmCTest::ExecuteTests() } } - if (!this->Initialize(workDir.c_str(), nullptr)) { + if (!this->Initialize(workDir, nullptr)) { res = 12; cmCTestLog(this, ERROR_MESSAGE, "Problem initializing the dashboard." << std::endl); diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 0017b3e..9a8d5a6 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -481,7 +481,7 @@ private: * call this method because it sets CTEST_COMMAND to drive a build * through the ctest command line. */ - int Initialize(const char* binary_dir, cmCTestStartCommand* command); + int Initialize(const std::string& binary_dir, cmCTestStartCommand* command); /** parse the option after -D and convert it into the appropriate steps */ bool AddTestsForDashboardType(std::string& targ); diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 044f69f..6cfdf62 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -368,7 +368,7 @@ cmComputeLinkInformation::cmComputeLinkInformation( LibraryFeatureDescriptor{ "__CMAKE_LINK_EXECUTABLE", cmStrCat(this->LoaderFlag, "<LIBRARY>") }); } - // To link framewortk using a full path + // To link framework using a full path this->LibraryFeatureDescriptors.emplace( "__CMAKE_LINK_FRAMEWORK", LibraryFeatureDescriptor{ "__CMAKE_LINK_FRAMEWORK", "<LIBRARY>" }); diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 25a0e2d..2a4ea80 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -7,6 +7,7 @@ #include <cstring> #include <set> #include <sstream> +#include <type_traits> #include <utility> #include <cm/string_view> @@ -1131,7 +1132,7 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode( result.VariableCached = !arguments.NoCache; result.Output = std::move(output); result.ExitCode = res; - return result; + return cm::optional<cmTryCompileResult>(std::move(result)); } bool cmCoreTryCompile::IsTemporary(std::string const& path) diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx index 3fc2179..d1d3d25 100644 --- a/Source/cmFileAPI.cxx +++ b/Source/cmFileAPI.cxx @@ -18,6 +18,7 @@ #include "cmFileAPICMakeFiles.h" #include "cmFileAPICache.h" #include "cmFileAPICodemodel.h" +#include "cmFileAPIConfigureLog.h" #include "cmFileAPIToolchains.h" #include "cmGlobalGenerator.h" #include "cmStringAlgorithms.h" @@ -66,6 +67,26 @@ void cmFileAPI::ReadQueries() } } +std::vector<unsigned long> cmFileAPI::GetConfigureLogVersions() +{ + std::vector<unsigned long> versions; + auto getConfigureLogVersions = [&versions](Query const& q) { + for (Object const& o : q.Known) { + if (o.Kind == ObjectKind::ConfigureLog) { + versions.emplace_back(o.Version); + } + } + }; + getConfigureLogVersions(this->TopQuery); + for (auto const& client : this->ClientQueries) { + getConfigureLogVersions(client.second.DirQuery); + } + std::sort(versions.begin(), versions.end()); + versions.erase(std::unique(versions.begin(), versions.end()), + versions.end()); + return versions; +} + void cmFileAPI::WriteReplies() { if (this->QueryExists) { @@ -241,6 +262,17 @@ bool cmFileAPI::ReadQuery(std::string const& query, objects.push_back(o); return true; } + if (kindName == ObjectKindName(ObjectKind::ConfigureLog)) { + Object o; + o.Kind = ObjectKind::ConfigureLog; + if (verStr == "v1") { + o.Version = 1; + } else { + return false; + } + objects.push_back(o); + return true; + } if (kindName == ObjectKindName(ObjectKind::Cache)) { Object o; o.Kind = ObjectKind::Cache; @@ -411,11 +443,12 @@ const char* cmFileAPI::ObjectKindName(ObjectKind kind) { // Keep in sync with ObjectKind enum. static const char* objectKindNames[] = { - "codemodel", // - "cache", // - "cmakeFiles", // - "toolchains", // - "__test" // + "codemodel", // + "configureLog", // + "cache", // + "cmakeFiles", // + "toolchains", // + "__test" // }; return objectKindNames[static_cast<size_t>(kind)]; } @@ -442,6 +475,9 @@ Json::Value cmFileAPI::BuildObject(Object const& object) case ObjectKind::CodeModel: value = this->BuildCodeModel(object); break; + case ObjectKind::ConfigureLog: + value = this->BuildConfigureLog(object); + break; case ObjectKind::Cache: value = this->BuildCache(object); break; @@ -503,6 +539,8 @@ cmFileAPI::ClientRequest cmFileAPI::BuildClientRequest( if (kindName == this->ObjectKindName(ObjectKind::CodeModel)) { r.Kind = ObjectKind::CodeModel; + } else if (kindName == this->ObjectKindName(ObjectKind::ConfigureLog)) { + r.Kind = ObjectKind::ConfigureLog; } else if (kindName == this->ObjectKindName(ObjectKind::Cache)) { r.Kind = ObjectKind::Cache; } else if (kindName == this->ObjectKindName(ObjectKind::CMakeFiles)) { @@ -530,6 +568,9 @@ cmFileAPI::ClientRequest cmFileAPI::BuildClientRequest( case ObjectKind::CodeModel: this->BuildClientRequestCodeModel(r, versions); break; + case ObjectKind::ConfigureLog: + this->BuildClientRequestConfigureLog(r, versions); + break; case ObjectKind::Cache: this->BuildClientRequestCache(r, versions); break; @@ -719,6 +760,41 @@ Json::Value cmFileAPI::BuildCodeModel(Object const& object) return codemodel; } +// The "configureLog" object kind. + +// Update Help/manual/cmake-file-api.7.rst when updating this constant. +static unsigned int const ConfigureLogV1Minor = 0; + +void cmFileAPI::BuildClientRequestConfigureLog( + ClientRequest& r, std::vector<RequestVersion> const& versions) +{ + // Select a known version from those requested. + for (RequestVersion const& v : versions) { + if ((v.Major == 1 && v.Minor <= ConfigureLogV1Minor)) { + r.Version = v.Major; + break; + } + } + if (!r.Version) { + r.Error = NoSupportedVersion(versions); + } +} + +Json::Value cmFileAPI::BuildConfigureLog(Object const& object) +{ + Json::Value configureLog = cmFileAPIConfigureLogDump(*this, object.Version); + configureLog["kind"] = this->ObjectKindName(object.Kind); + + Json::Value& version = configureLog["version"]; + if (object.Version == 1) { + version = BuildVersion(1, ConfigureLogV1Minor); + } else { + return configureLog; // should be unreachable + } + + return configureLog; +} + // The "cache" object kind. static unsigned int const CacheV2Minor = 0; @@ -870,6 +946,14 @@ Json::Value cmFileAPI::ReportCapabilities() { Json::Value request = Json::objectValue; + request["kind"] = ObjectKindName(ObjectKind::ConfigureLog); + Json::Value& versions = request["version"] = Json::arrayValue; + versions.append(BuildVersion(1, ConfigureLogV1Minor)); + requests.append(std::move(request)); // NOLINT(*) + } + + { + Json::Value request = Json::objectValue; request["kind"] = ObjectKindName(ObjectKind::Cache); Json::Value& versions = request["version"] = Json::arrayValue; versions.append(BuildVersion(2, CacheV2Minor)); diff --git a/Source/cmFileAPI.h b/Source/cmFileAPI.h index 22302b4..6d7678f 100644 --- a/Source/cmFileAPI.h +++ b/Source/cmFileAPI.h @@ -24,6 +24,9 @@ public: /** Read fileapi queries from disk. */ void ReadQueries(); + /** Get the list of configureLog object kind versions requested. */ + std::vector<unsigned long> GetConfigureLogVersions(); + /** Write fileapi replies to disk. */ void WriteReplies(); @@ -54,6 +57,7 @@ private: enum class ObjectKind { CodeModel, + ConfigureLog, Cache, CMakeFiles, Toolchains, @@ -193,6 +197,10 @@ private: ClientRequest& r, std::vector<RequestVersion> const& versions); Json::Value BuildCodeModel(Object const& object); + void BuildClientRequestConfigureLog( + ClientRequest& r, std::vector<RequestVersion> const& versions); + Json::Value BuildConfigureLog(Object const& object); + void BuildClientRequestCache(ClientRequest& r, std::vector<RequestVersion> const& versions); Json::Value BuildCache(Object const& object); diff --git a/Source/cmFileAPIConfigureLog.cxx b/Source/cmFileAPIConfigureLog.cxx new file mode 100644 index 0000000..50189cb --- /dev/null +++ b/Source/cmFileAPIConfigureLog.cxx @@ -0,0 +1,67 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmFileAPIConfigureLog.h" + +#include <cm3p/json/value.h> + +#include "cmFileAPI.h" +#include "cmStringAlgorithms.h" +#include "cmake.h" + +namespace { + +class ConfigureLog +{ + cmFileAPI& FileAPI; + unsigned long Version; + + Json::Value DumpPath(); + Json::Value DumpEventKindNames(); + +public: + ConfigureLog(cmFileAPI& fileAPI, unsigned long version); + Json::Value Dump(); +}; + +ConfigureLog::ConfigureLog(cmFileAPI& fileAPI, unsigned long version) + : FileAPI(fileAPI) + , Version(version) +{ + static_cast<void>(this->Version); +} + +Json::Value ConfigureLog::Dump() +{ + Json::Value configureLog = Json::objectValue; + configureLog["path"] = this->DumpPath(); + configureLog["eventKindNames"] = this->DumpEventKindNames(); + return configureLog; +} + +Json::Value ConfigureLog::DumpPath() +{ + return cmStrCat(this->FileAPI.GetCMakeInstance()->GetHomeOutputDirectory(), + "/CMakeFiles/CMakeConfigureLog.yaml"); +} + +Json::Value ConfigureLog::DumpEventKindNames() +{ + // Report at most one version of each event kind. + // If a new event kind is added, increment ConfigureLogV1Minor. + // If a new version of an existing event kind is added, a new + // major version of the configureLog object kind is needed. + Json::Value eventKindNames = Json::arrayValue; + if (this->Version == 1) { + eventKindNames.append("try_compile-v1"); // WriteTryCompileEvent + eventKindNames.append("try_run-v1"); // WriteTryRunEvent + } + return eventKindNames; +} +} + +Json::Value cmFileAPIConfigureLogDump(cmFileAPI& fileAPI, + unsigned long version) +{ + ConfigureLog configureLog(fileAPI, version); + return configureLog.Dump(); +} diff --git a/Source/cmFileAPIConfigureLog.h b/Source/cmFileAPIConfigureLog.h new file mode 100644 index 0000000..deaa403 --- /dev/null +++ b/Source/cmFileAPIConfigureLog.h @@ -0,0 +1,12 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#pragma once + +#include "cmConfigure.h" // IWYU pragma: keep + +#include <cm3p/json/value.h> + +class cmFileAPI; + +extern Json::Value cmFileAPIConfigureLogDump(cmFileAPI& fileAPI, + unsigned long version); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 7ecdd87..d0d339d 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -4856,13 +4856,10 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetStaticLibraryLinkOptions( EvaluatedTargetPropertyEntries entries; if (cmValue linkOptions = this->GetProperty("STATIC_LIBRARY_OPTIONS")) { - std::vector<std::string> options = cmExpandedList(*linkOptions); - for (const auto& option : options) { - std::unique_ptr<TargetPropertyEntry> entry = CreateTargetPropertyEntry( - *this->LocalGenerator->GetCMakeInstance(), option); - entries.Entries.emplace_back(EvaluateTargetPropertyEntry( - this, config, language, &dagChecker, *entry)); - } + std::unique_ptr<TargetPropertyEntry> entry = CreateTargetPropertyEntry( + *this->LocalGenerator->GetCMakeInstance(), *linkOptions); + entries.Entries.emplace_back(EvaluateTargetPropertyEntry( + this, config, language, &dagChecker, *entry)); } processOptions(this, entries, result, uniqueOptions, false, "static library link options", OptionsParse::Shell); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 4ebf9f6..66ab752 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -371,7 +371,7 @@ public: that is a framework. */ bool NameResolvesToFramework(const std::string& libname) const; /** Split a framework path to the directory and name of the framework as well - * as optiona; suffix. + * as optional suffix. * Returns std::nullopt if the path does not match with framework format * when extendedFormat is true, required format is relaxed (i.e. extension * `.framework' is optional). Used when FRAMEWORK link feature is diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx index eff21cc..c70c03e 100644 --- a/Source/cmTryCompileCommand.cxx +++ b/Source/cmTryCompileCommand.cxx @@ -21,6 +21,7 @@ namespace { void WriteTryCompileEvent(cmConfigureLog& log, cmMakefile const& mf, cmTryCompileResult const& compileResult) { + // Keep in sync with cmFileAPIConfigureLog's DumpEventKindNames. static const std::vector<unsigned long> LogVersionsWithTryCompileV1{ 1 }; if (log.IsAnyLogVersionEnabled(LogVersionsWithTryCompileV1)) { diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index 63e4478..86c9679 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -40,6 +40,7 @@ void WriteTryRunEvent(cmConfigureLog& log, cmMakefile const& mf, cmTryCompileResult const& compileResult, cmTryRunResult const& runResult) { + // Keep in sync with cmFileAPIConfigureLog's DumpEventKindNames. static const std::vector<unsigned long> LogVersionsWithTryRunV1{ 1 }; if (log.IsAnyLogVersionEnabled(LogVersionsWithTryRunV1)) { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ee63909..0d947a5 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2429,7 +2429,7 @@ int cmake::ActualConfigure() this->TruncateOutputLog("CMakeConfigureLog.yaml"); this->ConfigureLog = cm::make_unique<cmConfigureLog>( cmStrCat(this->GetHomeOutputDirectory(), "/CMakeFiles"_s), - std::vector<unsigned long>()); + this->FileAPI->GetConfigureLogVersions()); } #endif diff --git a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt index 969d8be..597dbd4 100644 --- a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt +++ b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt @@ -1 +1 @@ -^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":5}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]},{"kind":"toolchains","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":false,"tls":(true|false),"version":{.*}}$ +^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":5}]},{"kind":"configureLog","version":\[{"major":1,"minor":0}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]},{"kind":"toolchains","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":false,"tls":(true|false),"version":{.*}}$ diff --git a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake index 961b73a..c768d18 100644 --- a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake +++ b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake @@ -65,6 +65,7 @@ function(run_object object) endfunction() run_object(codemodel-v2) +run_object(configureLog-v1) run_object(cache-v2) run_object(cmakeFiles-v1) run_object(toolchains-v1) diff --git a/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateful-check.cmake b/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateful-check.cmake new file mode 100644 index 0000000..bd4081c --- /dev/null +++ b/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateful-check.cmake @@ -0,0 +1,11 @@ +set(expect + query + query/client-foo + query/client-foo/query.json + reply + reply/configureLog-v1-[0-9a-f]+.json + reply/index-[0-9.T-]+.json + ) +check_api("^${expect}$") + +check_python(configureLog-v1) diff --git a/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateful-prep.cmake b/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateful-prep.cmake new file mode 100644 index 0000000..c443487 --- /dev/null +++ b/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateful-prep.cmake @@ -0,0 +1,4 @@ +file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/query) +file(WRITE "${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/query/client-foo/query.json" [[ + { "requests": [ { "kind": "configureLog", "version" : 1 } ] } +]]) diff --git a/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateless-check.cmake b/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateless-check.cmake new file mode 100644 index 0000000..7498dd5 --- /dev/null +++ b/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateless-check.cmake @@ -0,0 +1,11 @@ +set(expect + query + query/client-foo + query/client-foo/configureLog-v1 + reply + reply/configureLog-v1-[0-9a-f]+.json + reply/index-[0-9.T-]+.json + ) +check_api("^${expect}$") + +check_python(configureLog-v1) diff --git a/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateless-prep.cmake b/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateless-prep.cmake new file mode 100644 index 0000000..ad49e08 --- /dev/null +++ b/Tests/RunCMake/FileAPI/configureLog-v1-ClientStateless-prep.cmake @@ -0,0 +1,2 @@ +file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/query) +file(WRITE "${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/query/client-foo/configureLog-v1" "") diff --git a/Tests/RunCMake/FileAPI/configureLog-v1-SharedStateless-check.cmake b/Tests/RunCMake/FileAPI/configureLog-v1-SharedStateless-check.cmake new file mode 100644 index 0000000..3e34be6 --- /dev/null +++ b/Tests/RunCMake/FileAPI/configureLog-v1-SharedStateless-check.cmake @@ -0,0 +1,10 @@ +set(expect + query + query/configureLog-v1 + reply + reply/configureLog-v1-[0-9a-f]+.json + reply/index-[0-9.T-]+.json + ) +check_api("^${expect}$") + +check_python(configureLog-v1) diff --git a/Tests/RunCMake/FileAPI/configureLog-v1-SharedStateless-prep.cmake b/Tests/RunCMake/FileAPI/configureLog-v1-SharedStateless-prep.cmake new file mode 100644 index 0000000..6fe0037 --- /dev/null +++ b/Tests/RunCMake/FileAPI/configureLog-v1-SharedStateless-prep.cmake @@ -0,0 +1,2 @@ +file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/query) +file(WRITE "${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/query/configureLog-v1" "") diff --git a/Tests/RunCMake/FileAPI/configureLog-v1-check.py b/Tests/RunCMake/FileAPI/configureLog-v1-check.py new file mode 100644 index 0000000..ea5beb4 --- /dev/null +++ b/Tests/RunCMake/FileAPI/configureLog-v1-check.py @@ -0,0 +1,21 @@ +from check_index import * +import os + +def check_objects(o): + assert is_list(o) + assert len(o) == 1 + check_index_object(o[0], "configureLog", 1, 0, check_object_configureLog) + +def check_object_configureLog(o): + assert sorted(o.keys()) == ["eventKindNames", "kind", "path", "version"] + # The "kind" and "version" members are handled by check_index_object. + path = o["path"] + assert matches(path, "^.*/CMakeFiles/CMakeConfigureLog\\.yaml$") + assert os.path.exists(path) + eventKindNames = o["eventKindNames"] + assert is_list(eventKindNames) + assert sorted(eventKindNames) == ["try_compile-v1", "try_run-v1"] + +assert is_dict(index) +assert sorted(index.keys()) == ["cmake", "objects", "reply"] +check_objects(index["objects"]) diff --git a/Tests/RunCMake/FileAPI/configureLog-v1.cmake b/Tests/RunCMake/FileAPI/configureLog-v1.cmake new file mode 100644 index 0000000..c00af08 --- /dev/null +++ b/Tests/RunCMake/FileAPI/configureLog-v1.cmake @@ -0,0 +1 @@ +enable_language(C) diff --git a/Utilities/cmzlib/cm_zlib_mangle.h b/Utilities/cmzlib/cm_zlib_mangle.h index 1461e2f..d75405d 100644 --- a/Utilities/cmzlib/cm_zlib_mangle.h +++ b/Utilities/cmzlib/cm_zlib_mangle.h @@ -19,7 +19,7 @@ # define compress2 cm_zlib_compress2 # define compressBound cm_zlib_compressBound #endif -#define crc32 z_crc32 +#define crc32 cm_zlib_crc32 #define crc32_combine cm_zlib_crc32_combine #define crc32_combine64 cm_zlib_crc32_combine64 #define crc32_z cm_zlib_crc32_z @@ -126,7 +126,6 @@ #define crc32_combine_gen cm_zlib_crc32_combine_gen #define crc32_combine_op cm_zlib_crc32_combine_op #define gz_error cm_zlib_gz_error -#define z_crc32 cm_zlib_z_crc32 #define z_errmsg cm_zlib_z_errmsg #endif |