summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml10
-rw-r--r--.gitlab/ci/configure_common.cmake4
-rw-r--r--.gitlab/ci/configure_debian10_aarch64_ninja.cmake1
-rw-r--r--.gitlab/ci/configure_debian10_ninja.cmake1
-rw-r--r--.gitlab/ci/configure_fedora34_makefiles.cmake1
-rw-r--r--.gitlab/ci/configure_hip4.2_radeon.cmake3
-rw-r--r--.gitlab/ci/configure_intelcompiler_common.cmake12
-rw-r--r--.gitlab/ci/docker/hip4.2/Dockerfile7
-rwxr-xr-x.gitlab/ci/docker/hip4.2/install_deps.sh13
-rw-r--r--.gitlab/ci/gitlab_ci.cmake4
-rw-r--r--.gitlab/os-linux.yml28
-rw-r--r--.gitlab/os-windows.yml2
-rw-r--r--Auxiliary/vim/syntax/cmake.vim1
-rw-r--r--Help/command/file.rst10
-rw-r--r--Help/command/find_package.rst11
-rw-r--r--Help/command/install.rst126
-rw-r--r--Help/cpack_gen/rpm.rst11
-rw-r--r--Help/manual/cmake-packages.7.rst4
-rw-r--r--Help/manual/cmake-variables.7.rst3
-rw-r--r--Help/manual/presets/example.json2
-rw-r--r--Help/prop_tgt/CUDA_STANDARD.rst24
-rw-r--r--Help/prop_tgt/CXX_STANDARD.rst26
-rw-r--r--Help/prop_tgt/LINK_WHAT_YOU_USE.rst24
-rw-r--r--Help/prop_tgt/OBJCXX_STANDARD.rst22
-rw-r--r--Help/prop_tgt/OBJC_STANDARD.rst11
-rw-r--r--Help/release/dev/LINK_WHAT_USE_USE-configuration.rst5
-rw-r--r--Help/release/dev/UseSWIG-dependencies.rst6
-rw-r--r--Help/release/dev/cpack-rpm-requires-exclude-from.rst6
-rw-r--r--Help/release/dev/find_package-required-var.rst5
-rw-r--r--Help/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.rst2
-rw-r--r--Help/variable/CMAKE_LANG_LINK_WHAT_YOU_USE_FLAG.rst9
-rw-r--r--Help/variable/CMAKE_LINK_WHAT_YOU_USE.rst2
-rw-r--r--Help/variable/CMAKE_LINK_WHAT_YOU_USE_CHECK.rst10
-rw-r--r--Help/variable/CMAKE_REQUIRE_FIND_PACKAGE_PackageName.rst14
-rw-r--r--Help/variable/PROJECT-NAME_IS_TOP_LEVEL.rst10
-rw-r--r--Help/variable/PROJECT_IS_TOP_LEVEL.rst10
-rw-r--r--Modules/CMakeCInformation.cmake10
-rw-r--r--Modules/CMakeCUDAInformation.cmake9
-rw-r--r--Modules/CMakeCXXInformation.cmake9
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake7
-rw-r--r--Modules/CMakeFortranInformation.cmake9
-rw-r--r--Modules/CMakeHIPInformation.cmake9
-rw-r--r--Modules/CMakeOBJCInformation.cmake9
-rw-r--r--Modules/CMakeOBJCXXInformation.cmake9
-rw-r--r--Modules/CMakeSwiftInformation.cmake9
-rw-r--r--Modules/Compiler/IAR.cmake14
-rw-r--r--Modules/Compiler/IntelLLVM-C.cmake6
-rw-r--r--Modules/Compiler/IntelLLVM-CXX.cmake6
-rw-r--r--Modules/Compiler/PGI.cmake2
-rw-r--r--Modules/FindBLAS.cmake4
-rw-r--r--Modules/FindCUDAToolkit.cmake13
-rw-r--r--Modules/FindGLUT.cmake163
-rw-r--r--Modules/FindJPEG.cmake2
-rw-r--r--Modules/FindLAPACK.cmake4
-rw-r--r--Modules/FindMPI.cmake4
-rw-r--r--Modules/FindPkgConfig.cmake1
-rw-r--r--Modules/Internal/CPack/CPackDeb.cmake2
-rw-r--r--Modules/Internal/CPack/CPackRPM.cmake12
-rw-r--r--Modules/Internal/CPack/NSIS.template.in13
-rw-r--r--Modules/Internal/CheckCompilerFlag.cmake1
-rw-r--r--Modules/UseSWIG.cmake25
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx2
-rw-r--r--Source/cmBinUtilsLinuxELFLinker.cxx34
-rw-r--r--Source/cmBinUtilsLinuxELFLinker.h4
-rw-r--r--Source/cmCommonTargetGenerator.h1
-rw-r--r--Source/cmDependsCompiler.cxx4
-rw-r--r--Source/cmELF.cxx16
-rw-r--r--Source/cmELF.h4
-rw-r--r--Source/cmFindPackageCommand.cxx24
-rw-r--r--Source/cmGccDepfileReader.cxx8
-rw-r--r--Source/cmGccDepfileReader.h11
-rw-r--r--Source/cmGeneratorTarget.cxx7
-rw-r--r--Source/cmGeneratorTarget.h3
-rw-r--r--Source/cmGlobalGenerator.cxx26
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx6
-rw-r--r--Source/cmListFileCache.cxx4
-rw-r--r--Source/cmLocalGenerator.cxx57
-rw-r--r--Source/cmLocalGenerator.h4
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx2
-rw-r--r--Source/cmMakefile.cxx24
-rw-r--r--Source/cmMakefile.h5
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx23
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx25
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx36
-rw-r--r--Source/cmState.cxx33
-rw-r--r--Source/cmState.h28
-rw-r--r--Source/cmake.cxx21
-rw-r--r--Source/cmake.h4
-rw-r--r--Source/cmcmd.cxx11
-rw-r--r--Tests/CMakeLists.txt1
-rw-r--r--Tests/FindBLAS/CMakeLists.txt14
-rw-r--r--Tests/FindBLAS/Test/CMakeLists.txt3
-rw-r--r--Tests/FindGLUT/CMakeLists.txt9
-rw-r--r--Tests/FindGLUT/Test/CMakeLists.txt17
-rw-r--r--Tests/FindGLUT/Test/main.c11
-rw-r--r--Tests/FindLAPACK/CMakeLists.txt14
-rw-r--r--Tests/FindLAPACK/Test/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CheckEnvironmentVar-build-stdout.txt1
-rw-r--r--Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CheckEnvironmentVar.cmake2
-rw-r--r--Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/RunCMakeTest.cmake8
-rwxr-xr-xTests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/echo_message.bat1
-rw-r--r--Tests/RunCMake/CMakeLists.txt12
-rw-r--r--Tests/RunCMake/CMakePresets/ListPresets-stdout.txt7
-rw-r--r--Tests/RunCMake/CMakePresets/ListPresets.json.in5
-rw-r--r--Tests/RunCMake/CMakePresets/ListPresetsHidden-stdout.txt7
-rw-r--r--Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-stdout.txt7
-rw-r--r--Tests/RunCMake/CMakePresets/ListPresetsWorkingDir-stdout.txt7
-rw-r--r--Tests/RunCMake/CPack/RPM/default_expected_stderr.txt3
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTest-discovery-POST_BUILD-timeout-test-stdout.txt6
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTest-property-timeout1-stdout.txt6
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTest-property-timeout2-stdout.txt6
-rw-r--r--Tests/RunCMake/VS10Project/VsDpiAwareBadParam-stderr.txt2
-rw-r--r--Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-component-stdout.txt3
-rw-r--r--Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-stdout.txt3
-rw-r--r--Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-component-stdout.txt3
-rw-r--r--Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-stdout.txt3
-rw-r--r--Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-component-stdout.txt3
-rw-r--r--Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-stdout.txt3
-rw-r--r--Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-component-stdout.txt3
-rw-r--r--Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-stdout.txt3
-rw-r--r--Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-component-stdout.txt3
-rw-r--r--Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-stdout.txt3
-rw-r--r--Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-component-stdout.txt3
-rw-r--r--Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-stdout.txt3
-rw-r--r--Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-component-stdout.txt3
-rw-r--r--Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-stdout.txt3
-rw-r--r--Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-notfile-all-stderr.txt5
-rw-r--r--Tests/RunCMake/find_package/MissingNormalForceRequired-result.txt1
-rw-r--r--Tests/RunCMake/find_package/MissingNormalForceRequired-stderr.txt20
-rw-r--r--Tests/RunCMake/find_package/MissingNormalForceRequired.cmake3
-rw-r--r--Tests/RunCMake/find_package/RequiredOptionValuesClash-result.txt1
-rw-r--r--Tests/RunCMake/find_package/RequiredOptionValuesClash-stderr.txt11
-rw-r--r--Tests/RunCMake/find_package/RequiredOptionValuesClash.cmake5
-rw-r--r--Tests/RunCMake/find_package/RunCMakeTest.cmake2
-rw-r--r--Tests/TryCompile/CMakeLists.txt10
-rw-r--r--Tests/UseSWIG/CMakeLists.txt2
-rw-r--r--Utilities/cmlibuv/src/win/process.c5
140 files changed, 1101 insertions, 384 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 857ef73..a964b46 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -248,6 +248,16 @@ test:cuda10.2-clang:
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
+test:hip4.2-radeon:
+ extends:
+ - .hip4.2_radeon
+ - .cmake_test_linux_release
+ - .linux_builder_tags_radeon
+ - .run_dependent
+ - .needs_centos6_x86_64
+ variables:
+ CMAKE_CI_JOB_NIGHTLY: "true"
+
build:fedora34-ninja:
extends:
- .fedora34_ninja
diff --git a/.gitlab/ci/configure_common.cmake b/.gitlab/ci/configure_common.cmake
index 436e582..a711f3b 100644
--- a/.gitlab/ci/configure_common.cmake
+++ b/.gitlab/ci/configure_common.cmake
@@ -6,8 +6,8 @@ set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY "ON" CACHE BOOL "")
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "")
set(CMake_TEST_INSTALL "OFF" CACHE BOOL "")
-if (NOT "$ENV{CMAKE_BUILD_TYPE}" STREQUAL "")
- set(CMAKE_BUILD_TYPE "$ENV{CMAKE_BUILD_TYPE}" CACHE STRING "")
+if (NOT "$ENV{CMAKE_CI_BUILD_TYPE}" STREQUAL "")
+ set(CMAKE_BUILD_TYPE "$ENV{CMAKE_CI_BUILD_TYPE}" CACHE STRING "")
endif ()
if (NOT configure_no_sccache)
diff --git a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake
index 4d8dde6..a6b7cb5 100644
--- a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake
+++ b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake
@@ -16,6 +16,7 @@ set(CMake_TEST_FindGDAL "ON" CACHE BOOL "")
set(CMake_TEST_FindGIF "ON" CACHE BOOL "")
set(CMake_TEST_FindGit "ON" CACHE BOOL "")
set(CMake_TEST_FindGLEW "ON" CACHE BOOL "")
+set(CMake_TEST_FindGLUT "ON" CACHE BOOL "")
set(CMake_TEST_FindGnuTLS "ON" CACHE BOOL "")
set(CMake_TEST_FindGSL "ON" CACHE BOOL "")
set(CMake_TEST_FindGTest "ON" CACHE BOOL "")
diff --git a/.gitlab/ci/configure_debian10_ninja.cmake b/.gitlab/ci/configure_debian10_ninja.cmake
index 732624a..10d0997 100644
--- a/.gitlab/ci/configure_debian10_ninja.cmake
+++ b/.gitlab/ci/configure_debian10_ninja.cmake
@@ -16,6 +16,7 @@ set(CMake_TEST_FindGDAL "ON" CACHE BOOL "")
set(CMake_TEST_FindGIF "ON" CACHE BOOL "")
set(CMake_TEST_FindGit "ON" CACHE BOOL "")
set(CMake_TEST_FindGLEW "ON" CACHE BOOL "")
+set(CMake_TEST_FindGLUT "ON" CACHE BOOL "")
set(CMake_TEST_FindGnuTLS "ON" CACHE BOOL "")
set(CMake_TEST_FindGSL "ON" CACHE BOOL "")
set(CMake_TEST_FindGTest "ON" CACHE BOOL "")
diff --git a/.gitlab/ci/configure_fedora34_makefiles.cmake b/.gitlab/ci/configure_fedora34_makefiles.cmake
index 48786e4..d4bdb6a 100644
--- a/.gitlab/ci/configure_fedora34_makefiles.cmake
+++ b/.gitlab/ci/configure_fedora34_makefiles.cmake
@@ -16,6 +16,7 @@ set(CMake_TEST_FindGDAL "ON" CACHE BOOL "")
set(CMake_TEST_FindGIF "ON" CACHE BOOL "")
set(CMake_TEST_FindGit "ON" CACHE BOOL "")
set(CMake_TEST_FindGLEW "ON" CACHE BOOL "")
+set(CMake_TEST_FindGLUT "ON" CACHE BOOL "")
set(CMake_TEST_FindGnuTLS "ON" CACHE BOOL "")
set(CMake_TEST_FindGSL "ON" CACHE BOOL "")
set(CMake_TEST_FindGTest "ON" CACHE BOOL "")
diff --git a/.gitlab/ci/configure_hip4.2_radeon.cmake b/.gitlab/ci/configure_hip4.2_radeon.cmake
new file mode 100644
index 0000000..58036b0
--- /dev/null
+++ b/.gitlab/ci/configure_hip4.2_radeon.cmake
@@ -0,0 +1,3 @@
+set(CMake_TEST_HIP "ON" CACHE BOOL "")
+
+include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_intelcompiler_common.cmake b/.gitlab/ci/configure_intelcompiler_common.cmake
index df3a696..be175e4 100644
--- a/.gitlab/ci/configure_intelcompiler_common.cmake
+++ b/.gitlab/ci/configure_intelcompiler_common.cmake
@@ -1,6 +1,10 @@
-set(CMake_TEST_FindBLAS "Intel10_64lp;Intel10_64lp.gcc" CACHE STRING "")
-set(CMake_TEST_FindBLAS_STATIC "Intel10_64lp;Intel10_64lp.gcc" CACHE STRING "")
-set(CMake_TEST_FindLAPACK "Intel10_64lp;Intel10_64lp.gcc" CACHE STRING "")
-set(CMake_TEST_FindLAPACK_STATIC "Intel10_64lp;Intel10_64lp.gcc" CACHE STRING "")
+set(CMake_TEST_FindBLAS "All;Intel10_64lp;Intel10_64lp.gcc" CACHE STRING "")
+set(CMake_TEST_FindBLAS_All "Intel10_64lp" CACHE STRING "")
+set(CMake_TEST_FindBLAS_STATIC "All;Intel10_64lp;Intel10_64lp.gcc" CACHE STRING "")
+set(CMake_TEST_FindBLAS_STATIC_All "Intel10_64lp" CACHE STRING "")
+set(CMake_TEST_FindLAPACK "All;Intel10_64lp;Intel10_64lp.gcc" CACHE STRING "")
+set(CMake_TEST_FindLAPACK_All "Intel10_64lp" CACHE STRING "")
+set(CMake_TEST_FindLAPACK_STATIC "All;Intel10_64lp;Intel10_64lp.gcc" CACHE STRING "")
+set(CMake_TEST_FindLAPACK_STATIC_All "Intel10_64lp" CACHE STRING "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/docker/hip4.2/Dockerfile b/.gitlab/ci/docker/hip4.2/Dockerfile
new file mode 100644
index 0000000..563e94f
--- /dev/null
+++ b/.gitlab/ci/docker/hip4.2/Dockerfile
@@ -0,0 +1,7 @@
+FROM rocm/dev-ubuntu-20.04:4.2
+MAINTAINER Brad King <brad.king@kitware.com>
+
+ENV PATH="/opt/rocm/bin:$PATH"
+
+COPY install_deps.sh /root/install_deps.sh
+RUN sh /root/install_deps.sh
diff --git a/.gitlab/ci/docker/hip4.2/install_deps.sh b/.gitlab/ci/docker/hip4.2/install_deps.sh
new file mode 100755
index 0000000..2b45bc9
--- /dev/null
+++ b/.gitlab/ci/docker/hip4.2/install_deps.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+apt-get update
+
+# Install development tools.
+apt-get install -y --no-install-recommends \
+ g++ \
+ curl \
+ git
+
+apt-get clean
diff --git a/.gitlab/ci/gitlab_ci.cmake b/.gitlab/ci/gitlab_ci.cmake
index f166215..697162c 100644
--- a/.gitlab/ci/gitlab_ci.cmake
+++ b/.gitlab/ci/gitlab_ci.cmake
@@ -26,8 +26,8 @@ set(CTEST_SITE "gitlab-ci")
set(ctest_model "Experimental")
# Default to Release builds.
-if (NOT "$ENV{CMAKE_BUILD_TYPE}" STREQUAL "")
- set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_BUILD_TYPE}")
+if (NOT "$ENV{CMAKE_CI_BUILD_TYPE}" STREQUAL "")
+ set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CI_BUILD_TYPE}")
endif ()
if (NOT CTEST_BUILD_CONFIGURATION)
set(CTEST_BUILD_CONFIGURATION "Release")
diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml
index cd1195b..1513c90 100644
--- a/.gitlab/os-linux.yml
+++ b/.gitlab/os-linux.yml
@@ -90,7 +90,7 @@
variables:
CMAKE_CONFIGURATION: fedora34_clang_analyzer
- CMAKE_BUILD_TYPE: Debug
+ CMAKE_CI_BUILD_TYPE: Debug
CTEST_NO_WARNINGS_ALLOWED: 1
CMake_SKIP_INSTALL: 1
@@ -168,7 +168,7 @@
.fedora_memcheck:
variables:
- CMAKE_BUILD_TYPE: RelWithDebInfo
+ CMAKE_CI_BUILD_TYPE: RelWithDebInfo
.fedora_asan_addon:
extends: .fedora_memcheck
@@ -245,6 +245,23 @@
CMAKE_CONFIGURATION: cuda10.2_clang
CTEST_NO_WARNINGS_ALLOWED: 1
+### HIP builds
+
+.hip4.2:
+ image: "kitware/cmake:ci-hip4.2-x86_64-2021-07-09"
+
+ variables:
+ GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
+ CMAKE_ARCH: x86_64
+ CTEST_LABELS: "HIP"
+
+.hip4.2_radeon:
+ extends: .hip4.2
+
+ variables:
+ CMAKE_CONFIGURATION: hip4.2_radeon
+ CMAKE_GENERATOR: "Ninja Multi-Config"
+
## Tags
.linux_builder_tags:
@@ -277,6 +294,13 @@
- docker
- linux
+.linux_builder_tags_radeon:
+ tags:
+ - cmake
+ - radeon
+ - docker
+ - linux
+
.linux_builder_tags_aarch64:
tags:
- cmake
diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml
index fb72ff1..90ff0a8 100644
--- a/.gitlab/os-windows.yml
+++ b/.gitlab/os-windows.yml
@@ -28,7 +28,7 @@
# Debug and RelWithDebinfo build types use the `/Zi` which results in
# uncacheable compiations.
# https://github.com/mozilla/sccache/issues/242
- CMAKE_BUILD_TYPE: Release
+ CMAKE_CI_BUILD_TYPE: Release
CTEST_NO_WARNINGS_ALLOWED: 1
.windows_vs2019_x64_ninja:
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim
index f936ca0..7a3e4ed 100644
--- a/Auxiliary/vim/syntax/cmake.vim
+++ b/Auxiliary/vim/syntax/cmake.vim
@@ -2808,6 +2808,7 @@ syn keyword cmakeKWfind_package contained
\ ABI
\ BUNDLE
\ CMAKE_DISABLE_FIND_PACKAGE_
+ \ CMAKE_REQUIRE_FIND_PACKAGE_
\ CMAKE_FIND_ROOT_PATH_BOTH
\ COMPONENTS
\ CONFIG
diff --git a/Help/command/file.rst b/Help/command/file.rst
index b6ed416..943bf7c 100644
--- a/Help/command/file.rst
+++ b/Help/command/file.rst
@@ -189,8 +189,10 @@ the ``<format>`` and ``UTC`` options.
Recursively get the list of libraries depended on by the given files.
Please note that this sub-command is not intended to be used in project mode.
-Instead, use it in an :command:`install(CODE)` or :command:`install(SCRIPT)`
-block. For example:
+It is intended for use at install time, either from code generated by the
+:command:`install(RUNTIME_DEPENDENCY_SET)` command, or from code provided by
+the project via :command:`install(CODE)` or :command:`install(SCRIPT)`.
+For example:
.. code-block:: cmake
@@ -703,10 +705,14 @@ Move a file or directory within a filesystem from ``<oldname>`` to
The options are:
``RESULT <result>``
+ .. versionadded:: 3.21
+
Set ``<result>`` variable to ``0`` on success or an error message otherwise.
If ``RESULT`` is not specified and the operation fails, an error is emitted.
``NO_REPLACE``
+ .. versionadded:: 3.21
+
If the ``<newname>`` path already exists, do not replace it.
If ``RESULT <result>`` is used, the result variable will be
set to ``NO_REPLACE``. Otherwise, an error is emitted.
diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst
index 3dfd62f..7febd5d 100644
--- a/Help/command/find_package.rst
+++ b/Help/command/find_package.rst
@@ -448,8 +448,15 @@ which the file is found. The :variable:`CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS`
variable may be set to ``TRUE`` before calling ``find_package`` in order
to resolve symbolic links and store the real path to the file.
-Every non-REQUIRED ``find_package`` call can be disabled by setting the
-:variable:`CMAKE_DISABLE_FIND_PACKAGE_<PackageName>` variable to ``TRUE``.
+Every non-REQUIRED ``find_package`` call can be disabled or made REQUIRED:
+
+* Setting the :variable:`CMAKE_DISABLE_FIND_PACKAGE_<PackageName>` variable
+ to ``TRUE`` disables the package.
+
+* Setting the :variable:`CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>` variable
+ to ``TRUE`` makes the package REQUIRED.
+
+Setting both variables to ``TRUE`` simultaneously is an error.
Package File Interface Variables
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Help/command/install.rst b/Help/command/install.rst
index acfaa48..c6af489 100644
--- a/Help/command/install.rst
+++ b/Help/command/install.rst
@@ -346,10 +346,10 @@ top level:
This option causes all runtime dependencies of installed executable, shared
library, and module targets to be added to the specified runtime dependency
- set. This set can then be installed later on with an
+ set. This set can then be installed with an
`install(RUNTIME_DEPENDENCY_SET)`_ command.
- This argument and the ``RUNTIME_DEPENDENCIES`` argument are mutually
+ This keyword and the ``RUNTIME_DEPENDENCIES`` keyword are mutually
exclusive.
``RUNTIME_DEPENDENCIES``
@@ -361,13 +361,28 @@ top level:
arguments are used to determine the properties (``DESTINATION``,
``COMPONENT``, etc.) of the installation of these dependencies.
- ``RUNTIME_DEPENDENCIES`` is semantically equivalent to calling
- ``install(TARGETS ... RUNTIME_DEPENDENCY_SET)`` and then
- `install(RUNTIME_DEPENDENCY_SET)`_ with a randomly generated name. It accepts
- all of the same options as `install(RUNTIME_DEPENDENCY_SET)`_.
+ ``RUNTIME_DEPENDENCIES`` is semantically equivalent to the following pair
+ of calls:
- This argument and the ``RUNTIME_DEPENDENCY_SET`` argument are mutually
- exclusive.
+ .. code-block:: cmake
+
+ install(TARGETS ... RUNTIME_DEPENDENCY_SET <set-name>)
+ install(RUNTIME_DEPENDENCY_SET <set-name> args...)
+
+ where ``<set-name>`` will be a randomly generated set name.
+ The ``args...`` may include any of the following keywords supported by
+ the `install(RUNTIME_DEPENDENCY_SET)`_ command:
+
+ * ``DIRECTORIES``
+ * ``PRE_INCLUDE_REGEXES``
+ * ``PRE_EXCLUDE_REGEXES``
+ * ``POST_INCLUDE_REGEXES``
+ * ``POST_EXCLUDE_REGEXES``
+ * ``POST_INCLUDE_FILES``
+ * ``POST_EXCLUDE_FILES``
+
+ The ``RUNTIME_DEPENDENCIES`` and ``RUNTIME_DEPENDENCY_SET`` keywords are
+ mutually exclusive.
One or more groups of properties may be specified in a single call to
the ``TARGETS`` form of this command. A target may be installed more than
@@ -446,14 +461,10 @@ not installed. In the case of :prop_tgt:`FRAMEWORK` libraries,
:prop_tgt:`MACOSX_BUNDLE` executables, and :prop_tgt:`BUNDLE` CFBundles, the
entire directory is installed.
-``IMPORTED_RUNTIME_ARTIFACTS`` accepts the following additional arguments:
-
-``RUNTIME_DEPENDENCY_SET``
-
- This option causes all runtime dependencies of installed executable, shared
- library, and module targets to be added to the specified runtime dependency
- set. This set can then be installed later on with an
- `install(RUNTIME_DEPENDENCY_SET)`_ command.
+The ``RUNTIME_DEPENDENCY_SET`` option causes the runtime artifacts of the
+imported executable, shared library, and module library ``targets`` to be
+added to the ``<set-name>`` runtime dependency set. This set can then be
+installed with an `install(RUNTIME_DEPENDENCY_SET)`_ command.
Installing Files
^^^^^^^^^^^^^^^^
@@ -693,7 +704,8 @@ Custom Installation Logic
.. code-block:: cmake
install([[SCRIPT <file>] [CODE <code>]]
- [COMPONENT <component>] [EXCLUDE_FROM_ALL] [ALL_COMPONENTS] [...])
+ [ALL_COMPONENTS | COMPONENT <component>]
+ [EXCLUDE_FROM_ALL] [...])
The ``SCRIPT`` form will invoke the given CMake script files during
installation. If the script file name is a relative path it will be
@@ -708,11 +720,11 @@ example, the code
will print a message during installation.
-The option ``ALL_COMPONENTS``
- .. versionadded:: 3.21
-
- Run the custom installation script code for every component of a
- component-specific installation.
+.. versionadded:: 3.21
+ When the ``ALL_COMPONENTS`` option is given, the custom installation
+ script code will be executed for every component of a component-specific
+ installation. This option is mutually exclusive with the ``COMPONENT``
+ option.
.. versionadded:: 3.14
``<file>`` or ``<code>`` may use "generator expressions" with the syntax
@@ -836,50 +848,46 @@ Installing Runtime Dependencies
[PRE_EXCLUDE_REGEXES regexes...]
[POST_INCLUDE_REGEXES regexes...]
[POST_EXCLUDE_REGEXES regexes...]
+ [POST_INCLUDE_FILES files...]
+ [POST_EXCLUDE_FILES files...]
[DIRECTORIES directories...]
)
-Installs a runtime dependency set created by one or more
+Installs a runtime dependency set previously created by one or more
`install(TARGETS)`_ or `install(IMPORTED_RUNTIME_ARTIFACTS)`_ commands. The
dependencies of targets belonging to a runtime dependency set are installed in
the ``RUNTIME`` destination and component on DLL platforms, and in the
``LIBRARY`` destination and component on non-DLL platforms. macOS frameworks
-are installed in the ``FRAMEWORK`` destination and component. The generated
-install script calls :command:`file(GET_RUNTIME_DEPENDENCIES)` on the
-build-tree files to calculate the runtime dependencies, with the build-tree
-executable files as the ``EXECUTABLES`` argument, the build-tree shared
-libraries as the ``LIBRARIES`` argument, and the build-tree modules as the
-``MODULES`` argument. If one of the executables is a :prop_tgt:`MACOSX_BUNDLE`
-executable on a macOS platform, that executable is passed as the
-``BUNDLE_EXECUTABLE`` argument. If ``RUNTIME_DEPENDENCY_SET`` is specified on
-a macOS platform, at most one :prop_tgt:`MACOSX_BUNDLE` executable may be in
-the runtime dependency set. The :prop_tgt:`MACOSX_BUNDLE` property has no
-effect on non-macOS platforms. Targets built within the build tree will never
-be installed as runtime dependencies, nor will their own dependencies, unless
-the targets themselves are installed with `install(TARGETS)`_.
-
-This argument accepts the following sub-arguments:
-
-``DIRECTORIES <directories>``
- List of directories to be passed as the ``DIRECTORIES`` argument of
- :command:`file(GET_RUNTIME_DEPENDENCIES)`. This argument supports
- :manual:`generator expressions <cmake-generator-expressions(7)>`. If a
- ``DIRECTORIES`` argument evaluates to an empty string, it is not passed to
- :command:`file(GET_RUNTIME_DEPENDENCIES)`.
-
-``PRE_INCLUDE_REGEXES <regexes>``, ``PRE_EXCLUDE_REGEXES <regexes>``, ``POST_INCLUDE_REGEXES <regexes>``, ``POST_EXCLUDE_REGEXES <regexes>``
- List of regular expressions to be passed as their respective arguments to
- :command:`file(GET_RUNTIME_DEPENDENCIES)`. These arguments support
- :manual:`generator expressions <cmake-generator-expressions(7)>`. If an
- argument evaluates to an empty string, it is not passed to
- :command:`file(GET_RUNTIME_DEPENDENCIES)`.
-
-``POST_INCLUDE_FILES <files>``, ``POST_EXCLUDE_FILES <files>``
- List of files to be passed as their respective arguments to
- :command:`file(GET_RUNTIME_DEPENDENCIES)`. These arguments support
- :manual:`generator expressions <cmake-generator-expressions(7)>`. If an
- argument evaluates to an empty string, it is not passed to
- :command:`file(GET_RUNTIME_DEPENDENCIES)`.
+are installed in the ``FRAMEWORK`` destination and component.
+Targets built within the build tree will never be installed as runtime
+dependencies, nor will their own dependencies, unless the targets themselves
+are installed with `install(TARGETS)`_.
+
+The generated install script calls :command:`file(GET_RUNTIME_DEPENDENCIES)`
+on the build-tree files to calculate the runtime dependencies. The build-tree
+executable files are passed as the ``EXECUTABLES`` argument, the build-tree
+shared libraries as the ``LIBRARIES`` argument, and the build-tree modules as
+the ``MODULES`` argument. On macOS, if one of the executables is a
+:prop_tgt:`MACOSX_BUNDLE`, that executable is passed as the
+``BUNDLE_EXECUTABLE`` argument. At most one such bundle executable may be in
+the runtime dependency set on macOS. The :prop_tgt:`MACOSX_BUNDLE` property
+has no effect on other platforms. Note that
+:command:`file(GET_RUNTIME_DEPENDENCIES)` only supports collecting the runtime
+dependencies for Windows, Linux and macOS platforms, so
+``install(RUNTIME_DEPENDENCY_SET)`` has the same limitation.
+
+The following sub-arguments are forwarded through as the corresponding
+arguments to :command:`file(GET_RUNTIME_DEPENDENCIES)` (for those that provide
+a non-empty list of directories, regular expressions or files). They all
+support :manual:`generator expressions <cmake-generator-expressions(7)>`.
+
+* ``DIRECTORIES <directories>``
+* ``PRE_INCLUDE_REGEXES <regexes>``
+* ``PRE_EXCLUDE_REGEXES <regexes>``
+* ``POST_INCLUDE_REGEXES <regexes>``
+* ``POST_EXCLUDE_REGEXES <regexes>``
+* ``POST_INCLUDE_FILES <files>``
+* ``POST_EXCLUDE_FILES <files>``
Generated Installation Script
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Help/cpack_gen/rpm.rst b/Help/cpack_gen/rpm.rst
index 322ab68..f6274f9 100644
--- a/Help/cpack_gen/rpm.rst
+++ b/Help/cpack_gen/rpm.rst
@@ -1035,3 +1035,14 @@ Source RPM packaging has its own set of variables:
example::
set(CPACK_RPM_BUILDREQUIRES "python >= 2.5.0, cmake >= 2.8")
+
+.. VARIABLE:: CPACK_RPM_REQUIRES_EXCLUDE_FROM
+
+ * Mandatory : NO
+ * Default : -
+
+ May be used to keep the dependency generator from scanning specific files
+ or directories for dependencies. Note that you can use a regular
+ expression that matches all of the directories or files, for example::
+
+ set(CPACK_RPM_REQUIRES_EXCLUDE_FROM "bin/libqsqloci.*\\.so.*")
diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst
index 4b2934a..5262105 100644
--- a/Help/manual/cmake-packages.7.rst
+++ b/Help/manual/cmake-packages.7.rst
@@ -74,7 +74,9 @@ package.
By setting the :variable:`CMAKE_DISABLE_FIND_PACKAGE_<PackageName>` variable to
``TRUE``, the ``<PackageName>`` package will not be searched, and will always
-be ``NOTFOUND``.
+be ``NOTFOUND``. Likewise, setting the
+:variable:`CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>` to ``TRUE`` will make the
+package REQUIRED.
.. _`Config File Packages`:
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 39fbbed..c55bb58 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -230,6 +230,7 @@ Variables that Change Behavior
/variable/CMAKE_PROJECT_INCLUDE_BEFORE
/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE
/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE_BEFORE
+ /variable/CMAKE_REQUIRE_FIND_PACKAGE_PackageName
/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY
/variable/CMAKE_STAGING_PREFIX
/variable/CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS
@@ -427,6 +428,7 @@ Variables that Control the Build
/variable/CMAKE_LANG_LINKER_LAUNCHER
/variable/CMAKE_LANG_LINK_LIBRARY_FILE_FLAG
/variable/CMAKE_LANG_LINK_LIBRARY_FLAG
+ /variable/CMAKE_LANG_LINK_WHAT_YOU_USE_FLAG
/variable/CMAKE_LANG_VISIBILITY_PRESET
/variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY
/variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY_CONFIG
@@ -437,6 +439,7 @@ Variables that Control the Build
/variable/CMAKE_LINK_LIBRARY_FILE_FLAG
/variable/CMAKE_LINK_LIBRARY_FLAG
/variable/CMAKE_LINK_WHAT_YOU_USE
+ /variable/CMAKE_LINK_WHAT_YOU_USE_CHECK
/variable/CMAKE_MACOSX_BUNDLE
/variable/CMAKE_MACOSX_RPATH
/variable/CMAKE_MAP_IMPORTED_CONFIG_CONFIG
diff --git a/Help/manual/presets/example.json b/Help/manual/presets/example.json
index 346f342..b08445a 100644
--- a/Help/manual/presets/example.json
+++ b/Help/manual/presets/example.json
@@ -2,7 +2,7 @@
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
- "minor": 20,
+ "minor": 21,
"patch": 0
},
"configurePresets": [
diff --git a/Help/prop_tgt/CUDA_STANDARD.rst b/Help/prop_tgt/CUDA_STANDARD.rst
index 6517035..5ef57be 100644
--- a/Help/prop_tgt/CUDA_STANDARD.rst
+++ b/Help/prop_tgt/CUDA_STANDARD.rst
@@ -9,7 +9,29 @@ This property specifies the CUDA/C++ standard whose features are requested
to build this target. For some compilers, this results in adding a
flag such as ``-std=gnu++11`` to the compile line.
-Supported values are ``98``, ``03``, ``11``, ``14``, ``17``, ``20``, ``23``.
+Supported values are:
+
+``98``
+ CUDA C++98
+
+``11``
+ CUDA C++11
+
+``14``
+ CUDA C++14
+
+``17``
+ CUDA C++17
+
+``20``
+ .. versionadded:: 3.12
+
+ CUDA C++20
+
+``23``
+ .. versionadded:: 3.20
+
+ CUDA C++23
If the value requested does not result in a compile flag being added for
the compiler in use, a previous standard flag will be added instead. This
diff --git a/Help/prop_tgt/CXX_STANDARD.rst b/Help/prop_tgt/CXX_STANDARD.rst
index be0dab5..b10d201 100644
--- a/Help/prop_tgt/CXX_STANDARD.rst
+++ b/Help/prop_tgt/CXX_STANDARD.rst
@@ -11,7 +11,31 @@ flag such as ``-std=gnu++11`` to the compile line. For compilers that
have no notion of a standard level, such as Microsoft Visual C++ before
2015 Update 3, this has no effect.
-Supported values are ``98``, ``11``, ``14``, ``17``, ``20``, ``23``.
+Supported values are:
+
+``98``
+ C++98
+
+``11``
+ C++11
+
+``14``
+ C++14
+
+``17``
+ .. versionadded:: 3.8
+
+ C++17
+
+``20``
+ .. versionadded:: 3.12
+
+ C++20
+
+``23``
+ .. versionadded:: 3.20
+
+ C++23
If the value requested does not result in a compile flag being added for
the compiler in use, a previous standard flag will be added instead. This
diff --git a/Help/prop_tgt/LINK_WHAT_YOU_USE.rst b/Help/prop_tgt/LINK_WHAT_YOU_USE.rst
index 2ed93ad..d6de0d4 100644
--- a/Help/prop_tgt/LINK_WHAT_YOU_USE.rst
+++ b/Help/prop_tgt/LINK_WHAT_YOU_USE.rst
@@ -1,16 +1,22 @@
LINK_WHAT_YOU_USE
----------------------------
+-----------------
.. versionadded:: 3.7
-This is a boolean option that when set to ``TRUE`` will automatically run
-``ldd -r -u`` on the target after it is linked. In addition, the linker flag
-``-Wl,--no-as-needed`` will be passed to the target with the link command so
-that all libraries specified on the command line will be linked into the
-target. This will result in the link producing a list of libraries that
-provide no symbols used by this target but are being linked to it.
-This is only applicable to executable and shared library targets and
-will only work when ld and ldd accept the flags used.
+This is a boolean option that, when set to ``TRUE``, will automatically run
+contents of variable :variable:`CMAKE_LINK_WHAT_YOU_USE_CHECK` on the target
+after it is linked. In addition, the linker flag specified by variable
+:variable:`CMAKE_<LANG>_LINK_WHAT_YOU_USE_FLAG` will be passed to the target
+with the link command so that all libraries specified on the command line will
+be linked into the target. This will result in the link producing a list of
+libraries that provide no symbols used by this target but are being linked to
+it.
+
+.. note::
+
+ For now, it is only supported for ``ELF`` platforms and is only applicable to
+ executable and shared or module library targets. This property will be
+ ignored for any other targets and configurations.
This property is initialized by the value of
the :variable:`CMAKE_LINK_WHAT_YOU_USE` variable if it is set
diff --git a/Help/prop_tgt/OBJCXX_STANDARD.rst b/Help/prop_tgt/OBJCXX_STANDARD.rst
index 96088af..654e687 100644
--- a/Help/prop_tgt/OBJCXX_STANDARD.rst
+++ b/Help/prop_tgt/OBJCXX_STANDARD.rst
@@ -9,7 +9,27 @@ This property specifies the ObjC++ standard whose features are requested
to build this target. For some compilers, this results in adding a
flag such as ``-std=gnu++11`` to the compile line.
-Supported values are ``98``, ``11``, ``14``, ``17``, ``20``, ``23``.
+Supported values are:
+
+``98``
+ Objective C++98
+
+``11``
+ Objective C++11
+
+``14``
+ Objective C++14
+
+``17``
+ Objective C++17
+
+``20``
+ Objective C++20
+
+``23``
+ .. versionadded:: 3.20
+
+ Objective C++23
If the value requested does not result in a compile flag being added for
the compiler in use, a previous standard flag will be added instead. This
diff --git a/Help/prop_tgt/OBJC_STANDARD.rst b/Help/prop_tgt/OBJC_STANDARD.rst
index 2143ff9..2d27bcf 100644
--- a/Help/prop_tgt/OBJC_STANDARD.rst
+++ b/Help/prop_tgt/OBJC_STANDARD.rst
@@ -9,7 +9,16 @@ This property specifies the OBJC standard whose features are requested
to build this target. For some compilers, this results in adding a
flag such as ``-std=gnu11`` to the compile line.
-Supported values are ``90``, ``99`` and ``11``.
+Supported values are:
+
+``90``
+ Objective C89/C90
+
+``99``
+ Objective C99
+
+``11``
+ Objective C11
If the value requested does not result in a compile flag being added for
the compiler in use, a previous standard flag will be added instead. This
diff --git a/Help/release/dev/LINK_WHAT_USE_USE-configuration.rst b/Help/release/dev/LINK_WHAT_USE_USE-configuration.rst
new file mode 100644
index 0000000..990ed36
--- /dev/null
+++ b/Help/release/dev/LINK_WHAT_USE_USE-configuration.rst
@@ -0,0 +1,5 @@
+LINK_WHAT_YOU_USE-configuration
+-------------------------------
+
+* Configuration for :prop_tgt:`LINK_WHAT_YOU_USE` feature is now controlled by
+ ``CMake`` variables and only active for ``ELF`` platforms.
diff --git a/Help/release/dev/UseSWIG-dependencies.rst b/Help/release/dev/UseSWIG-dependencies.rst
new file mode 100644
index 0000000..a3ec29e
--- /dev/null
+++ b/Help/release/dev/UseSWIG-dependencies.rst
@@ -0,0 +1,6 @@
+UseSWIG-dependencies
+--------------------
+
+* :module:`UseSWIG` module gained the capability, for
+ :ref:`Visual Studio Generators` to use `swig` tool to generate implicit
+ dependencies.
diff --git a/Help/release/dev/cpack-rpm-requires-exclude-from.rst b/Help/release/dev/cpack-rpm-requires-exclude-from.rst
new file mode 100644
index 0000000..7125901
--- /dev/null
+++ b/Help/release/dev/cpack-rpm-requires-exclude-from.rst
@@ -0,0 +1,6 @@
+cpack-rpm-requires-exclude-from
+-------------------------------
+
+* The :cpack_gen:`CPack RPM Generator` gained the
+ :variable:`CPACK_RPM_REQUIRES_EXCLUDE_FROM` option avoid scanning
+ specific paths for dependencies.
diff --git a/Help/release/dev/find_package-required-var.rst b/Help/release/dev/find_package-required-var.rst
new file mode 100644
index 0000000..36935ef
--- /dev/null
+++ b/Help/release/dev/find_package-required-var.rst
@@ -0,0 +1,5 @@
+find_package-required-var
+-------------------------
+
+* The :variable:`CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>` variable was added
+ to turn a non-REQUIRED :command:`find_package` call into a REQUIRED one.
diff --git a/Help/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.rst b/Help/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.rst
index ed60020..f77e939 100644
--- a/Help/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.rst
+++ b/Help/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.rst
@@ -14,3 +14,5 @@ the package has already been found in a previous CMake run, the
variables which have been stored in the cache will still be there. In
that case it is recommended to remove the cache variables for this
package from the cache using the cache editor or :manual:`cmake(1)` ``-U``
+
+See also the :variable:`CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>` variable.
diff --git a/Help/variable/CMAKE_LANG_LINK_WHAT_YOU_USE_FLAG.rst b/Help/variable/CMAKE_LANG_LINK_WHAT_YOU_USE_FLAG.rst
new file mode 100644
index 0000000..5004530
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_LINK_WHAT_YOU_USE_FLAG.rst
@@ -0,0 +1,9 @@
+CMAKE_<LANG>_LINK_WHAT_YOU_USE_FLAG
+-----------------------------------
+
+.. versionadded:: 3.22
+
+Linker flag to be used to configure linker so that all specified libraries on
+the command line will be linked into the target.
+
+See also variable :variable:`CMAKE_LINK_WHAT_YOU_USE_CHECK`.
diff --git a/Help/variable/CMAKE_LINK_WHAT_YOU_USE.rst b/Help/variable/CMAKE_LINK_WHAT_YOU_USE.rst
index 06b3aa8..bca4519 100644
--- a/Help/variable/CMAKE_LINK_WHAT_YOU_USE.rst
+++ b/Help/variable/CMAKE_LINK_WHAT_YOU_USE.rst
@@ -1,5 +1,5 @@
CMAKE_LINK_WHAT_YOU_USE
----------------------------------
+-----------------------
.. versionadded:: 3.7
diff --git a/Help/variable/CMAKE_LINK_WHAT_YOU_USE_CHECK.rst b/Help/variable/CMAKE_LINK_WHAT_YOU_USE_CHECK.rst
new file mode 100644
index 0000000..e626641
--- /dev/null
+++ b/Help/variable/CMAKE_LINK_WHAT_YOU_USE_CHECK.rst
@@ -0,0 +1,10 @@
+CMAKE_LINK_WHAT_YOU_USE_CHECK
+-----------------------------
+
+.. versionadded:: 3.22
+
+Defines the command executed after the link step to check libraries usage.
+This check is currently only defined on ``ELF`` platforms with value
+``ldd -u -r``.
+
+See also :variable:`CMAKE_<LANG>_LINK_WHAT_YOU_USE_FLAG` variables.
diff --git a/Help/variable/CMAKE_REQUIRE_FIND_PACKAGE_PackageName.rst b/Help/variable/CMAKE_REQUIRE_FIND_PACKAGE_PackageName.rst
new file mode 100644
index 0000000..893f1ae
--- /dev/null
+++ b/Help/variable/CMAKE_REQUIRE_FIND_PACKAGE_PackageName.rst
@@ -0,0 +1,14 @@
+CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>
+----------------------------------------
+
+.. versionadded:: 3.22
+
+Variable for making :command:`find_package` call ``REQUIRED``.
+
+Every non-``REQUIRED`` :command:`find_package` call in a project can be
+turned into ``REQUIRED`` by setting the variable
+``CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>`` to ``TRUE``.
+This can be used to assert assumptions about build environment and to
+ensure the build will fail early if they do not hold.
+
+See also the :variable:`CMAKE_DISABLE_FIND_PACKAGE_<PackageName>` variable.
diff --git a/Help/variable/PROJECT-NAME_IS_TOP_LEVEL.rst b/Help/variable/PROJECT-NAME_IS_TOP_LEVEL.rst
index 953e978..6718ecf 100644
--- a/Help/variable/PROJECT-NAME_IS_TOP_LEVEL.rst
+++ b/Help/variable/PROJECT-NAME_IS_TOP_LEVEL.rst
@@ -9,3 +9,13 @@ level ``CMakeLists.txt`` file.
To obtain the value from the most recent call to :command:`project` in
the current directory scope or above, see the
:variable:`PROJECT_IS_TOP_LEVEL` variable.
+
+The variable value will be true in:
+
+* the top-level directory of the project
+* the top-level directory of an external project added by :module:`ExternalProject`
+
+The variable value will be false in:
+
+* a directory added by :command:`add_subdirectory`
+* a directory added by :module:`FetchContent`
diff --git a/Help/variable/PROJECT_IS_TOP_LEVEL.rst b/Help/variable/PROJECT_IS_TOP_LEVEL.rst
index e5eb6c1..ad61fec 100644
--- a/Help/variable/PROJECT_IS_TOP_LEVEL.rst
+++ b/Help/variable/PROJECT_IS_TOP_LEVEL.rst
@@ -19,3 +19,13 @@ options:
if(PROJECT_IS_TOP_LEVEL)
include(CTest)
endif()
+
+The variable value will be true in:
+
+* the top-level directory of the project
+* the top-level directory of an external project added by :module:`ExternalProject`
+
+The variable value will be false in:
+
+* a directory added by :command:`add_subdirectory`
+* a directory added by :module:`FetchContent`
diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake
index 6be1865..665f309 100644
--- a/Modules/CMakeCInformation.cmake
+++ b/Modules/CMakeCInformation.cmake
@@ -91,6 +91,14 @@ if(CMAKE_USER_MAKE_RULES_OVERRIDE_C)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_C "${_override}")
endif()
+if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
+ if(NOT DEFINED CMAKE_C_LINK_WHAT_YOU_USE_FLAG)
+ set(CMAKE_C_LINK_WHAT_YOU_USE_FLAG "LINKER:--no-as-needed")
+ endif()
+ if(NOT DEFINED CMAKE_LINK_WHAT_YOU_USE_CHECK)
+ set(CMAKE_LINK_WHAT_YOU_USE_CHECK ldd -u -r)
+ endif()
+endif()
# for most systems a module is the same as a shared library
# so unless the variable CMAKE_MODULE_EXISTS is set just
@@ -196,5 +204,3 @@ if(NOT CMAKE_EXECUTABLE_RPATH_LINK_C_FLAG)
endif()
set(CMAKE_C_INFORMATION_LOADED 1)
-
-
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake
index a2946f4..e9cfed6 100644
--- a/Modules/CMakeCUDAInformation.cmake
+++ b/Modules/CMakeCUDAInformation.cmake
@@ -100,6 +100,15 @@ if(NOT CMAKE_MODULE_EXISTS)
set(CMAKE_SHARED_MODULE_CREATE_CUDA_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS})
endif()
+if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
+ if(NOT DEFINED CMAKE_CUDA_LINK_WHAT_YOU_USE_FLAG)
+ set(CMAKE_CUDA_LINK_WHAT_YOU_USE_FLAG "LINKER:--no-as-needed")
+ endif()
+ if(NOT DEFINED CMAKE_LINK_WHAT_YOU_USE_CHECK)
+ set(CMAKE_LINK_WHAT_YOU_USE_CHECK ldd -u -r)
+ endif()
+endif()
+
# add the flags to the cache based
# on the initial values computed in the platform/*.cmake files
# use _INIT variables so that this only happens the first time
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake
index 944d236..53abf37 100644
--- a/Modules/CMakeCXXInformation.cmake
+++ b/Modules/CMakeCXXInformation.cmake
@@ -193,6 +193,15 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
endif()
endforeach()
+if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
+ if(NOT DEFINED CMAKE_CXX_LINK_WHAT_YOU_USE_FLAG)
+ set(CMAKE_CXX_LINK_WHAT_YOU_USE_FLAG "LINKER:--no-as-needed")
+ endif()
+ if(NOT DEFINED CMAKE_LINK_WHAT_YOU_USE_CHECK)
+ set(CMAKE_LINK_WHAT_YOU_USE_CHECK ldd -u -r)
+ endif()
+endif()
+
# add the flags to the cache based
# on the initial values computed in the platform/*.cmake files
# use _INIT variables so that this only happens the first time
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index bd1e732..fb5d773 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -722,7 +722,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
# Check the result of compilation.
if(CMAKE_${lang}_COMPILER_ID_RESULT
# Intel Fortran warns and ignores preprocessor lines without /fpp
- OR CMAKE_${lang}_COMPILER_ID_OUTPUT MATCHES "Bad # preprocessor line"
+ OR CMAKE_${lang}_COMPILER_ID_OUTPUT MATCHES "warning #5117: Bad # preprocessor line"
)
# Compilation failed.
set(MSG
@@ -733,7 +733,10 @@ ${CMAKE_${lang}_COMPILER_ID_RESULT}
${CMAKE_${lang}_COMPILER_ID_OUTPUT}
")
- file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "${MSG}")
+ # Log the output unless we recognize it as a known-bad case.
+ if(NOT CMAKE_${lang}_COMPILER_ID_OUTPUT MATCHES "warning #5117: Bad # preprocessor line")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "${MSG}")
+ endif()
# Some languages may know the correct/desired set of flags and want to fail right away if they don't work.
# This is currently only used by CUDA.
diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake
index 9a4ce63..0f71c6f 100644
--- a/Modules/CMakeFortranInformation.cmake
+++ b/Modules/CMakeFortranInformation.cmake
@@ -157,6 +157,15 @@ if(NOT CMAKE_INCLUDE_FLAG_Fortran)
set(CMAKE_INCLUDE_FLAG_Fortran ${CMAKE_INCLUDE_FLAG_C})
endif()
+if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
+ if(NOT DEFINED CMAKE_Fortran_LINK_WHAT_YOU_USE_FLAG)
+ set(CMAKE_Fortran_LINK_WHAT_YOU_USE_FLAG "LINKER:--no-as-needed")
+ endif()
+ if(NOT DEFINED CMAKE_LINK_WHAT_YOU_USE_CHECK)
+ set(CMAKE_LINK_WHAT_YOU_USE_CHECK ldd -u -r)
+ endif()
+endif()
+
set(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.")
set(CMAKE_Fortran_FLAGS_INIT "$ENV{FFLAGS} ${CMAKE_Fortran_FLAGS_INIT}")
diff --git a/Modules/CMakeHIPInformation.cmake b/Modules/CMakeHIPInformation.cmake
index ec37e1c..9862f24 100644
--- a/Modules/CMakeHIPInformation.cmake
+++ b/Modules/CMakeHIPInformation.cmake
@@ -68,6 +68,15 @@ if(NOT CMAKE_MODULE_EXISTS)
set(CMAKE_SHARED_MODULE_CREATE_HIP_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_HIP_FLAGS})
endif()
+if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
+ if(NOT DEFINED CMAKE_HIP_LINK_WHAT_YOU_USE_FLAG)
+ set(CMAKE_HIP_LINK_WHAT_YOU_USE_FLAG "LINKER:--no-as-needed")
+ endif()
+ if(NOT DEFINED CMAKE_LINK_WHAT_YOU_USE_CHECK)
+ set(CMAKE_LINK_WHAT_YOU_USE_CHECK ldd -u -r)
+ endif()
+endif()
+
# add the flags to the cache based
# on the initial values computed in the platform/*.cmake files
# use _INIT variables so that this only happens the first time
diff --git a/Modules/CMakeOBJCInformation.cmake b/Modules/CMakeOBJCInformation.cmake
index ac67d01..4c697da 100644
--- a/Modules/CMakeOBJCInformation.cmake
+++ b/Modules/CMakeOBJCInformation.cmake
@@ -91,6 +91,15 @@ if(CMAKE_USER_MAKE_RULES_OVERRIDE_OBJC)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_OBJC "${_override}")
endif()
+if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
+ if(NOT DEFINED CMAKE_OBJC_LINK_WHAT_YOU_USE_FLAG)
+ set(CMAKE_OBJC_LINK_WHAT_YOU_USE_FLAG "LINKER:--no-as-needed")
+ endif()
+ if(NOT DEFINED CMAKE_LINK_WHAT_YOU_USE_CHECK)
+ set(CMAKE_LINK_WHAT_YOU_USE_CHECK ldd -u -r)
+ endif()
+endif()
+
# for most systems a module is the same as a shared library
# so unless the variable CMAKE_MODULE_EXISTS is set just
diff --git a/Modules/CMakeOBJCXXInformation.cmake b/Modules/CMakeOBJCXXInformation.cmake
index 70e8579..a6d824f 100644
--- a/Modules/CMakeOBJCXXInformation.cmake
+++ b/Modules/CMakeOBJCXXInformation.cmake
@@ -189,6 +189,15 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
endif()
endforeach()
+if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
+ if(NOT DEFINED CMAKE_OBJCXX_LINK_WHAT_YOU_USE_FLAG)
+ set(CMAKE_OBJCXX_LINK_WHAT_YOU_USE_FLAG "LINKER:--no-as-needed")
+ endif()
+ if(NOT DEFINED CMAKE_LINK_WHAT_YOU_USE_CHECK)
+ set(CMAKE_LINK_WHAT_YOU_USE_CHECK ldd -u -r)
+ endif()
+endif()
+
# add the flags to the cache based
# on the initial values computed in the platform/*.cmake files
# use _INIT variables so that this only happens the first time
diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake
index 8f0909c..ecad1d5 100644
--- a/Modules/CMakeSwiftInformation.cmake
+++ b/Modules/CMakeSwiftInformation.cmake
@@ -70,6 +70,15 @@ set(CMAKE_Swift_FLAGS_RELEASE_INIT "-O")
set(CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT "-O -g")
set(CMAKE_Swift_FLAGS_MINSIZEREL_INIT "-Osize")
+if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
+ if(NOT DEFINED CMAKE_Swift_LINK_WHAT_YOU_USE_FLAG)
+ set(CMAKE_Swift_LINK_WHAT_YOU_USE_FLAG "LINKER:--no-as-needed")
+ endif()
+ if(NOT DEFINED CMAKE_LINK_WHAT_YOU_USE_CHECK)
+ set(CMAKE_LINK_WHAT_YOU_USE_CHECK ldd -u -r)
+ endif()
+endif()
+
cmake_initialize_per_config_variable(CMAKE_Swift_FLAGS "Swift Compiler Flags")
# NOTE(compnerd) we do not have an object compile rule since we build the objects as part of the link step
diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake
index b8c0770..8bfc3ef 100644
--- a/Modules/Compiler/IAR.cmake
+++ b/Modules/Compiler/IAR.cmake
@@ -66,10 +66,10 @@ macro(__compiler_iar_ilink lang)
string(APPEND CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT " -r -DNDEBUG")
endif()
- set(CMAKE_${lang}_LINK_EXECUTABLE "\"${CMAKE_IAR_LINKER}\" --silent <OBJECTS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>")
- set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "\"${CMAKE_IAR_ARCHIVE}\" <TARGET> --create <LINK_FLAGS> <OBJECTS>")
- set(CMAKE_${lang}_ARCHIVE_CREATE "\"${CMAKE_IAR_ARCHIVE}\" <TARGET> --create <LINK_FLAGS> <OBJECTS>")
- set(CMAKE_${lang}_ARCHIVE_APPEND "\"${CMAKE_IAR_ARCHIVE}\" <TARGET> --replace <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> --silent <OBJECTS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>")
+ set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> <TARGET> --create <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> <TARGET> --create <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> <TARGET> --replace <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_FINISH "")
set(CMAKE_LINKER "${CMAKE_IAR_LINKER}" CACHE FILEPATH "The IAR linker" FORCE)
@@ -102,9 +102,9 @@ macro(__compiler_iar_xlink lang)
string(APPEND CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT " -r -DNDEBUG")
endif()
- set(CMAKE_${lang}_LINK_EXECUTABLE "\"${CMAKE_IAR_LINKER}\" -S <OBJECTS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>")
- set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "\"${CMAKE_IAR_AR}\" <TARGET> <LINK_FLAGS> <OBJECTS>")
- set(CMAKE_${lang}_ARCHIVE_CREATE "\"${CMAKE_IAR_AR}\" <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> -S <OBJECTS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> -o <TARGET>")
+ set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_APPEND "")
set(CMAKE_${lang}_ARCHIVE_FINISH "")
diff --git a/Modules/Compiler/IntelLLVM-C.cmake b/Modules/Compiler/IntelLLVM-C.cmake
index beb7132..d69d064 100644
--- a/Modules/Compiler/IntelLLVM-C.cmake
+++ b/Modules/Compiler/IntelLLVM-C.cmake
@@ -55,8 +55,4 @@ else()
set(CMAKE_C17_EXTENSION_COMPILE_OPTION "")
endif()
-if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
- __compiler_check_default_language_standard(C 2020 17)
-else()
- set(CMAKE_C_STANDARD_DEFAULT "")
-endif()
+__compiler_check_default_language_standard(C 2020 17)
diff --git a/Modules/Compiler/IntelLLVM-CXX.cmake b/Modules/Compiler/IntelLLVM-CXX.cmake
index 4c0c26e..9799888 100644
--- a/Modules/Compiler/IntelLLVM-CXX.cmake
+++ b/Modules/Compiler/IntelLLVM-CXX.cmake
@@ -62,8 +62,4 @@ else()
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-Qstd=c++20")
endif()
-if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
- __compiler_check_default_language_standard(CXX 2020 14)
-else()
- set(CMAKE_CXX_STANDARD_DEFAULT "")
-endif()
+__compiler_check_default_language_standard(CXX 2020 14)
diff --git a/Modules/Compiler/PGI.cmake b/Modules/Compiler/PGI.cmake
index 4f8b90b..d111be9 100644
--- a/Modules/Compiler/PGI.cmake
+++ b/Modules/Compiler/PGI.cmake
@@ -26,7 +26,7 @@ macro(__compiler_pgi lang)
endif()
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
- set(CMAKE_${lang}_LINKER_WRAPPER_FLAG ",")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL ppc64le AND (NOT CMAKE_HOST_WIN32 OR CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 16.3))
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index e048318..726ff75 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -1110,8 +1110,8 @@ if(BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All")
endif()
# Fujitsu SSL2 Library?
-if(NOT BLAS_LIBRARIES AND
- BLA_VENDOR MATCHES "Fujitsu_SSL2" OR BLA_VENDOR STREQUAL "All")
+if(NOT BLAS_LIBRARIES
+ AND (BLA_VENDOR MATCHES "Fujitsu_SSL2" OR BLA_VENDOR STREQUAL "All"))
if(BLA_VENDOR STREQUAL "Fujitsu_SSL2BLAMP")
set(_ssl2_suffix BLAMP)
else()
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index 4c535b9..e453109 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -75,12 +75,17 @@ The CUDA Toolkit search behavior uses the following order:
(2) ensure that the correct ``nvcc`` executable shows up in ``$PATH`` for
:command:`find_program` to find.
+Arguments
+^^^^^^^^^
+
+``[<version>]``
+ The ``[<version>]`` argument requests a version with which the package found
+ should be compatible. See :ref:`find_package version format <FIND_PACKAGE_VERSION_FORMAT>`
+ for more details.
+
Options
^^^^^^^
-``VERSION``
- If specified, describes the version of the CUDA Toolkit to search for.
-
``REQUIRED``
If specified, configuration will error if a suitable CUDA Toolkit is not
found.
@@ -410,7 +415,7 @@ Result variables
``CUDAToolkit_VERSION_MAJOR``
The major version of the CUDA Toolkit.
-``CUDAToolkit_VERSION_MAJOR``
+``CUDAToolkit_VERSION_MINOR``
The minor version of the CUDA Toolkit.
``CUDAToolkit_VERSION_PATCH``
diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake
index 2770c60..dd0975d 100644
--- a/Modules/FindGLUT.cmake
+++ b/Modules/FindGLUT.cmake
@@ -41,8 +41,43 @@ Also defined, but not for general use are:
#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-if (WIN32)
+function(_add_glut_target_simple)
+ if(TARGET GLUT::GLUT)
+ return()
+ endif()
+ add_library(GLUT::GLUT INTERFACE IMPORTED)
+ if(GLUT_INCLUDE_DIRS)
+ target_include_directories(GLUT::GLUT SYSTEM
+ INTERFACE "${GLUT_INCLUDE_DIRS}")
+ endif()
+ if(GLUT_LIBRARIES)
+ target_link_libraries(GLUT::GLUT INTERFACE ${GLUT_LIBRARIES})
+ endif()
+ if(GLUT_LDFLAGS)
+ target_link_options(GLUT::GLUT INTERFACE ${GLUT_LDFLAGS})
+ endif()
+ if(GLUT_CFLAGS)
+ separate_arguments(GLUT_CFLAGS_SPLIT UNIX_COMMAND "${GLUT_CFLAGS}")
+ target_compile_options(GLUT::GLUT INTERFACE ${GLUT_CFLAGS_SPLIT})
+ endif()
+
+ set_property(TARGET GLUT::GLUT APPEND PROPERTY
+ IMPORTED_LOCATION "${GLUT_glut_LIBRARY}")
+endfunction()
+
+find_package(PkgConfig)
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(GLUT glut)
+ if(GLUT_FOUND)
+ _add_glut_target_simple()
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLUT REQUIRED_VARS GLUT_FOUND)
+ return()
+ endif()
+endif()
+
+if(WIN32)
find_path( GLUT_INCLUDE_DIR NAMES GL/glut.h
PATHS ${GLUT_ROOT_PATH}/include )
find_library( GLUT_glut_LIBRARY_RELEASE NAMES glut glut32 freeglut
@@ -57,85 +92,75 @@ if (WIN32)
)
mark_as_advanced(GLUT_glut_LIBRARY_RELEASE GLUT_glut_LIBRARY_DEBUG)
select_library_configurations(GLUT_glut)
-else ()
-
- if (APPLE)
- find_path(GLUT_INCLUDE_DIR glut.h ${OPENGL_LIBRARY_DIR})
- find_library(GLUT_glut_LIBRARY GLUT DOC "GLUT library for OSX")
- find_library(GLUT_cocoa_LIBRARY Cocoa DOC "Cocoa framework for OSX")
- mark_as_advanced(GLUT_glut_LIBRARY GLUT_cocoa_LIBRARY)
-
- if(GLUT_cocoa_LIBRARY AND NOT TARGET GLUT::Cocoa)
- add_library(GLUT::Cocoa UNKNOWN IMPORTED)
- # Cocoa should always be a Framework, but we check to make sure.
- if(GLUT_cocoa_LIBRARY MATCHES "/([^/]+)\\.framework$")
- set(_glut_cocoa "${GLUT_cocoa_LIBRARY}/${CMAKE_MATCH_1}")
- if(EXISTS "${_glut_cocoa}.tbd")
- string(APPEND _glut_cocoa ".tbd")
- endif()
- set_target_properties(GLUT::Cocoa PROPERTIES
- IMPORTED_LOCATION "${_glut_cocoa}")
- else()
- set_target_properties(GLUT::Cocoa PROPERTIES
- IMPORTED_LOCATION "${GLUT_cocoa_LIBRARY}")
+elseif(APPLE)
+ find_path(GLUT_INCLUDE_DIR glut.h ${OPENGL_LIBRARY_DIR})
+ find_library(GLUT_glut_LIBRARY GLUT DOC "GLUT library for OSX")
+ find_library(GLUT_cocoa_LIBRARY Cocoa DOC "Cocoa framework for OSX")
+ mark_as_advanced(GLUT_glut_LIBRARY GLUT_cocoa_LIBRARY)
+
+ if(GLUT_cocoa_LIBRARY AND NOT TARGET GLUT::Cocoa)
+ add_library(GLUT::Cocoa UNKNOWN IMPORTED)
+ # Cocoa should always be a Framework, but we check to make sure.
+ if(GLUT_cocoa_LIBRARY MATCHES "/([^/]+)\\.framework$")
+ set(_glut_cocoa "${GLUT_cocoa_LIBRARY}/${CMAKE_MATCH_1}")
+ if(EXISTS "${_glut_cocoa}.tbd")
+ string(APPEND _glut_cocoa ".tbd")
endif()
- endif()
- else ()
-
- if (BEOS)
-
- set(_GLUT_INC_DIR /boot/develop/headers/os/opengl)
- set(_GLUT_glut_LIB_DIR /boot/develop/lib/x86)
-
+ set_target_properties(GLUT::Cocoa PROPERTIES
+ IMPORTED_LOCATION "${_glut_cocoa}")
else()
-
- find_library( GLUT_Xi_LIBRARY Xi
- /usr/openwin/lib
- )
- mark_as_advanced(GLUT_Xi_LIBRARY)
-
- find_library( GLUT_Xmu_LIBRARY Xmu
- /usr/openwin/lib
- )
- mark_as_advanced(GLUT_Xmu_LIBRARY)
-
- if(GLUT_Xi_LIBRARY AND NOT TARGET GLUT::Xi)
- add_library(GLUT::Xi UNKNOWN IMPORTED)
- set_target_properties(GLUT::Xi PROPERTIES
- IMPORTED_LOCATION "${GLUT_Xi_LIBRARY}")
- endif()
-
- if(GLUT_Xmu_LIBRARY AND NOT TARGET GLUT::Xmu)
- add_library(GLUT::Xmu UNKNOWN IMPORTED)
- set_target_properties(GLUT::Xmu PROPERTIES
- IMPORTED_LOCATION "${GLUT_Xmu_LIBRARY}")
- endif()
-
- endif ()
-
- find_path( GLUT_INCLUDE_DIR GL/glut.h
- /usr/include/GL
- /usr/openwin/share/include
- /usr/openwin/include
- /opt/graphics/OpenGL/include
- /opt/graphics/OpenGL/contrib/libglut
- ${_GLUT_INC_DIR}
+ set_target_properties(GLUT::Cocoa PROPERTIES
+ IMPORTED_LOCATION "${GLUT_cocoa_LIBRARY}")
+ endif()
+ endif()
+else()
+ if(BEOS)
+ set(_GLUT_INC_DIR /boot/develop/headers/os/opengl)
+ set(_GLUT_glut_LIB_DIR /boot/develop/lib/x86)
+ else()
+ find_library( GLUT_Xi_LIBRARY Xi
+ /usr/openwin/lib
)
+ mark_as_advanced(GLUT_Xi_LIBRARY)
- find_library( GLUT_glut_LIBRARY glut
+ find_library( GLUT_Xmu_LIBRARY Xmu
/usr/openwin/lib
- ${_GLUT_glut_LIB_DIR}
)
- mark_as_advanced(GLUT_glut_LIBRARY)
+ mark_as_advanced(GLUT_Xmu_LIBRARY)
- unset(_GLUT_INC_DIR)
- unset(_GLUT_glut_LIB_DIR)
+ if(GLUT_Xi_LIBRARY AND NOT TARGET GLUT::Xi)
+ add_library(GLUT::Xi UNKNOWN IMPORTED)
+ set_target_properties(GLUT::Xi PROPERTIES
+ IMPORTED_LOCATION "${GLUT_Xi_LIBRARY}")
+ endif()
+
+ if(GLUT_Xmu_LIBRARY AND NOT TARGET GLUT::Xmu)
+ add_library(GLUT::Xmu UNKNOWN IMPORTED)
+ set_target_properties(GLUT::Xmu PROPERTIES
+ IMPORTED_LOCATION "${GLUT_Xmu_LIBRARY}")
+ endif()
endif ()
-endif ()
+ find_path( GLUT_INCLUDE_DIR GL/glut.h
+ /usr/include/GL
+ /usr/openwin/share/include
+ /usr/openwin/include
+ /opt/graphics/OpenGL/include
+ /opt/graphics/OpenGL/contrib/libglut
+ ${_GLUT_INC_DIR}
+ )
+
+ find_library( GLUT_glut_LIBRARY glut
+ /usr/openwin/lib
+ ${_GLUT_glut_LIB_DIR}
+ )
+
+ unset(_GLUT_INC_DIR)
+ unset(_GLUT_glut_LIB_DIR)
+endif()
+mark_as_advanced(GLUT_glut_LIBRARY)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLUT REQUIRED_VARS GLUT_glut_LIBRARY GLUT_INCLUDE_DIR)
if (GLUT_FOUND)
diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake
index add2486..3f243de 100644
--- a/Modules/FindJPEG.cmake
+++ b/Modules/FindJPEG.cmake
@@ -58,7 +58,7 @@ Obsolete variables
find_path(JPEG_INCLUDE_DIR jpeglib.h)
-set(jpeg_names ${JPEG_NAMES} jpeg jpeg-static libjpeg libjpeg-static turbojpeg turbojpeg-static)
+set(jpeg_names ${JPEG_NAMES} jpeg jpeg-static libjpeg libjpeg-static)
foreach(name ${jpeg_names})
list(APPEND jpeg_names_debug "${name}d")
endforeach()
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index b8a3363..3146e06 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -550,7 +550,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE)
# Fujitsu SSL2 Library?
if(NOT LAPACK_LIBRARIES
- AND BLA_VENDOR MATCHES "Fujitsu_SSL2" OR BLA_VENDOR STREQUAL "All")
+ AND (BLA_VENDOR MATCHES "Fujitsu_SSL2" OR BLA_VENDOR STREQUAL "All"))
if(BLA_VENDOR STREQUAL "Fujitsu_SSL2BLAMP")
set(_ssl2_suffix BLAMP)
else()
@@ -582,7 +582,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE)
# NVHPC Library?
if(NOT LAPACK_LIBRARIES
- AND BLA_VENDOR MATCHES "NVHPC" OR BLA_VENDOR STREQUAL "All")
+ AND (BLA_VENDOR MATCHES "NVHPC" OR BLA_VENDOR STREQUAL "All"))
check_lapack_libraries(
LAPACK_LIBRARIES
LAPACK
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index c48decb..0b0d2d3 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -1440,9 +1440,10 @@ foreach(LANG IN ITEMS C CXX Fortran)
endif()
if(_MPI_FIND_${LANG})
if( ${LANG} STREQUAL CXX AND NOT MPICXX IN_LIST MPI_FIND_COMPONENTS )
- set(MPI_CXX_SKIP_MPICXX FALSE CACHE BOOL "If true, the MPI-2 C++ bindings are disabled using definitions.")
+ option(MPI_CXX_SKIP_MPICXX "If true, the MPI-2 C++ bindings are disabled using definitions." FALSE)
mark_as_advanced(MPI_CXX_SKIP_MPICXX)
endif()
+ _MPI_adjust_compile_definitions(${LANG})
if(NOT (MPI_${LANG}_LIB_NAMES AND (MPI_${LANG}_INCLUDE_PATH OR MPI_${LANG}_INCLUDE_DIRS OR MPI_${LANG}_COMPILER_INCLUDE_DIRS)))
set(MPI_${LANG}_TRIED_IMPLICIT FALSE)
set(MPI_${LANG}_WORKS_IMPLICIT FALSE)
@@ -1547,7 +1548,6 @@ foreach(LANG IN ITEMS C CXX Fortran)
endif()
_MPI_assemble_libraries(${LANG})
- _MPI_adjust_compile_definitions(${LANG})
# We always create imported targets even if they're empty
_MPI_create_imported_target(${LANG})
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index bd54fd9..d39bbd0 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -46,6 +46,7 @@ set(PKG_CONFIG_NAMES "pkg-config")
if(CMAKE_HOST_WIN32)
list(PREPEND PKG_CONFIG_NAMES "pkg-config.bat")
endif()
+list(PREPEND PKG_CONFIG_NAMES "pkgconf")
find_program(PKG_CONFIG_EXECUTABLE
NAMES ${PKG_CONFIG_NAMES}
diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake
index 2ceab10..967ad7b 100644
--- a/Modules/Internal/CPack/CPackDeb.cmake
+++ b/Modules/Internal/CPack/CPackDeb.cmake
@@ -673,7 +673,7 @@ function(cpack_deb_prepare_package_vars)
if(CPACK_ADD_LDCONFIG_CALL)
set(CPACK_DEBIAN_GENERATE_POSTINST 1)
set(CPACK_DEBIAN_GENERATE_POSTRM 1)
- foreach(f IN LISTS PACKAGE_CONTROL_EXTRA)
+ foreach(f IN LISTS CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA)
get_filename_component(n "${f}" NAME)
if(n STREQUAL "postinst")
set(CPACK_DEBIAN_GENERATE_POSTINST 0)
diff --git a/Modules/Internal/CPack/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake
index 47d2a5c..bfb42f3 100644
--- a/Modules/Internal/CPack/CPackRPM.cmake
+++ b/Modules/Internal/CPack/CPackRPM.cmake
@@ -1162,6 +1162,16 @@ function(cpack_rpm_generate_package)
set(TMP_RPM_SPEC_INSTALL_POST "%define __spec_install_post ${CPACK_RPM_SPEC_INSTALL_POST}")
endif()
+ # CPACK_RPM_REQUIRES_EXCLUDE_FROM
+ # May be defined to keep the dependency generator from
+ # scanning specific files or directories for deps.
+ if(CPACK_RPM_REQUIRES_EXCLUDE_FROM)
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: User defined CPACK_RPM_REQUIRES_EXCLUDE_FROM = ${CPACK_RPM_REQUIRES_EXCLUDE_FROM}")
+ endif()
+ set(TMP_RPM_REQUIRES_EXCLUDE_FROM "%global __requires_exclude_from ${CPACK_RPM_REQUIRES_EXCLUDE_FROM}")
+ endif()
+
# CPACK_RPM_POST_INSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE)
# CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE)
# CPACK_RPM_POST_TRANS_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_TRANS_SCRIPT_FILE)
@@ -1650,6 +1660,7 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
\@FILE_NAME_DEFINE\@
%define _unpackaged_files_terminate_build 0
\@TMP_RPM_SPEC_INSTALL_POST\@
+\@TMP_RPM_REQUIRES_EXCLUDE_FROM\@
\@CPACK_RPM_SPEC_MORE_DEFINE\@
\@CPACK_RPM_COMPRESSION_TYPE_TMP\@
@@ -1784,6 +1795,7 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
\@FILE_NAME_DEFINE\@
%define _unpackaged_files_terminate_build 0
\@TMP_RPM_SPEC_INSTALL_POST\@
+\@TMP_RPM_REQUIRES_EXCLUDE_FROM\@
\@CPACK_RPM_SPEC_MORE_DEFINE\@
\@CPACK_RPM_COMPRESSION_TYPE_TMP\@
diff --git a/Modules/Internal/CPack/NSIS.template.in b/Modules/Internal/CPack/NSIS.template.in
index 0a9c487..848691f 100644
--- a/Modules/Internal/CPack/NSIS.template.in
+++ b/Modules/Internal/CPack/NSIS.template.in
@@ -564,21 +564,27 @@ FunctionEnd
;Languages
!insertmacro MUI_LANGUAGE "English" ;first language is the default language
+ !insertmacro MUI_LANGUAGE "Afrikaans"
!insertmacro MUI_LANGUAGE "Albanian"
!insertmacro MUI_LANGUAGE "Arabic"
+ !insertmacro MUI_LANGUAGE "Asturian"
!insertmacro MUI_LANGUAGE "Basque"
!insertmacro MUI_LANGUAGE "Belarusian"
!insertmacro MUI_LANGUAGE "Bosnian"
!insertmacro MUI_LANGUAGE "Breton"
!insertmacro MUI_LANGUAGE "Bulgarian"
+ !insertmacro MUI_LANGUAGE "Catalan"
+ !insertmacro MUI_LANGUAGE "Corsican"
!insertmacro MUI_LANGUAGE "Croatian"
!insertmacro MUI_LANGUAGE "Czech"
!insertmacro MUI_LANGUAGE "Danish"
!insertmacro MUI_LANGUAGE "Dutch"
+ !insertmacro MUI_LANGUAGE "Esperanto"
!insertmacro MUI_LANGUAGE "Estonian"
!insertmacro MUI_LANGUAGE "Farsi"
!insertmacro MUI_LANGUAGE "Finnish"
!insertmacro MUI_LANGUAGE "French"
+ !insertmacro MUI_LANGUAGE "Galician"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "Greek"
!insertmacro MUI_LANGUAGE "Hebrew"
@@ -597,22 +603,29 @@ FunctionEnd
!insertmacro MUI_LANGUAGE "Malay"
!insertmacro MUI_LANGUAGE "Mongolian"
!insertmacro MUI_LANGUAGE "Norwegian"
+ !insertmacro MUI_LANGUAGE "NorwegianNynorsk"
+ !insertmacro MUI_LANGUAGE "Pashto"
!insertmacro MUI_LANGUAGE "Polish"
!insertmacro MUI_LANGUAGE "Portuguese"
!insertmacro MUI_LANGUAGE "PortugueseBR"
!insertmacro MUI_LANGUAGE "Romanian"
!insertmacro MUI_LANGUAGE "Russian"
+ !insertmacro MUI_LANGUAGE "ScotsGaelic"
!insertmacro MUI_LANGUAGE "Serbian"
!insertmacro MUI_LANGUAGE "SerbianLatin"
!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_LANGUAGE "Slovak"
!insertmacro MUI_LANGUAGE "Slovenian"
!insertmacro MUI_LANGUAGE "Spanish"
+ !insertmacro MUI_LANGUAGE "SpanishInternational"
!insertmacro MUI_LANGUAGE "Swedish"
+ !insertmacro MUI_LANGUAGE "Tatar"
!insertmacro MUI_LANGUAGE "Thai"
!insertmacro MUI_LANGUAGE "TradChinese"
!insertmacro MUI_LANGUAGE "Turkish"
!insertmacro MUI_LANGUAGE "Ukrainian"
+ !insertmacro MUI_LANGUAGE "Uzbek"
+ !insertmacro MUI_LANGUAGE "Vietnamese"
!insertmacro MUI_LANGUAGE "Welsh"
;--------------------------------
diff --git a/Modules/Internal/CheckCompilerFlag.cmake b/Modules/Internal/CheckCompilerFlag.cmake
index 693e28b..f6a4cc9 100644
--- a/Modules/Internal/CheckCompilerFlag.cmake
+++ b/Modules/Internal/CheckCompilerFlag.cmake
@@ -78,7 +78,6 @@ int main(void) { return 0; }]=])
foreach(v IN LISTS _locale_vars)
set(ENV{${v}} ${_locale_vars_saved_${v}})
endforeach()
- set(${_var} "${${_var}}" PARENT_SCOPE)
endfunction ()
cmake_policy(POP)
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index 5c8f152..9808861 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -192,12 +192,17 @@ ensure generated files will receive the required settings.
If set to ``TRUE``, implicit dependencies are generated by the ``swig`` tool
itself. This property is only meaningful for
:ref:`Makefile <Makefile Generators>`,
- :ref:`Ninja <Ninja Generators>` and :generator:`Xcode` generators. Default
- value is ``FALSE``.
+ :ref:`Ninja <Ninja Generators>`, :generator:`Xcode`, and
+ :ref:`Visual Studio <Visual Studio Generators>`
+ (:generator:`Visual Studio 11 2012` and above) generators. Default value is
+ ``FALSE``.
.. versionadded:: 3.21
Added the support of :generator:`Xcode` generator.
+ .. versionadded:: 3.22
+ Added the support of :ref:`Visual Studio Generators`.
+
``SWIG_MODULE_NAME``
Specify the actual import name of the module in the target language.
This is required if it cannot be scanned automatically from source
@@ -342,8 +347,10 @@ as well as ``SWIG``:
If set to ``TRUE``, implicit dependencies are generated by the ``swig`` tool
itself. This variable is only meaningful for
:ref:`Makefile <Makefile Generators>`,
- :ref:`Ninja <Ninja Generators>` and :generator:`Xcode` generators. Default
- value is ``FALSE``.
+ :ref:`Ninja <Ninja Generators>`, :generator:`Xcode`, and
+ :ref:`Visual Studio <Visual Studio Generators>`
+ (:generator:`Visual Studio 11 2012` and above) generators. Default value is
+ ``FALSE``.
Source file property ``USE_SWIG_DEPENDENCIES``, if not defined, will be
initialized with the value of this variable.
@@ -351,6 +358,9 @@ as well as ``SWIG``:
.. versionadded:: 3.21
Added the support of :generator:`Xcode` generator.
+ .. versionadded:: 3.22
+ Added the support of :ref:`Visual Studio Generators`.
+
#]=======================================================================]
cmake_policy(PUSH)
@@ -515,7 +525,7 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
endif()
set (use_swig_dependencies ${SWIG_USE_SWIG_DEPENDENCIES})
- if (CMAKE_GENERATOR MATCHES "Make|Ninja|Xcode")
+ if (CMAKE_GENERATOR MATCHES "Make|Ninja|Xcode|Visual Studio (1[1-9]|[2-9][0-9])")
get_property(use_swig_dependencies_set SOURCE "${infile}" PROPERTY USE_SWIG_DEPENDENCIES SET)
if (use_swig_dependencies_set)
get_property(use_swig_dependencies SOURCE "${infile}" PROPERTY USE_SWIG_DEPENDENCIES)
@@ -840,8 +850,9 @@ function(SWIG_ADD_LIBRARY name)
set(SWIG_SOURCE_FILE_EXTENSIONS ".i")
endif()
- if (CMAKE_GENERATOR MATCHES "Make|Ninja|Xcode")
- # For Makefiles and Ninja generators, use SWIG generated dependencies
+ if (CMAKE_GENERATOR MATCHES "Make|Ninja|Xcode|Visual Studio (1[1-9]|[2-9][0-9])")
+ # For Makefiles, Ninja, Xcode and Visual Studio generators,
+ # use SWIG generated dependencies if requested
if (NOT DEFINED SWIG_USE_SWIG_DEPENDENCIES)
set (SWIG_USE_SWIG_DEPENDENCIES OFF)
endif()
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 23a44e7..fc80b1f 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 21)
-set(CMake_VERSION_PATCH 20210702)
+set(CMake_VERSION_PATCH 20210713)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index c29c124..1157d10 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -2165,7 +2165,7 @@ bool cmCTestTestHandler::SetTestsProperties(
// Ensure we have complete triples otherwise the data is corrupt.
if (triples.size() % 3 == 0) {
- cmState state;
+ cmState state(cmState::Unknown);
rt.Backtrace = cmListFileBacktrace(state.CreateBaseSnapshot());
// the first entry represents the top of the trace so we need to
diff --git a/Source/cmBinUtilsLinuxELFLinker.cxx b/Source/cmBinUtilsLinuxELFLinker.cxx
index 9ce403d..a69c00d 100644
--- a/Source/cmBinUtilsLinuxELFLinker.cxx
+++ b/Source/cmBinUtilsLinuxELFLinker.cxx
@@ -11,6 +11,7 @@
#include <cmsys/RegularExpression.hxx>
#include "cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h"
+#include "cmELF.h"
#include "cmLDConfigLDConfigTool.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -86,6 +87,22 @@ bool cmBinUtilsLinuxELFLinker::ScanDependencies(
std::string const& file, cmStateEnums::TargetType /* unused */)
{
std::vector<std::string> parentRpaths;
+
+ cmELF elf(file.c_str());
+ if (!elf) {
+ return false;
+ }
+ if (elf.GetMachine() != 0) {
+ if (this->Machine != 0) {
+ if (elf.GetMachine() != this->Machine) {
+ this->SetError("All files must have the same architecture.");
+ return false;
+ }
+ } else {
+ this->Machine = elf.GetMachine();
+ }
+ }
+
return this->ScanDependencies(file, parentRpaths);
}
@@ -150,13 +167,25 @@ bool cmBinUtilsLinuxELFLinker::ScanDependencies(
return true;
}
+namespace {
+bool FileHasArchitecture(const char* filename, std::uint16_t machine)
+{
+ cmELF elf(filename);
+ if (!elf) {
+ return false;
+ }
+ return machine == 0 || machine == elf.GetMachine();
+}
+}
+
bool cmBinUtilsLinuxELFLinker::ResolveDependency(
std::string const& name, std::vector<std::string> const& searchPaths,
std::string& path, bool& resolved)
{
for (auto const& searchPath : searchPaths) {
path = cmStrCat(searchPath, '/', name);
- if (cmSystemTools::PathExists(path)) {
+ if (cmSystemTools::PathExists(path) &&
+ FileHasArchitecture(path.c_str(), this->Machine)) {
resolved = true;
return true;
}
@@ -164,7 +193,8 @@ bool cmBinUtilsLinuxELFLinker::ResolveDependency(
for (auto const& searchPath : this->Archive->GetSearchDirectories()) {
path = cmStrCat(searchPath, '/', name);
- if (cmSystemTools::PathExists(path)) {
+ if (cmSystemTools::PathExists(path) &&
+ FileHasArchitecture(path.c_str(), this->Machine)) {
std::ostringstream warning;
warning << "Dependency " << name << " found in search directory:\n "
<< searchPath
diff --git a/Source/cmBinUtilsLinuxELFLinker.h b/Source/cmBinUtilsLinuxELFLinker.h
index 4e7e36d..395ed56 100644
--- a/Source/cmBinUtilsLinuxELFLinker.h
+++ b/Source/cmBinUtilsLinuxELFLinker.h
@@ -3,6 +3,9 @@
#pragma once
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include <cstdint>
#include <memory>
#include <string>
#include <vector>
@@ -29,6 +32,7 @@ private:
std::unique_ptr<cmLDConfigTool> LDConfigTool;
bool HaveLDConfigPaths = false;
std::vector<std::string> LDConfigPaths;
+ std::uint16_t Machine = 0;
bool ScanDependencies(std::string const& file,
std::vector<std::string> const& parentRpaths);
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index a156a41..e1a4f8b 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -40,6 +40,7 @@ protected:
cmLocalCommonGenerator* LocalCommonGenerator;
cmGlobalCommonGenerator* GlobalCommonGenerator;
std::vector<std::string> ConfigNames;
+ bool UseLWYU = false;
void AppendFortranFormatFlags(std::string& flags,
cmSourceFile const& source);
diff --git a/Source/cmDependsCompiler.cxx b/Source/cmDependsCompiler.cxx
index 800725f..bf599ff 100644
--- a/Source/cmDependsCompiler.cxx
+++ b/Source/cmDependsCompiler.cxx
@@ -131,7 +131,9 @@ bool cmDependsCompiler::CheckDependencies(
depends.emplace_back(std::move(line));
}
} else if (format == "gcc"_s) {
- auto deps = cmReadGccDepfile(depFile.c_str());
+ auto deps = cmReadGccDepfile(
+ depFile.c_str(), this->LocalGenerator->GetCurrentBinaryDirectory(),
+ GccDepfilePrependPaths::Deps);
if (!deps) {
continue;
}
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index cde7cdf..1678ce8 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -137,6 +137,9 @@ public:
// Return the recorded ELF type.
cmELF::FileType GetFileType() const { return this->ELFType; }
+ // Return the recorded machine.
+ std::uint16_t GetMachine() const { return this->Machine; }
+
protected:
// Data common to all ELF class implementations.
@@ -152,6 +155,9 @@ protected:
// The ELF file type.
cmELF::FileType ELFType;
+ // The ELF architecture.
+ std::uint16_t Machine;
+
// Whether we need to byte-swap structures read from the stream.
bool NeedSwap;
@@ -439,6 +445,8 @@ cmELFInternalImpl<Types>::cmELFInternalImpl(cmELF* external,
}
}
+ this->Machine = this->ELFHeader.e_machine;
+
// Load the section headers.
this->SectionHeaders.resize(this->ELFHeader.e_shnum);
for (ELF_Half i = 0; i < this->ELFHeader.e_shnum; ++i) {
@@ -709,6 +717,14 @@ cmELF::FileType cmELF::GetFileType() const
return FileTypeInvalid;
}
+std::uint16_t cmELF::GetMachine() const
+{
+ if (this->Valid()) {
+ return this->Internal->GetMachine();
+ }
+ return 0;
+}
+
unsigned int cmELF::GetNumberOfSections() const
{
if (this->Valid()) {
diff --git a/Source/cmELF.h b/Source/cmELF.h
index 5807c16..ce8bd7f 100644
--- a/Source/cmELF.h
+++ b/Source/cmELF.h
@@ -4,6 +4,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <cstdint>
#include <iosfwd>
#include <memory>
#include <string>
@@ -68,6 +69,9 @@ public:
/** Get the type of the file opened. */
FileType GetFileType() const;
+ /** Get the machine of the file opened. */
+ std::uint16_t GetMachine() const;
+
/** Get the number of ELF sections present. */
unsigned int GetNumberOfSections() const;
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index fba736e..a0de74c 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -478,17 +478,35 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
this->VersionMaxPatch, this->VersionMaxTweak);
}
+ const std::string makePackageRequiredVar =
+ cmStrCat("CMAKE_REQUIRE_FIND_PACKAGE_", this->Name);
+ const bool makePackageRequiredSet =
+ this->Makefile->IsOn(makePackageRequiredVar);
+ if (makePackageRequiredSet) {
+ if (this->Required) {
+ this->Makefile->IssueMessage(
+ MessageType::WARNING,
+ cmStrCat("for module ", this->Name,
+ " already called with REQUIRED, thus ",
+ makePackageRequiredVar, " has no effect."));
+ } else {
+ this->Required = true;
+ }
+ }
+
std::string disableFindPackageVar =
cmStrCat("CMAKE_DISABLE_FIND_PACKAGE_", this->Name);
if (this->Makefile->IsOn(disableFindPackageVar)) {
if (this->Required) {
this->SetError(
- cmStrCat("for module ", this->Name, " called with REQUIRED, but ",
- disableFindPackageVar,
+ cmStrCat("for module ", this->Name,
+ (makePackageRequiredSet
+ ? " was made REQUIRED with " + makePackageRequiredVar
+ : " called with REQUIRED, "),
+ " but ", disableFindPackageVar,
" is enabled. A REQUIRED package cannot be disabled."));
return false;
}
-
return true;
}
diff --git a/Source/cmGccDepfileReader.cxx b/Source/cmGccDepfileReader.cxx
index 6436baa..d30dbc3 100644
--- a/Source/cmGccDepfileReader.cxx
+++ b/Source/cmGccDepfileReader.cxx
@@ -12,8 +12,9 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-cm::optional<cmGccDepfileContent> cmReadGccDepfile(const char* filePath,
- const std::string& prefix)
+cm::optional<cmGccDepfileContent> cmReadGccDepfile(
+ const char* filePath, const std::string& prefix,
+ GccDepfilePrependPaths prependPaths)
{
cmGccDepfileLexerHelper helper;
if (!helper.readFile(filePath)) {
@@ -23,7 +24,8 @@ cm::optional<cmGccDepfileContent> cmReadGccDepfile(const char* filePath,
for (auto& dep : *deps) {
for (auto& rule : dep.rules) {
- if (!prefix.empty() && !cmSystemTools::FileIsFullPath(rule)) {
+ if (prependPaths == GccDepfilePrependPaths::All && !prefix.empty() &&
+ !cmSystemTools::FileIsFullPath(rule)) {
rule = cmStrCat(prefix, '/', rule);
}
if (cmSystemTools::FileIsFullPath(rule)) {
diff --git a/Source/cmGccDepfileReader.h b/Source/cmGccDepfileReader.h
index c8a3748..2433492 100644
--- a/Source/cmGccDepfileReader.h
+++ b/Source/cmGccDepfileReader.h
@@ -8,8 +8,15 @@
#include "cmGccDepfileReaderTypes.h"
+enum class GccDepfilePrependPaths
+{
+ All,
+ Deps,
+};
+
/*
- * Read dependencies file and append prefix to all relative paths
+ * Read dependencies file and prepend prefix to all relative paths
*/
cm::optional<cmGccDepfileContent> cmReadGccDepfile(
- const char* filePath, const std::string& prefix = {});
+ const char* filePath, const std::string& prefix = {},
+ GccDepfilePrependPaths prependPaths = GccDepfilePrependPaths::All);
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index f035bd0..300c13b 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -4461,6 +4461,13 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
// Last step: replace "LINKER:" prefixed elements by
// actual linker wrapper
+ return this->ResolveLinkerWrapper(result, language);
+}
+
+std::vector<BT<std::string>>& cmGeneratorTarget::ResolveLinkerWrapper(
+ std::vector<BT<std::string>>& result, const std::string& language) const
+{
+ // replace "LINKER:" prefixed elements by actual linker wrapper
const std::string wrapper(this->Makefile->GetSafeDefinition(
"CMAKE_" + language +
(this->IsDeviceLink() ? "_DEVICE_LINKER_WRAPPER_FLAG"
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index e1909a4..09f4167 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -498,6 +498,9 @@ public:
std::vector<BT<std::string>> GetLinkOptions(
std::string const& config, std::string const& language) const;
+ std::vector<BT<std::string>>& ResolveLinkerWrapper(
+ std::vector<BT<std::string>>& result, const std::string& language) const;
+
void GetStaticLibraryLinkOptions(std::vector<std::string>& result,
const std::string& config,
const std::string& language) const;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index cad7855..15a7304 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1263,10 +1263,8 @@ void cmGlobalGenerator::Configure()
this->CreateDefaultGlobalTargets(globalTargets);
for (const auto& mf : this->Makefiles) {
- auto& targets = mf->GetTargets();
for (GlobalTargetInfo const& globalTarget : globalTargets) {
- targets.emplace(globalTarget.Name,
- this->CreateGlobalTarget(globalTarget, mf.get()));
+ this->CreateGlobalTarget(globalTarget, mf.get());
}
}
}
@@ -1783,9 +1781,8 @@ void cmGlobalGenerator::CreateGeneratorTargets(
std::map<cmTarget*, cmGeneratorTarget*> const& importedMap)
{
if (targetTypes == AllTargets) {
- for (auto& target : mf->GetTargets()) {
- cmTarget* t = &target.second;
- lg->AddGeneratorTarget(cm::make_unique<cmGeneratorTarget>(t, lg));
+ for (cmTarget* target : mf->GetOrderedTargets()) {
+ lg->AddGeneratorTarget(cm::make_unique<cmGeneratorTarget>(target, lg));
}
}
@@ -2824,12 +2821,19 @@ bool cmGlobalGenerator::UseFolderProperty() const
return false;
}
-cmTarget cmGlobalGenerator::CreateGlobalTarget(GlobalTargetInfo const& gti,
- cmMakefile* mf)
+void cmGlobalGenerator::CreateGlobalTarget(GlobalTargetInfo const& gti,
+ cmMakefile* mf)
{
// Package
- cmTarget target(gti.Name, cmStateEnums::GLOBAL_TARGET,
- cmTarget::VisibilityNormal, mf, gti.PerConfig);
+ auto tb =
+ mf->CreateNewTarget(gti.Name, cmStateEnums::GLOBAL_TARGET, gti.PerConfig);
+
+ // Do nothing if gti.Name is already used
+ if (!tb.second) {
+ return;
+ }
+
+ cmTarget& target = tb.first;
target.SetProperty("EXCLUDE_FROM_ALL", "TRUE");
std::vector<std::string> no_outputs;
@@ -2853,8 +2857,6 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(GlobalTargetInfo const& gti,
if (this->UseFolderProperty()) {
target.SetProperty("FOLDER", this->GetPredefinedTargetsFolder());
}
-
- return target;
}
std::string cmGlobalGenerator::GenerateRuleFile(
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 147146e..f0b59bf 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -596,7 +596,7 @@ protected:
void AddGlobalTarget_RebuildCache(
std::vector<GlobalTargetInfo>& targets) const;
void AddGlobalTarget_Install(std::vector<GlobalTargetInfo>& targets);
- cmTarget CreateGlobalTarget(GlobalTargetInfo const& gti, cmMakefile* mf);
+ void CreateGlobalTarget(GlobalTargetInfo const& gti, cmMakefile* mf);
std::string FindMakeProgramFile;
std::string ConfiguredFilesPath;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index f513942..3994816 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -4610,7 +4610,11 @@ void cmGlobalXCodeGenerator::OutputXCodeWorkspaceSettings(
switch (this->XcodeBuildSystem) {
case BuildSystem::One:
xout.Element("string", "Original");
- xout.Element("key", "DisableBuildSystemDeprecationWarning");
+ if (this->XcodeVersion >= 130) {
+ xout.Element("key", "DisableBuildSystemDeprecationDiagnostic");
+ } else {
+ xout.Element("key", "DisableBuildSystemDeprecationWarning");
+ }
xout.Element("true");
break;
case BuildSystem::Twelve:
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 4f7c959..2e444f2 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -548,7 +548,7 @@ void cmListFileBacktrace::PrintTitle(std::ostream& out) const
}
cmListFileContext lfc = this->TopEntry->Context;
cmStateSnapshot bottom = this->GetBottom();
- if (!bottom.GetState()->GetIsInTryCompile()) {
+ if (bottom.GetState()->GetProjectKind() == cmState::ProjectKind::Normal) {
lfc.FilePath = cmSystemTools::RelativeIfUnder(
bottom.GetState()->GetSourceDirectory(), lfc.FilePath);
}
@@ -579,7 +579,7 @@ void cmListFileBacktrace::PrintCallStack(std::ostream& out) const
out << "Call Stack (most recent call first):\n";
}
cmListFileContext lfc = cur->Context;
- if (!bottom.GetState()->GetIsInTryCompile()) {
+ if (bottom.GetState()->GetProjectKind() == cmState::ProjectKind::Normal) {
lfc.FilePath = cmSystemTools::RelativeIfUnder(
bottom.GetState()->GetSourceDirectory(), lfc.FilePath);
}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index a14f085..028952a 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -107,10 +107,9 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile)
{
std::vector<std::string> cpath;
cmSystemTools::GetPath(cpath, "CPATH");
- for (std::string& cp : cpath) {
+ for (std::string const& cp : cpath) {
if (cmSystemTools::FileIsFullPath(cp)) {
- cp = cmSystemTools::CollapseFullPath(cp);
- this->EnvCPATH.emplace(std::move(cp));
+ this->EnvCPATH.emplace_back(cmSystemTools::CollapseFullPath(cp));
}
}
}
@@ -1247,19 +1246,31 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
}
}
+ bool const isCorCxx = (lang == "C" || lang == "CXX");
+
+ // Resolve symlinks in CPATH for comparison with resolved include paths.
+ // We do this here instead of when EnvCPATH is populated in case symlinks
+ // on disk have changed in the meantime.
+ std::set<std::string> resolvedEnvCPATH;
+ if (isCorCxx) {
+ for (std::string const& i : this->EnvCPATH) {
+ resolvedEnvCPATH.emplace(this->GlobalGenerator->GetRealPath(i));
+ }
+ }
+
// Checks if this is not an excluded (implicit) include directory.
- auto notExcluded = [this, &implicitSet, &implicitExclude,
- &lang](std::string const& dir) {
- return (
- // Do not exclude directories that are not in an excluded set.
- ((!cm::contains(implicitSet, this->GlobalGenerator->GetRealPath(dir))) &&
- (!cm::contains(implicitExclude, dir)))
+ auto notExcluded = [this, &implicitSet, &implicitExclude, &resolvedEnvCPATH,
+ isCorCxx](std::string const& dir) -> bool {
+ std::string const& real_dir = this->GlobalGenerator->GetRealPath(dir);
+ return
+ // Do not exclude directories that are not in any excluded set.
+ !(cm::contains(implicitSet, real_dir) ||
+ cm::contains(implicitExclude, dir))
// Do not exclude entries of the CPATH environment variable even though
// they are implicitly searched by the compiler. They are meant to be
// user-specified directories that can be re-ordered or converted to
// -isystem without breaking real compiler builtin headers.
- ||
- ((lang == "C" || lang == "CXX") && cm::contains(this->EnvCPATH, dir)));
+ || (isCorCxx && cm::contains(resolvedEnvCPATH, real_dir));
};
// Get the target-specific include directories.
@@ -3047,6 +3058,30 @@ void cmLocalGenerator::AppendPositionIndependentLinkerFlags(
}
}
+bool cmLocalGenerator::AppendLWYUFlags(std::string& flags,
+ const cmGeneratorTarget* target,
+ const std::string& lang)
+{
+ auto useLWYU = target->GetPropertyAsBool("LINK_WHAT_YOU_USE") &&
+ (target->GetType() == cmStateEnums::TargetType::EXECUTABLE ||
+ target->GetType() == cmStateEnums::TargetType::SHARED_LIBRARY ||
+ target->GetType() == cmStateEnums::TargetType::MODULE_LIBRARY);
+
+ if (useLWYU) {
+ const auto& lwyuFlag = this->GetMakefile()->GetSafeDefinition(
+ cmStrCat("CMAKE_", lang, "_LINK_WHAT_YOU_USE_FLAG"));
+ useLWYU = !lwyuFlag.empty();
+
+ if (useLWYU) {
+ std::vector<BT<std::string>> lwyuOpts;
+ lwyuOpts.emplace_back(lwyuFlag);
+ this->AppendFlags(flags, target->ResolveLinkerWrapper(lwyuOpts, lang));
+ }
+ }
+
+ return useLWYU;
+}
+
void cmLocalGenerator::AppendCompileOptions(std::string& options,
std::string const& options_list,
const char* regex) const
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 993280a..1e09b23 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -171,6 +171,8 @@ public:
cmGeneratorTarget* target,
const std::string& config,
const std::string& lang);
+ bool AppendLWYUFlags(std::string& flags, const cmGeneratorTarget* target,
+ const std::string& lang);
enum class IncludePathStyle
{
@@ -587,7 +589,7 @@ protected:
std::string::size_type ObjectPathMax;
std::set<std::string> ObjectMaxPathViolations;
- std::set<std::string> EnvCPATH;
+ std::vector<std::string> EnvCPATH;
using GeneratorTargetMap =
std::unordered_map<std::string, cmGeneratorTarget*>;
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index 002f484..46f9d31 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -171,7 +171,7 @@ std::string cmLocalVisualStudioGenerator::ConstructScript(
// for visual studio IDE add extra stuff to the PATH
// if CMAKE_MSVCIDE_RUN_PATH is set.
- if (this->Makefile->GetDefinition("MSVC_IDE")) {
+ if (this->GetGlobalGenerator()->IsVisualStudio()) {
cmProp extraPath = this->Makefile->GetDefinition("CMAKE_MSVCIDE_RUN_PATH");
if (extraPath) {
script += newline;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index f6ecf8e..6d477a7 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2118,15 +2118,23 @@ cmTarget* cmMakefile::AddExecutable(const std::string& exeName,
cmTarget* cmMakefile::AddNewTarget(cmStateEnums::TargetType type,
const std::string& name)
{
- auto it = this->Targets
- .emplace(name,
- cmTarget(name, type, cmTarget::VisibilityNormal, this,
- cmTarget::PerConfig::Yes))
- .first;
+ return &this->CreateNewTarget(name, type).first;
+}
+
+std::pair<cmTarget&, bool> cmMakefile::CreateNewTarget(
+ const std::string& name, cmStateEnums::TargetType type,
+ cmTarget::PerConfig perConfig)
+{
+ auto ib = this->Targets.emplace(
+ name, cmTarget(name, type, cmTarget::VisibilityNormal, this, perConfig));
+ auto it = ib.first;
+ if (!ib.second) {
+ return std::make_pair(std::ref(it->second), false);
+ }
this->OrderedTargets.push_back(&it->second);
this->GetGlobalGenerator()->IndexTarget(&it->second);
this->GetStateSnapshot().GetDirectory().AddNormalTargetName(name);
- return &it->second;
+ return std::make_pair(std::ref(it->second), true);
}
cmTarget* cmMakefile::AddNewUtilityTarget(const std::string& utilityName,
@@ -3559,8 +3567,8 @@ int cmMakefile::TryCompile(const std::string& srcdir,
// make sure the same generator is used
// use this program as the cmake to be run, it should not
// be run that way but the cmake object requires a vailid path
- cmake cm(cmake::RoleProject, cmState::Project);
- cm.SetIsInTryCompile(true);
+ cmake cm(cmake::RoleProject, cmState::Project,
+ cmState::ProjectKind::TryCompile);
auto gg = cm.CreateGlobalGenerator(this->GetGlobalGenerator()->GetName());
if (!gg) {
this->IssueMessage(MessageType::INTERNAL_ERROR,
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 14c1a0f..5886c86 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -13,6 +13,7 @@
#include <stack>
#include <string>
#include <unordered_map>
+#include <utility>
#include <vector>
#include <cm/optional>
@@ -230,6 +231,10 @@ public:
cmTarget* AddImportedTarget(const std::string& name,
cmStateEnums::TargetType type, bool global);
+ std::pair<cmTarget&, bool> CreateNewTarget(
+ const std::string& name, cmStateEnums::TargetType type,
+ cmTarget::PerConfig perConfig = cmTarget::PerConfig::Yes);
+
cmTarget* AddNewTarget(cmStateEnums::TargetType type,
const std::string& name);
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 3a2744e..306b38f 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -397,9 +397,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
this->LocalGenerator->GetLinkLibsCMP0065(
linkLanguage, *this->GeneratorTarget));
- if (this->GeneratorTarget->GetPropertyAsBool("LINK_WHAT_YOU_USE")) {
- this->LocalGenerator->AppendFlags(linkFlags, " -Wl,--no-as-needed");
- }
+ this->UseLWYU = this->LocalGenerator->AppendLWYUFlags(
+ linkFlags, this->GeneratorTarget, linkLanguage);
// Add language feature flags.
this->LocalGenerator->AddLanguageFlagsForLinking(
@@ -577,12 +576,18 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
vars.Launcher = linkerLauncher.c_str();
}
- if (this->GeneratorTarget->GetPropertyAsBool("LINK_WHAT_YOU_USE")) {
- std::string cmakeCommand =
- cmStrCat(this->LocalGenerator->ConvertToOutputFormat(
- cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL),
- " -E __run_co_compile --lwyu=", targetOutPathReal);
- real_link_commands.push_back(std::move(cmakeCommand));
+ if (this->UseLWYU) {
+ cmProp lwyuCheck =
+ this->Makefile->GetDefinition("CMAKE_LINK_WHAT_YOU_USE_CHECK");
+ if (lwyuCheck) {
+ std::string cmakeCommand = cmStrCat(
+ this->LocalGenerator->ConvertToOutputFormat(
+ cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL),
+ " -E __run_co_compile --lwyu=");
+ cmakeCommand += this->LocalGenerator->EscapeForShell(*lwyuCheck);
+ cmakeCommand += cmStrCat(" --source=", targetOutPathReal);
+ real_link_commands.push_back(std::move(cmakeCommand));
+ }
}
std::string launcher;
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index d0e3837..64992f2 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -178,9 +178,9 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
this->AddModuleDefinitionFlag(linkLineComputer.get(), extraFlags,
this->GetConfigName());
- if (this->GeneratorTarget->GetPropertyAsBool("LINK_WHAT_YOU_USE")) {
- this->LocalGenerator->AppendFlags(extraFlags, " -Wl,--no-as-needed");
- }
+ this->UseLWYU = this->LocalGenerator->AppendLWYUFlags(
+ extraFlags, this->GeneratorTarget, linkLanguage);
+
this->WriteLibraryRules(linkRuleVar, extraFlags, relink);
}
@@ -871,13 +871,18 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Get the set of commands.
std::string linkRule = this->GetLinkRule(linkRuleVar);
cmExpandList(linkRule, real_link_commands);
- if (this->GeneratorTarget->GetPropertyAsBool("LINK_WHAT_YOU_USE") &&
- (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY)) {
- std::string cmakeCommand = cmStrCat(
- this->LocalGenerator->ConvertToOutputFormat(
- cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL),
- " -E __run_co_compile --lwyu=", targetOutPathReal);
- real_link_commands.push_back(std::move(cmakeCommand));
+ if (this->UseLWYU) {
+ cmProp lwyuCheck =
+ this->Makefile->GetDefinition("CMAKE_LINK_WHAT_YOU_USE_CHECK");
+ if (lwyuCheck) {
+ std::string cmakeCommand = cmStrCat(
+ this->LocalGenerator->ConvertToOutputFormat(
+ cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL),
+ " -E __run_co_compile --lwyu=");
+ cmakeCommand += this->LocalGenerator->EscapeForShell(*lwyuCheck);
+ cmakeCommand += cmStrCat(" --source=", targetOutPathReal);
+ real_link_commands.push_back(std::move(cmakeCommand));
+ }
}
// Expand placeholders.
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 5a4c652..93a54c2 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -581,17 +581,23 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd(
}
}
cmExpandList(linkCmdStr, linkCmds);
- if (this->GetGeneratorTarget()->GetPropertyAsBool("LINK_WHAT_YOU_USE")) {
- std::string cmakeCommand = cmStrCat(
- this->GetLocalGenerator()->ConvertToOutputFormat(
- cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL),
- " -E __run_co_compile --lwyu=");
- cmGeneratorTarget& gt = *this->GetGeneratorTarget();
- std::string targetOutputReal = this->ConvertToNinjaPath(
- gt.GetFullPath(config, cmStateEnums::RuntimeBinaryArtifact,
- /*realname=*/true));
- cmakeCommand += targetOutputReal;
- linkCmds.push_back(std::move(cmakeCommand));
+ if (this->UseLWYU) {
+ cmProp lwyuCheck = mf->GetDefinition("CMAKE_LINK_WHAT_YOU_USE_CHECK");
+ if (lwyuCheck) {
+ std::string cmakeCommand = cmStrCat(
+ this->GetLocalGenerator()->ConvertToOutputFormat(
+ cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL),
+ " -E __run_co_compile --lwyu=");
+ cmakeCommand +=
+ this->GetLocalGenerator()->EscapeForShell(*lwyuCheck);
+
+ std::string targetOutputReal =
+ this->ConvertToNinjaPath(this->GetGeneratorTarget()->GetFullPath(
+ config, cmStateEnums::RuntimeBinaryArtifact,
+ /*realname=*/true));
+ cmakeCommand += cmStrCat(" --source=", targetOutputReal);
+ linkCmds.push_back(std::move(cmakeCommand));
+ }
}
return linkCmds;
}
@@ -1156,9 +1162,11 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
this->AddModuleDefinitionFlag(linkLineComputer.get(), vars["LINK_FLAGS"],
config);
- if (gt->GetPropertyAsBool("LINK_WHAT_YOU_USE")) {
- vars["LINK_FLAGS"] += " -Wl,--no-as-needed";
- }
+
+ this->UseLWYU = this->GetLocalGenerator()->AppendLWYUFlags(
+ vars["LINK_FLAGS"], this->GetGeneratorTarget(),
+ this->TargetLinkLanguage(config));
+
vars["LINK_FLAGS"] = globalGen->EncodeLiteral(vars["LINK_FLAGS"]);
vars["MANIFESTS"] = this->GetManifests(config);
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index ce6eb31..bdb5bda 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -26,7 +26,9 @@
#include "cmSystemTools.h"
#include "cmake.h"
-cmState::cmState()
+cmState::cmState(Mode mode, ProjectKind projectKind)
+ : StateMode(mode)
+ , StateProjectKind(projectKind)
{
this->CacheManager = cm::make_unique<cmCacheManager>();
this->GlobVerificationManager = cm::make_unique<cmGlobVerificationManager>();
@@ -381,16 +383,6 @@ void cmState::ClearEnabledLanguages()
this->EnabledLanguages.clear();
}
-bool cmState::GetIsInTryCompile() const
-{
- return this->IsInTryCompile;
-}
-
-void cmState::SetIsInTryCompile(bool b)
-{
- this->IsInTryCompile = b;
-}
-
bool cmState::GetIsGeneratorMultiConfig() const
{
return this->IsGeneratorMultiConfig;
@@ -593,8 +585,9 @@ cmProp cmState::GetGlobalProperty(const std::string& prop)
std::vector<std::string> commands = this->GetCommandNames();
this->SetGlobalProperty("COMMANDS", cmJoin(commands, ";").c_str());
} else if (prop == "IN_TRY_COMPILE") {
- this->SetGlobalProperty("IN_TRY_COMPILE",
- this->IsInTryCompile ? "1" : "0");
+ this->SetGlobalProperty(
+ "IN_TRY_COMPILE",
+ this->StateProjectKind == ProjectKind::TryCompile ? "1" : "0");
} else if (prop == "GENERATOR_IS_MULTI_CONFIG") {
this->SetGlobalProperty("GENERATOR_IS_MULTI_CONFIG",
this->IsGeneratorMultiConfig ? "1" : "0");
@@ -771,17 +764,12 @@ unsigned int cmState::GetCacheMinorVersion() const
cmState::Mode cmState::GetMode() const
{
- return this->CurrentMode;
+ return this->StateMode;
}
std::string cmState::GetModeString() const
{
- return ModeToString(this->CurrentMode);
-}
-
-void cmState::SetMode(cmState::Mode mode)
-{
- this->CurrentMode = mode;
+ return ModeToString(this->StateMode);
}
std::string cmState::ModeToString(cmState::Mode mode)
@@ -803,6 +791,11 @@ std::string cmState::ModeToString(cmState::Mode mode)
return "UNKNOWN";
}
+cmState::ProjectKind cmState::GetProjectKind() const
+{
+ return this->StateProjectKind;
+}
+
std::string const& cmState::GetBinaryDirectory() const
{
return this->BinaryDirectory;
diff --git a/Source/cmState.h b/Source/cmState.h
index 9951b9a..8561fc0 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -35,12 +35,6 @@ class cmState
friend class cmStateSnapshot;
public:
- cmState();
- ~cmState();
-
- cmState(const cmState&) = delete;
- cmState& operator=(const cmState&) = delete;
-
enum Mode
{
Unknown,
@@ -51,6 +45,18 @@ public:
CPack,
};
+ enum class ProjectKind
+ {
+ Normal,
+ TryCompile,
+ };
+
+ cmState(Mode mode, ProjectKind projectKind = ProjectKind::Normal);
+ ~cmState();
+
+ cmState(const cmState&) = delete;
+ cmState& operator=(const cmState&) = delete;
+
static const std::string& GetTargetTypeName(
cmStateEnums::TargetType targetType);
@@ -141,9 +147,6 @@ public:
void SetEnabledLanguages(std::vector<std::string> const& langs);
void ClearEnabledLanguages();
- bool GetIsInTryCompile() const;
- void SetIsInTryCompile(bool b);
-
bool GetIsGeneratorMultiConfig() const;
void SetIsGeneratorMultiConfig(bool b);
@@ -207,10 +210,11 @@ public:
Mode GetMode() const;
std::string GetModeString() const;
- void SetMode(Mode mode);
static std::string ModeToString(Mode mode);
+ ProjectKind GetProjectKind() const;
+
private:
friend class cmake;
void AddCacheEntry(const std::string& key, const char* value,
@@ -248,7 +252,6 @@ private:
std::string SourceDirectory;
std::string BinaryDirectory;
- bool IsInTryCompile = false;
bool IsGeneratorMultiConfig = false;
bool WindowsShell = false;
bool WindowsVSIDE = false;
@@ -258,5 +261,6 @@ private:
bool NMake = false;
bool MSYSShell = false;
bool NinjaMulti = false;
- Mode CurrentMode = Unknown;
+ Mode StateMode = Unknown;
+ ProjectKind StateProjectKind = ProjectKind::Normal;
};
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 14f66d9..ab8309d 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -156,17 +156,16 @@ static void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/,
}
#endif
-cmake::cmake(Role role, cmState::Mode mode)
+cmake::cmake(Role role, cmState::Mode mode, cmState::ProjectKind projectKind)
: CMakeWorkingDirectory(cmSystemTools::GetCurrentWorkingDirectory())
, FileTimeCache(cm::make_unique<cmFileTimeCache>())
#ifndef CMAKE_BOOTSTRAP
, VariableWatch(cm::make_unique<cmVariableWatch>())
#endif
- , State(cm::make_unique<cmState>())
+ , State(cm::make_unique<cmState>(mode, projectKind))
, Messenger(cm::make_unique<cmMessenger>())
{
this->TraceFile.close();
- this->State->SetMode(mode);
this->CurrentSnapshot = this->State->CreateBaseSnapshot();
#ifdef __APPLE__
@@ -1687,6 +1686,9 @@ void cmake::PrintPresetList(const cmCMakePresetsFile& file) const
this->GetRegisteredGenerators(generators, false);
auto filter =
[&generators](const cmCMakePresetsFile::ConfigurePreset& preset) -> bool {
+ if (preset.Generator.empty()) {
+ return true;
+ }
auto condition = [&preset](const GeneratorInfo& info) -> bool {
return info.name == preset.Generator;
};
@@ -1840,7 +1842,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
std::vector<std::string> argsSplit = cmExpandedList(var, true);
// erase the property to avoid infinite recursion
this->State->SetGlobalProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_", "");
- if (this->State->GetIsInTryCompile()) {
+ if (this->GetIsInTryCompile()) {
return 0;
}
std::vector<SaveCacheEntry> saved;
@@ -2108,7 +2110,7 @@ int cmake::ActualConfigure()
// reset any system configuration information, except for when we are
// InTryCompile. With TryCompile the system info is taken from the parent's
// info to save time
- if (!this->State->GetIsInTryCompile()) {
+ if (!this->GetIsInTryCompile()) {
this->GlobalGenerator->ClearEnabledLanguages();
this->TruncateOutputLog("CMakeOutput.log");
@@ -2619,19 +2621,14 @@ void cmake::SetProgressCallback(ProgressCallbackType f)
void cmake::UpdateProgress(const std::string& msg, float prog)
{
- if (this->ProgressCallback && !this->State->GetIsInTryCompile()) {
+ if (this->ProgressCallback && !this->GetIsInTryCompile()) {
this->ProgressCallback(msg, prog);
}
}
bool cmake::GetIsInTryCompile() const
{
- return this->State->GetIsInTryCompile();
-}
-
-void cmake::SetIsInTryCompile(bool b)
-{
- this->State->SetIsInTryCompile(b);
+ return this->State->GetProjectKind() == cmState::ProjectKind::TryCompile;
}
void cmake::AppendGlobalGeneratorsDocumentation(
diff --git a/Source/cmake.h b/Source/cmake.h
index 5a2a88f..12cce7e 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -168,7 +168,8 @@ public:
static const int DEFAULT_BUILD_PARALLEL_LEVEL = 0;
/// Default constructor
- cmake(Role role, cmState::Mode mode);
+ cmake(Role role, cmState::Mode mode,
+ cmState::ProjectKind projectKind = cmState::ProjectKind::Normal);
/// Destructor
~cmake();
@@ -356,7 +357,6 @@ public:
//! Is this cmake running as a result of a TRY_COMPILE command
bool GetIsInTryCompile() const;
- void SetIsInTryCompile(bool b);
#ifndef CMAKE_BOOTSTRAP
void SetWarningFromPreset(const std::string& name,
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 1f4c0b8..1e0f497 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -385,18 +385,15 @@ int HandleTidy(const std::string& runCmd, const std::string& sourceFile,
return ret;
}
-int HandleLWYU(const std::string& runCmd, const std::string& /* sourceFile */,
+int HandleLWYU(const std::string& runCmd, const std::string& sourceFile,
const std::vector<std::string>&)
{
// Construct the ldd -r -u (link what you use lwyu) command line
// ldd -u -r lwuy target
- std::vector<std::string> lwyu_cmd;
- lwyu_cmd.emplace_back("ldd");
- lwyu_cmd.emplace_back("-u");
- lwyu_cmd.emplace_back("-r");
- lwyu_cmd.push_back(runCmd);
+ std::vector<std::string> lwyu_cmd = cmExpandedList(runCmd, true);
+ lwyu_cmd.push_back(sourceFile);
- // Run the ldd -u -r command line.
+ // Run the lwyu check command line, currently ldd is expected.
// Capture its stdout and hide its stderr.
// Ignore its return code because the tool always returns non-zero
// if there are any warnings, but we just want to warn.
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 341aba6..388ff20 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1442,6 +1442,7 @@ if(BUILD_TESTING)
GIF
Git
GLEW
+ GLUT
GnuTLS
GSL
GTK2
diff --git a/Tests/FindBLAS/CMakeLists.txt b/Tests/FindBLAS/CMakeLists.txt
index 31c701e..482cee8 100644
--- a/Tests/FindBLAS/CMakeLists.txt
+++ b/Tests/FindBLAS/CMakeLists.txt
@@ -6,6 +6,11 @@ foreach(variant IN LISTS CMake_TEST_FindBLAS)
set(vendor "${variant}")
set(alt_compiler "")
endif()
+ if(vendor STREQUAL "All" AND CMake_TEST_FindBLAS_All)
+ set(EXPECT_All "-DEXPECT_All=${CMake_TEST_FindBLAS_All}")
+ else()
+ set(EXPECT_All "")
+ endif()
add_test(NAME FindBLAS.Test_${variant} COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -13,7 +18,7 @@ foreach(variant IN LISTS CMake_TEST_FindBLAS)
"${CMake_BINARY_DIR}/Tests/FindBLAS/Test_${variant}"
${build_generator_args}
--build-project TestFindBLAS
- --build-options ${build_options} ${alt_compiler} -DBLA_VENDOR=${vendor}
+ --build-options ${build_options} ${alt_compiler} ${EXPECT_All} -DBLA_VENDOR=${vendor}
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
endforeach()
@@ -26,6 +31,11 @@ foreach(variant IN LISTS CMake_TEST_FindBLAS_STATIC)
set(vendor "${variant}")
set(alt_compiler "")
endif()
+ if(vendor STREQUAL "All" AND CMake_TEST_FindBLAS_STATIC_All)
+ set(EXPECT_All "-DEXPECT_All=${CMake_TEST_FindBLAS_STATIC_All}")
+ else()
+ set(EXPECT_All "")
+ endif()
add_test(NAME FindBLAS.Test_${variant}_Static COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -33,7 +43,7 @@ foreach(variant IN LISTS CMake_TEST_FindBLAS_STATIC)
"${CMake_BINARY_DIR}/Tests/FindBLAS/Test_${variant}_Static"
${build_generator_args}
--build-project TestFindBLAS
- --build-options ${build_options} ${alt_compiler} -DBLA_VENDOR=${vendor} -DBLA_STATIC=ON
+ --build-options ${build_options} ${alt_compiler} ${EXPECT_All} -DBLA_VENDOR=${vendor} -DBLA_STATIC=ON
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
endforeach()
diff --git a/Tests/FindBLAS/Test/CMakeLists.txt b/Tests/FindBLAS/Test/CMakeLists.txt
index 98e12d5..7379749 100644
--- a/Tests/FindBLAS/Test/CMakeLists.txt
+++ b/Tests/FindBLAS/Test/CMakeLists.txt
@@ -12,7 +12,8 @@ add_executable(test_var main.c)
target_link_libraries(test_var PRIVATE ${BLAS_LIBRARIES})
add_test(NAME test_var COMMAND test_var)
-if(BLA_VENDOR STREQUAL "Intel10_64lp")
+if((BLA_VENDOR STREQUAL "Intel10_64lp") OR
+ (BLA_VENDOR STREQUAL "All" AND EXPECT_All STREQUAL "Intel10_64lp"))
if(NOT BLAS_LIBRARIES MATCHES "^(-Wl,--start-group;)?[^;]*mkl_intel_lp64")
message(FATAL_ERROR "BLAS_LIBRARIES does not start in mkl_intel_lp64:\n ${BLAS_LIBRARIES}")
endif()
diff --git a/Tests/FindGLUT/CMakeLists.txt b/Tests/FindGLUT/CMakeLists.txt
new file mode 100644
index 0000000..e75ec40
--- /dev/null
+++ b/Tests/FindGLUT/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_test(NAME FindGLUT.Test COMMAND ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindGLUT/Test"
+ "${CMake_BINARY_DIR}/Tests/FindGLUT/Test"
+ ${build_generator_args}
+ --build-project TestFindGLUT
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V
+ )
diff --git a/Tests/FindGLUT/Test/CMakeLists.txt b/Tests/FindGLUT/Test/CMakeLists.txt
new file mode 100644
index 0000000..0f4e536
--- /dev/null
+++ b/Tests/FindGLUT/Test/CMakeLists.txt
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 3.21)
+project(TestFindGLUT C)
+include(CTest)
+
+find_package(GLUT REQUIRED)
+
+add_executable(testglut_tgt main.c)
+target_link_libraries(testglut_tgt GLUT::GLUT)
+add_test(NAME testglut_tgt COMMAND testglut_tgt)
+
+add_executable(testglut_var main.c)
+target_include_directories(testglut_var PRIVATE ${GLUT_INCLUDE_DIRS})
+target_link_libraries(testglut_var PRIVATE ${GLUT_LIBRARIES})
+add_test(NAME testglut_var COMMAND testglut_var)
+
+set_tests_properties(testglut_tgt testglut_var
+ PROPERTIES WILL_FAIL true)
diff --git a/Tests/FindGLUT/Test/main.c b/Tests/FindGLUT/Test/main.c
new file mode 100644
index 0000000..1c8569c
--- /dev/null
+++ b/Tests/FindGLUT/Test/main.c
@@ -0,0 +1,11 @@
+#include <GL/glut.h>
+#include <stdio.h>
+
+int main()
+{
+ /* The following should call exit(1) and print
+ freeglut ERROR: Function <glutCreateWindow> called
+ without first calling 'glutInit'.
+ to stderr */
+ glutCreateWindow("gluttest");
+}
diff --git a/Tests/FindLAPACK/CMakeLists.txt b/Tests/FindLAPACK/CMakeLists.txt
index 26cfa87..535c7b6 100644
--- a/Tests/FindLAPACK/CMakeLists.txt
+++ b/Tests/FindLAPACK/CMakeLists.txt
@@ -6,6 +6,11 @@ foreach(variant IN LISTS CMake_TEST_FindLAPACK)
set(vendor "${variant}")
set(alt_compiler "")
endif()
+ if(vendor STREQUAL "All" AND CMake_TEST_FindLAPACK_All)
+ set(EXPECT_All "-DEXPECT_All=${CMake_TEST_FindLAPACK_All}")
+ else()
+ set(EXPECT_All "")
+ endif()
add_test(NAME FindLAPACK.Test_${variant} COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -13,7 +18,7 @@ foreach(variant IN LISTS CMake_TEST_FindLAPACK)
"${CMake_BINARY_DIR}/Tests/FindLAPACK/Test_${variant}"
${build_generator_args}
--build-project TestFindLAPACK
- --build-options ${build_options} ${alt_compiler} -DBLA_VENDOR=${vendor}
+ --build-options ${build_options} ${alt_compiler} ${EXPECT_All} -DBLA_VENDOR=${vendor}
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
endforeach()
@@ -26,6 +31,11 @@ foreach(variant IN LISTS CMake_TEST_FindLAPACK_STATIC)
set(vendor "${variant}")
set(alt_compiler "")
endif()
+ if(vendor STREQUAL "All" AND CMake_TEST_FindLAPACK_STATIC_All)
+ set(EXPECT_All "-DEXPECT_All=${CMake_TEST_FindLAPACK_STATIC_All}")
+ else()
+ set(EXPECT_All "")
+ endif()
add_test(NAME FindLAPACK.Test_${variant}_Static COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -33,7 +43,7 @@ foreach(variant IN LISTS CMake_TEST_FindLAPACK_STATIC)
"${CMake_BINARY_DIR}/Tests/FindLAPACK/Test_${variant}_Static"
${build_generator_args}
--build-project TestFindLAPACK
- --build-options ${build_options} ${alt_compiler} -DBLA_VENDOR=${vendor} -DBLA_STATIC=ON
+ --build-options ${build_options} ${alt_compiler} ${EXPECT_All} -DBLA_VENDOR=${vendor} -DBLA_STATIC=ON
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
endforeach()
diff --git a/Tests/FindLAPACK/Test/CMakeLists.txt b/Tests/FindLAPACK/Test/CMakeLists.txt
index bb33482..23a43ac 100644
--- a/Tests/FindLAPACK/Test/CMakeLists.txt
+++ b/Tests/FindLAPACK/Test/CMakeLists.txt
@@ -12,7 +12,8 @@ add_executable(test_var main.c)
target_link_libraries(test_var PRIVATE ${LAPACK_LIBRARIES})
add_test(NAME test_var COMMAND test_var)
-if(BLA_VENDOR STREQUAL "Intel10_64lp")
+if((BLA_VENDOR STREQUAL "Intel10_64lp") OR
+ (BLA_VENDOR STREQUAL "All" AND EXPECT_All STREQUAL "Intel10_64lp"))
if(NOT LAPACK_LIBRARIES MATCHES "^(-Wl,--start-group;)?[^;]*mkl_intel_lp64")
message(FATAL_ERROR "LAPACK_LIBRARIES does not start in mkl_intel_lp64:\n ${LAPACK_LIBRARIES}")
endif()
diff --git a/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CMakeLists.txt b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CMakeLists.txt
new file mode 100644
index 0000000..bbc08e6
--- /dev/null
+++ b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.21)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CheckEnvironmentVar-build-stdout.txt b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CheckEnvironmentVar-build-stdout.txt
new file mode 100644
index 0000000..f0f2efc
--- /dev/null
+++ b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CheckEnvironmentVar-build-stdout.txt
@@ -0,0 +1 @@
+This message is printed by echo_message.bat
diff --git a/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CheckEnvironmentVar.cmake b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CheckEnvironmentVar.cmake
new file mode 100644
index 0000000..63d6068
--- /dev/null
+++ b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CheckEnvironmentVar.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_MSVCIDE_RUN_PATH "${CMAKE_SOURCE_DIR}")
+add_custom_target(main COMMAND echo_message)
diff --git a/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/RunCMakeTest.cmake b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/RunCMakeTest.cmake
new file mode 100644
index 0000000..a424ff2
--- /dev/null
+++ b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/RunCMakeTest.cmake
@@ -0,0 +1,8 @@
+include(RunCMake)
+
+set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CheckEnvironmentVar-build)
+run_cmake(CheckEnvironmentVar)
+set(RunCMake_TEST_NO_CLEAN 1)
+run_cmake_command(CheckEnvironmentVar-build ${CMAKE_COMMAND} --build . --config Debug --target main)
+unset(RunCMake_TEST_BINARY_DIR)
+unset(RunCMake_TEST_NO_CLEAN)
diff --git a/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/echo_message.bat b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/echo_message.bat
new file mode 100755
index 0000000..9037d02
--- /dev/null
+++ b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/echo_message.bat
@@ -0,0 +1 @@
+echo This message is printed by echo_message.bat
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 5e0fefd..ef797f7 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -442,6 +442,17 @@ function(add_RunCMake_test_try_compile)
set(CMAKE_C_STANDARD_DEFAULT 11)
endif()
endif()
+ if(CMAKE_VERSION VERSION_LESS 3.20.6 AND "x${CMAKE_C_COMPILER_ID}" STREQUAL "xIntelLLVM" AND "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
+ # Older CMake versions accidentally set the default standards to empty when
+ # IntelLLVM targets the MSVC ABI, thus not activating standard selection.
+ # Approximate the logic from IntelLLVM-{C,CXX}.cmake.
+ if(DEFINED CMAKE_C_STANDARD_DEFAULT AND "${CMAKE_C_STANDARD_DEFAULT}" STREQUAL "")
+ set(CMAKE_C_STANDARD_DEFAULT 17)
+ endif()
+ if(DEFINED CMAKE_CXX_STANDARD_DEFAULT AND "${CMAKE_CXX_STANDARD_DEFAULT}" STREQUAL "")
+ set(CMAKE_CXX_STANDARD_DEFAULT 14)
+ endif()
+ endif()
foreach(var
CMAKE_SYSTEM_NAME
CMAKE_C_COMPILER_ID
@@ -545,6 +556,7 @@ if(CMake_TEST_FindGTK2)
endif()
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
+ add_RunCMake_test(CMAKE_MSVCIDE_RUN_PATH)
add_RunCMake_test(include_external_msproject -DVS_PLATFORM_NAME=${CMAKE_VS_PLATFORM_NAME})
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio (9|10)" AND NOT CMAKE_VS_DEVENV_COMMAND)
set(NO_USE_FOLDERS 1)
diff --git a/Tests/RunCMake/CMakePresets/ListPresets-stdout.txt b/Tests/RunCMake/CMakePresets/ListPresets-stdout.txt
index 60d6adb..97eedae 100644
--- a/Tests/RunCMake/CMakePresets/ListPresets-stdout.txt
+++ b/Tests/RunCMake/CMakePresets/ListPresets-stdout.txt
@@ -1,6 +1,7 @@
^Not searching for unused variables given on the command line\.
Available configure presets:
- "zzzzzz" - Sleepy
- "aaaaaaaa" - Screaming
- "mmmmmm"$
+ "zzzzzz" - Sleepy
+ "aaaaaaaa" - Screaming
+ "mmmmmm"
+ "no-generator"$
diff --git a/Tests/RunCMake/CMakePresets/ListPresets.json.in b/Tests/RunCMake/CMakePresets/ListPresets.json.in
index 2ef3797..160098c 100644
--- a/Tests/RunCMake/CMakePresets/ListPresets.json.in
+++ b/Tests/RunCMake/CMakePresets/ListPresets.json.in
@@ -1,5 +1,5 @@
{
- "version": 1,
+ "version": 3,
"configurePresets": [
{
"name": "zzzzzz",
@@ -19,6 +19,9 @@
"binaryDir": "${sourceDir}/build/mmmmmm"
},
{
+ "name": "no-generator"
+ },
+ {
"name": "invalid-generator",
"generator": "Invalid Generator",
"binaryDir": "${sourceDir}/build/invalid"
diff --git a/Tests/RunCMake/CMakePresets/ListPresetsHidden-stdout.txt b/Tests/RunCMake/CMakePresets/ListPresetsHidden-stdout.txt
index 60d6adb..97eedae 100644
--- a/Tests/RunCMake/CMakePresets/ListPresetsHidden-stdout.txt
+++ b/Tests/RunCMake/CMakePresets/ListPresetsHidden-stdout.txt
@@ -1,6 +1,7 @@
^Not searching for unused variables given on the command line\.
Available configure presets:
- "zzzzzz" - Sleepy
- "aaaaaaaa" - Screaming
- "mmmmmm"$
+ "zzzzzz" - Sleepy
+ "aaaaaaaa" - Screaming
+ "mmmmmm"
+ "no-generator"$
diff --git a/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-stdout.txt b/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-stdout.txt
index 60d6adb..97eedae 100644
--- a/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-stdout.txt
+++ b/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-stdout.txt
@@ -1,6 +1,7 @@
^Not searching for unused variables given on the command line\.
Available configure presets:
- "zzzzzz" - Sleepy
- "aaaaaaaa" - Screaming
- "mmmmmm"$
+ "zzzzzz" - Sleepy
+ "aaaaaaaa" - Screaming
+ "mmmmmm"
+ "no-generator"$
diff --git a/Tests/RunCMake/CMakePresets/ListPresetsWorkingDir-stdout.txt b/Tests/RunCMake/CMakePresets/ListPresetsWorkingDir-stdout.txt
index 60d6adb..97eedae 100644
--- a/Tests/RunCMake/CMakePresets/ListPresetsWorkingDir-stdout.txt
+++ b/Tests/RunCMake/CMakePresets/ListPresetsWorkingDir-stdout.txt
@@ -1,6 +1,7 @@
^Not searching for unused variables given on the command line\.
Available configure presets:
- "zzzzzz" - Sleepy
- "aaaaaaaa" - Screaming
- "mmmmmm"$
+ "zzzzzz" - Sleepy
+ "aaaaaaaa" - Screaming
+ "mmmmmm"
+ "no-generator"$
diff --git a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt
index 6c87ca0..404076b 100644
--- a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt
+++ b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt
@@ -1 +1,2 @@
-^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM\.[^/]*/CPack/[^-]*(-package-target)?-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$
+^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM\.[^/]*/CPack/[^-]*(-package-target)?-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(
+|$))*$
diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-discovery-POST_BUILD-timeout-test-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-discovery-POST_BUILD-timeout-test-stdout.txt
index d9de3f8..904ed11 100644
--- a/Tests/RunCMake/GoogleTest/GoogleTest-discovery-POST_BUILD-timeout-test-stdout.txt
+++ b/Tests/RunCMake/GoogleTest/GoogleTest-discovery-POST_BUILD-timeout-test-stdout.txt
@@ -8,11 +8,13 @@ Debug/discovery_timeout_test_NOT_BUILT
Debug/discovery_timeout_test_NOT_BUILT(\.exe)?
Debug/discovery_timeout_test_NOT_BUILT
Debug/discovery_timeout_test_NOT_BUILT(\.exe)?
-[^\n]+discovery_timeout_test_NOT_BUILT +\.+\*\*\*Not Run +[0-9.]+ sec
+[^
+]+discovery_timeout_test_NOT_BUILT +\.+\*\*\*Not Run +[0-9.]+ sec
+
0% tests passed, 1 tests failed out of 1
+
Total Test time \(real\) = +[0-9.]+ sec
+
The following tests FAILED:
-[^\n]+discovery_timeout_test_NOT_BUILT \(Not Run\)
+[^
+]+discovery_timeout_test_NOT_BUILT \(Not Run\)
diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout1-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout1-stdout.txt
index 0dda49d..5febfbf 100644
--- a/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout1-stdout.txt
+++ b/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout1-stdout.txt
@@ -1,10 +1,12 @@
Test project .*GoogleTest-build
[ \t]*Start [0-9]+: property_timeout.case_no_discovery
-[^\n]+property_timeout.case_no_discovery +\.+\*\*\*Timeout +[0-9.]+ sec
+[^
+]+property_timeout.case_no_discovery +\.+\*\*\*Timeout +[0-9.]+ sec
+
0% tests passed, 1 tests failed out of 1
+
Total Test time \(real\) = +[0-9.]+ sec
+
The following tests FAILED:
-[^\n]*property_timeout.case_no_discovery \(Timeout\)
+[^
+]*property_timeout.case_no_discovery \(Timeout\)
diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout2-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout2-stdout.txt
index 72cea55..c9c7198 100644
--- a/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout2-stdout.txt
+++ b/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout2-stdout.txt
@@ -1,10 +1,12 @@
Test project .*GoogleTest-build
[ \t]*Start [0-9]+: property_timeout.case_with_discovery
-[^\n]+property_timeout.case_with_discovery +\.+\*\*\*Timeout +[0-9.]+ sec
+[^
+]+property_timeout.case_with_discovery +\.+\*\*\*Timeout +[0-9.]+ sec
+
0% tests passed, 1 tests failed out of 1
+
Total Test time \(real\) = +[0-9.]+ sec
+
The following tests FAILED:
-[^\n]*property_timeout.case_with_discovery \(Timeout\)
+[^
+]*property_timeout.case_with_discovery \(Timeout\)
diff --git a/Tests/RunCMake/VS10Project/VsDpiAwareBadParam-stderr.txt b/Tests/RunCMake/VS10Project/VsDpiAwareBadParam-stderr.txt
index 95fc5ca..39415af 100644
--- a/Tests/RunCMake/VS10Project/VsDpiAwareBadParam-stderr.txt
+++ b/Tests/RunCMake/VS10Project/VsDpiAwareBadParam-stderr.txt
@@ -1,3 +1,3 @@
-CMake Error: Bad parameter for VS_DPI_AWARE: Bar
CMake Error: Bad parameter for VS_DPI_AWARE: Foo
+CMake Error: Bad parameter for VS_DPI_AWARE: Bar
CMake Generate step failed. Build files cannot be regenerated correctly.
diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-component-stdout.txt
index 7d76ed9..169f0cc 100644
--- a/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-component-stdout.txt
+++ b/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-component-stdout.txt
@@ -1,4 +1,5 @@
-^-- Install configuration: "[^\n]*"
+^-- Install configuration: "[^
+]*"
-- Install component: "Unspecified"
-- sub
-- top$
diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-stdout.txt
index 35b0bb5..426114b 100644
--- a/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-stdout.txt
+++ b/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-stdout.txt
@@ -1,3 +1,4 @@
-^-- Install configuration: "[^\n]*"
+^-- Install configuration: "[^
+]*"
-- sub
-- top$
diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-component-stdout.txt
index 4b39789..b26500e 100644
--- a/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-component-stdout.txt
+++ b/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-component-stdout.txt
@@ -1,4 +1,5 @@
-^-- Install configuration: "[^\n]*"
+^-- Install configuration: "[^
+]*"
-- Install component: "Unspecified"
-- top
-- sub$
diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-stdout.txt
index 8f3a5f7..fcd556c 100644
--- a/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-stdout.txt
+++ b/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-stdout.txt
@@ -1,3 +1,4 @@
-^-- Install configuration: "[^\n]*"
+^-- Install configuration: "[^
+]*"
-- top
-- sub$
diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-component-stdout.txt
index 4b39789..b26500e 100644
--- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-component-stdout.txt
+++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-component-stdout.txt
@@ -1,4 +1,5 @@
-^-- Install configuration: "[^\n]*"
+^-- Install configuration: "[^
+]*"
-- Install component: "Unspecified"
-- top
-- sub$
diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-stdout.txt
index 8f3a5f7..fcd556c 100644
--- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-stdout.txt
+++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-stdout.txt
@@ -1,3 +1,4 @@
-^-- Install configuration: "[^\n]*"
+^-- Install configuration: "[^
+]*"
-- top
-- sub$
diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-component-stdout.txt
index 4b39789..b26500e 100644
--- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-component-stdout.txt
+++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-component-stdout.txt
@@ -1,4 +1,5 @@
-^-- Install configuration: "[^\n]*"
+^-- Install configuration: "[^
+]*"
-- Install component: "Unspecified"
-- top
-- sub$
diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-stdout.txt
index 8f3a5f7..fcd556c 100644
--- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-stdout.txt
+++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-stdout.txt
@@ -1,3 +1,4 @@
-^-- Install configuration: "[^\n]*"
+^-- Install configuration: "[^
+]*"
-- top
-- sub$
diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-component-stdout.txt
index f7a331d..c6020bd 100644
--- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-component-stdout.txt
+++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-component-stdout.txt
@@ -1,3 +1,4 @@
-^-- Install configuration: "[^\n]*"
+^-- Install configuration: "[^
+]*"
-- Install component: "Unspecified"
-- sub$
diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-stdout.txt
index 6f22ae2..658386b 100644
--- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-stdout.txt
+++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-stdout.txt
@@ -1,2 +1,3 @@
-^-- Install configuration: "[^\n]*"
+^-- Install configuration: "[^
+]*"
-- sub$
diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-component-stdout.txt
index 157ab37..ad070d5 100644
--- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-component-stdout.txt
+++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-component-stdout.txt
@@ -1,3 +1,4 @@
-^-- Install configuration: "[^\n]*"
+^-- Install configuration: "[^
+]*"
-- Install component: "Unspecified"
-- top$
diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-stdout.txt
index 9e15872..5a44e46 100644
--- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-stdout.txt
+++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-stdout.txt
@@ -1,2 +1,3 @@
-^-- Install configuration: "[^\n]*"
+^-- Install configuration: "[^
+]*"
-- top$
diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-component-stdout.txt
index 4b39789..b26500e 100644
--- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-component-stdout.txt
+++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-component-stdout.txt
@@ -1,4 +1,5 @@
-^-- Install configuration: "[^\n]*"
+^-- Install configuration: "[^
+]*"
-- Install component: "Unspecified"
-- top
-- sub$
diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-stdout.txt
index 8f3a5f7..fcd556c 100644
--- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-stdout.txt
+++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-stdout.txt
@@ -1,3 +1,4 @@
-^-- Install configuration: "[^\n]*"
+^-- Install configuration: "[^
+]*"
-- top
-- sub$
diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-notfile-all-stderr.txt b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-notfile-all-stderr.txt
index d9758c5..5b86322 100644
--- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-notfile-all-stderr.txt
+++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-notfile-all-stderr.txt
@@ -1,5 +1,2 @@
^CMake Error at cmake_install\.cmake:[0-9]+ \(file\):
- file Failed to run objdump on:
-
- [^
-]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-notfile-build/root-all/bin/\.\./lib/libtest\.so$
+ file Could not resolve file libtest\.so$
diff --git a/Tests/RunCMake/find_package/MissingNormalForceRequired-result.txt b/Tests/RunCMake/find_package/MissingNormalForceRequired-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalForceRequired-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_package/MissingNormalForceRequired-stderr.txt b/Tests/RunCMake/find_package/MissingNormalForceRequired-stderr.txt
new file mode 100644
index 0000000..f6c0b44
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalForceRequired-stderr.txt
@@ -0,0 +1,20 @@
+CMake Error at MissingNormalForceRequired.cmake:2 \(find_package\):
+ No "FindNotHere.cmake" found in CMAKE_MODULE_PATH\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Warning \(dev\) at MissingNormalForceRequired.cmake:2 \(find_package\):
+ FindNotHere.cmake must either be part of this project itself, in this case
+ adjust CMAKE_MODULE_PATH so that it points to the correct location inside
+ its source tree\.
+
+ Or it must be installed by a package which has already been found via
+ find_package\(\)\. In this case make sure that package has indeed been found
+ and adjust CMAKE_MODULE_PATH to contain the location where that package has
+ installed FindNotHere\.cmake\. This must be a location provided by that
+ package. This error in general means that the buildsystem of this project
+ is relying on a Find-module without ensuring that it is actually available\.
+
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it\.
diff --git a/Tests/RunCMake/find_package/MissingNormalForceRequired.cmake b/Tests/RunCMake/find_package/MissingNormalForceRequired.cmake
new file mode 100644
index 0000000..5935316
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalForceRequired.cmake
@@ -0,0 +1,3 @@
+set(CMAKE_REQUIRE_FIND_PACKAGE_NotHere ON)
+find_package(NotHere MODULE)
+message(FATAL_ERROR "This error must not be reachable.")
diff --git a/Tests/RunCMake/find_package/RequiredOptionValuesClash-result.txt b/Tests/RunCMake/find_package/RequiredOptionValuesClash-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/find_package/RequiredOptionValuesClash-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_package/RequiredOptionValuesClash-stderr.txt b/Tests/RunCMake/find_package/RequiredOptionValuesClash-stderr.txt
new file mode 100644
index 0000000..b4fdd98
--- /dev/null
+++ b/Tests/RunCMake/find_package/RequiredOptionValuesClash-stderr.txt
@@ -0,0 +1,11 @@
+CMake Error at RequiredOptionValuesClash.cmake:4 \(find_package\):
+ find_package for module Foo was made REQUIRED with
+ CMAKE_REQUIRE_FIND_PACKAGE_Foo but CMAKE_DISABLE_FIND_PACKAGE_Foo is
+ enabled. A REQUIRED package cannot be disabled.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at RequiredOptionValuesClash.cmake:5 \(message\):
+ This error must not be reachable\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/find_package/RequiredOptionValuesClash.cmake b/Tests/RunCMake/find_package/RequiredOptionValuesClash.cmake
new file mode 100644
index 0000000..04fece7
--- /dev/null
+++ b/Tests/RunCMake/find_package/RequiredOptionValuesClash.cmake
@@ -0,0 +1,5 @@
+set(CMAKE_DISABLE_FIND_PACKAGE_Foo ON)
+set(CMAKE_REQUIRE_FIND_PACKAGE_Foo ON)
+
+find_package(Foo)
+message(FATAL_ERROR "This error must not be reachable.")
diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake
index 3ba04c8..b20a889 100644
--- a/Tests/RunCMake/find_package/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake
@@ -6,6 +6,7 @@ run_cmake(ComponentRequiredAndOptional)
run_cmake(FromPATHEnv)
run_cmake(FromPrefixPath)
run_cmake(MissingNormal)
+run_cmake(MissingNormalForceRequired)
run_cmake(MissingNormalRequired)
run_cmake(MissingNormalVersion)
run_cmake(MissingNormalWarnNoModuleOld)
@@ -23,6 +24,7 @@ run_cmake(PackageRootNestedConfig)
run_cmake(PackageRootNestedModule)
run_cmake(PolicyPush)
run_cmake(PolicyPop)
+run_cmake(RequiredOptionValuesClash)
run_cmake(SetFoundFALSE)
run_cmake(WrongVersion)
run_cmake(WrongVersionConfig)
diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt
index fa0549f..d0c413f 100644
--- a/Tests/TryCompile/CMakeLists.txt
+++ b/Tests/TryCompile/CMakeLists.txt
@@ -305,11 +305,21 @@ unset(C_BOGUS_FLAG CACHE)
include(CheckCCompilerFlag)
CHECK_C_COMPILER_FLAG(${C_DD}-_this_is_not_a_flag_ C_BOGUS_FLAG)
TEST_FAIL(C_BOGUS_FLAG "CHECK_C_COMPILER_FLAG() succeeded, but should have failed")
+unset(C_BOGUS_FLAG CACHE)
+if(DEFINED C_BOGUS_FLAG)
+ # Verify that CHECK_C_COMPILER_FLAG didn't construct a normal variable
+ message(SEND_ERROR "CHECK_C_COMPILER_FLAG shouldn't construct C_BOGUS_FLAG as a normal variable")
+endif()
unset(CXX_BOGUS_FLAG CACHE)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(${CXX_DD}-_this_is_not_a_flag_ CXX_BOGUS_FLAG)
TEST_FAIL(CXX_BOGUS_FLAG "CHECK_CXX_COMPILER_FLAG() succeeded, but should have failed")
+unset(CXX_BOGUS_FLAG CACHE)
+if(DEFINED CXX_BOGUS_FLAG)
+ # Verify that CHECK_C_COMPILER_FLAG didn't construct a normal variable
+ message(SEND_ERROR "CHECK_CXX_COMPILER_FLAG shouldn't construct CXX_BOGUS_FLAG as a normal variable")
+endif()
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
unset(C_STRICT_PROTOTYPES CACHE)
diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt
index f1b2f32..c3f9e03 100644
--- a/Tests/UseSWIG/CMakeLists.txt
+++ b/Tests/UseSWIG/CMakeLists.txt
@@ -67,7 +67,7 @@ add_test(NAME UseSWIG.BasicPerl COMMAND
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
if(SWIG_FOUND AND NOT SWIG_VERSION VERSION_LESS "4.0.2"
- AND CMAKE_GENERATOR MATCHES "Make|Ninja|Xcode")
+ AND CMAKE_GENERATOR MATCHES "Make|Ninja|Xcode|Visual Studio (1[1-9]|[2-9][0-9])")
add_test(NAME UseSWIG.Depfile.BasicPython COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
diff --git a/Utilities/cmlibuv/src/win/process.c b/Utilities/cmlibuv/src/win/process.c
index 04718db..aada889 100644
--- a/Utilities/cmlibuv/src/win/process.c
+++ b/Utilities/cmlibuv/src/win/process.c
@@ -169,7 +169,10 @@ static WCHAR* search_path_join_test(const WCHAR* dir,
size_t cwd_len) {
WCHAR *result, *result_pos;
DWORD attrs;
- if (dir_len > 2 && dir[0] == L'\\' && dir[1] == L'\\') {
+ if (
+ (dir_len > 2 && dir[0] == L'\\' && dir[1] == L'\\') ||
+ (dir_len > 2 && dir[0] == L'/' && dir[1] == L'/')
+ ) {
/* It's a UNC path so ignore cwd */
cwd_len = 0;
} else if (dir_len >= 1 && (dir[0] == L'/' || dir[0] == L'\\')) {