diff --git a/.gitattributes b/.gitattributes index d414c68fa57..3cf1b86fb8a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,6 +6,7 @@ .editorconfig export-ignore .pre-commit-config.yaml export-ignore .typos.toml export-ignore +sgconfig.yml export-ignore # Custom attribute to mark sources as using our C code style. [attr]our-c-style whitespace=tab-in-indent format.clang-format=18 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b9097c6714c..fc49cb84344 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1625,7 +1625,7 @@ b:windows-x86_64-package: - .windows_x86_64_package - .cmake_build_windows - .cmake_build_package_artifacts - - .windows_x86_64_tags_nonconcurrent_vs2026 + - .windows_x86_64_tags_nonconcurrent_vs2022_msvc14.44 - .run_only_for_package needs: - p:doc-package @@ -1656,7 +1656,7 @@ b:windows-i386-package: - .windows_i386_package - .cmake_build_windows - .cmake_build_package_artifacts - - .windows_x86_64_tags_nonconcurrent_vs2026 + - .windows_x86_64_tags_nonconcurrent_vs2022_msvc14.44 - .run_only_for_package needs: - p:doc-package diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index e90a2459a2f..2317e5f9617 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -390,6 +390,7 @@ image: "kitware/cmake:ci-nvhpc24.9-x86_64-2024-09-27" variables: CMAKE_ARCH: x86_64 + CMAKE_CUDA_ARCHITECTURES_NATIVE_CLAMP: 1 .nvhpc_ninja: extends: .nvhpc diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml index c0f97abba7d..c8aaec62c60 100644 --- a/.gitlab/os-macos.yml +++ b/.gitlab/os-macos.yml @@ -7,9 +7,7 @@ GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci ext/$CI_CONCURRENT_ID" # TODO: Factor this out so that each job selects the Xcode version to # use so that different versions can be tested in a single pipeline. - DEVELOPER_DIR: "/Applications/Xcode-26.1.app/Contents/Developer" - # Avoid conflicting with other projects running on the same machine. - SCCACHE_SERVER_PORT: 4227 + DEVELOPER_DIR: "/Applications/Xcode-26.2.app/Contents/Developer" ### Build and test @@ -145,7 +143,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos-x86_64 - shell - - xcode-26.1 + - xcode-26.2 - nonconcurrent .macos_x86_64_tags_ext: @@ -153,7 +151,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos-x86_64 - shell - - xcode-26.1 + - xcode-26.2 - concurrent .macos_arm64_tags: @@ -161,7 +159,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos-arm64 - shell - - xcode-26.1 + - xcode-26.2 - nonconcurrent .macos_arm64_tags_ext: @@ -169,7 +167,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos-arm64 - shell - - xcode-26.1 + - xcode-26.2 - concurrent .macos_arm64_tags_package: @@ -177,7 +175,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos-arm64 - shell - - xcode-26.1 + - xcode-26.2 - nonconcurrent - finder diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml index 3b19d4c741d..1fed1770cbf 100644 --- a/.gitlab/os-windows.yml +++ b/.gitlab/os-windows.yml @@ -5,8 +5,6 @@ .windows: variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR\\cmake ci ext\\$CI_CONCURRENT_ID" - # Avoid conflicting with other projects running on the same machine. - SCCACHE_SERVER_PORT: 4227 ### Build and test @@ -43,6 +41,12 @@ VCVARSPLATFORM: "x64" VCVARSVERSION: "14.44.35207" +.windows_vcvarsall_vs2022_x86_msvc14.44: + variables: + VCVARSALL: "${VS170COMNTOOLS}\\..\\..\\VC\\Auxiliary\\Build\\vcvarsall.bat" + VCVARSPLATFORM: "x86" + VCVARSVERSION: "14.44.35207" + .windows_vcvarsall_vs2026_x64: variables: VCVARSALL: "${VS180COMNTOOLS}\\..\\..\\VC\\Auxiliary\\Build\\vcvarsall.bat" @@ -101,7 +105,7 @@ .windows_x86_64_package: extends: - .windows_package - - .windows_vcvarsall_vs2026_x64 + - .windows_vcvarsall_vs2022_x64_msvc14.44 variables: CMAKE_CONFIGURATION: windows_x86_64_package @@ -109,7 +113,7 @@ .windows_i386_package: extends: - .windows_package - - .windows_vcvarsall_vs2026_x86 + - .windows_vcvarsall_vs2022_x86_msvc14.44 variables: CMAKE_CONFIGURATION: windows_i386_package @@ -403,6 +407,15 @@ - msvc-14.50 - concurrent +.windows_x86_64_tags_nonconcurrent_vs2022_msvc14.44: + tags: + - cmake # Since this is a bare runner, pin to a project. + - windows-x86_64 + - shell + - vs2022 + - msvc-14.44 + - nonconcurrent + .windows_x86_64_tags_concurrent_vs2022_msvc14.44: tags: - cmake # Since this is a bare runner, pin to a project. diff --git a/CMakeLists.txt b/CMakeLists.txt index 42903e8262c..f26b2287982 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,81 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) endif() set(CMake_BIN_DIR ${CMake_BINARY_DIR}/bin) + + include(CMakeDependentOption) + + # Allow the user to enable/disable all system utility library options by + # defining CMAKE_USE_SYSTEM_LIBRARIES or CMAKE_USE_SYSTEM_LIBRARY_${util}. + set(UTILITIES BZIP2 CPPDAP CURL EXPAT FORM JSONCPP LIBARCHIVE LIBLZMA LIBRHASH LIBUV NGHTTP2 ZLIB ZSTD) + foreach(util IN LISTS UTILITIES) + if(NOT DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util} + AND DEFINED CMAKE_USE_SYSTEM_LIBRARIES) + set(CMAKE_USE_SYSTEM_LIBRARY_${util} "${CMAKE_USE_SYSTEM_LIBRARIES}") + endif() + if(DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util}) + if(CMAKE_USE_SYSTEM_LIBRARY_${util}) + set(CMAKE_USE_SYSTEM_LIBRARY_${util} ON) + else() + set(CMAKE_USE_SYSTEM_LIBRARY_${util} OFF) + endif() + if(CMAKE_BOOTSTRAP) + unset(CMAKE_USE_SYSTEM_LIBRARY_${util} CACHE) + endif() + string(TOLOWER "${util}" lutil) + set(CMAKE_USE_SYSTEM_${util} "${CMAKE_USE_SYSTEM_LIBRARY_${util}}" + CACHE BOOL "Use system-installed ${lutil}" FORCE) + elseif(util STREQUAL "CURL" AND APPLE) + # macOS provides a curl with backends configured by Apple. + set(CMAKE_USE_SYSTEM_LIBRARY_${util} ON) + else() + set(CMAKE_USE_SYSTEM_LIBRARY_${util} OFF) + endif() + endforeach() + if(CMAKE_BOOTSTRAP) + unset(CMAKE_USE_SYSTEM_LIBRARIES CACHE) + endif() + + # Optionally use system utility libraries. + option(CMAKE_USE_SYSTEM_LIBARCHIVE "Use system-installed libarchive" "${CMAKE_USE_SYSTEM_LIBRARY_LIBARCHIVE}") + if(CMake_ENABLE_DEBUGGER) + option(CMAKE_USE_SYSTEM_CPPDAP "Use system-installed cppdap" "${CMAKE_USE_SYSTEM_LIBRARY_CPPDAP}") + endif() + option(CMAKE_USE_SYSTEM_CURL "Use system-installed curl" "${CMAKE_USE_SYSTEM_LIBRARY_CURL}") + option(CMAKE_USE_SYSTEM_EXPAT "Use system-installed expat" "${CMAKE_USE_SYSTEM_LIBRARY_EXPAT}") + cmake_dependent_option(CMAKE_USE_SYSTEM_ZLIB "Use system-installed zlib" + "${CMAKE_USE_SYSTEM_LIBRARY_ZLIB}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE;NOT CMAKE_USE_SYSTEM_CURL" ON) + cmake_dependent_option(CMAKE_USE_SYSTEM_BZIP2 "Use system-installed bzip2" + "${CMAKE_USE_SYSTEM_LIBRARY_BZIP2}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON) + cmake_dependent_option(CMAKE_USE_SYSTEM_ZSTD "Use system-installed zstd" + "${CMAKE_USE_SYSTEM_LIBRARY_ZSTD}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON) + cmake_dependent_option(CMAKE_USE_SYSTEM_LIBLZMA "Use system-installed liblzma" + "${CMAKE_USE_SYSTEM_LIBRARY_LIBLZMA}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON) + cmake_dependent_option(CMAKE_USE_SYSTEM_NGHTTP2 "Use system-installed nghttp2" + "${CMAKE_USE_SYSTEM_LIBRARY_NGHTTP2}" "NOT CMAKE_USE_SYSTEM_CURL" ON) + option(CMAKE_USE_SYSTEM_FORM "Use system-installed libform" "${CMAKE_USE_SYSTEM_LIBRARY_FORM}") + cmake_dependent_option(CMAKE_USE_SYSTEM_JSONCPP "Use system-installed jsoncpp" + "${CMAKE_USE_SYSTEM_LIBRARY_JSONCPP}" "NOT CMAKE_USE_SYSTEM_CPPDAP" ON) + option(CMAKE_USE_SYSTEM_LIBRHASH "Use system-installed librhash" "${CMAKE_USE_SYSTEM_LIBRARY_LIBRHASH}") + option(CMAKE_USE_SYSTEM_LIBUV "Use system-installed libuv" "${CMAKE_USE_SYSTEM_LIBRARY_LIBUV}") + + # For now use system KWIML only if explicitly requested rather + # than activating via the general system libs options. + option(CMAKE_USE_SYSTEM_KWIML "Use system-installed KWIML" OFF) + mark_as_advanced(CMAKE_USE_SYSTEM_KWIML) + + # Mention to the user what system libraries are being used. + if(CMAKE_USE_SYSTEM_CURL) + # Avoid messaging about curl-only dependencies. + list(REMOVE_ITEM UTILITIES NGHTTP2) + endif() + foreach(util IN LISTS UTILITIES ITEMS KWIML) + if(CMAKE_USE_SYSTEM_${util}) + message(STATUS "Using system-installed ${util}") + endif() + endforeach() + + # Inform utility library header wrappers whether to use system versions. + configure_file(Utilities/cmThirdParty.h.in Utilities/cmThirdParty.h @ONLY) endif() if(CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL) @@ -154,88 +229,6 @@ else() set(CMake_ENABLE_DEBUGGER 0) endif() -#----------------------------------------------------------------------- -# a macro to deal with system libraries, implemented as a macro -# simply to improve readability of the main script -#----------------------------------------------------------------------- -macro(CMAKE_HANDLE_SYSTEM_LIBRARIES) - include(CMakeDependentOption) - - # Allow the user to enable/disable all system utility library options by - # defining CMAKE_USE_SYSTEM_LIBRARIES or CMAKE_USE_SYSTEM_LIBRARY_${util}. - set(UTILITIES BZIP2 CPPDAP CURL EXPAT FORM JSONCPP LIBARCHIVE LIBLZMA LIBRHASH LIBUV NGHTTP2 ZLIB ZSTD) - foreach(util IN LISTS UTILITIES) - if(NOT DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util} - AND DEFINED CMAKE_USE_SYSTEM_LIBRARIES) - set(CMAKE_USE_SYSTEM_LIBRARY_${util} "${CMAKE_USE_SYSTEM_LIBRARIES}") - endif() - if(DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util}) - if(CMAKE_USE_SYSTEM_LIBRARY_${util}) - set(CMAKE_USE_SYSTEM_LIBRARY_${util} ON) - else() - set(CMAKE_USE_SYSTEM_LIBRARY_${util} OFF) - endif() - if(CMAKE_BOOTSTRAP) - unset(CMAKE_USE_SYSTEM_LIBRARY_${util} CACHE) - endif() - string(TOLOWER "${util}" lutil) - set(CMAKE_USE_SYSTEM_${util} "${CMAKE_USE_SYSTEM_LIBRARY_${util}}" - CACHE BOOL "Use system-installed ${lutil}" FORCE) - elseif(util STREQUAL "CURL" AND APPLE) - # macOS provides a curl with backends configured by Apple. - set(CMAKE_USE_SYSTEM_LIBRARY_${util} ON) - else() - set(CMAKE_USE_SYSTEM_LIBRARY_${util} OFF) - endif() - endforeach() - if(CMAKE_BOOTSTRAP) - unset(CMAKE_USE_SYSTEM_LIBRARIES CACHE) - endif() - - # Optionally use system utility libraries. - option(CMAKE_USE_SYSTEM_LIBARCHIVE "Use system-installed libarchive" "${CMAKE_USE_SYSTEM_LIBRARY_LIBARCHIVE}") - if(CMake_ENABLE_DEBUGGER) - option(CMAKE_USE_SYSTEM_CPPDAP "Use system-installed cppdap" "${CMAKE_USE_SYSTEM_LIBRARY_CPPDAP}") - endif() - option(CMAKE_USE_SYSTEM_CURL "Use system-installed curl" "${CMAKE_USE_SYSTEM_LIBRARY_CURL}") - option(CMAKE_USE_SYSTEM_EXPAT "Use system-installed expat" "${CMAKE_USE_SYSTEM_LIBRARY_EXPAT}") - cmake_dependent_option(CMAKE_USE_SYSTEM_ZLIB "Use system-installed zlib" - "${CMAKE_USE_SYSTEM_LIBRARY_ZLIB}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE;NOT CMAKE_USE_SYSTEM_CURL" ON) - cmake_dependent_option(CMAKE_USE_SYSTEM_BZIP2 "Use system-installed bzip2" - "${CMAKE_USE_SYSTEM_LIBRARY_BZIP2}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON) - cmake_dependent_option(CMAKE_USE_SYSTEM_ZSTD "Use system-installed zstd" - "${CMAKE_USE_SYSTEM_LIBRARY_ZSTD}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON) - cmake_dependent_option(CMAKE_USE_SYSTEM_LIBLZMA "Use system-installed liblzma" - "${CMAKE_USE_SYSTEM_LIBRARY_LIBLZMA}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON) - cmake_dependent_option(CMAKE_USE_SYSTEM_NGHTTP2 "Use system-installed nghttp2" - "${CMAKE_USE_SYSTEM_LIBRARY_NGHTTP2}" "NOT CMAKE_USE_SYSTEM_CURL" ON) - option(CMAKE_USE_SYSTEM_FORM "Use system-installed libform" "${CMAKE_USE_SYSTEM_LIBRARY_FORM}") - cmake_dependent_option(CMAKE_USE_SYSTEM_JSONCPP "Use system-installed jsoncpp" - "${CMAKE_USE_SYSTEM_LIBRARY_JSONCPP}" "NOT CMAKE_USE_SYSTEM_CPPDAP" ON) - option(CMAKE_USE_SYSTEM_LIBRHASH "Use system-installed librhash" "${CMAKE_USE_SYSTEM_LIBRARY_LIBRHASH}") - option(CMAKE_USE_SYSTEM_LIBUV "Use system-installed libuv" "${CMAKE_USE_SYSTEM_LIBRARY_LIBUV}") - - # For now use system KWIML only if explicitly requested rather - # than activating via the general system libs options. - option(CMAKE_USE_SYSTEM_KWIML "Use system-installed KWIML" OFF) - mark_as_advanced(CMAKE_USE_SYSTEM_KWIML) - - # Mention to the user what system libraries are being used. - if(CMAKE_USE_SYSTEM_CURL) - # Avoid messaging about curl-only dependencies. - list(REMOVE_ITEM UTILITIES NGHTTP2) - endif() - foreach(util IN LISTS UTILITIES ITEMS KWIML) - if(CMAKE_USE_SYSTEM_${util}) - message(STATUS "Using system-installed ${util}") - endif() - endforeach() - - # Inform utility library header wrappers whether to use system versions. - configure_file(Utilities/cmThirdParty.h.in Utilities/cmThirdParty.h @ONLY) - -endmacro() - #----------------------------------------------------------------------- # a macro to determine the generator and ctest executable to use # for testing. Simply to improve readability of the main script. diff --git a/CompileFlags.cmake b/CompileFlags.cmake index 1d2ed5a300f..62e5233a800 100644 --- a/CompileFlags.cmake +++ b/CompileFlags.cmake @@ -68,8 +68,14 @@ endif() # Use 64-bit off_t on 32-bit Linux if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SIZEOF_VOID_P EQUAL 4) - # ensure 64bit offsets are used for filesystem accesses for 32bit compilation - add_compile_definitions(_FILE_OFFSET_BITS=64 _TIME_BITS=64) + # Use 64-bit off_t even in 32-bit builds. + add_compile_definitions(_FILE_OFFSET_BITS=64) + + # Use 64-bit time_t even in 32-bit builds. Skip this with + # system libarchive because its ABI uses the default time_t. + if (NOT CMAKE_USE_SYSTEM_LIBARCHIVE) + add_compile_definitions(_TIME_BITS=64) + endif() endif() # Workaround for TOC Overflow on ppc64 diff --git a/Help/cpack_gen/appimage.rst b/Help/cpack_gen/appimage.rst index 0ed776e9b61..42dec8ef53b 100644 --- a/Help/cpack_gen/appimage.rst +++ b/Help/cpack_gen/appimage.rst @@ -3,23 +3,22 @@ CPack AppImage Generator .. versionadded:: 4.2 -CPack `AppImage`_ generator allows to bundle an application into -AppImage format. It uses ``appimagetool`` to pack the application, +The CPack `AppImage`_ generator enables bundling an application into the +AppImage format. It uses ``appimagetool`` to pack the application and ``patchelf`` to set the application ``RPATH`` to a relative path based on where the AppImage will be mounted. .. _`AppImage`: https://appimage.org -The ``appimagetool`` does not scan for libraries dependencies it only -packs the installed content and check if the provided ``.desktop`` file -was properly created. For best compatibility it's recommended to choose -some old LTS distro and built it there, as well as including most -dependencies on the generated file. +The ``appimagetool`` does not scan for libraries dependencies. It only +packs the installed content and checks if the provided ``.desktop`` file +was properly created. For best compatibility, it's recommended to build on +an old LTS distribution and to include any dependencies in the generated file. -The snipped below can be added to your ``CMakeLists.txt`` file -replacing ``my_application_target`` with your application target, -it will do a best effort to scan and copy the libraries your -application links to and copy to install location. +The snippet below can be added to your ``CMakeLists.txt`` file. +Replace ``my_application_target`` with your application target. +The example will do a best effort to identify the libraries your +application links to and copy them to the install location. .. code-block:: cmake @@ -41,10 +40,17 @@ application links to and copy to install location. endforeach() ]]) -For Qt based projects it's recommended to call +The CPack AppImage generator will generate a default `AppRun`_ based on the +provided ``.desktop`` entry. Alternatively, if a custom ``AppRun`` is +installed, e.g., via the :command:`install` command, it will be used instead +of the generated one. + +.. _`AppRun`: https://docs.appimage.org/introduction/software-overview.html#apprun + +For Qt-based projects, it is recommended to call ``qt_generate_deploy_app_script()`` or ``qt_generate_deploy_qml_app_script()`` -and install the files generated by the script, this will install -Qt module's plugins. +and install the files generated by the script. This will install the +Qt plugins. You must also set :variable:`CPACK_PACKAGE_ICON` with the same value listed in the Desktop file. @@ -54,77 +60,96 @@ Variables Specific to CPack AppImage Generator .. variable:: CPACK_APPIMAGE_TOOL_EXECUTABLE - Name of the ``appimagetool`` executable, might be located in the build dir, - full path or reachable in ``PATH``. + Name of the ``appimagetool`` executable. If not given as an absolute path, + logic based on :command:`find_program` will be used internally with this + value to find the executable. - :Default: ``appimagetool`` :variable:`CPACK_PACKAGE_FILE_NAME` + :Default: ``appimagetool`` .. variable:: CPACK_APPIMAGE_PATCHELF_EXECUTABLE - Name of the ``patchelf`` executable, might be located in the build dir, - full path or reachable in ``PATH``. + Name of the ``patchelf`` executable. If not given as an absolute path, + logic based on :command:`find_program` will be used internally with this + value to find the executable. - :Default: ``patchelf`` :variable:`CPACK_APPIMAGE_PATCHELF_EXECUTABLE` + :Default: ``patchelf`` .. variable:: CPACK_APPIMAGE_DESKTOP_FILE - Name of freedesktop.org desktop file installed. + Name of the freedesktop.org desktop file to be installed. If not specified, + the first ``.desktop`` file found in the list of files to be installed will + be used. There must be a valid ``.desktop`` file for the package, and it + must include an ``Icon`` entry that matches :variable:`CPACK_PACKAGE_ICON` + without the file extension. The actual installed location of the icon + should follow the freedesktop.org specification. - :Mandatory: Yes - :Default: :variable:`CPACK_APPIMAGE_DESKTOP_FILE` + :Default: Unset .. variable:: CPACK_APPIMAGE_UPDATE_INFORMATION - Embed update information STRING; if zsyncmake is installed, - generate zsync file. + Embed the value of this variable as the update information. See the + ``appimagetool`` source code for the supported values and formats of the + ``--updateinformation`` option. It is highly recommended to have + the ``zsyncmake`` tool installed if using ``zsync`` update information. - :Default: :variable:`CPACK_APPIMAGE_UPDATE_INFORMATION` + :Default: Unset .. variable:: CPACK_APPIMAGE_GUESS_UPDATE_INFORMATION - Guess update information based on GitHub or GitLab environment variables. + When this variable is true, add the ``--guess`` option to the + ``appimagetool`` invocation. This directs the tool to try to guess + appropriate update information based on GitHub or GitLab environment + variables. - :Default: :variable:`CPACK_APPIMAGE_GUESS_UPDATE_INFORMATION` + :Default: Unset .. variable:: CPACK_APPIMAGE_COMPRESSOR - Squashfs compression. + Override the ``appimagetool``'s default type of squashfs compression (zstd). + This corresponds to the ``appimagetool --comp`` option. - :Default: :variable:`CPACK_APPIMAGE_COMPRESSOR` + :Default: Unset .. variable:: CPACK_APPIMAGE_MKSQUASHFS_OPTIONS - Arguments to pass through to mksquashfs. + List of arguments to pass through to ``mksquashfs``. Each of these will be + preceded by ``--mksquashfs-opt`` on the ``appimagetool`` command line. - :Default: :variable:`CPACK_APPIMAGE_MKSQUASHFS_OPTIONS` + :Default: Unset .. variable:: CPACK_APPIMAGE_NO_APPSTREAM - Do not check AppStream metadata. + If set to true, do not check AppStream metadata. This passes the + ``--no-appstream`` option to ``appimagetool``. - :Default: :variable:`CPACK_APPIMAGE_NO_APPSTREAM` + :Default: Unset .. variable:: CPACK_APPIMAGE_EXCLUDE_FILE - Uses given file as exclude file for mksquashfs, - in addition to .appimageignore. + Use the specified file as an exclude file for ``mksquashfs``, + in addition to ``.appimageignore``. This uses the ``--exclude-file`` + option to ``appimagetool``. - :Default: :variable:`CPACK_APPIMAGE_EXCLUDE_FILE` + :Default: Unset .. variable:: CPACK_APPIMAGE_RUNTIME_FILE - Runtime file to use, if not set a bash script will be generated. + Specify a runtime file to use instead of letting the ``appimagetool`` + download a runtime to embed in the generated AppImage. - :Default: :variable:`CPACK_APPIMAGE_RUNTIME_FILE` + :Default: Unset .. variable:: CPACK_APPIMAGE_SIGN - Sign with gpg[2]. + When set to true, sign the generated AppImage with gpg[2]. + :variable:`CPACK_APPIMAGE_SIGN_KEY` should also be specified if using this + option. - :Default: :variable:`CPACK_APPIMAGE_SIGN` + :Default: Unset .. variable:: CPACK_APPIMAGE_SIGN_KEY - Key ID to use for gpg[2] signatures. + Key ID to use for gpg[2] signatures when signing is enabled with + :variable:`CPACK_APPIMAGE_SIGN`. - :Default: :variable:`CPACK_APPIMAGE_SIGN_KEY` + :Default: Unset diff --git a/Help/guide/tutorial/In-Depth CMake Target Commands.rst b/Help/guide/tutorial/In-Depth CMake Target Commands.rst index 322d65af3b9..842b0d55def 100644 --- a/Help/guide/tutorial/In-Depth CMake Target Commands.rst +++ b/Help/guide/tutorial/In-Depth CMake Target Commands.rst @@ -447,14 +447,26 @@ Getting Started You will need to build the vendor library into a static archive to complete this exercise. Navigate to the ``Help/guide/tutorial/Step4/Vendor/lib`` directory -and build the code as appropriate for your platform. On Unix-like operating -systems the appropriate commands are usually: +and build the code as appropriate for your platform. + +Typical commands for a GCC toolchain on Unix-like systems are: .. code-block:: console - g++ -c Vendors.cxx + g++ -c Vendor.cxx ar rvs libVendor.a Vendor.o +Likewise, sample commands for an MSVC toolchain on Windows are: + +.. code-block:: console + + cl -c Vendor.cxx + lib -out:Vendor.lib Vendor.obj + +Here, since you're directly invoking ``cl`` and ``lib``, make sure to use a +Developer Command Prompt for your version of Visual Studio with the same +target architecture used by this CMake project. + Then complete ``TODO 11`` through ``TODO 14``. .. note:: diff --git a/Help/guide/tutorial/In-Depth System Introspection.rst b/Help/guide/tutorial/In-Depth System Introspection.rst index 73fe0f2dcc4..f872c564e8e 100644 --- a/Help/guide/tutorial/In-Depth System Introspection.rst +++ b/Help/guide/tutorial/In-Depth System Introspection.rst @@ -380,7 +380,7 @@ The first ``TODO`` is easy, we add another option to our project.
TODO 6: Click to show/hide answer .. literalinclude:: Step7/CMakeLists.txt - :caption: TODO 6: MathFunctions/CMakeLists.txt + :caption: TODO 6: CMakeLists.txt :name: CMakeLists.txt-enable-ipo :language: cmake :start-at: option(TUTORIAL_ENABLE_IPO diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst index 48547177ec4..f1b1cb1c735 100644 --- a/Help/manual/cmake-env-variables.7.rst +++ b/Help/manual/cmake-env-variables.7.rst @@ -62,12 +62,12 @@ Environment Variables that Control the Build /envvar/CMAKE_INSTALL_MODE /envvar/CMAKE_INSTALL_PARALLEL_LEVEL /envvar/CMAKE_INSTALL_PREFIX + /envvar/CMAKE_INTERMEDIATE_DIR_STRATEGY /envvar/CMAKE_LANG_COMPILER_LAUNCHER /envvar/CMAKE_LANG_IMPLICIT_LINK_DIRECTORIES_EXCLUDE /envvar/CMAKE_LANG_IMPLICIT_LINK_LIBRARIES_EXCLUDE /envvar/CMAKE_LANG_LINKER_LAUNCHER /envvar/CMAKE_MSVCIDE_RUN_PATH - /envvar/CMAKE_INTERMEDIATE_DIR_STRATEGY /envvar/CMAKE_NO_VERBOSE /envvar/CMAKE_OSX_ARCHITECTURES /envvar/CMAKE_TEST_LAUNCHER diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 7474197595a..d5dc281dfda 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -2241,7 +2241,7 @@ In the following, the phrase "the ``tgt`` filename" means the name of the .. versionadded:: 3.15 .. versionadded:: 4.2 - The option ``POSTFIX``, which can be used to control the inclusion or not + The ``POSTFIX`` option can be used to control the inclusion or not of the :prop_tgt:`_POSTFIX` target property value as part of the base name. The default is ``POSTFIX:INCLUDE``. @@ -2319,7 +2319,7 @@ In the following, the phrase "the ``tgt`` filename" means the name of the .. versionadded:: 3.27 .. versionadded:: 4.2 - The option ``POSTFIX``, which can be used to control the inclusion or not + The ``POSTFIX`` option can be used to control the inclusion or not of the :prop_tgt:`_POSTFIX` target property value as part of the base name. The default is ``POSTFIX:INCLUDE``. @@ -2405,14 +2405,15 @@ In the following, the phrase "the ``tgt`` filename" means the name of the .. versionadded:: 3.15 .. versionadded:: 4.2 - The option ``POSTFIX``, which can be used to control the inclusion or not + The ``POSTFIX`` option can be used to control the inclusion or not of the :prop_tgt:`_POSTFIX` target property value as part of the base name. The default is ``POSTFIX:INCLUDE``. Base name of file used to link the target ``tgt``, i.e. :genex:`$` without prefix and suffix, and, optionally, postfix. - For example, if target file name is ``libbase_postfix.a``, the base name is: + For example, if the target file name is ``libbase_postfix.a``, the base name + is: * ``base_postfix`` for ``$`` or ``$``. @@ -2483,14 +2484,15 @@ In the following, the phrase "the ``tgt`` filename" means the name of the .. versionadded:: 3.27 .. versionadded:: 4.2 - The option ``POSTFIX``, which can be used to control the inclusion or not + The ``POSTFIX`` option can be used to control the inclusion or not of the :prop_tgt:`_POSTFIX` target property value as part of the base name. The default is ``POSTFIX:INCLUDE``. Base name of library file used to link the target ``tgt``, i.e. :genex:`$` without prefix and suffix,and, optionally, postfix. - For example, if target file name is ``libbase_postfix.a``, the base name is: + For example, if the target file name is ``libbase_postfix.a``, the base name + is: * ``base_postfix`` for ``$`` or ``$``. @@ -2564,14 +2566,15 @@ In the following, the phrase "the ``tgt`` filename" means the name of the .. versionadded:: 3.27 .. versionadded:: 4.2 - The option ``POSTFIX``, which can be used to control the inclusion or not + The ``POSTFIX`` option can be used to control the inclusion or not of the :prop_tgt:`_POSTFIX` target property value as part of the base name. The default is ``POSTFIX:INCLUDE``. Base name of the import file used to link the target ``tgt``, i.e. :genex:`$` without prefix and suffix, and, optionally, postfix. - For example, if target file name is ``libbase_postfix.tbd``, the base name is + For example, if the target file name is ``libbase_postfix.tbd``, the base + name is * ``base_postfix`` for ``$`` or ``$``. @@ -2696,29 +2699,29 @@ In the following, the phrase "the ``tgt`` filename" means the name of the where ``tgt`` is the name of a target. .. versionadded:: 4.2 - The option ``POSTFIX``, which can be used to control the inclusion or not + The ``POSTFIX`` option can be used to control the inclusion or not of the :prop_tgt:`_POSTFIX` target property value as part of the base name. The default is ``POSTFIX:INCLUDE``. .. versionchanged:: 4.2 The postfix, as specified by :prop_tgt:`DEBUG_POSTFIX` or :prop_tgt:`_POSTFIX` target properties, is always included in the - ``PDB`` base name, except if option ``POSTFIX`` has value ``EXCLUDE``. - See the policy :policy:`CMP0202`. + ``PDB`` base name, except if the ``POSTFIX`` option has the value + ``EXCLUDE``. See the policy :policy:`CMP0202`. The base name corresponds to the target PDB file name (see ``$``) without prefix and suffix, and, optionally, - postfix. For example, if target file name is ``base_postfix.pdb``, the base - name is + postfix. For example, if the target file name is ``base_postfix.pdb``, the + base name is * ``base_postfix`` for ``$`` or ``$``. * ``base`` for ``$``. - See also the :prop_tgt:`OUTPUT_NAME`, :prop_tgt:`PDB_NAME` target properties, - and their configuration-specific variants :prop_tgt:`OUTPUT_NAME_` - and :prop_tgt:`PDB_NAME_`, and the :prop_tgt:`_POSTFIX` and - :prop_tgt:`DEBUG_POSTFIX` target properties. + See also the :prop_tgt:`OUTPUT_NAME` and :prop_tgt:`PDB_NAME` target + properties, their configuration-specific variants + :prop_tgt:`OUTPUT_NAME_` and :prop_tgt:`PDB_NAME_`, and the + :prop_tgt:`_POSTFIX` and :prop_tgt:`DEBUG_POSTFIX` target properties. Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index a477897afe0..51a31978de3 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -103,7 +103,7 @@ Policies Introduced by CMake 4.2 CMP0202: PDB file names always include their target's per-config POSTFIX. CMP0201: Python::NumPy does not depend on Python::Development.Module. CMP0200: Location and configuration selection for imported targets is more consistent. - CMP0199: $ only matches the configuration of the consumed target. + CMP0199: $ does not match mapped configurations that are not selected. CMP0198: CMAKE_PARENT_LIST_FILE is not defined in CMakeLists.txt. Policies Introduced by CMake 4.1 diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 947b1affeb9..5de9ccf157d 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -40,8 +40,8 @@ Properties of Global Scope /prop_gbl/GENERATOR_IS_MULTI_CONFIG /prop_gbl/GLOBAL_DEPENDS_DEBUG_MODE /prop_gbl/GLOBAL_DEPENDS_NO_CYCLES - /prop_gbl/INSTALL_PARALLEL /prop_gbl/IN_TRY_COMPILE + /prop_gbl/INSTALL_PARALLEL /prop_gbl/JOB_POOLS /prop_gbl/PACKAGES_FOUND /prop_gbl/PACKAGES_NOT_FOUND @@ -333,7 +333,6 @@ Properties on Targets /prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG /prop_tgt/LIBRARY_OUTPUT_NAME /prop_tgt/LIBRARY_OUTPUT_NAME_CONFIG - /prop_tgt/SPDX_LICENSE /prop_tgt/LINK_DEPENDS /prop_tgt/LINK_DEPENDS_NO_SHARED /prop_tgt/LINK_DIRECTORIES @@ -408,6 +407,7 @@ Properties on Targets /prop_tgt/SOURCE_DIR /prop_tgt/SOURCES /prop_tgt/SOVERSION + /prop_tgt/SPDX_LICENSE /prop_tgt/STATIC_LIBRARY_FLAGS /prop_tgt/STATIC_LIBRARY_FLAGS_CONFIG /prop_tgt/STATIC_LIBRARY_OPTIONS @@ -505,13 +505,13 @@ Properties on Targets /prop_tgt/XCODE_SCHEME_EXECUTABLE /prop_tgt/XCODE_SCHEME_GUARD_MALLOC /prop_tgt/XCODE_SCHEME_LAUNCH_CONFIGURATION - /prop_tgt/XCODE_SCHEME_TEST_CONFIGURATION /prop_tgt/XCODE_SCHEME_LAUNCH_MODE /prop_tgt/XCODE_SCHEME_LLDB_INIT_FILE /prop_tgt/XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP /prop_tgt/XCODE_SCHEME_MALLOC_GUARD_EDGES /prop_tgt/XCODE_SCHEME_MALLOC_SCRIBBLE /prop_tgt/XCODE_SCHEME_MALLOC_STACK + /prop_tgt/XCODE_SCHEME_TEST_CONFIGURATION /prop_tgt/XCODE_SCHEME_THREAD_SANITIZER /prop_tgt/XCODE_SCHEME_THREAD_SANITIZER_STOP /prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER @@ -581,6 +581,7 @@ Properties on Source Files /prop_sf/HEADER_FILE_ONLY /prop_sf/INCLUDE_DIRECTORIES /prop_sf/INSTALL_OBJECT_NAME + /prop_sf/JOB_POOL_COMPILE /prop_sf/KEEP_EXTENSION /prop_sf/LABELS /prop_sf/LANGUAGE @@ -589,7 +590,6 @@ Properties on Source Files /prop_sf/OBJECT_DEPENDS /prop_sf/OBJECT_NAME /prop_sf/OBJECT_OUTPUTS - /prop_sf/JOB_POOL_COMPILE /prop_sf/SKIP_AUTOGEN /prop_sf/SKIP_AUTOMOC /prop_sf/SKIP_AUTORCC diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 874820fed82..2a23383115a 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -56,17 +56,17 @@ Variables that Provide Information /variable/CMAKE_EXECUTABLE_SUFFIX /variable/CMAKE_EXECUTABLE_SUFFIX_LANG /variable/CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES + /variable/CMAKE_FASTBUILD_ALLOW_RESPONSE_FILE /variable/CMAKE_FASTBUILD_CACHE_PATH /variable/CMAKE_FASTBUILD_CAPTURE_SYSTEM_ENV - /variable/CMAKE_FASTBUILD_COMPILER_EXTRA_FILES - /variable/CMAKE_FASTBUILD_ENV_OVERRIDES - /variable/CMAKE_FASTBUILD_TRACK_BYPRODUCTS_AS_OUTPUT - /variable/CMAKE_FASTBUILD_ALLOW_RESPONSE_FILE /variable/CMAKE_FASTBUILD_CLANG_GCC_UPDATE_XLANG_ARG /variable/CMAKE_FASTBUILD_CLANG_REWRITE_INCLUDES + /variable/CMAKE_FASTBUILD_COMPILER_EXTRA_FILES + /variable/CMAKE_FASTBUILD_ENV_OVERRIDES /variable/CMAKE_FASTBUILD_FORCE_RESPONSE_FILE /variable/CMAKE_FASTBUILD_IDE_ARGS /variable/CMAKE_FASTBUILD_SOURCE_MAPPING + /variable/CMAKE_FASTBUILD_TRACK_BYPRODUCTS_AS_OUTPUT /variable/CMAKE_FASTBUILD_USE_DETERMINISTIC_PATHS /variable/CMAKE_FASTBUILD_USE_LIGHTCACHE /variable/CMAKE_FASTBUILD_USE_RELATIVE_PATHS @@ -128,9 +128,9 @@ Variables that Provide Information /variable/CMAKE_ROOT /variable/CMAKE_RULE_MESSAGES /variable/CMAKE_SCRIPT_MODE_FILE + /variable/CMAKE_SHARED_LIBRARY_ARCHIVE_SUFFIX /variable/CMAKE_SHARED_LIBRARY_PREFIX /variable/CMAKE_SHARED_LIBRARY_SUFFIX - /variable/CMAKE_SHARED_LIBRARY_ARCHIVE_SUFFIX /variable/CMAKE_SHARED_MODULE_PREFIX /variable/CMAKE_SHARED_MODULE_SUFFIX /variable/CMAKE_SIZEOF_VOID_P @@ -229,9 +229,9 @@ Variables that Change Behavior /variable/CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL /variable/CMAKE_EXPORT_BUILD_DATABASE /variable/CMAKE_EXPORT_COMPILE_COMMANDS - /variable/CMAKE_EXPORT_SARIF - /variable/CMAKE_EXPORT_PACKAGE_REGISTRY /variable/CMAKE_EXPORT_NO_PACKAGE_REGISTRY + /variable/CMAKE_EXPORT_PACKAGE_REGISTRY + /variable/CMAKE_EXPORT_SARIF /variable/CMAKE_FIND_APPBUNDLE /variable/CMAKE_FIND_FRAMEWORK /variable/CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX @@ -266,6 +266,7 @@ Variables that Change Behavior /variable/CMAKE_INSTALL_MESSAGE /variable/CMAKE_INSTALL_PREFIX /variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT + /variable/CMAKE_INTERMEDIATE_DIR_STRATEGY /variable/CMAKE_KATE_FILES_MODE /variable/CMAKE_KATE_MAKE_ARGUMENTS /variable/CMAKE_LIBRARY_PATH @@ -278,7 +279,6 @@ Variables that Change Behavior /variable/CMAKE_MESSAGE_LOG_LEVEL /variable/CMAKE_MFC_FLAG /variable/CMAKE_MODULE_PATH - /variable/CMAKE_INTERMEDIATE_DIR_STRATEGY /variable/CMAKE_PKG_CONFIG_DISABLE_UNINSTALLED /variable/CMAKE_PKG_CONFIG_PC_LIB_DIRS /variable/CMAKE_PKG_CONFIG_PC_PATH @@ -333,13 +333,13 @@ Variables that Change Behavior /variable/CMAKE_XCODE_SCHEME_ENVIRONMENT /variable/CMAKE_XCODE_SCHEME_GUARD_MALLOC /variable/CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION - /variable/CMAKE_XCODE_SCHEME_TEST_CONFIGURATION /variable/CMAKE_XCODE_SCHEME_LAUNCH_MODE /variable/CMAKE_XCODE_SCHEME_LLDB_INIT_FILE /variable/CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP /variable/CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES /variable/CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE /variable/CMAKE_XCODE_SCHEME_MALLOC_STACK + /variable/CMAKE_XCODE_SCHEME_TEST_CONFIGURATION /variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER /variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP /variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER @@ -363,8 +363,8 @@ Variables that Describe the System /variable/CMAKE_ANDROID_NDK_VERSION /variable/CMAKE_CL_64 /variable/CMAKE_COMPILER_2005 - /variable/CMAKE_HOST_APPLE /variable/CMAKE_HOST_AIX + /variable/CMAKE_HOST_APPLE /variable/CMAKE_HOST_BSD /variable/CMAKE_HOST_EXECUTABLE_SUFFIX /variable/CMAKE_HOST_LINUX @@ -408,8 +408,8 @@ Variables that Control the Build :maxdepth: 1 /variable/CMAKE_ADSP_ROOT - /variable/CMAKE_AIX_SHARED_LIBRARY_ARCHIVE /variable/CMAKE_AIX_EXPORT_ALL_SYMBOLS + /variable/CMAKE_AIX_SHARED_LIBRARY_ARCHIVE /variable/CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS /variable/CMAKE_ANDROID_API /variable/CMAKE_ANDROID_API_MIN @@ -449,18 +449,18 @@ Variables that Control the Build /variable/CMAKE_AUTOMOC /variable/CMAKE_AUTOMOC_COMPILER_PREDEFINES /variable/CMAKE_AUTOMOC_DEPEND_FILTERS + /variable/CMAKE_AUTOMOC_EXECUTABLE /variable/CMAKE_AUTOMOC_INCLUDE_DIRECTORIES /variable/CMAKE_AUTOMOC_MACRO_NAMES /variable/CMAKE_AUTOMOC_MOC_OPTIONS /variable/CMAKE_AUTOMOC_PATH_PREFIX - /variable/CMAKE_AUTOMOC_EXECUTABLE /variable/CMAKE_AUTORCC - /variable/CMAKE_AUTORCC_OPTIONS /variable/CMAKE_AUTORCC_EXECUTABLE + /variable/CMAKE_AUTORCC_OPTIONS /variable/CMAKE_AUTOUIC + /variable/CMAKE_AUTOUIC_EXECUTABLE /variable/CMAKE_AUTOUIC_OPTIONS /variable/CMAKE_AUTOUIC_SEARCH_PATHS - /variable/CMAKE_AUTOUIC_EXECUTABLE /variable/CMAKE_BUILD_RPATH /variable/CMAKE_BUILD_RPATH_USE_ORIGIN /variable/CMAKE_BUILD_WITH_INSTALL_NAME_DIR @@ -517,9 +517,9 @@ Variables that Control the Build /variable/CMAKE_LANG_COMPILER_LAUNCHER /variable/CMAKE_LANG_CPPCHECK /variable/CMAKE_LANG_CPPLINT - /variable/CMAKE_LANG_LINK_DEF_FILE_FLAG /variable/CMAKE_LANG_ICSTAT /variable/CMAKE_LANG_INCLUDE_WHAT_YOU_USE + /variable/CMAKE_LANG_LINK_DEF_FILE_FLAG /variable/CMAKE_LANG_LINK_GROUP_USING_FEATURE /variable/CMAKE_LANG_LINK_GROUP_USING_FEATURE_SUPPORTED /variable/CMAKE_LANG_LINK_LIBRARY_FEATURE_ATTRIBUTES diff --git a/Help/policy/CMP0199.rst b/Help/policy/CMP0199.rst index cef282a057b..b102845333f 100644 --- a/Help/policy/CMP0199.rst +++ b/Help/policy/CMP0199.rst @@ -3,7 +3,8 @@ CMP0199 .. versionadded:: 4.2 -:genex:`$` only matches the configuration of the consumed target. +:genex:`$` does not match mapped configurations that are not +selected. Historically, when a :genex:`$` generator expression appeared in the properties of an imported target, it would match (that is, evaluate to @@ -18,18 +19,21 @@ the properties of an imported target, it would match (that is, evaluate to (where ```` is the configuration of the consuming target), *whether or not such configurations are valid for the imported target*. -This could result in expressions which are intended to be mutually exclusive -being concurrently evaluated. This would be especially problematic if the -value of a compile definition is intended to be determined by the -configuration, as this lack of exclusivity could result in redefinition. +This can result in expressions which are intended to be mutually exclusive +being concurrently evaluated. This can be especially problematic if the value +of a compile definition is intended to be determined by the configuration, as +this lack of exclusivity could result in redefinition. -CMake 4.2 and above prefer to consider *only* the configuration of the imported -target being consumed; that is, (1) in the above list. +CMake 4.2 and above prefer to consider *only* the configuration of the +consuming target and (when applicable) the selected configuration of the +imported target; that is, (2) and (1) in the above list. Unfortunately, +because users rely on both of these, this policy is not able to fully prevent +multiple unique ``$`` expressions from matching concurrently. This policy provides compatibility with projects that rely on the historical behavior. The ``OLD`` behavior for this policy is to retain the historic behavior as described above. The ``NEW`` behavior is to consider only the -configuration of the imported target being consumed. +configurations of the consuming and consumed targets. .. note:: @@ -43,8 +47,8 @@ configuration of the imported target being consumed. configuration, which is necessarily the same as the consuming target's configuration.) - For targets imported from |CPS| packages, the ``NEW`` behavior is used, - regardless of the policy setting. + For targets imported from |CPS| packages, **only** the configuration of the + consumed imported target is considered, regardless of the policy setting. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 4.2 .. |WARNS_OR_DOES_NOT_WARN| replace:: warns @@ -75,19 +79,19 @@ Consider the following imported libraries: ) Assume that the consuming project is built in the ``Release`` configuration. -Under the ``OLD`` policy, a consumer of ``test1`` would see both ``DEBUG`` -and ``RELEASE`` defined; ``$`` evaluates to ``1`` because the -selected configuration of ``test1`` is ``DEBUG``, and ``$`` -evaluates to ``1`` because the consumer's configuration is ``Release`` -(keeping in mind that configuration matching is case-insensitive). Likewise, -a consumer of ``test2`` would see all of ``DEBUG``, ``RELEASE`` and ``TEST`` -defined; ``$``, ``$`` and ``$`` all -evaluate to ``1`` because all of these configurations appear in -``MAP_IMPORTED_CONFIG_RELEASE``. - -Under the ``NEW`` policy, when ``test1`` is consumed, only ``$`` -will evaluate to ``1``. Similarly, when ``test2`` is consumed, only -``$`` will evaluate to ``1``. Both of these correspond to the -configuration of the consumed library that is actually selected by CMake. +A consumer of ``test1`` will see both ``DEBUG`` and ``RELEASE`` defined, +regardless of the policy setting; ``$`` evaluates to ``1`` +because the selected configuration of ``test1`` is ``DEBUG``, and +``$`` evaluates to ``1`` because the consumer's configuration +is ``Release`` (keeping in mind that configuration matching is +case-insensitive). + +Under the ``OLD`` policy, a consumer of ``test2`` would see all of ``DEBUG``, +``EXAMPLE`` and ``TEST`` defined; ``$``, ``$`` +and ``$`` all evaluate to ``1`` because all of these +configurations appear in ``MAP_IMPORTED_CONFIG_RELEASE``. + +Under the ``NEW`` policy, a consumer of ``test2`` will see only ``TEST`` +defined. .. |CPS| replace:: Common Package Specification diff --git a/Help/release/3.31.rst b/Help/release/3.31.rst index 420a9b79c40..e3755948593 100644 --- a/Help/release/3.31.rst +++ b/Help/release/3.31.rst @@ -280,3 +280,10 @@ Changes made since CMake 3.31.0 include the following. * The :command:`execute_process` command once again terminates child processes when its ``TIMEOUT`` is reached. This was accidentally regressed by CMake 3.29. + +3.31.11 +------- + +* This version made no changes to documented features or interfaces. + Some implementation updates were made to support ecosystem changes + and/or fix regressions. diff --git a/Help/release/4.0.rst b/Help/release/4.0.rst index 4cf3e0d0e66..ab7c7145aa1 100644 --- a/Help/release/4.0.rst +++ b/Help/release/4.0.rst @@ -313,3 +313,10 @@ Changes made since CMake 4.0.0 include the following. * The :command:`execute_process` command once again terminates child processes when its ``TIMEOUT`` is reached. This was accidentally regressed by CMake 3.29. + +4.0.6 +----- + +* This version made no changes to documented features or interfaces. + Some implementation updates were made to support ecosystem changes + and/or fix regressions. diff --git a/Help/release/4.1.rst b/Help/release/4.1.rst index 0b93e812217..80d7249b001 100644 --- a/Help/release/4.1.rst +++ b/Help/release/4.1.rst @@ -220,9 +220,11 @@ Other Changes ``CMAKE_*_LINKER_FLAGS`` variables. See policy :policy:`CMP0197`. * The :ref:`Visual Studio Generators` now suppress Visual Studio's default - flags ``-Zc:forScope``, ``-Zc:inline``, and ``-Zc:wchar_t`` if they are - not specified by the project or user. This makes builds more consistent - with other generators, and with what projects and users actually specify. + ``-Zc:forScope``, ``-Zc:inline``, and ``-Zc:wchar_t`` compiler flags, + and ``-dynamicbase``, ``-errorreport``, ``-nxcompat``, and ``-safeseh`` + link flags, if they are not specified by the project or user. This makes + builds more consistent with other generators, and with what projects and + users actually specify. * The :genex:`TARGET_PROPERTY` generator expression now evaluates the :prop_tgt:`LINK_LIBRARIES` and :prop_tgt:`INTERFACE_LINK_LIBRARIES` @@ -261,9 +263,9 @@ Changes made since CMake 4.1.0 include the following. processes when its ``TIMEOUT`` is reached. This was accidentally regressed by CMake 3.29. -4.1.4 ------ +4.1.4, 4.1.5 +------------ -* This version made no changes to documented features or interfaces. +* These versions made no changes to documented features or interfaces. Some implementation updates were made to support ecosystem changes and/or fix regressions. diff --git a/Help/release/4.2.rst b/Help/release/4.2.rst index 8fff469ca09..de09e00d177 100644 --- a/Help/release/4.2.rst +++ b/Help/release/4.2.rst @@ -203,8 +203,8 @@ Other Changes ============= * The :genex:`$` generator expression, when appearing on an - imported target, has been fixed to only match the configuration actually - being consumed. See policy :policy:`CMP0199`. + imported target, has been fixed to not match configurations that are not + applicable. See policy :policy:`CMP0199`. * Selection of configuration and location of imported targets is now more consistent. See policy :policy:`CMP0200`. @@ -236,3 +236,19 @@ Changes made since CMake 4.2.0 include the following. * This version made no changes to documented features or interfaces. Some implementation updates were made to support ecosystem changes and/or fix regressions. + +4.2.2 +----- + +* Policy :policy:`CMP0199`'s NEW behavior has been partially reverted. + In 4.2.0 and 4.2.1, ``$`` only matched the configuration + of the consumed target. This broke existing use cases that rely on + matching the configuration of the consuming target, and so has been + partially reverted to match either as CMake 4.1 and below did. + +4.2.3 +----- + +* This version made no changes to documented features or interfaces. + Some implementation updates were made to support ecosystem changes + and/or fix regressions. diff --git a/Help/variable/CMAKE_FIND_REQUIRED.rst b/Help/variable/CMAKE_FIND_REQUIRED.rst index 0518edb57f9..cb3f4b1528a 100644 --- a/Help/variable/CMAKE_FIND_REQUIRED.rst +++ b/Help/variable/CMAKE_FIND_REQUIRED.rst @@ -22,6 +22,6 @@ Note that enabling this variable breaks some commonly used patterns. Multiple calls to :command:`find_package` are sometimes used to obtain a different search order to the default. -See also the :variable:`CMAKE_REQUIRE_FIND_PACKAGE_` for making -a :command:`find_package` call ``REQUIRED``, and for additional information on -how enabling these variables can break commonly used patterns. +See also the :variable:`CMAKE_REQUIRE_FIND_PACKAGE_` variable for +making a :command:`find_package` call ``REQUIRED``, and for additional +information on how enabling these variables can break commonly used patterns. diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 715c1747315..9f986a78e7c 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -1378,7 +1378,7 @@ if(BLA_VENDOR STREQUAL "NVPL" OR BLA_VENDOR STREQUAL "All") endif() if(NOT BLAS_LIBRARIES) - find_package(nvpl) + find_package(nvpl QUIET) if(nvpl_FOUND) foreach(_nvpl_thread IN LISTS _blas_nvpl_threads) foreach(_nvpl_int IN LISTS _blas_nvpl_ints) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index d4486f2b572..52b13d97620 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -750,7 +750,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) list(APPEND _lapack_nvpl_threads "_seq") endif() - find_package(nvpl) + find_package(nvpl QUIET) if(nvpl_FOUND) foreach(_nvpl_thread IN LISTS _lapack_nvpl_threads) foreach(_nvpl_int IN LISTS _lapack_nvpl_ints) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 677892a4800..825eb203aae 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 4) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 1) +set(CMake_VERSION_PATCH 3) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CPack/cmCPackAppImageGenerator.cxx b/Source/CPack/cmCPackAppImageGenerator.cxx index 373dcfaff03..c6d4d8a9198 100644 --- a/Source/CPack/cmCPackAppImageGenerator.cxx +++ b/Source/CPack/cmCPackAppImageGenerator.cxx @@ -18,6 +18,7 @@ #include "cmCPackLog.h" #include "cmELF.h" #include "cmGeneratedFileStream.h" +#include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmValue.h" @@ -182,8 +183,18 @@ int cmCPackAppImageGenerator::PackageFiles() } std::string const appRunFile = this->toplevel + "/AppRun"; - { - // AppRun script will run our application + if (cmSystemTools::PathExists(appRunFile)) { + // User provided an AppRun file + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + cmStrCat("Found AppRun file: \"", appRunFile, '"') + << std::endl); + } else { + // Generate a default AppRun script that will run our application + cmCPackLogger( + cmCPackLog::LOG_OUTPUT, + cmStrCat("No AppRun found, generating a default one that will run: \"", + application, '"') + << std::endl); cmGeneratedFileStream appRun(appRunFile); appRun << R"sh(#! /usr/bin/env bash diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 24ee6eb6769..de8651c96fa 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -813,9 +813,7 @@ bool cmCTestRunTest::ForkProcess() if (stop_time != std::chrono::system_clock::time_point()) { cmDuration timeUntilStop = (stop_time - std::chrono::system_clock::now()) % std::chrono::hours(24); - if (timeUntilStop < timeRemaining) { - timeRemaining = timeUntilStop; - } + this->TestProcess->SetStopTimeout(timeUntilStop); } // Enforce remaining time even over explicit TIMEOUT=0. @@ -824,7 +822,16 @@ bool cmCTestRunTest::ForkProcess() } if (!timeout || timeRemaining < *timeout) { timeout = timeRemaining; - this->TestProcess->SetTimeoutReason(cmProcess::TimeoutReason::StopTime); + } + + // Inform the test process of its normal timeout + if (timeout) { + this->TestProcess->SetTimeout(*timeout); + } + + // Ask the test process which timeout is in effect. + if (auto ctimeout = this->TestProcess->GetComputedTimeout()) { + timeout = ctimeout->Duration; } if (timeout) { diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index 9002d2e1b6f..9bf81f81f6c 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -158,9 +158,10 @@ bool cmProcess::StartProcess(uv_loop_t& loop, std::vector* affinity) void cmProcess::StartTimer() { - if (this->Timeout) { - auto msec = - std::chrono::duration_cast(*this->Timeout); + if (auto ctimeout = this->GetComputedTimeout()) { + this->TimeoutReason_ = ctimeout->Reason; + auto msec = std::chrono::duration_cast( + ctimeout->Duration); this->Timer.start(&cmProcess::OnTimeoutCB, static_cast(msec.count()), 0, cm::uv_update_time::no); @@ -374,6 +375,24 @@ cmProcess::State cmProcess::GetProcessStatus() return this->ProcessState; } +cm::optional cmProcess::GetComputedTimeout() const +{ + if (this->StopTimeout && this->Timeout) { + if (*this->StopTimeout < *this->Timeout) { + return ComputedTimeout{ TimeoutReason::StopTime, *this->StopTimeout }; + } + return ComputedTimeout{ TimeoutReason::Normal, *this->Timeout }; + } + if (this->StopTimeout) { + return ComputedTimeout{ TimeoutReason::StopTime, *this->StopTimeout }; + } + if (this->Timeout) { + return ComputedTimeout{ TimeoutReason::Normal, *this->Timeout }; + } + + return cm::nullopt; +} + void cmProcess::ChangeTimeout(cmDuration t) { this->Timeout = t; diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h index 2489ba522dd..a4704b42ed9 100644 --- a/Source/CTest/cmProcess.h +++ b/Source/CTest/cmProcess.h @@ -37,6 +37,7 @@ class cmProcess void SetCommand(std::string const& command); void SetCommandArguments(std::vector const& arg); void SetWorkingDirectory(std::string const& dir); + void SetStopTimeout(cmDuration t) { this->StopTimeout = t; } void SetTimeout(cmDuration t) { this->Timeout = t; } void ChangeTimeout(cmDuration t); void ResetStartTime(); @@ -48,8 +49,13 @@ class cmProcess Normal, StopTime, }; - void SetTimeoutReason(TimeoutReason r) { this->TimeoutReason_ = r; } TimeoutReason GetTimeoutReason() const { return this->TimeoutReason_; } + struct ComputedTimeout + { + TimeoutReason Reason; + cmDuration Duration; + }; + cm::optional GetComputedTimeout() const; enum class State { @@ -104,6 +110,7 @@ class cmProcess Termination GetTerminationStyle() const { return this->TerminationStyle; } private: + cm::optional StopTimeout; cm::optional Timeout; TimeoutReason TimeoutReason_ = TimeoutReason::Normal; std::chrono::steady_clock::time_point StartTime; diff --git a/Source/Modules/CMakeBuildUtilities.cmake b/Source/Modules/CMakeBuildUtilities.cmake index da6781981c1..d6879fd268f 100644 --- a/Source/Modules/CMakeBuildUtilities.cmake +++ b/Source/Modules/CMakeBuildUtilities.cmake @@ -78,10 +78,6 @@ endif() add_subdirectory(Utilities/std) CMAKE_SET_TARGET_FOLDER(cmstd "Utilities/std") -# check for the use of system libraries versus builtin ones -# (a macro defined in this file) -CMAKE_HANDLE_SYSTEM_LIBRARIES() - if(CMAKE_USE_SYSTEM_KWIML) find_package(KWIML 1.0) if(NOT KWIML_FOUND) diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx index 216b1c6c05b..c2b804279dd 100644 --- a/Source/cmFileAPI.cxx +++ b/Source/cmFileAPI.cxx @@ -72,7 +72,8 @@ void cmFileAPI::ReadQueries() { std::string const query_dir = cmStrCat(this->APIv1, "/query"); std::string const user_query_dir = cmStrCat(this->UserAPIv1, "/query"); - this->QueryExists = cmSystemTools::FileIsDirectory(query_dir); + this->QueryExists = + this->QueryExists || cmSystemTools::FileIsDirectory(query_dir); if (!this->UserAPIv1.empty()) { this->QueryExists = this->QueryExists || cmSystemTools::FileIsDirectory(user_query_dir); diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index b4b60f651ef..35afd91056e 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -2049,13 +2049,34 @@ Json::Value Target::DumpArtifacts() } // Add Windows-specific artifacts produced by the linker. + // NOTE: HasImportLibrary() only checks if the target SHOULD have an import + // library, not whether it has one set. if (this->GT->HasImportLibrary(this->Config)) { - Json::Value artifact = Json::objectValue; - artifact["path"] = - RelativeIfUnder(this->TopBuild, - this->GT->GetFullPath( - this->Config, cmStateEnums::ImportLibraryArtifact)); - artifacts.append(std::move(artifact)); // NOLINT(*) + std::string fullPath; + if (this->GT->IsImported()) { + // This imported target might not be well-formed. For Windows, it should + // have its IMPORTED_IMPLIB property set, and CMP0111's NEW behavior is + // intended to catch and report that. But if nothing uses the imported + // target, there won't have been any opportunity to detect that property + // being missing before here. Therefore, we tell ImportedGetFullPath() + // not to raise that CMP0111 error if it sees the problem. We don't want + // to trigger an error for a target that nothing uses, as that would be a + // regression compared to CMake 4.1 and earlier behavior. + fullPath = this->GT->Target->ImportedGetFullPath( + this->Config, cmStateEnums::ImportLibraryArtifact, + cmTarget::ImportArtifactMissingOk::Yes); + if (cmHasLiteralSuffix(fullPath, "-NOTFOUND")) { + fullPath.clear(); + } + } else { + fullPath = this->GT->NormalGetFullPath( + this->Config, cmStateEnums::ImportLibraryArtifact, false); + } + if (!fullPath.empty()) { + Json::Value artifact = Json::objectValue; + artifact["path"] = RelativeIfUnder(this->TopBuild, fullPath); + artifacts.append(std::move(artifact)); // NOLINT(*) + } } if (this->GT->IsDLLPlatform() && this->GT->GetType() != cmStateEnums::STATIC_LIBRARY) { diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 9f75f5c5b18..9230746ab45 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -2210,57 +2210,26 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode firstParam = false; } - // Determine the context(s) in which the expression should be evaluated. If - // CMPxxxx is NEW, the context is exactly one of the imported target's - // selected configuration, if applicable, or the consuming target's - // configuration, otherwise. + // Partially determine the context(s) in which the expression should be + // evaluated. // - // If CMPxxxx is OLD, we evaluate first in the context of the consuming - // target, then, if the consumed target is imported, we evaluate based on - // the mapped configurations (this logic is... problematic; see comment - // below), then finally based on the selected configuration of the imported - // target. + // If CMPxxxx is NEW, the context is exactly one of the imported target's + // selected configuration, if applicable and if the target was imported + // from CPS, or the consuming target's configuration otherwise. Here, we + // determine if we are in that 'otherwise' branch. + // + // Longer term, we need a way for non-CPS users to match the selected + // configuration of the imported target. At that time, CPS should switch + // to that mechanism and the CPS-specific logic here should be dropped. + // (We can do that because CPS doesn't use generator expressions directly; + // rather, CMake generates them on import.) bool const targetIsImported = (eval->CurrentTarget && eval->CurrentTarget->IsImported()); - bool const oldPolicy = [&] { - if (!targetIsImported) { - // For non-imported targets, there is no behavior difference between - // the OLD and NEW policy. - return false; - } - cmTarget const* const t = eval->CurrentTarget->Target; - if (t->GetOrigin() == cmTarget::Origin::Cps) { - // Generator expressions appearing on targets imported from CPS should - // always be evaluated according to the selected configuration of the - // imported target, i.e. the NEW policy. - return false; - } - switch (eval->HeadTarget->GetPolicyStatusCMP0199()) { - case cmPolicies::WARN: - if (eval->Context.LG->GetMakefile()->PolicyOptionalWarningEnabled( - "CMAKE_POLICY_WARNING_CMP0199")) { - std::string const err = - cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0199), - "\nEvaluation of $ for imported target \"", - eval->CurrentTarget->GetName(), "\", used by \"", - eval->HeadTarget->GetName(), - "\", may match multiple configurations.\n"); - eval->Context.LG->GetCMakeInstance()->IssueMessage( - MessageType ::AUTHOR_WARNING, err, eval->Backtrace); - } - CM_FALLTHROUGH; - case cmPolicies::OLD: - return true; - case cmPolicies::NEW: - return false; - } - - // Should be unreachable - assert(false); - return false; - }(); + bool const useConsumerConfig = + (targetIsImported && + eval->CurrentTarget->Target->GetOrigin() != cmTarget::Origin::Cps); - if (!targetIsImported || oldPolicy) { + if (!targetIsImported || useConsumerConfig) { // Does the consuming target's configuration match any of the arguments? for (auto const& param : parameters) { if (eval->Context.Config.empty()) { @@ -2280,13 +2249,55 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode std::string suffix; if (eval->CurrentTarget->Target->GetMappedConfig(eval->Context.Config, loc, imp, suffix)) { + // Finish determine the context(s) in which the expression should be + // evaluated. Note that we use the consumer's policy, so that end users + // can override the imported target's policy. This may be needed if + // upstream has changed their policy version without realizing that + // consumers were depending on the OLD behavior. + bool const oldPolicy = [&] { + if (!useConsumerConfig) { + // Targets imported from CPS shall use only the selected + // configuration of the imported target. + return false; + } + cmLocalGenerator const* const lg = eval->Context.LG; + switch (eval->HeadTarget->GetPolicyStatusCMP0199()) { + case cmPolicies::WARN: + if (lg->GetMakefile()->PolicyOptionalWarningEnabled( + "CMAKE_POLICY_WARNING_CMP0199")) { + std::string const err = + cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0199), + "\nEvaluation of $ for imported target \"", + eval->CurrentTarget->GetName(), "\", used by \"", + eval->HeadTarget->GetName(), + "\", may match multiple configurations.\n"); + lg->GetCMakeInstance()->IssueMessage( + MessageType ::AUTHOR_WARNING, err, eval->Backtrace); + } + CM_FALLTHROUGH; + case cmPolicies::OLD: + return true; + case cmPolicies::NEW: + return false; + } + + // Should be unreachable + assert(false); + return false; + }(); + if (oldPolicy) { + // If CMPxxxx is OLD (and we aren't dealing with a target imported + // form CPS), we already evaluated in the context of the consuming + // target. Next, for imported targets, we will evaluate based on the + // mapped configurations. + // // If the target has a MAP_IMPORTED_CONFIG_ property for the - // consumer's , match *any* config in that list, regardless - // of whether it's valid or of what GetMappedConfig actually picked. - // This will result in $ producing '1' for multiple configs, - // and is almost certainly wrong, but it's what CMake did for a very - // long time, and... Hyrum's Law. + // consumer's , we will match *any* config in that list, + // regardless of whether it's valid or of what GetMappedConfig + // actually picked. This will result in $ producing '1' for + // multiple configs, and is almost certainly wrong, but it's what + // CMake did for a very long time, and... Hyrum's Law. cmList mappedConfigs; std::string mapProp = cmStrCat("MAP_IMPORTED_CONFIG_", @@ -2305,11 +2316,13 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode } } - // This imported target has an appropriate location for this (possibly - // mapped) config. + // Finally, check if we selected (possibly via mapping) a configuration + // for this imported target, and if we should evaluate the expression + // in the context of the same. + // + // For targets imported from CPS, this is the only context we evaluate + // the expression. if (!suffix.empty()) { - // Use the (possibly mapped) configuration of the imported location - // that was selected. for (auto const& param : parameters) { if (cmStrCat('_', cmSystemTools::UpperCase(param)) == suffix) { return "1"; diff --git a/Source/cmGlobalFastbuildGenerator.cxx b/Source/cmGlobalFastbuildGenerator.cxx index 7b613c724b3..95a1f673bea 100644 --- a/Source/cmGlobalFastbuildGenerator.cxx +++ b/Source/cmGlobalFastbuildGenerator.cxx @@ -1020,7 +1020,8 @@ void cmGlobalFastbuildGenerator::AddCompiler(std::string const& language, // If FASTBUILD_COMPILER_EXTRA_FILES is not set - automatically add extra // files based on compiler (see // https://fastbuild.org/docs/functions/compiler.html) - if (compilerDef.ExtraFiles.empty() && + if (!this->GetCMakeInstance()->GetIsInTryCompile() && + compilerDef.ExtraFiles.empty() && (language == "C" || language == "CXX") && compilerDef.CmakeCompilerID == "MSVC") { // https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html @@ -1437,6 +1438,14 @@ void cmGlobalFastbuildGenerator::WriteTarget(FastbuildTarget const& target) } void cmGlobalFastbuildGenerator::WriteIDEProjects() { +#if defined(_WIN32) + std::string platformToolset; + std::string const toolset = + this->GetSafeGlobalSetting("MSVC_TOOLSET_VERSION"); + if (!toolset.empty()) { + platformToolset = cmStrCat('v', toolset); + } +#endif for (auto const& proj : IDEProjects) { (void)proj; // VS @@ -1445,6 +1454,9 @@ void cmGlobalFastbuildGenerator::WriteIDEProjects() WriteCommand("VCXProject", Quote(VSProj.Alias)); *this->BuildFileStream << "{\n"; WriteVariable("ProjectOutput", Quote(VSProj.ProjectOutput), 1); + if (!platformToolset.empty()) { + WriteVariable("PlatformToolset", Quote(platformToolset), 1); + } WriteIDEProjectConfig(VSProj.ProjectConfigs); WriteVSBuildCommands(); WriteIDEProjectCommon(VSProj); diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 087d4491e71..03965958157 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -803,6 +803,9 @@ cm::string_view cmGlobalVisualStudioGenerator::ExternalProjectTypeId( if (extension == ".dbproj"_s) { return Solution::Project::TypeIdDatabase; } + if (extension == ".njsproj"_s) { + return Solution::Project::TypeIdNodeJS; + } if (extension == ".wapproj"_s) { return Solution::Project::TypeIdWinAppPkg; } @@ -977,7 +980,8 @@ cm::VS::Solution cmGlobalVisualStudioGenerator::CreateSolution( if (!projectType.IsEmpty()) { project->TypeId = *projectType; } else { - project->TypeId = this->ExternalProjectTypeId(project->Path); + project->TypeId = + std::string{ this->ExternalProjectTypeId(project->Path) }; } for (std::string const& config : solution.Configs) { cmList mapConfig{ gt->GetProperty(cmStrCat( @@ -1010,13 +1014,13 @@ cm::VS::Solution cmGlobalVisualStudioGenerator::CreateSolution( cm::string_view vcprojExt; if (this->TargetIsFortranOnly(gt)) { vcprojExt = ".vfproj"_s; - project->TypeId = Solution::Project::TypeIdFortran; + project->TypeId = std::string{ Solution::Project::TypeIdFortran }; } else if (gt->IsCSharpOnly()) { vcprojExt = ".csproj"_s; - project->TypeId = Solution::Project::TypeIdCSharp; + project->TypeId = std::string{ Solution::Project::TypeIdCSharp }; } else { vcprojExt = ".vcproj"_s; - project->TypeId = Solution::Project::TypeIdDefault; + project->TypeId = std::string{ Solution::Project::TypeIdDefault }; } if (cmValue genExt = gt->GetProperty("GENERATOR_FILE_NAME_EXT")) { vcprojExt = *genExt; @@ -1069,7 +1073,7 @@ cm::VS::Solution cmGlobalVisualStudioGenerator::CreateSolution( cmSourceGroup* sg = mf->FindSourceGroup(item, sourceGroups); std::string folderName = sg->GetFullName(); if (folderName.empty()) { - folderName = "Solution Items"_s; + folderName = "Solution Items"; } Solution::Folder* folder = this->CreateSolutionFolder(solution, folderName); diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 2f22aaad7ed..a278d7fb88f 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -593,10 +593,10 @@ class cmMakefile; SELECT(POLICY, CMP0198, \ "CMAKE_PARENT_LIST_FILE is not defined in CMakeLists.txt.", 4, 2, 0, \ WARN) \ - SELECT( \ - POLICY, CMP0199, \ - "$ only matches the configuration of the consumed target.", \ - 4, 2, 0, WARN) \ + SELECT(POLICY, CMP0199, \ + "$ does not match mapped configurations that are not " \ + "selected.", \ + 4, 2, 0, WARN) \ SELECT(POLICY, CMP0200, \ "Location and configuration selection for imported targets is more " \ "consistent.", \ diff --git a/Source/cmRuntimeDependencyArchive.cxx b/Source/cmRuntimeDependencyArchive.cxx index 1ee80b4cd81..1a0aeefbcf0 100644 --- a/Source/cmRuntimeDependencyArchive.cxx +++ b/Source/cmRuntimeDependencyArchive.cxx @@ -236,6 +236,7 @@ bool cmRuntimeDependencyArchive::GetGetRuntimeDependenciesCommand( cmGlobalGenerator* gg = this->GetMakefile()->GetGlobalGenerator(); // Add newer Visual Studio paths + AddVisualStudioPath(paths, "Visual Studio 18 ", 18, gg); AddVisualStudioPath(paths, "Visual Studio 17 ", 17, gg); AddVisualStudioPath(paths, "Visual Studio 16 ", 16, gg); AddVisualStudioPath(paths, "Visual Studio 15 ", 15, gg); diff --git a/Source/cmSarifLog.cxx b/Source/cmSarifLog.cxx index 35b67f79141..e5953db80ee 100644 --- a/Source/cmSarifLog.cxx +++ b/Source/cmSarifLog.cxx @@ -5,8 +5,6 @@ #include #include -#include - #include #include @@ -299,8 +297,7 @@ cmSarif::LogFileWriter::~LogFileWriter() if (this->TryWrite() == WriteResult::FAILURE) { // If the result is `FAILURE`, it means the write condition is true but // the file still wasn't written. This is an error. - cmSystemTools::Error("Failed to write SARIF log to " + - this->FilePath.generic_string()); + cmSystemTools::Error("Failed to write SARIF log to " + this->FilePath); } } } @@ -308,16 +305,16 @@ cmSarif::LogFileWriter::~LogFileWriter() bool cmSarif::LogFileWriter::EnsureFileValid() { // First, ensure directory exists - cm::filesystem::path dir = this->FilePath.parent_path(); - if (!cmSystemTools::FileIsDirectory(dir.generic_string())) { + std::string const dir = cmSystemTools::GetFilenamePath(this->FilePath); + if (!cmSystemTools::FileIsDirectory(dir)) { if (!this->CreateDirectories || - !cmSystemTools::MakeDirectory(dir.generic_string()).IsSuccess()) { + !cmSystemTools::MakeDirectory(dir).IsSuccess()) { return false; } } // Open the file for writing - cmsys::ofstream outputFile(this->FilePath.generic_string().c_str()); + cmsys::ofstream outputFile(this->FilePath.c_str()); if (!outputFile.good()) { return false; } @@ -335,7 +332,7 @@ cmSarif::LogFileWriter::WriteResult cmSarif::LogFileWriter::TryWrite() if (!this->EnsureFileValid()) { return WriteResult::FAILURE; } - cmsys::ofstream outputFile(this->FilePath.generic_string().c_str()); + cmsys::ofstream outputFile(this->FilePath.c_str()); // The file is available, so proceed to write the log @@ -357,9 +354,8 @@ cmSarif::LogFileWriter::WriteResult cmSarif::LogFileWriter::TryWrite() bool cmSarif::LogFileWriter::ConfigureForCMakeRun(cmake& cm) { // If an explicit SARIF output path has been provided, set and check it - cm::optional sarifFilePath = cm.GetSarifFilePath(); - if (sarifFilePath) { - this->SetPath(cm::filesystem::path(*sarifFilePath)); + if (cm::optional sarifFilePath = cm.GetSarifFilePath()) { + this->SetPath(*sarifFilePath); if (!this->EnsureFileValid()) { cmSystemTools::Error( cmStrCat("Invalid SARIF output file path: ", *sarifFilePath)); diff --git a/Source/cmSarifLog.h b/Source/cmSarifLog.h index efdaf14f16e..d267d0001b3 100644 --- a/Source/cmSarifLog.h +++ b/Source/cmSarifLog.h @@ -9,7 +9,6 @@ #include #include -#include #include #include @@ -269,8 +268,7 @@ class LogFileWriter /// /// The settings will apply when the log file is written. If the output /// file should be checked earlier, use `CheckFileValidity`. - void SetPath(cm::filesystem::path const& path, - bool createParentDirectories = false) + void SetPath(std::string const& path, bool createParentDirectories = false) { this->FilePath = path; this->CreateDirectories = createParentDirectories; @@ -279,7 +277,7 @@ class LogFileWriter private: ResultsLog const& Log; std::function WriteCondition; - cm::filesystem::path FilePath; + std::string FilePath; bool CreateDirectories = false; bool FileWritten = false; }; diff --git a/Source/cmStdIoInit.cxx b/Source/cmStdIoInit.cxx index a2fc50db7f3..49f31873bdc 100644 --- a/Source/cmStdIoInit.cxx +++ b/Source/cmStdIoInit.cxx @@ -93,19 +93,23 @@ class Globals Globals(); +#ifdef _WIN32 + static BOOL WINAPI CtrlHandler(DWORD /*dwCtrlType*/) + { + Get().StdErr.Destroy(); + Get().StdOut.Destroy(); + Get().StdIn.Destroy(); + return FALSE; + } +#endif + static Globals& Get(); }; #ifdef _WIN32 Globals::Globals() { - static auto const ctrlHandler = [](DWORD /*dwCtrlType*/) -> BOOL { - Get().StdErr.Destroy(); - Get().StdOut.Destroy(); - Get().StdIn.Destroy(); - return FALSE; - }; - SetConsoleCtrlHandler(ctrlHandler, TRUE); + SetConsoleCtrlHandler(CtrlHandler, TRUE); } #else Globals::Globals() = default; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 6c0cd8b6cce..ad37fe0ae07 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2993,7 +2993,8 @@ char const* cmTarget::GetPrefixVariableInternal( } std::string cmTarget::ImportedGetFullPath( - std::string const& config, cmStateEnums::ArtifactType artifact) const + std::string const& config, cmStateEnums::ArtifactType artifact, + ImportArtifactMissingOk missingOk) const { assert(this->IsImported()); @@ -3074,7 +3075,7 @@ std::string cmTarget::ImportedGetFullPath( } } - if (result.empty()) { + if (result.empty() && missingOk != ImportArtifactMissingOk::Yes) { if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) { auto message = [&]() -> std::string { std::string unset; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 1eed1006a90..96a067b4d7f 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -328,8 +328,15 @@ class cmTarget cmBTStringRange GetInterfaceHeaderSetsEntries() const; cmBTStringRange GetInterfaceCxxModuleSetsEntries() const; - std::string ImportedGetFullPath(std::string const& config, - cmStateEnums::ArtifactType artifact) const; + enum class ImportArtifactMissingOk + { + No, + Yes + }; + + std::string ImportedGetFullPath( + std::string const& config, cmStateEnums::ArtifactType artifact, + ImportArtifactMissingOk missingOk = ImportArtifactMissingOk::No) const; struct StrictTargetComparison { diff --git a/Source/cmVSSolution.cxx b/Source/cmVSSolution.cxx index 2ec3f021b50..c8d4775cac3 100644 --- a/Source/cmVSSolution.cxx +++ b/Source/cmVSSolution.cxx @@ -17,22 +17,36 @@ namespace cm { namespace VS { +cm::string_view const Solution::Project::TypeIdAspNetCore = + "8BB2217D-0F2D-49D1-97BC-3654ED321F3B"_s; cm::string_view const Solution::Project::TypeIdCSharp = "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"_s; cm::string_view const Solution::Project::TypeIdDatabase = "C8D11400-126E-41CD-887F-60BD40844F9E"_s; cm::string_view const Solution::Project::TypeIdDefault = "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"_s; +cm::string_view const Solution::Project::TypeIdDotNetCore = + "9A19103F-16F7-4668-BE54-9A1E7A4F7556"_s; cm::string_view const Solution::Project::TypeIdFSharp = "F2A71F9B-5D33-465A-A702-920D77279786"_s; cm::string_view const Solution::Project::TypeIdFortran = "6989167D-11E4-40FE-8C1A-2192A86A7E90"_s; +cm::string_view const Solution::Project::TypeIdJScript = + "262852C6-CD72-467D-83FE-5EEB1973A190"_s; +cm::string_view const Solution::Project::TypeIdMisc = + "66A2671D-8FB5-11D2-AA7E-00C04F688DDE"_s; +cm::string_view const Solution::Project::TypeIdNodeJS = + "9092AA53-FB77-4645-B42D-1CCCA6BD08BD"_s; cm::string_view const Solution::Project::TypeIdPython = "888888A0-9F3D-457C-B088-3A5042F75D52"_s; +cm::string_view const Solution::Project::TypeIdSqlSrv = + "00D1A9C2-B5F0-4AF3-8072-F6C62B433612"_s; cm::string_view const Solution::Project::TypeIdVDProj = "54435603-DBB4-11D2-8724-00A0C9A8B90C"_s; cm::string_view const Solution::Project::TypeIdVisualBasic = "F184B08F-C81C-45F6-A57F-5ABD9991F28F"_s; +cm::string_view const Solution::Project::TypeIdWebSite = + "E24C65DC-7377-472B-9ABA-BC803B73C61A"_s; cm::string_view const Solution::Project::TypeIdWinAppPkg = "C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5"_s; cm::string_view const Solution::Project::TypeIdWiX = @@ -64,7 +78,7 @@ T* GetEntry(std::map>& entryMap, auto i = entryMap.find(name); if (i == entryMap.end()) { auto p = cm::make_unique(); - p->Name = name; + p->Name = std::string{ name }; i = entryMap.emplace(p->Name, std::move(p)).first; } return i->second.get(); @@ -297,6 +311,18 @@ void WriteSln(std::ostream& sln, Solution const& solution) } namespace { + +bool NeedExplicitProjectPlatform(cm::string_view typeId) +{ + // Some projects do not build interactively in the VS IDE unless they + // have an explicit platform, even if it matches the SLN platform. + if (typeId == Solution::Project::TypeIdCSharp || + typeId == Solution::Project::TypeIdDotNetCore) { + return true; + } + return false; +} + void WriteSlnxSolutionConfigurationPlatforms(cmXMLElement& xmlParent, Solution const& solution) { @@ -339,9 +365,7 @@ void WriteSlnxProject(cmXMLElement& xmlParent, Solution const& solution, } } if (project.Platform != solution.Platform || - // C# projects do not build interactively in the VS IDE unless they - // have an explicit platform, even if it matches the SLN platform. - project.TypeId == Solution::Project::TypeIdCSharp) { + NeedExplicitProjectPlatform(project.TypeId)) { cmXMLElement(xmlProject, "Platform") .Attribute("Project", project.Platform); } diff --git a/Source/cmVSSolution.h b/Source/cmVSSolution.h index 5d6b306b88b..49385da3bf4 100644 --- a/Source/cmVSSolution.h +++ b/Source/cmVSSolution.h @@ -70,14 +70,21 @@ struct Solution final std::vector BuildDependencies; // Project type GUIDs used during creation. + static cm::string_view const TypeIdAspNetCore; static cm::string_view const TypeIdCSharp; static cm::string_view const TypeIdDatabase; static cm::string_view const TypeIdDefault; + static cm::string_view const TypeIdDotNetCore; static cm::string_view const TypeIdFSharp; static cm::string_view const TypeIdFortran; + static cm::string_view const TypeIdJScript; + static cm::string_view const TypeIdMisc; + static cm::string_view const TypeIdNodeJS; static cm::string_view const TypeIdPython; + static cm::string_view const TypeIdSqlSrv; static cm::string_view const TypeIdVDProj; static cm::string_view const TypeIdVisualBasic; + static cm::string_view const TypeIdWebSite; static cm::string_view const TypeIdWinAppPkg; static cm::string_view const TypeIdWiX; }; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 286592b0926..112ebfa6daf 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -445,18 +445,20 @@ void cmVisualStudio10TargetGenerator::Generate() if (!this->ComputeLibOptions()) { return; } - for (std::string const& config : this->Configurations) { - // Default character set if not populated above. - this->CharSet.emplace( - config, - (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") || - this->GlobalGenerator->TargetsWindowsPhone() || - this->GlobalGenerator->TargetsWindowsStore() || - this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) - ? MsvcCharSet::Unicode - : MsvcCharSet::MultiByte); - } } + + for (std::string const& config : this->Configurations) { + // Default character set if not populated above. + this->CharSet.emplace( + config, + (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") || + this->GlobalGenerator->TargetsWindowsPhone() || + this->GlobalGenerator->TargetsWindowsStore() || + this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) + ? MsvcCharSet::Unicode + : MsvcCharSet::MultiByte); + } + std::string path = cmStrCat(this->LocalGenerator->GetCurrentBinaryDirectory(), '/', this->Name, ProjectFileExtension); @@ -1572,12 +1574,9 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues( e1.Element("UseOfMfc", useOfMfcValue); } - if ((this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY && - this->CharSet[config] == MsvcCharSet::Unicode)) { + if (this->CharSet[config] == MsvcCharSet::Unicode) { e1.Element("CharacterSet", "Unicode"); - } else if (this->GeneratorTarget->GetType() <= - cmStateEnums::OBJECT_LIBRARY && - this->CharSet[config] == MsvcCharSet::SingleByte) { + } else if (this->CharSet[config] == MsvcCharSet::SingleByte) { e1.Element("CharacterSet", "NotSet"); } else { e1.Element("CharacterSet", "MultiByte"); @@ -4685,35 +4684,32 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( } if (this->MSTools) { - if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) { - // Specify an entry point for executables. - if (this->GeneratorTarget->IsWin32Executable(config)) { - if (this->GlobalGenerator->TargetsWindowsCE()) { - linkOptions.AddFlag("SubSystem", "WindowsCE"); - if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) { - if (this->CharSet[config] == MsvcCharSet::Unicode) { - linkOptions.AddFlag("EntryPointSymbol", "wWinMainCRTStartup"); - } else { - linkOptions.AddFlag("EntryPointSymbol", "WinMainCRTStartup"); - } + if (this->GeneratorTarget->IsWin32Executable(config)) { + if (this->GlobalGenerator->TargetsWindowsCE()) { + linkOptions.AddFlag("SubSystem", "WindowsCE"); + if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) { + if (this->CharSet[config] == MsvcCharSet::Unicode) { + linkOptions.AddFlag("EntryPointSymbol", "wWinMainCRTStartup"); + } else { + linkOptions.AddFlag("EntryPointSymbol", "WinMainCRTStartup"); } - } else { - linkOptions.AddFlag("SubSystem", "Windows"); } } else { - if (this->GlobalGenerator->TargetsWindowsCE()) { - linkOptions.AddFlag("SubSystem", "WindowsCE"); - if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) { - if (this->CharSet[config] == MsvcCharSet::Unicode) { - linkOptions.AddFlag("EntryPointSymbol", "mainWCRTStartup"); - } else { - linkOptions.AddFlag("EntryPointSymbol", "mainACRTStartup"); - } - } - } else { - linkOptions.AddFlag("SubSystem", "Console"); - }; + linkOptions.AddFlag("SubSystem", "Windows"); } + } else { + if (this->GlobalGenerator->TargetsWindowsCE()) { + linkOptions.AddFlag("SubSystem", "WindowsCE"); + if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) { + if (this->CharSet[config] == MsvcCharSet::Unicode) { + linkOptions.AddFlag("EntryPointSymbol", "mainWCRTStartup"); + } else { + linkOptions.AddFlag("EntryPointSymbol", "mainACRTStartup"); + } + } + } else { + linkOptions.AddFlag("SubSystem", "Console"); + }; } if (cmValue stackVal = this->Makefile->GetDefinition( diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 0b01e7301e4..81423d1c346 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -15,7 +15,6 @@ #include #include -#include #include #include #include @@ -719,6 +718,8 @@ bool cmake::SetCacheArgs(std::vector const& args) // Resolve script path specified on command line // relative to $PWD. auto path = cmSystemTools::ToNormalizedPathOnDisk(value); + state->InitializeFileAPI(); + state->InitializeInstrumentation(); state->ReadListFile(args, path); return true; } }, @@ -2670,13 +2671,9 @@ int cmake::ActualConfigure() } #if !defined(CMAKE_BOOTSTRAP) - this->FileAPI = cm::make_unique(this); + this->InitializeFileAPI(); this->FileAPI->ReadQueries(); - - this->Instrumentation = cm::make_unique( - this->State->GetBinaryDirectory(), - cmInstrumentation::LoadQueriesAfter::No); - this->Instrumentation->ClearGeneratedQueries(); + this->InitializeInstrumentation(); if (!this->GetIsInTryCompile()) { this->TruncateOutputLog("CMakeConfigureLog.yaml"); @@ -2934,6 +2931,27 @@ void cmake::StopDebuggerIfNeeded(int exitCode) #endif +void cmake::InitializeFileAPI() +{ +#ifndef CMAKE_BOOTSTRAP + if (!this->FileAPI) { + this->FileAPI = cm::make_unique(this); + } +#endif +} + +void cmake::InitializeInstrumentation() +{ +#ifndef CMAKE_BOOTSTRAP + if (!this->Instrumentation) { + this->Instrumentation = cm::make_unique( + this->State->GetBinaryDirectory(), + cmInstrumentation::LoadQueriesAfter::No); + this->Instrumentation->ClearGeneratedQueries(); + } +#endif +} + // handle a command line invocation int cmake::Run(std::vector const& args, bool noconfigure) { @@ -2986,10 +3004,9 @@ int cmake::Run(std::vector const& args, bool noconfigure) if (!this->SarifFileOutput) { // If no output file is specified, use the default path // Enable parent directory creation for the default path - sarifLogFileWriter.SetPath( - cm::filesystem::path(this->GetHomeOutputDirectory()) / - std::string(cmSarif::PROJECT_DEFAULT_SARIF_FILE), - true); + sarifLogFileWriter.SetPath(cmStrCat(this->GetHomeOutputDirectory(), '/', + cmSarif::PROJECT_DEFAULT_SARIF_FILE), + true); } #endif } else { diff --git a/Source/cmake.h b/Source/cmake.h index a1caf8b9cfa..6beaae0e041 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -714,6 +714,8 @@ class cmake return this->Instrumentation.get(); } #endif + void InitializeFileAPI(); + void InitializeInstrumentation(); cmState* GetState() const { return this->State.get(); } void SetCurrentSnapshot(cmStateSnapshot const& snapshot) diff --git a/Tests/CudaOnly/ArchSpecial/CMakeLists.txt b/Tests/CudaOnly/ArchSpecial/CMakeLists.txt index 3f862450a5a..1a8879359d1 100644 --- a/Tests/CudaOnly/ArchSpecial/CMakeLists.txt +++ b/Tests/CudaOnly/ArchSpecial/CMakeLists.txt @@ -61,7 +61,14 @@ try_compile(native_archs_compiles COMPILE_DEFINITIONS ${try_compile_flags} OUTPUT_VARIABLE output ) -verify_output(native) +if(native_archs_compiles) + verify_output(native) +elseif("$ENV{CMAKE_CUDA_ARCHITECTURES_NATIVE_CLAMP}" + AND CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" + AND output MATCHES "Unsupported gpu architecture") + # nvcc -arch=native is not affected by the clamp + set(native_archs_compiles 1) +endif() if(all_archs_compiles AND all_major_archs_compiles AND native_archs_compiles) set(CMAKE_CUDA_ARCHITECTURES all) diff --git a/Tests/CudaOnly/OptixIR/CMakeLists.txt b/Tests/CudaOnly/OptixIR/CMakeLists.txt index f408d40325e..26d276200dc 100644 --- a/Tests/CudaOnly/OptixIR/CMakeLists.txt +++ b/Tests/CudaOnly/OptixIR/CMakeLists.txt @@ -14,7 +14,7 @@ if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "11.7.0") endif() set_property(TARGET CudaOptix PROPERTY CUDA_SEPARABLE_COMPILATION ON) -set_property(TARGET CudaOptix PROPERTY CUDA_ARCHITECTURES native) +set_property(TARGET CudaOptix PROPERTY CUDA_ARCHITECTURES "${CMAKE_CUDA_ARCHITECTURES_NATIVE}") add_executable(CudaOnlyOptixIR main.cu) target_compile_features(CudaOnlyOptixIR PRIVATE cuda_std_11) diff --git a/Tests/CudaOnly/ResolveDeviceSymbols/file2_launch.cu b/Tests/CudaOnly/ResolveDeviceSymbols/file2_launch.cu index 4e8da13712c..17f1117e80e 100644 --- a/Tests/CudaOnly/ResolveDeviceSymbols/file2_launch.cu +++ b/Tests/CudaOnly/ResolveDeviceSymbols/file2_launch.cu @@ -1,18 +1,23 @@ #include "file2.h" -static __global__ void file2_kernel(result_type_dynamic& r, int x) +static __global__ void file2_kernel(result_type_dynamic* r, int x) { // call static_func which is a method that is defined in the // static library that is always out of date - r = file2_func(x); + *r = file2_func(x); } -static __global__ void file2_kernel(result_type_dynamic& r, int x); - int file2_launch_kernel(int x) { - result_type_dynamic r; + result_type_dynamic* r; + cudaMallocManaged(&r, sizeof(result_type_dynamic)); + file2_kernel<<<1, 1>>>(r, x); - return r.sum; + cudaDeviceSynchronize(); + + auto sum = r->sum; + cudaFree(r); + + return sum; } diff --git a/Tests/CudaOnly/RuntimeControls/file1.cu b/Tests/CudaOnly/RuntimeControls/file1.cu index 28beb5e87ff..c9a258e0069 100644 --- a/Tests/CudaOnly/RuntimeControls/file1.cu +++ b/Tests/CudaOnly/RuntimeControls/file1.cu @@ -5,14 +5,21 @@ # define EXPORT #endif -void __global__ file1_kernel(int x, int& r) +void __global__ file1_kernel(int x, int* r) { - r = -x; + *r = -x; } EXPORT int file1_launch_kernel(int x) { - int r = 0; + int* r; + cudaMallocManaged(&r, sizeof(int)); + file1_kernel<<<1, 1>>>(x, r); - return r; + cudaDeviceSynchronize(); + + auto result = *r; + cudaFree(r); + + return result; } diff --git a/Tests/CudaOnly/RuntimeControls/file2.cu b/Tests/CudaOnly/RuntimeControls/file2.cu index ff68a702452..634ca3865e6 100644 --- a/Tests/CudaOnly/RuntimeControls/file2.cu +++ b/Tests/CudaOnly/RuntimeControls/file2.cu @@ -5,14 +5,21 @@ # define EXPORT #endif -void __global__ file2_kernel(int x, int& r) +void __global__ file2_kernel(int x, int* r) { - r = -x; + *r = -x; } EXPORT int file2_launch_kernel(int x) { - int r = 0; + int* r; + cudaMallocManaged(&r, sizeof(int)); + file2_kernel<<<1, 1>>>(x, r); - return r; + cudaDeviceSynchronize(); + + auto result = *r; + cudaFree(r); + + return result; } diff --git a/Tests/CudaOnly/SeparateCompilation/file3.cu b/Tests/CudaOnly/SeparateCompilation/file3.cu index 155b513bb20..02048eec015 100644 --- a/Tests/CudaOnly/SeparateCompilation/file3.cu +++ b/Tests/CudaOnly/SeparateCompilation/file3.cu @@ -6,17 +6,24 @@ result_type __device__ file1_func(int x); result_type_dynamic __device__ file2_func(int x); -static __global__ void file3_kernel(result_type& r, int x) +static __global__ void file3_kernel(result_type* r, int x) { // call static_func which is a method that is defined in the // static library that is always out of date - r = file1_func(x); + *r = file1_func(x); result_type_dynamic rd = file2_func(x); } result_type file3_launch_kernel(int x) { - result_type r; + result_type* r; + cudaMallocManaged(&r, sizeof(result_type)); + file3_kernel<<<1, 1>>>(r, x); - return r; + cudaDeviceSynchronize(); + + auto result = *r; + cudaFree(r); + + return result; } diff --git a/Tests/CudaOnly/SeparateCompilation/file4.cu b/Tests/CudaOnly/SeparateCompilation/file4.cu index f2ef8e7ef4a..f2e5e6ec91c 100644 --- a/Tests/CudaOnly/SeparateCompilation/file4.cu +++ b/Tests/CudaOnly/SeparateCompilation/file4.cu @@ -4,17 +4,24 @@ result_type __device__ file1_func(int x); result_type_dynamic __device__ file2_func(int x); -static __global__ void file4_kernel(result_type& r, int x) +static __global__ void file4_kernel(result_type* r, int x) { // call static_func which is a method that is defined in the // static library that is always out of date - r = file1_func(x); + *r = file1_func(x); result_type_dynamic rd = file2_func(x); } EXPORT int file4_launch_kernel(int x) { - result_type r; + result_type* r; + cudaMallocManaged(&r, sizeof(result_type)); + file4_kernel<<<1, 1>>>(r, x); - return r.sum; + cudaDeviceSynchronize(); + + auto sum = r->sum; + cudaFree(r); + + return sum; } diff --git a/Tests/CudaOnly/SeparateCompilation/file5.cu b/Tests/CudaOnly/SeparateCompilation/file5.cu index 9b2c92a1d6d..112925b1d37 100644 --- a/Tests/CudaOnly/SeparateCompilation/file5.cu +++ b/Tests/CudaOnly/SeparateCompilation/file5.cu @@ -4,17 +4,24 @@ result_type __device__ file1_func(int x); result_type_dynamic __device__ file2_func(int x); -static __global__ void file5_kernel(result_type& r, int x) +static __global__ void file5_kernel(result_type* r, int x) { // call static_func which is a method that is defined in the // static library that is always out of date - r = file1_func(x); + *r = file1_func(x); result_type_dynamic rd = file2_func(x); } EXPORT int file5_launch_kernel(int x) { - result_type r; + result_type* r; + cudaMallocManaged(&r, sizeof(result_type)); + file5_kernel<<<1, 1>>>(r, x); - return r.sum; + cudaDeviceSynchronize(); + + auto sum = r->sum; + cudaFree(r); + + return sum; } diff --git a/Tests/RunCMake/CPack_AppImage/AppImageTestApp-cpack-AppImage-stdout.txt b/Tests/RunCMake/CPack_AppImage/AppImageTestApp-cpack-AppImage-stdout.txt index 67d5a51056e..c8ec5f5b16e 100644 --- a/Tests/RunCMake/CPack_AppImage/AppImageTestApp-cpack-AppImage-stdout.txt +++ b/Tests/RunCMake/CPack_AppImage/AppImageTestApp-cpack-AppImage-stdout.txt @@ -7,6 +7,7 @@ CPack: Found Desktop file: "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1 CPack: Desktop file destination: "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux/com\.example\.app\.desktop" CPack: Icon file: "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux/share/icons/hicolor/64x64/apps/ApplicationIcon\.png" CPack: Icon link destination: "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux/ApplicationIcon\.png" +CPack: No AppRun found, generating a default one that will run: "bin/app" CPack: Running AppImageTool: "[^"]*" "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux" "\.\./GeneratorTest-1\.2\.3-Linux\.AppImage" "--runtime-file" "[^"]*" [^ ]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux should be packaged as \.\./GeneratorTest-1\.2\.3-Linux\.AppImage diff --git a/Tests/RunCMake/CTestTimeoutAfterMatch/RunCMakeTest.cmake b/Tests/RunCMake/CTestTimeoutAfterMatch/RunCMakeTest.cmake index ee4db839f7d..2dad5f0974e 100644 --- a/Tests/RunCMake/CTestTimeoutAfterMatch/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestTimeoutAfterMatch/RunCMakeTest.cmake @@ -1,3 +1,4 @@ +include(RunCMake) include(RunCTest) function(run_ctest_TimeoutAfterMatch CASE_NAME) @@ -9,3 +10,24 @@ run_ctest_TimeoutAfterMatch(MissingArg1 "\"-Darg2=Test started\"") run_ctest_TimeoutAfterMatch(MissingArg2 "\"-Darg1=2\"") run_ctest_TimeoutAfterMatch(ShouldTimeout "\"-Darg1=1\" \"-Darg2=Test started\"") run_ctest_TimeoutAfterMatch(ShouldPass "\"-Darg1=15\" \"-Darg2=Test started\"") + +function(run_ctest_cli_TimeoutAfterMatch CASE_NAME) + set(test_name "${CASE_NAME}") + + set(RunCMake_TEST_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/${test_name}") + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${test_name}-build") + + if (RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_CONFIGURATION_TYPES=Debug) + else () + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) + endif () + list(APPEND RunCMake_TEST_OPTIONS + ${ARGN}) + run_cmake("${test_name}") + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command("${test_name}-build" "${CMAKE_COMMAND}" --build . --config Debug) + run_cmake_command("${test_name}-test" "${CMAKE_CTEST_COMMAND}" -C Debug -VV) +endfunction() + +run_ctest_cli_TimeoutAfterMatch(ShouldTimeoutNoBaseTimeout "-Dno_timeout=1" "-Darg1=1" "-Darg2=Test started") diff --git a/Tests/RunCMake/CTestTimeoutAfterMatch/ShouldTimeoutNoBaseTimeout-test-result.txt b/Tests/RunCMake/CTestTimeoutAfterMatch/ShouldTimeoutNoBaseTimeout-test-result.txt new file mode 100644 index 00000000000..45a4fb75db8 --- /dev/null +++ b/Tests/RunCMake/CTestTimeoutAfterMatch/ShouldTimeoutNoBaseTimeout-test-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/CTestTimeoutAfterMatch/ShouldTimeoutNoBaseTimeout-test-stderr.txt b/Tests/RunCMake/CTestTimeoutAfterMatch/ShouldTimeoutNoBaseTimeout-test-stderr.txt new file mode 100644 index 00000000000..0452e31f5bc --- /dev/null +++ b/Tests/RunCMake/CTestTimeoutAfterMatch/ShouldTimeoutNoBaseTimeout-test-stderr.txt @@ -0,0 +1,3 @@ +^Errors while running CTest +Output from these tests are in: .*/Tests/RunCMake/CTestTimeoutAfterMatch/ShouldTimeoutNoBaseTimeout-build/Testing/Temporary/LastTest\.log +Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely\.$ diff --git a/Tests/RunCMake/CTestTimeoutAfterMatch/ShouldTimeoutNoBaseTimeout-test-stdout.txt b/Tests/RunCMake/CTestTimeoutAfterMatch/ShouldTimeoutNoBaseTimeout-test-stdout.txt new file mode 100644 index 00000000000..1b383316b6a --- /dev/null +++ b/Tests/RunCMake/CTestTimeoutAfterMatch/ShouldTimeoutNoBaseTimeout-test-stdout.txt @@ -0,0 +1 @@ +1/1 Test #1: SleepFor1Second \.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\*\*\*Timeout +[0-9\.]+ sec diff --git a/Tests/RunCMake/CTestTimeoutAfterMatch/ShouldTimeoutNoBaseTimeout/CMakeLists.txt b/Tests/RunCMake/CTestTimeoutAfterMatch/ShouldTimeoutNoBaseTimeout/CMakeLists.txt new file mode 100644 index 00000000000..456c092e1a5 --- /dev/null +++ b/Tests/RunCMake/CTestTimeoutAfterMatch/ShouldTimeoutNoBaseTimeout/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.10) +project(TimeoutAfterMatch NONE) +enable_testing() +add_test(NAME SleepFor1Second COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_SOURCE_DIR}/../SleepFor1Second.cmake) +set_property(TEST SleepFor1Second PROPERTY TIMEOUT_AFTER_MATCH "${arg1}" "${arg2}") diff --git a/Tests/RunCMake/FileAPI/InitialCache-check.cmake b/Tests/RunCMake/FileAPI/InitialCache-check.cmake new file mode 100644 index 00000000000..3767f151685 --- /dev/null +++ b/Tests/RunCMake/FileAPI/InitialCache-check.cmake @@ -0,0 +1,8 @@ +set(expect + reply + reply/codemodel-v2-[0-9a-f]+.json + .*reply/index-[0-9.T-]+.json.* +) + +# Only need to check for existence. Other tests check the reply contents. +check_api("^${expect}$") diff --git a/Tests/RunCMake/FileAPI/InitialCache-script.cmake b/Tests/RunCMake/FileAPI/InitialCache-script.cmake new file mode 100644 index 00000000000..9d8505fb556 --- /dev/null +++ b/Tests/RunCMake/FileAPI/InitialCache-script.cmake @@ -0,0 +1,5 @@ +cmake_file_api( + QUERY + API_VERSION 1 + CODEMODEL 2 +) diff --git a/Tests/RunCMake/FileAPI/InitialCache.cmake b/Tests/RunCMake/FileAPI/InitialCache.cmake new file mode 100644 index 00000000000..e69de29bb2d diff --git a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake index 47834675077..1fb534fa1a2 100644 --- a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake +++ b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake @@ -140,6 +140,7 @@ run_cmake(ClientStateless) run_cmake(MixedStateless) run_cmake(DuplicateStateless) run_cmake(ClientStateful) +run_cmake_with_options(InitialCache -C ${RunCMake_SOURCE_DIR}/InitialCache-script.cmake) run_cmake(ProjectQueryGood) run_cmake(ProjectQueryBad) run_cmake(FailConfigure) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py index 8b2e1c30e84..8d140aba711 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py +++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py @@ -1224,6 +1224,7 @@ def gen_check_abstract_targets(c, g, inSource): read_codemodel_json_data("targets/imported_object_lib.json"), read_codemodel_json_data("targets/imported_shared_lib.json"), read_codemodel_json_data("targets/imported_static_lib.json"), + read_codemodel_json_data("targets/unused_imported_shared_lib.json"), read_codemodel_json_data("targets/iface_none.json"), read_codemodel_json_data("targets/iface_symbolic.json"), diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json index bbb77ecb839..6dd03a6ac2e 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json @@ -20,7 +20,8 @@ "^imported_lib::@ba7eb709d0b48779c6c8$", "^imported_object_lib::@ba7eb709d0b48779c6c8$", "^imported_shared_lib::@ba7eb709d0b48779c6c8$", - "^imported_static_lib::@ba7eb709d0b48779c6c8$" + "^imported_static_lib::@ba7eb709d0b48779c6c8$", + "^unused_imported_shared_lib::@ba7eb709d0b48779c6c8$" ], "projectName": "Imported", "minimumCMakeVersion": "3.13", diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/imported.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/imported.json index 56734181a65..80d24177b8d 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/imported.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/imported.json @@ -22,6 +22,7 @@ "^imported_interface_symbolic_lib::@ba7eb709d0b48779c6c8$", "^imported_object_lib::@ba7eb709d0b48779c6c8$", "^imported_shared_lib::@ba7eb709d0b48779c6c8$", - "^imported_static_lib::@ba7eb709d0b48779c6c8$" + "^imported_static_lib::@ba7eb709d0b48779c6c8$", + "^unused_imported_shared_lib::@ba7eb709d0b48779c6c8$" ] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/unused_imported_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/unused_imported_shared_lib.json new file mode 100644 index 00000000000..133c78f9895 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/unused_imported_shared_lib.json @@ -0,0 +1,50 @@ +{ + "name": "unused_imported_shared_lib", + "id": "^unused_imported_shared_lib::@ba7eb709d0b48779c6c8$", + "directorySource": "^imported$", + "projectName": "Imported", + "type": "SHARED_LIBRARY", + "imported": true, + "local": true, + "abstract": true, + "symbolic": null, + "isGeneratorProvided": null, + "fileSets": null, + "sources": [], + "sourceGroups": null, + "compileGroups": null, + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": 48, + "command": "add_library", + "hasParent": true + }, + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^(lib|cyg|msys-)?unused_imported_shared\\.(so|dylib|dll)$", + "artifacts": [ + { + "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg|msys-)?unused_imported_shared\\.(so|dylib|dll)$", + "_dllExtra": false + } + ], + "build": "^imported$", + "source": "^imported$", + "install": null, + "link": null, + "archive": null, + "dependencies": null, + "linkLibraries": null, + "interfaceLinkLibraries": null, + "compileDependencies": null, + "interfaceCompileDependencies": null, + "objectDependencies": null, + "orderDependencies": null +} diff --git a/Tests/RunCMake/FileAPI/imported/CMakeLists.txt b/Tests/RunCMake/FileAPI/imported/CMakeLists.txt index d9b59020799..9d6ec39f6d9 100644 --- a/Tests/RunCMake/FileAPI/imported/CMakeLists.txt +++ b/Tests/RunCMake/FileAPI/imported/CMakeLists.txt @@ -42,3 +42,10 @@ install(IMPORTED_RUNTIME_ARTIFACTS imported_shared_lib install(IMPORTED_RUNTIME_ARTIFACTS imported_shared_lib DESTINATION lib2 OPTIONAL ) + +# This is deliberately missing the IMPORTED_IMPLIB property. +# The file API needs to tolerate this for unused imported targets. +add_library(unused_imported_shared_lib SHARED IMPORTED) +set_target_properties(unused_imported_shared_lib PROPERTIES + IMPORTED_LOCATION "unused_imported_shared${CMAKE_SHARED_LIBRARY_SUFFIX}" +) diff --git a/Tests/RunCMake/GeneratorExpression/CMP0199-NEW+CMP0200-NEW.cmake b/Tests/RunCMake/GeneratorExpression/CMP0199-NEW+CMP0200-NEW.cmake index 22858545694..b1a1d76362b 100644 --- a/Tests/RunCMake/GeneratorExpression/CMP0199-NEW+CMP0200-NEW.cmake +++ b/Tests/RunCMake/GeneratorExpression/CMP0199-NEW+CMP0200-NEW.cmake @@ -5,4 +5,4 @@ cmake_policy(SET CMP0200 NEW) include(CMP0199-cases.cmake) -do_mapped_config_test(NEW EXPECT_TEST) +do_mapped_config_test(NEW EXPECT_RELEASE EXPECT_TEST) diff --git a/Tests/RunCMake/GeneratorExpression/CMP0199-NEW.cmake b/Tests/RunCMake/GeneratorExpression/CMP0199-NEW.cmake index 3efdc0e0d48..ea4948280a5 100644 --- a/Tests/RunCMake/GeneratorExpression/CMP0199-NEW.cmake +++ b/Tests/RunCMake/GeneratorExpression/CMP0199-NEW.cmake @@ -10,4 +10,3 @@ cmake_policy(SET CMP0200 OLD) include(CMP0199-cases.cmake) do_mapped_config_test(EXPECT_RELEASE) -do_unique_config_test(EXPECT_DEBUG) diff --git a/Tests/RunCMake/GeneratorExpression/CMP0199-OLD.cmake b/Tests/RunCMake/GeneratorExpression/CMP0199-OLD.cmake index d670697e782..c9569afab7b 100644 --- a/Tests/RunCMake/GeneratorExpression/CMP0199-OLD.cmake +++ b/Tests/RunCMake/GeneratorExpression/CMP0199-OLD.cmake @@ -5,4 +5,3 @@ cmake_policy(SET CMP0199 OLD) include(CMP0199-cases.cmake) do_mapped_config_test(EXPECT_RELEASE EXPECT_DEBUG EXPECT_TEST) -do_unique_config_test(EXPECT_RELEASE EXPECT_DEBUG) diff --git a/Tests/RunCMake/GeneratorExpression/CMP0199-WARN-stderr.txt b/Tests/RunCMake/GeneratorExpression/CMP0199-WARN-stderr.txt index 2c5dfbdef37..0d3af1950bf 100644 --- a/Tests/RunCMake/GeneratorExpression/CMP0199-WARN-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/CMP0199-WARN-stderr.txt @@ -1,7 +1,8 @@ CMake Warning \(dev\) at CMP0199-WARN\.cmake:[0-9]+ \(target_link_libraries\): - Policy CMP0199 is not set: \$ only matches the configuration of - the consumed target\. Run "cmake --help-policy CMP0199" for policy details\. - Use the cmake_policy command to set the policy and suppress this warning\. + Policy CMP0199 is not set: \$ does not match mapped + configurations that are not selected\. Run "cmake --help-policy CMP0199" + for policy details\. Use the cmake_policy command to set the policy and + suppress this warning\. Evaluation of \$ for imported target "lib_test", used by "exe_test", may match multiple configurations\. diff --git a/Tests/RunCMake/GeneratorExpression/CMP0199-cases.cmake b/Tests/RunCMake/GeneratorExpression/CMP0199-cases.cmake index 591e52e9672..e8e1b57b13a 100644 --- a/Tests/RunCMake/GeneratorExpression/CMP0199-cases.cmake +++ b/Tests/RunCMake/GeneratorExpression/CMP0199-cases.cmake @@ -1,6 +1,7 @@ -# Under CMP0199 OLD, $ matches not just the selected configuration, but -# every entry in MAP_IMPORTED_CONFIG_. Under NEW, it should only match -# the selected configuration. +# Under CMP0199 OLD, $ matches the selected configuration and every +# entry in MAP_IMPORTED_CONFIG_. Under NEW, it should only match the +# configuration of the consuming target and the selected configuration of the +# library being consumed. function(do_mapped_config_test) add_library(lib_mapped INTERFACE IMPORTED) set_target_properties(lib_mapped PROPERTIES @@ -14,19 +15,3 @@ function(do_mapped_config_test) target_compile_definitions(exe_mapped PRIVATE ${ARGN}) target_link_libraries(exe_mapped PRIVATE lib_mapped) endfunction() - -# Under CMake CMP0199 OLD, $ matches both the consumer's configuration -# AND the selected configuration of the library being consumed. Under NEW, it -# should only match the selected configuration. -function(do_unique_config_test) - add_library(lib_unique INTERFACE IMPORTED) - set_target_properties(lib_unique PROPERTIES - IMPORTED_CONFIGURATIONS "DEBUG" - INTERFACE_COMPILE_DEFINITIONS - "$<$:DEBUG>;$<$:RELEASE>" - ) - - add_executable(exe_unique configtest.c) - target_compile_definitions(exe_unique PRIVATE ${ARGN}) - target_link_libraries(exe_unique PRIVATE lib_unique) -endfunction() diff --git a/Tests/RunCMake/GeneratorExpression/CMP0200-OLD.cmake b/Tests/RunCMake/GeneratorExpression/CMP0200-OLD.cmake index 104e7e3f380..14686c3b414 100644 --- a/Tests/RunCMake/GeneratorExpression/CMP0200-OLD.cmake +++ b/Tests/RunCMake/GeneratorExpression/CMP0200-OLD.cmake @@ -5,5 +5,5 @@ cmake_policy(SET CMP0200 OLD) include(CMP0200-cases.cmake) -do_match_config_test(EXPECT_DEBUG) +do_match_config_test(EXPECT_DEBUG EXPECT_RELEASE) do_first_config_test(EXPECT_DEBUG) diff --git a/Tests/RunCMake/GeneratorExpression/CMP0200-cases.cmake b/Tests/RunCMake/GeneratorExpression/CMP0200-cases.cmake index 11afc7fb7d5..0f7eef53e02 100644 --- a/Tests/RunCMake/GeneratorExpression/CMP0200-cases.cmake +++ b/Tests/RunCMake/GeneratorExpression/CMP0200-cases.cmake @@ -1,7 +1,15 @@ +# TODO: $ matches both the conumer's configuration AND the selected +# configuration of the imported target. This is ungood, and eventually we need +# a way to match only the selected configuration of the imported target. For +# historic reasons, that will probably not be $, which means $ +# should eventually stop matching the selected configuration of the imported +# target. When that happens, this test should be changed to use the new +# mechanism, and the test cases adjusted accordingly. + # Under CMP0200 OLD, CMake fails to select a valid configuration for an # imported INTERFACE library with no location, and will (as an implementation # artifact) select the last configuration in IMPORTED_CONFIGURATIONS. - +# # Under NEW, CMake should select a configuration which matches the current # build type, if available in IMPORTED_CONFIGURATIONS. function(do_match_config_test) diff --git a/Tests/RunCMake/Instrumentation/RunCMakeTest.cmake b/Tests/RunCMake/Instrumentation/RunCMakeTest.cmake index 6fe6581f32e..ddf6a10fb9c 100644 --- a/Tests/RunCMake/Instrumentation/RunCMakeTest.cmake +++ b/Tests/RunCMake/Instrumentation/RunCMakeTest.cmake @@ -28,6 +28,7 @@ function(instrument test) set(v1 ${RunCMake_TEST_BINARY_DIR}/.cmake/instrumentation-${uuid}/v1) set(v1 ${v1} PARENT_SCOPE) set(query_dir ${CMAKE_CURRENT_LIST_DIR}/query) + configure_file(${RunCMake_SOURCE_DIR}/initial.cmake.in ${RunCMake_BINARY_DIR}/initial.cmake) # Clear previous instrumentation data # We can't use RunCMake_TEST_NO_CLEAN 0 because we preserve queries placed in the build tree after @@ -189,6 +190,10 @@ instrument(cmake-command-bad-arg NO_WARN) instrument(cmake-command-parallel-install BUILD INSTALL TEST NO_WARN INSTALL_PARALLEL DYNAMIC_QUERY CHECK_SCRIPT check-data-dir.cmake) +instrument(cmake-command-initial-cache + CONFIGURE_ARG "-C ${RunCMake_BINARY_DIR}/initial.cmake" + CHECK_SCRIPT check-data-dir.cmake +) instrument(cmake-command-resets-generated NO_WARN COPY_QUERIES_GENERATED CHECK_SCRIPT check-data-dir.cmake diff --git a/Tests/RunCMake/Instrumentation/cmake-command-initial-cache-stderr.txt b/Tests/RunCMake/Instrumentation/cmake-command-initial-cache-stderr.txt new file mode 100644 index 00000000000..a1935a04a7e --- /dev/null +++ b/Tests/RunCMake/Instrumentation/cmake-command-initial-cache-stderr.txt @@ -0,0 +1,4 @@ +CMake Warning \(dev\) at .* + CMake's support for collecting instrumentation data is experimental. It is + meant only for experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/Instrumentation/initial.cmake.in b/Tests/RunCMake/Instrumentation/initial.cmake.in new file mode 100644 index 00000000000..0d6285d8e80 --- /dev/null +++ b/Tests/RunCMake/Instrumentation/initial.cmake.in @@ -0,0 +1,5 @@ +set(CMAKE_EXPERIMENTAL_INSTRUMENTATION @uuid@) +cmake_instrumentation( + API_VERSION 1 + DATA_VERSION 1 +) diff --git a/Tests/RunCMake/Instrumentation/query/cmake-command-initial-cache.cmake b/Tests/RunCMake/Instrumentation/query/cmake-command-initial-cache.cmake new file mode 100644 index 00000000000..e69de29bb2d diff --git a/Tests/RunCMake/VS10Project/VsDefaultFlags-check.cmake b/Tests/RunCMake/VS10Project/VsDefaultFlags-check.cmake index 5a71b3055ae..ac0cbc4cbe6 100644 --- a/Tests/RunCMake/VS10Project/VsDefaultFlags-check.cmake +++ b/Tests/RunCMake/VS10Project/VsDefaultFlags-check.cmake @@ -110,12 +110,12 @@ macro(VsDefaultCompilerFlags_check tgt) endif() endmacro() -macro(VsDefaultLinkerFlags_check tgt needs_subsystem_console) +macro(VsDefaultLinkerFlags_check tgt) set(HAVE_DataExecutionPrevention 0) set(HAVE_ImageHasSafeExceptionHandlers 0) set(HAVE_LinkErrorReporting 0) set(HAVE_RandomizedBaseAddress 0) - set(HAVE_SubSystem 0) + set(HAVE_SubSystem_Empty 0) set(HAVE_SubSystem_Console 0) file(STRINGS "${vcProjectFile}" lines) @@ -133,7 +133,7 @@ macro(VsDefaultLinkerFlags_check tgt needs_subsystem_console) set(HAVE_RandomizedBaseAddress 1) endif() if(line MATCHES "^ *") - set(HAVE_SubSystem 1) + set(HAVE_SubSystem_Empty 1) endif() if(line MATCHES "^ *Console") set(HAVE_SubSystem_Console 1) @@ -160,33 +160,21 @@ macro(VsDefaultLinkerFlags_check tgt needs_subsystem_console) return() endif() - if(${needs_subsystem_console}) - if(HAVE_SubSystem) - set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj has a property.") - return() - endif() - - if(NOT HAVE_SubSystem_Console) - set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a property with 'Console' value.") - return() - endif() - else() - if(NOT HAVE_SubSystem) - set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a property.") - return() - endif() + if(HAVE_SubSystem_Empty) + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj has a property.") + return() + endif() - if(HAVE_SubSystem_Console) - set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj has a property with 'Console' value.") - return() - endif() + if(NOT HAVE_SubSystem_Console) + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a property with 'Console' value.") + return() endif() endmacro() VsDefaultCompilerFlags_check(emptyStatic) VsDefaultCompilerFlags_check(emptyShared) -VsDefaultLinkerFlags_check(emptyShared OFF) +VsDefaultLinkerFlags_check(emptyShared) VsDefaultCompilerFlags_check(main) -VsDefaultLinkerFlags_check(main ON) +VsDefaultLinkerFlags_check(main) diff --git a/Tests/RunCMake/include_external_msproject/AutoType-check-sln.cmake b/Tests/RunCMake/include_external_msproject/AutoType-check-sln.cmake index 070f62b88a8..22b2c4ee0c0 100644 --- a/Tests/RunCMake/include_external_msproject/AutoType-check-sln.cmake +++ b/Tests/RunCMake/include_external_msproject/AutoType-check-sln.cmake @@ -1,6 +1,7 @@ check_project(AutoType externalCS "" "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC" "" "") check_project(AutoType externalDB "" "C8D11400-126E-41CD-887F-60BD40844F9E" "" "") check_project(AutoType externalFS "" "F2A71F9B-5D33-465A-A702-920D77279786" "" "") +check_project(AutoType externalNJS "" "9092AA53-FB77-4645-B42D-1CCCA6BD08BD" "" "") check_project(AutoType externalPy "" "888888A0-9F3D-457C-B088-3A5042F75D52" "" "") check_project(AutoType externalVB "" "F184B08F-C81C-45F6-A57F-5ABD9991F28F" "" "") check_project(AutoType externalVD "" "54435603-DBB4-11D2-8724-00A0C9A8B90C" "" "") diff --git a/Tests/RunCMake/include_external_msproject/AutoType-check-slnx.cmake b/Tests/RunCMake/include_external_msproject/AutoType-check-slnx.cmake index de433524217..a065ee860d8 100644 --- a/Tests/RunCMake/include_external_msproject/AutoType-check-slnx.cmake +++ b/Tests/RunCMake/include_external_msproject/AutoType-check-slnx.cmake @@ -13,6 +13,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/AutoType.slnx" [[ + @@ -35,6 +36,9 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/AutoType.slnx" [[ + + + diff --git a/Tests/RunCMake/include_external_msproject/AutoType.cmake b/Tests/RunCMake/include_external_msproject/AutoType.cmake index 0ab0be7090e..c994a5ea424 100644 --- a/Tests/RunCMake/include_external_msproject/AutoType.cmake +++ b/Tests/RunCMake/include_external_msproject/AutoType.cmake @@ -2,6 +2,7 @@ include_external_msproject(externalCS external.csproj) include_external_msproject(externalDB external.dbproj) include_external_msproject(externalFS external.fsproj) include_external_msproject(externalPy external.pyproj) +include_external_msproject(externalNJS external.njsproj) include_external_msproject(externalVB external.vbproj) include_external_msproject(externalVD external.vdproj) include_external_msproject(externalVF external.vfproj) diff --git a/Tests/RunCMake/include_external_msproject/ProjType-check-sln.cmake b/Tests/RunCMake/include_external_msproject/ProjType-check-sln.cmake new file mode 100644 index 00000000000..b1f8ddb67a4 --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/ProjType-check-sln.cmake @@ -0,0 +1,6 @@ +check_project(ProjType AspNetCore "" "8BB2217D-0F2D-49D1-97BC-3654ED321F3B" "" "") +check_project(ProjType DotNetCore "" "9A19103F-16F7-4668-BE54-9A1E7A4F7556" "" "") +check_project(ProjType Misc "" "66A2671D-8FB5-11D2-AA7E-00C04F688DDE" "" "") +check_project(ProjType SqlSrv "" "00D1A9C2-B5F0-4AF3-8072-F6C62B433612" "" "") +check_project(ProjType JScript "" "262852C6-CD72-467D-83FE-5EEB1973A190" "" "") +check_project(ProjType WebSite "" "E24C65DC-7377-472B-9ABA-BC803B73C61A" "" "") diff --git a/Tests/RunCMake/include_external_msproject/ProjType-check-slnx.cmake b/Tests/RunCMake/include_external_msproject/ProjType-check-slnx.cmake new file mode 100644 index 00000000000..67aba13d3e7 --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/ProjType-check-slnx.cmake @@ -0,0 +1,44 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/ProjType.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/include_external_msproject/ProjType-check.cmake b/Tests/RunCMake/include_external_msproject/ProjType-check.cmake new file mode 100644 index 00000000000..5b37ec02521 --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/ProjType-check.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/ProjType-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/include_external_msproject/ProjType.cmake b/Tests/RunCMake/include_external_msproject/ProjType.cmake new file mode 100644 index 00000000000..3e5c687ebea --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/ProjType.cmake @@ -0,0 +1,6 @@ +include_external_msproject(AspNetCore AspNetCore.project TYPE 8BB2217D-0F2D-49D1-97BC-3654ED321F3B) +include_external_msproject(DotNetCore DotNetCore.project TYPE 9A19103F-16F7-4668-BE54-9A1E7A4F7556) +include_external_msproject(Misc Misc.project TYPE 66A2671D-8FB5-11D2-AA7E-00C04F688DDE) +include_external_msproject(SqlSrv SqlSrv.project TYPE 00D1A9C2-B5F0-4AF3-8072-F6C62B433612) +include_external_msproject(JScript JScript.project TYPE 262852C6-CD72-467D-83FE-5EEB1973A190) +include_external_msproject(WebSite WebSite.project TYPE E24C65DC-7377-472B-9ABA-BC803B73C61A) diff --git a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake index 1a869be4c13..25a83cbd6d5 100644 --- a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake @@ -9,6 +9,8 @@ else() endif() run_cmake(AutoType) +run_cmake(ProjType) + run_cmake(CustomGuid) run_cmake(CustomTypePlatform) run_cmake(CustomGuidTypePlatform) diff --git a/Tests/RunCMake/include_external_msproject/check_utils.cmake b/Tests/RunCMake/include_external_msproject/check_utils.cmake index 016251936a4..4b9658afbd0 100644 --- a/Tests/RunCMake/include_external_msproject/check_utils.cmake +++ b/Tests/RunCMake/include_external_msproject/check_utils.cmake @@ -90,8 +90,6 @@ endfunction() # RunCMake test check helper function(check_project test name guid type platform imported_release_config_name) set(sln "${RunCMake_TEST_BINARY_DIR}/${test}.sln") - set(sep "") - set(failed "") if(NOT type) set(type 8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942) endif() @@ -112,27 +110,23 @@ function(check_project test name guid type platform imported_release_config_name if(guid) check_project_guid("${sln}" "${name}" "${guid}" passed_guid) if(NOT passed_guid) - string(APPEND failed "${sep}${name} solution has no project with expected GUID=${guid}") - set(sep "\n") + string(APPEND RunCMake_TEST_FAILED "${name} solution has no project with expected GUID=${guid}\n") endif() else() set(passed_guid 1) endif() check_project_type("${sln}" "${name}" "${type}" passed_type) if(NOT passed_type) - string(APPEND failed "${sep}${name} solution has no project with expected TYPE=${type}") - set(sep "\n") + string(APPEND RunCMake_TEST_FAILED "${name} solution has no project with expected TYPE=${type}\n") endif() check_custom_platform("${sln}" "${name}" "${platform}" passed_platform) if(NOT passed_platform) - string(APPEND failed "${sep}${name} solution has no project with expected PLATFORM=${platform}") - set(sep "\n") + string(APPEND RunCMake_TEST_FAILED "${name} solution has no project with expected PLATFORM=${platform}\n") endif() check_custom_configuration("${sln}" "${name}" "Release" "${imported_release_config_name}" passed_configuration) if(NOT passed_configuration) - string(APPEND failed "${sep}${name} solution has no project with expected CONFIG=${imported_release_config_name}") - set(sep "\n") + string(APPEND RunCMake_TEST_FAILED "${name} solution has no project with expected CONFIG=${imported_release_config_name}\n") endif() - set(RunCMake_TEST_FAILED "${failed}" PARENT_SCOPE) + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) endfunction() diff --git a/Utilities/.gitattributes b/Utilities/.gitattributes index b6c6212023f..b28c28a666c 100644 --- a/Utilities/.gitattributes +++ b/Utilities/.gitattributes @@ -1,3 +1,4 @@ +/ast-grep export-ignore /Git export-ignore /GitSetup export-ignore SetupForDevelopment.sh export-ignore diff --git a/Utilities/cmlibarchive/libarchive/archive_string.c b/Utilities/cmlibarchive/libarchive/archive_string.c index 7437715f912..f66b8b426bd 100644 --- a/Utilities/cmlibarchive/libarchive/archive_string.c +++ b/Utilities/cmlibarchive/libarchive/archive_string.c @@ -575,7 +575,12 @@ archive_wstring_append_from_mbs_in_codepage(struct archive_wstring *dest, } else mbflag = MB_PRECOMPOSED; + /* FIXME(CMake#26903): Offer control over encoding conversion. + For now, we instead tolerate invalid characters as + libarchive 3.7.2 / CMake 3.30 and below did. */ + #if 0 mbflag |= MB_ERR_INVALID_CHARS; + #endif buffsize = dest->length + length + 1; do { diff --git a/VSInsertion/Packaging/cgmanifest.json b/VSInsertion/Packaging/cgmanifest.json index c7e74c96380..ed94fbe0bee 100644 --- a/VSInsertion/Packaging/cgmanifest.json +++ b/VSInsertion/Packaging/cgmanifest.json @@ -5,7 +5,7 @@ "Type": "git", "Git": { "RepositoryUrl": "https://github.com/microsoft/CMake.git", - "CommitHash": "cea9a87bc974c117a72a4fd044e0cc0b28ccfcf3" + "CommitHash": "e733867df1e3d8159703860b30861d5351ffe5f2" } } }