summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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_fedora35_makefiles.cmake1
-rw-r--r--.gitlab/ci/configure_windows_common.cmake1
-rwxr-xr-x.gitlab/ci/docker/debian10-aarch64/install_deps.sh1
-rwxr-xr-x.gitlab/ci/docker/debian10/install_deps.sh1
-rwxr-xr-x.gitlab/ci/docker/fedora35/install_deps.sh1
-rw-r--r--.gitlab/os-linux.yml6
-rw-r--r--.gitlab/os-macos.yml12
-rw-r--r--Auxiliary/vim/syntax/cmake.vim1
-rw-r--r--Help/command/FIND_XXX.txt9
-rw-r--r--Help/command/find_package.rst9
-rw-r--r--Help/guide/tutorial/Adding a Library.rst5
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/prop_tgt/VERIFY_HEADER_SETS.rst17
-rw-r--r--Help/release/dev/find-calls-search-install-prefix.rst12
-rw-r--r--Help/variable/CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH.rst1
-rw-r--r--Help/variable/CMAKE_FIND_USE_CMAKE_SYSTEM_PATH.rst1
-rw-r--r--Help/variable/CMAKE_FIND_USE_INSTALL_PREFIX.rst39
-rw-r--r--Help/variable/CMAKE_FIND_USE_PACKAGE_REGISTRY.rst1
-rw-r--r--Help/variable/CMAKE_FIND_USE_PACKAGE_ROOT_PATH.rst1
-rw-r--r--Help/variable/CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH.rst1
-rw-r--r--Help/variable/CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY.rst1
-rw-r--r--Modules/CMakeCheckCompilerFlagCommonPatterns.cmake1
-rw-r--r--Modules/CMakeSystemSpecificInformation.cmake10
-rw-r--r--Modules/FindICU.cmake4
-rw-r--r--Modules/Internal/CheckLinkerFlag.cmake9
-rw-r--r--Modules/Platform/CrayLinuxEnvironment.cmake1
-rw-r--r--Modules/Platform/UnixPaths.cmake1
-rw-r--r--Modules/Platform/Windows-Clang-ASM.cmake5
-rw-r--r--Modules/Platform/WindowsPaths.cmake1
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmExportFileGenerator.cxx73
-rw-r--r--Source/cmExportInstallFileGenerator.cxx9
-rw-r--r--Source/cmFindBase.cxx59
-rw-r--r--Source/cmFindCommon.cxx8
-rw-r--r--Source/cmFindCommon.h1
-rw-r--r--Source/cmFindPackageCommand.cxx52
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx17
-rw-r--r--Source/cmInstallExportGenerator.cxx16
-rw-r--r--Source/cmInstallGenerator.cxx4
-rw-r--r--Source/cmScriptGenerator.cxx6
-rw-r--r--Source/cmStringCommand.cxx5
-rw-r--r--Tests/RunCMake/CMakeLists.txt16
-rw-r--r--Tests/RunCMake/CMakePresets/check.cmake2
-rw-r--r--Tests/RunCMake/CMakePresets/validate_schema.cmake2
-rw-r--r--Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/CommandLine/trace-json-v1-check.cmake4
-rw-r--r--Tests/RunCMake/CommandLine/trace-json-v1-expand-check.cmake4
-rw-r--r--Tests/RunCMake/FileAPI/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/execute_process/AnyCommandAbnormalExit.cmake2
-rw-r--r--Tests/RunCMake/execute_process/LastCommandAbnormalExit-1.cmake4
-rw-r--r--Tests/RunCMake/execute_process/LastCommandAbnormalExit-2.cmake4
-rw-r--r--Tests/RunCMake/execute_process/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/find_file/FromPATHEnvDebugVar-stderr.txt2
-rw-r--r--Tests/RunCMake/find_file/PrefixInPATH-stderr.txt1
-rw-r--r--Tests/RunCMake/find_library/FromPATHEnv-stderr.txt2
-rw-r--r--Tests/RunCMake/find_library/FromPATHEnvDebugVar-stderr.txt2
-rw-r--r--Tests/RunCMake/find_library/IgnoreInstallPrefix-stderr.txt43
-rw-r--r--Tests/RunCMake/find_library/IgnoreInstallPrefix-stdout.txt3
-rw-r--r--Tests/RunCMake/find_library/IgnoreInstallPrefix.cmake32
-rw-r--r--Tests/RunCMake/find_library/PrefixInPATH-stderr.txt1
-rw-r--r--Tests/RunCMake/find_library/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/find_package/IgnoreInstallPrefix.cmake17
-rw-r--r--Tests/RunCMake/find_package/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/find_path/FromPATHEnv-stderr.txt2
-rw-r--r--Tests/RunCMake/find_path/FromPATHEnvDebugVar-stderr.txt2
-rw-r--r--Tests/RunCMake/find_program/EnvAndHints-stderr.txt2
-rw-r--r--Tests/RunCMake/find_program/EnvAndHintsDebugVar-stderr.txt2
-rw-r--r--Tests/RunCMake/no_install_prefix/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/no_install_prefix/do_test.cmake14
-rw-r--r--Tests/RunCMake/no_install_prefix/no_install_prefix-stderr.txt2
-rw-r--r--Utilities/Release/win/x86/cache-i386.txt2
-rw-r--r--Utilities/Release/win/x86/cache-x86_64.txt2
-rw-r--r--Utilities/Sphinx/CMakeLists.txt4
75 files changed, 471 insertions, 130 deletions
diff --git a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake
index dcb7f821a7..bbccbcf5e8 100644
--- a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake
+++ b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake
@@ -26,6 +26,7 @@ set(CMake_TEST_FindGSL "ON" CACHE BOOL "")
set(CMake_TEST_FindGTest "ON" CACHE BOOL "")
set(CMake_TEST_FindGTK2 "ON" CACHE BOOL "")
set(CMake_TEST_FindIconv "ON" CACHE BOOL "")
+set(CMake_TEST_FindICU "ON" CACHE BOOL "")
set(CMake_TEST_FindIntl "ON" CACHE BOOL "")
set(CMake_TEST_FindJNI "ON" CACHE BOOL "")
set(CMake_TEST_FindJPEG "ON" CACHE BOOL "")
diff --git a/.gitlab/ci/configure_debian10_ninja.cmake b/.gitlab/ci/configure_debian10_ninja.cmake
index 6cf19e3b82..2fcff7a97c 100644
--- a/.gitlab/ci/configure_debian10_ninja.cmake
+++ b/.gitlab/ci/configure_debian10_ninja.cmake
@@ -30,6 +30,7 @@ set(CMake_TEST_FindGSL "ON" CACHE BOOL "")
set(CMake_TEST_FindGTest "ON" CACHE BOOL "")
set(CMake_TEST_FindGTK2 "ON" CACHE BOOL "")
set(CMake_TEST_FindIconv "ON" CACHE BOOL "")
+set(CMake_TEST_FindICU "ON" CACHE BOOL "")
set(CMake_TEST_FindIntl "ON" CACHE BOOL "")
set(CMake_TEST_FindJNI "ON" CACHE BOOL "")
set(CMake_TEST_FindJPEG "ON" CACHE BOOL "")
diff --git a/.gitlab/ci/configure_fedora35_makefiles.cmake b/.gitlab/ci/configure_fedora35_makefiles.cmake
index 6d892d3d5d..9dc5ca982c 100644
--- a/.gitlab/ci/configure_fedora35_makefiles.cmake
+++ b/.gitlab/ci/configure_fedora35_makefiles.cmake
@@ -29,6 +29,7 @@ set(CMake_TEST_FindGSL "ON" CACHE BOOL "")
set(CMake_TEST_FindGTest "ON" CACHE BOOL "")
set(CMake_TEST_FindGTK2 "ON" CACHE BOOL "")
set(CMake_TEST_FindIconv "ON" CACHE BOOL "")
+set(CMake_TEST_FindICU "ON" CACHE BOOL "")
set(CMake_TEST_FindIntl "ON" CACHE BOOL "")
set(CMake_TEST_FindJNI "ON" CACHE BOOL "")
set(CMake_TEST_FindJPEG "ON" CACHE BOOL "")
diff --git a/.gitlab/ci/configure_windows_common.cmake b/.gitlab/ci/configure_windows_common.cmake
index a70d16597c..7467cfdf4c 100644
--- a/.gitlab/ci/configure_windows_common.cmake
+++ b/.gitlab/ci/configure_windows_common.cmake
@@ -2,5 +2,6 @@ set(BUILD_QtDialog ON CACHE BOOL "")
set(BUILD_CursesDialog ON CACHE BOOL "")
set(CMAKE_PREFIX_PATH "$ENV{CI_PROJECT_DIR}/.gitlab/qt" CACHE STRING "")
set(CMake_TEST_Java OFF CACHE BOOL "")
+set(Python_FIND_REGISTRY NEVER CACHE STRING "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake")
diff --git a/.gitlab/ci/docker/debian10-aarch64/install_deps.sh b/.gitlab/ci/docker/debian10-aarch64/install_deps.sh
index 6e9aa0fe96..f0228f88cd 100755
--- a/.gitlab/ci/docker/debian10-aarch64/install_deps.sh
+++ b/.gitlab/ci/docker/debian10-aarch64/install_deps.sh
@@ -58,6 +58,7 @@ apt-get install -y \
libgsl-dev \
libgtest-dev \
libgtk2.0-dev \
+ libicu-dev \
libinput-dev \
libjpeg-dev \
libjsoncpp-dev \
diff --git a/.gitlab/ci/docker/debian10/install_deps.sh b/.gitlab/ci/docker/debian10/install_deps.sh
index f858037d5d..9f50585195 100755
--- a/.gitlab/ci/docker/debian10/install_deps.sh
+++ b/.gitlab/ci/docker/debian10/install_deps.sh
@@ -62,6 +62,7 @@ apt-get install -y \
libgsl-dev \
libgtest-dev \
libgtk2.0-dev \
+ libicu-dev \
libinput-dev \
libjpeg-dev \
libjsoncpp-dev \
diff --git a/.gitlab/ci/docker/fedora35/install_deps.sh b/.gitlab/ci/docker/fedora35/install_deps.sh
index 3cc5ed5b97..13c70e6797 100755
--- a/.gitlab/ci/docker/fedora35/install_deps.sh
+++ b/.gitlab/ci/docker/fedora35/install_deps.sh
@@ -74,6 +74,7 @@ dnf install --setopt=install_weak_deps=False -y \
lapack-devel \
libarchive-devel \
libcurl-devel \
+ libicu-devel \
libinput-devel systemd-devel \
libjpeg-turbo-devel \
libpng-devel \
diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml
index 60a11b07a1..f9af14f312 100644
--- a/.gitlab/os-linux.yml
+++ b/.gitlab/os-linux.yml
@@ -45,7 +45,7 @@
### Debian
.debian10:
- image: "kitware/cmake:ci-debian10-x86_64-2022-03-16"
+ image: "kitware/cmake:ci-debian10-x86_64-2022-04-22"
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
@@ -60,7 +60,7 @@
CMAKE_CI_NO_INSTALL: 1
.debian10_aarch64:
- image: "kitware/cmake:ci-debian10-aarch64-2022-03-16"
+ image: "kitware/cmake:ci-debian10-aarch64-2022-04-22"
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
@@ -69,7 +69,7 @@
### Fedora
.fedora35:
- image: "kitware/cmake:ci-fedora35-x86_64-2022-03-16"
+ image: "kitware/cmake:ci-fedora35-x86_64-2022-04-22"
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci/long file name for testing purposes"
diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml
index e89dba8662..f36fe6d767 100644
--- a/.gitlab/os-macos.yml
+++ b/.gitlab/os-macos.yml
@@ -7,7 +7,7 @@
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci ext/$CI_CONCURRENT_ID"
# TODO: Factor this out so that each job selects the Xcode version to
# use so that different versions can be tested in a single pipeline.
- DEVELOPER_DIR: "/Applications/Xcode-13.2.app/Contents/Developer"
+ DEVELOPER_DIR: "/Applications/Xcode-13.3.app/Contents/Developer"
# Avoid conflicting with other projects running on the same machine.
SCCACHE_SERVER_PORT: 4227
@@ -87,7 +87,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos
- shell
- - xcode-13.2
+ - xcode-13.3
- nonconcurrent
.macos_x86_64_builder_tags_package:
@@ -95,7 +95,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos
- shell
- - xcode-13.2
+ - xcode-13.3
- nonconcurrent
- finder
@@ -104,7 +104,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos
- shell
- - xcode-13.2
+ - xcode-13.3
- concurrent
.macos_arm64_builder_tags:
@@ -112,7 +112,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos-arm64
- shell
- - xcode-13.2
+ - xcode-13.3
- nonconcurrent
.macos_arm64_builder_ext_tags:
@@ -120,7 +120,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos-arm64
- shell
- - xcode-13.2
+ - xcode-13.3
- concurrent
## macOS-specific scripts
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim
index 60be93727d..e1a2885052 100644
--- a/Auxiliary/vim/syntax/cmake.vim
+++ b/Auxiliary/vim/syntax/cmake.vim
@@ -1047,6 +1047,7 @@ syn keyword cmakeVariable contained
\ CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
\ CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
\ CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH
+ \ CMAKE_FIND_USE_INSTALL_PREFIX
\ CMAKE_FIND_USE_CMAKE_PATH
\ CMAKE_FIND_USE_CMAKE_SYSTEM_PATH
\ CMAKE_FIND_USE_PACKAGE_REGISTRY
diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt
index ee6c1ccb59..1e75dc9276 100644
--- a/Help/command/FIND_XXX.txt
+++ b/Help/command/FIND_XXX.txt
@@ -23,6 +23,7 @@ The general signature is:
[NO_CMAKE_ENVIRONMENT_PATH]
[NO_SYSTEM_ENVIRONMENT_PATH]
[NO_CMAKE_SYSTEM_PATH]
+ [NO_CMAKE_INSTALL_PREFIX]
[CMAKE_FIND_ROOT_PATH_BOTH |
ONLY_CMAKE_FIND_ROOT_PATH |
NO_CMAKE_FIND_ROOT_PATH]
@@ -154,9 +155,11 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
* |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX|
6. Search cmake variables defined in the Platform files
- for the current system. This can be skipped if ``NO_CMAKE_SYSTEM_PATH``
- is passed or by setting the :variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH`
- to ``FALSE``.
+ for the current system. The searching of ``CMAKE_INSTALL_PREFIX` can be
+ skipped if ``NO_CMAKE_INSTALL_PREFIX`` is passed or by setting the
+ :variable:`CMAKE_FIND_USE_INSTALL_PREFIX` to ``FALSE. All these locations
+ can be skipped if ``NO_CMAKE_SYSTEM_PATH`` is passed or by setting the
+ :variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH` to ``FALSE``.
* |CMAKE_SYSTEM_PREFIX_PATH_XXX|
* |CMAKE_SYSTEM_XXX_PATH|
diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst
index 1187772759..86e26e9dc8 100644
--- a/Help/command/find_package.rst
+++ b/Help/command/find_package.rst
@@ -176,6 +176,7 @@ Full Signature
[NO_CMAKE_PACKAGE_REGISTRY]
[NO_CMAKE_BUILDS_PATH] # Deprecated; does nothing.
[NO_CMAKE_SYSTEM_PATH]
+ [NO_CMAKE_INSTALL_PREFIX]
[NO_CMAKE_SYSTEM_PACKAGE_REGISTRY]
[CMAKE_FIND_ROOT_PATH_BOTH |
ONLY_CMAKE_FIND_ROOT_PATH |
@@ -346,9 +347,11 @@ enabled.
package registry.
7. Search cmake variables defined in the Platform files for the
- current system. This can be skipped if ``NO_CMAKE_SYSTEM_PATH`` is
- passed or by setting the :variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH`
- to ``FALSE``:
+ current system. The searching of ``CMAKE_INSTALL_PREFIX` can be skipped
+ if ``NO_CMAKE_INSTALL_PREFIX`` is passed or by setting the
+ :variable:`CMAKE_FIND_USE_INSTALL_PREFIX` to ``FALSE. All these locations
+ can be skipped if ``NO_CMAKE_SYSTEM_PATH`` is passed or by setting the
+ :variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH` to ``FALSE``:
* :variable:`CMAKE_SYSTEM_PREFIX_PATH`
* :variable:`CMAKE_SYSTEM_FRAMEWORK_PATH`
diff --git a/Help/guide/tutorial/Adding a Library.rst b/Help/guide/tutorial/Adding a Library.rst
index ed034489c5..71755be35a 100644
--- a/Help/guide/tutorial/Adding a Library.rst
+++ b/Help/guide/tutorial/Adding a Library.rst
@@ -23,8 +23,9 @@ directory:
To make use of the new library we will add an :command:`add_subdirectory`
call in the top-level ``CMakeLists.txt`` file so that the library will get
built. We add the new library to the executable, and add ``MathFunctions`` as
-an include directory so that the ``mysqrt.h`` header file can be found. The
-last few lines of the top-level ``CMakeLists.txt`` file should now look like:
+an include directory so that the ``MathFunctions.h`` header file can be found.
+The last few lines of the top-level ``CMakeLists.txt`` file should now look
+like:
.. code-block:: cmake
:caption: CMakeLists.txt
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 7d68d4ebc5..70dfc35c77 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -206,6 +206,7 @@ Variables that Change Behavior
/variable/CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
/variable/CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
/variable/CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH
+ /variable/CMAKE_FIND_USE_INSTALL_PREFIX
/variable/CMAKE_FIND_USE_CMAKE_PATH
/variable/CMAKE_FIND_USE_CMAKE_SYSTEM_PATH
/variable/CMAKE_FIND_USE_PACKAGE_REGISTRY
diff --git a/Help/prop_tgt/VERIFY_HEADER_SETS.rst b/Help/prop_tgt/VERIFY_HEADER_SETS.rst
index cbfd51bb1f..e151017c37 100644
--- a/Help/prop_tgt/VERIFY_HEADER_SETS.rst
+++ b/Help/prop_tgt/VERIFY_HEADER_SETS.rst
@@ -8,14 +8,15 @@ their own.
When this property is set to true, and the target is an object library, static
library, shared library, or executable with exports enabled, and the target
-has one or more header sets, an object library target named
-``<target_name>_verify_header_sets`` is created. This verification target has
-one source file per header in the header sets. Each source file only includes
-its associated header file. The verification target links against the original
-target to get all of its usage requirements. The verification target has its
-:prop_tgt:`EXCLUDE_FROM_ALL` and :prop_tgt:`DISABLE_PRECOMPILE_HEADERS`
-properties set to true, and its :prop_tgt:`AUTOMOC`, :prop_tgt:`AUTORCC`,
-:prop_tgt:`AUTOUIC`, and :prop_tgt:`UNITY_BUILD` properties set to false.
+has one or more ``PUBLIC`` or ``INTERFACE`` header sets, an object library
+target named ``<target_name>_verify_header_sets`` is created. This verification
+target has one source file per header in the ``PUBLIC`` and ``INTERFACE``
+header sets. Each source file only includes its associated header file. The
+verification target links against the original target to get all of its usage
+requirements. The verification target has its :prop_tgt:`EXCLUDE_FROM_ALL` and
+:prop_tgt:`DISABLE_PRECOMPILE_HEADERS` properties set to true, and its
+:prop_tgt:`AUTOMOC`, :prop_tgt:`AUTORCC`, :prop_tgt:`AUTOUIC`, and
+:prop_tgt:`UNITY_BUILD` properties set to false.
If the header's :prop_sf:`LANGUAGE` property is set, the value of that property
is used to determine the language with which to compile the header file.
diff --git a/Help/release/dev/find-calls-search-install-prefix.rst b/Help/release/dev/find-calls-search-install-prefix.rst
new file mode 100644
index 0000000000..a111a912ed
--- /dev/null
+++ b/Help/release/dev/find-calls-search-install-prefix.rst
@@ -0,0 +1,12 @@
+find-calls-search-install-prefix
+--------------------------------
+
+* The :command:`find_file`, :command:`find_library`, :command:`find_path`,
+ :command:`find_package`, and :command:`find_program` commands have gained
+ the `NO_CMAKE_INSTALL_PREFIX` option to control searching
+ `CMAKE_INSTALL_PREFIX`.
+
+* Adds support for :variable:`CMAKE_FIND_USE_INSTALL_PREFIX` to toggle
+ behavior of the :command:`find_file`, :command:`find_library`, :command:`find_path`,
+ :command:`find_package`, and :command:`find_program` commands new
+ `NO_CMAKE_INSTALL_PREFIX` option.
diff --git a/Help/variable/CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH.rst b/Help/variable/CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH.rst
index de1bad7063..f72fd655e8 100644
--- a/Help/variable/CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH.rst
+++ b/Help/variable/CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH.rst
@@ -20,6 +20,7 @@ take precedence over this variable.
See also the :variable:`CMAKE_FIND_USE_CMAKE_PATH`,
:variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH`,
+:variable:`CMAKE_FIND_USE_INSTALL_PREFIX`,
:variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH`,
:variable:`CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY`,
:variable:`CMAKE_FIND_USE_PACKAGE_REGISTRY`,
diff --git a/Help/variable/CMAKE_FIND_USE_CMAKE_SYSTEM_PATH.rst b/Help/variable/CMAKE_FIND_USE_CMAKE_SYSTEM_PATH.rst
index 2fd00dfcf4..2c1d237113 100644
--- a/Help/variable/CMAKE_FIND_USE_CMAKE_SYSTEM_PATH.rst
+++ b/Help/variable/CMAKE_FIND_USE_CMAKE_SYSTEM_PATH.rst
@@ -20,6 +20,7 @@ take precedence over this variable.
See also the :variable:`CMAKE_FIND_USE_CMAKE_PATH`,
:variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH`,
+:variable:`CMAKE_FIND_USE_INSTALL_PREFIX`,
:variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH`,
:variable:`CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY`,
:variable:`CMAKE_FIND_USE_PACKAGE_REGISTRY`,
diff --git a/Help/variable/CMAKE_FIND_USE_INSTALL_PREFIX.rst b/Help/variable/CMAKE_FIND_USE_INSTALL_PREFIX.rst
new file mode 100644
index 0000000000..8494e95491
--- /dev/null
+++ b/Help/variable/CMAKE_FIND_USE_INSTALL_PREFIX.rst
@@ -0,0 +1,39 @@
+CMAKE_FIND_USE_INSTALL_PREFIX
+-----------------------------------
+
+.. versionadded:: 3.24
+
+Controls the default behavior of the following commands for whether or not to
+search the install location:
+
+* :command:`find_program`
+* :command:`find_library`
+* :command:`find_file`
+* :command:`find_path`
+* :command:`find_package`
+
+This is useful in cross-compiling environments.
+
+Due to backwards compatibility with :variable:`CMAKE_FIND_NO_INSTALL_PREFIX`,
+the behavior of the find command change based on if this variable exists.
+
+============================== ============================ ===========
+ CMAKE_FIND_USE_INSTALL_PREFIX CMAKE_FIND_NO_INSTALL_PREFIX Search
+============================== ============================ ===========
+ Not Defined On NO
+ Not Defined Off || Not Defined YES
+ Off On NO
+ Off Off || Not Defined NO
+ On On YES
+ On Off || Not Defined YES
+============================== ============================ ===========
+
+By default this variable is not defined. Explicit options given to the above
+commands take precedence over this variable.
+
+See also the :variable:`CMAKE_FIND_USE_CMAKE_PATH`,
+:variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH`,
+:variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH`,
+:variable:`CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY`,
+:variable:`CMAKE_FIND_USE_PACKAGE_REGISTRY`,
+and :variable:`CMAKE_FIND_USE_PACKAGE_ROOT_PATH` variables.
diff --git a/Help/variable/CMAKE_FIND_USE_PACKAGE_REGISTRY.rst b/Help/variable/CMAKE_FIND_USE_PACKAGE_REGISTRY.rst
index 312720615f..a5eec7af20 100644
--- a/Help/variable/CMAKE_FIND_USE_PACKAGE_REGISTRY.rst
+++ b/Help/variable/CMAKE_FIND_USE_PACKAGE_REGISTRY.rst
@@ -26,6 +26,7 @@ the :ref:`User Package Registry` as if they were called with the
See also :ref:`Disabling the Package Registry` and the
:variable:`CMAKE_FIND_USE_CMAKE_PATH`,
:variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH`,
+:variable:`CMAKE_FIND_USE_INSTALL_PREFIX`,
:variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH`,
:variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH`,
:variable:`CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY`,
diff --git a/Help/variable/CMAKE_FIND_USE_PACKAGE_ROOT_PATH.rst b/Help/variable/CMAKE_FIND_USE_PACKAGE_ROOT_PATH.rst
index 64e5c6d6b2..1f876a9bd7 100644
--- a/Help/variable/CMAKE_FIND_USE_PACKAGE_ROOT_PATH.rst
+++ b/Help/variable/CMAKE_FIND_USE_PACKAGE_ROOT_PATH.rst
@@ -18,6 +18,7 @@ take precedence over this variable.
See also the :variable:`CMAKE_FIND_USE_CMAKE_PATH`,
:variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH`,
+:variable:`CMAKE_FIND_USE_INSTALL_PREFIX`,
:variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH`,
:variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH`,
:variable:`CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY`,
diff --git a/Help/variable/CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH.rst b/Help/variable/CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH.rst
index a0a86e43a9..65edd103b8 100644
--- a/Help/variable/CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH.rst
+++ b/Help/variable/CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH.rst
@@ -20,6 +20,7 @@ take precedence over this variable.
See also the :variable:`CMAKE_FIND_USE_CMAKE_PATH`,
:variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH`,
+:variable:`CMAKE_FIND_USE_INSTALL_PREFIX`,
:variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH`,
:variable:`CMAKE_FIND_USE_PACKAGE_REGISTRY`,
:variable:`CMAKE_FIND_USE_PACKAGE_ROOT_PATH`,
diff --git a/Help/variable/CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY.rst b/Help/variable/CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY.rst
index 504b7e872f..2527904a2e 100644
--- a/Help/variable/CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY.rst
+++ b/Help/variable/CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY.rst
@@ -27,6 +27,7 @@ See also :ref:`Disabling the Package Registry`.
See also the :variable:`CMAKE_FIND_USE_CMAKE_PATH`,
:variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH`,
+:variable:`CMAKE_FIND_USE_INSTALL_PREFIX`,
:variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH`,
:variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH`,
:variable:`CMAKE_FIND_USE_PACKAGE_REGISTRY`,
diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
index 8f59acdf8b..bda1d71110 100644
--- a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
+++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
@@ -13,7 +13,6 @@ macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR)
FAIL_REGEX "unknown .*option" # Clang
FAIL_REGEX "optimization flag .* not supported" # Clang
FAIL_REGEX "unknown argument ignored" # Clang (cl)
- FAIL_REGEX "warning: .* ignored" # Clang (linker)
FAIL_REGEX "ignoring unknown option" # MSVC, Intel
FAIL_REGEX "warning D9002" # MSVC, any lang
FAIL_REGEX "option.*not supported" # Intel
diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake
index 0ded568835..59f552ab42 100644
--- a/Modules/CMakeSystemSpecificInformation.cmake
+++ b/Modules/CMakeSystemSpecificInformation.cmake
@@ -17,6 +17,16 @@ set(CYGWIN )
set(MSYS )
set(WIN32 )
+function(_cmake_record_install_prefix )
+ set(_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_VALUE "${CMAKE_INSTALL_PREFIX}" PARENT_SCOPE)
+ set(count 0)
+ foreach(value IN LISTS CMAKE_SYSTEM_PREFIX_PATH)
+ if(value STREQUAL CMAKE_INSTALL_PREFIX)
+ math(EXPR count "${count}+1")
+ endif()
+ endforeach()
+ set(_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_COUNT "${count}" PARENT_SCOPE)
+endfunction()
# include Generic system information
include(CMakeGenericSystem)
diff --git a/Modules/FindICU.cmake b/Modules/FindICU.cmake
index 1bae825a53..91dcba5a8f 100644
--- a/Modules/FindICU.cmake
+++ b/Modules/FindICU.cmake
@@ -262,9 +262,9 @@ function(_ICU_FIND)
set("${component_found_compat}" "${${component_found_compat}}" PARENT_SCOPE)
if(component_found OR component_found_compat)
if (ICU_FIND_REQUIRED_${component})
- list(APPEND ICU_LIBS_FOUND "${component} (required)")
+ list(APPEND ICU_LIBS_FOUND "${component} (required): ${${component_cache}}")
else()
- list(APPEND ICU_LIBS_FOUND "${component} (optional)")
+ list(APPEND ICU_LIBS_FOUND "${component} (optional): ${${component_cache}}")
endif()
else()
if (ICU_FIND_REQUIRED_${component})
diff --git a/Modules/Internal/CheckLinkerFlag.cmake b/Modules/Internal/CheckLinkerFlag.cmake
index 51d42254f7..7613105500 100644
--- a/Modules/Internal/CheckLinkerFlag.cmake
+++ b/Modules/Internal/CheckLinkerFlag.cmake
@@ -25,6 +25,15 @@ function(CMAKE_CHECK_LINKER_FLAG _lang _flag _var)
set(CMAKE_REQUIRED_LINK_OPTIONS "${_flag}")
check_compiler_flag_common_patterns(_common_patterns)
+
+ # Match linker warnings if the exact flag is ignored.
+ foreach(flag IN LISTS _flag)
+ string(REGEX REPLACE "([][+.*?()^$])" [[\\\1]] _flag_regex "${flag}")
+ list(APPEND _common_patterns
+ FAIL_REGEX "warning: .*${_flag_regex}.* ignored"
+ )
+ endforeach()
+
cmake_check_source_compiles(${_lang}
"${_lang_src}"
${_var}
diff --git a/Modules/Platform/CrayLinuxEnvironment.cmake b/Modules/Platform/CrayLinuxEnvironment.cmake
index f2aaf3f710..b982b3f3cf 100644
--- a/Modules/Platform/CrayLinuxEnvironment.cmake
+++ b/Modules/Platform/CrayLinuxEnvironment.cmake
@@ -68,6 +68,7 @@ if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
)
endif()
endif()
+_cmake_record_install_prefix()
list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
$ENV{SYSROOT_DIR}/usr/include/X11
diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake
index b9381c3d7d..8a0ad23905 100644
--- a/Modules/Platform/UnixPaths.cmake
+++ b/Modules/Platform/UnixPaths.cmake
@@ -44,6 +44,7 @@ if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
)
endif()
endif()
+_cmake_record_install_prefix()
# Non "standard" but common install prefixes
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
diff --git a/Modules/Platform/Windows-Clang-ASM.cmake b/Modules/Platform/Windows-Clang-ASM.cmake
index 345d77d03b..c22e3b0b34 100644
--- a/Modules/Platform/Windows-Clang-ASM.cmake
+++ b/Modules/Platform/Windows-Clang-ASM.cmake
@@ -1,2 +1,7 @@
include(Platform/Windows-Clang)
__windows_compiler_clang(ASM)
+
+set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "")
+set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL "")
+set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug "")
+set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL "")
diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake
index b9e2f17979..de93338cf9 100644
--- a/Modules/Platform/WindowsPaths.cmake
+++ b/Modules/Platform/WindowsPaths.cmake
@@ -67,6 +67,7 @@ if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
)
endif()
endif()
+_cmake_record_install_prefix()
if(CMAKE_CROSSCOMPILING AND NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
# MinGW (useful when cross compiling from linux with CMAKE_FIND_ROOT_PATH set)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index f3abe6f0ad..0887544beb 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 23)
-set(CMake_VERSION_PATCH 20220421)
+set(CMake_VERSION_PATCH 20220426)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 6d6df71ab2..452eb998ba 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -922,8 +922,11 @@ void cmExportFileGenerator::GeneratePolicyHeaderCode(std::ostream& os)
// Protect that file against use with older CMake versions.
/* clang-format off */
os << "# Generated by CMake\n\n";
- os << "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.6)\n"
- << " message(FATAL_ERROR \"CMake >= 2.6.0 required\")\n"
+ os << "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.8)\n"
+ << " message(FATAL_ERROR \"CMake >= 2.8.0 required\")\n"
+ << "endif()\n"
+ << "if(CMAKE_VERSION VERSION_LESS \"2.8.3\")\n"
+ << " message(FATAL_ERROR \"CMake >= 2.8.3 required\")\n"
<< "endif()\n";
/* clang-format on */
@@ -935,7 +938,7 @@ void cmExportFileGenerator::GeneratePolicyHeaderCode(std::ostream& os)
// versions.
/* clang-format off */
os << "cmake_policy(PUSH)\n"
- << "cmake_policy(VERSION 2.6...3.22)\n";
+ << "cmake_policy(VERSION 2.8.3...3.22)\n";
/* clang-format on */
}
@@ -982,34 +985,36 @@ void cmExportFileGenerator::GenerateExpectedTargetsCode(
/* clang-format off */
os << "# Protect against multiple inclusion, which would fail when already "
"imported targets are added once more.\n"
- "set(_targetsDefined)\n"
- "set(_targetsNotDefined)\n"
- "set(_expectedTargets)\n"
- "foreach(_expectedTarget " << expectedTargets << ")\n"
- " list(APPEND _expectedTargets ${_expectedTarget})\n"
- " if(NOT TARGET ${_expectedTarget})\n"
- " list(APPEND _targetsNotDefined ${_expectedTarget})\n"
- " endif()\n"
- " if(TARGET ${_expectedTarget})\n"
- " list(APPEND _targetsDefined ${_expectedTarget})\n"
+ "set(_cmake_targets_defined \"\")\n"
+ "set(_cmake_targets_not_defined \"\")\n"
+ "set(_cmake_expected_targets \"\")\n"
+ "foreach(_cmake_expected_target IN ITEMS " << expectedTargets << ")\n"
+ " list(APPEND _cmake_expected_targets \"${_cmake_expected_target}\")\n"
+ " if(TARGET \"${_cmake_expected_target}\")\n"
+ " list(APPEND _cmake_targets_defined \"${_cmake_expected_target}\")\n"
+ " else()\n"
+ " list(APPEND _cmake_targets_not_defined \"${_cmake_expected_target}\")\n"
" endif()\n"
"endforeach()\n"
- "if(\"${_targetsDefined}\" STREQUAL \"${_expectedTargets}\")\n"
- " unset(_targetsDefined)\n"
- " unset(_targetsNotDefined)\n"
- " unset(_expectedTargets)\n"
- " set(CMAKE_IMPORT_FILE_VERSION)\n"
+ "unset(_cmake_expected_target)\n"
+ "if(_cmake_targets_defined STREQUAL _cmake_expected_targets)\n"
+ " unset(_cmake_targets_defined)\n"
+ " unset(_cmake_targets_not_defined)\n"
+ " unset(_cmake_expected_targets)\n"
+ " unset(CMAKE_IMPORT_FILE_VERSION)\n"
" cmake_policy(POP)\n"
" return()\n"
"endif()\n"
- "if(NOT \"${_targetsDefined}\" STREQUAL \"\")\n"
+ "if(NOT _cmake_targets_defined STREQUAL \"\")\n"
+ " string(REPLACE \";\" \", \" _cmake_targets_defined_text \"${_cmake_targets_defined}\")\n"
+ " string(REPLACE \";\" \", \" _cmake_targets_not_defined_text \"${_cmake_targets_not_defined}\")\n"
" message(FATAL_ERROR \"Some (but not all) targets in this export "
- "set were already defined.\\nTargets Defined: ${_targetsDefined}\\n"
- "Targets not yet defined: ${_targetsNotDefined}\\n\")\n"
+ "set were already defined.\\nTargets Defined: ${_cmake_targets_defined_text}\\n"
+ "Targets not yet defined: ${_cmake_targets_not_defined_text}\\n\")\n"
"endif()\n"
- "unset(_targetsDefined)\n"
- "unset(_targetsNotDefined)\n"
- "unset(_expectedTargets)\n"
+ "unset(_cmake_targets_defined)\n"
+ "unset(_cmake_targets_not_defined)\n"
+ "unset(_cmake_expected_targets)\n"
"\n\n";
/* clang-format on */
}
@@ -1175,12 +1180,12 @@ void cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os)
// but the development package was not installed.).
/* clang-format off */
os << "# Loop over all imported files and verify that they actually exist\n"
- "foreach(target ${_IMPORT_CHECK_TARGETS} )\n"
- " foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )\n"
- " if(NOT EXISTS \"${file}\" )\n"
- " message(FATAL_ERROR \"The imported target \\\"${target}\\\""
+ "foreach(_cmake_target IN LISTS _cmake_import_check_targets)\n"
+ " foreach(_cmake_file IN LISTS \"_cmake_import_check_files_for_${_cmake_target}\")\n"
+ " if(NOT EXISTS \"${_cmake_file}\")\n"
+ " message(FATAL_ERROR \"The imported target \\\"${_cmake_target}\\\""
" references the file\n"
- " \\\"${file}\\\"\n"
+ " \\\"${_cmake_file}\\\"\n"
"but this file does not exist. Possible reasons include:\n"
"* The file was deleted, renamed, or moved to another location.\n"
"* An install or uninstall procedure did not complete successfully.\n"
@@ -1190,9 +1195,11 @@ void cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os)
"\")\n"
" endif()\n"
" endforeach()\n"
- " unset(_IMPORT_CHECK_FILES_FOR_${target})\n"
+ " unset(_cmake_file)\n"
+ " unset(\"_cmake_import_check_files_for_${_cmake_target}\")\n"
"endforeach()\n"
- "unset(_IMPORT_CHECK_TARGETS)\n"
+ "unset(_cmake_target)\n"
+ "unset(_cmake_import_check_targets)\n"
"\n";
/* clang-format on */
}
@@ -1205,9 +1212,9 @@ void cmExportFileGenerator::GenerateImportedFileChecksCode(
// Construct the imported target name.
std::string targetName = cmStrCat(this->Namespace, target->GetExportName());
- os << "list(APPEND _IMPORT_CHECK_TARGETS " << targetName
+ os << "list(APPEND _cmake_import_check_targets " << targetName
<< " )\n"
- "list(APPEND _IMPORT_CHECK_FILES_FOR_"
+ "list(APPEND _cmake_import_check_files_for_"
<< targetName << " ";
for (std::string const& li : importedLocations) {
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 0c41946292..adccdfeece 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -253,12 +253,13 @@ void cmExportInstallFileGenerator::LoadConfigFiles(std::ostream& os)
// Now load per-configuration properties for them.
/* clang-format off */
os << "# Load information for each installed configuration.\n"
- << "get_filename_component(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n"
- << "file(GLOB CONFIG_FILES \"${_DIR}/"
+ << "file(GLOB _cmake_config_files \"${CMAKE_CURRENT_LIST_DIR}/"
<< this->GetConfigImportFileGlob() << "\")\n"
- << "foreach(f ${CONFIG_FILES})\n"
- << " include(${f})\n"
+ << "foreach(_cmake_config_file IN LISTS _cmake_config_files)\n"
+ << " include(\"${_cmake_config_file}\")\n"
<< "endforeach()\n"
+ << "unset(_cmake_config_file)\n"
+ << "unset(_cmake_config_files)\n"
<< "\n";
/* clang-format on */
}
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index efc4e3a957..a8db63d5cf 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -267,8 +267,61 @@ void cmFindBase::FillCMakeSystemVariablePath()
{
cmSearchPath& paths = this->LabeledPaths[PathLabel::CMakeSystem];
+ const bool install_prefix_in_list =
+ !this->Makefile->IsOn("CMAKE_FIND_NO_INSTALL_PREFIX");
+ const bool remove_install_prefix = this->NoCMakeInstallPath;
+ const bool add_install_prefix = !this->NoCMakeInstallPath &&
+ this->Makefile->IsDefinitionSet("CMAKE_FIND_USE_INSTALL_PREFIX");
+
+ // We have 3 possible states for `CMAKE_SYSTEM_PREFIX_PATH` and
+ // `CMAKE_INSTALL_PREFIX`.
+ // Either we need to remove `CMAKE_INSTALL_PREFIX`, add
+ // `CMAKE_INSTALL_PREFIX`, or do nothing.
+ //
+ // When we need to remove `CMAKE_INSTALL_PREFIX` we remove the Nth occurrence
+ // of `CMAKE_INSTALL_PREFIX` from `CMAKE_SYSTEM_PREFIX_PATH`, where `N` is
+ // computed by `CMakeSystemSpecificInformation.cmake` while constructing
+ // `CMAKE_SYSTEM_PREFIX_PATH`. This ensures that if projects / toolchains
+ // have removed `CMAKE_INSTALL_PREFIX` from the list, we don't remove
+ // some other entry by mistake
+ long install_prefix_count = -1;
+ std::string install_path_to_remove;
+ if (cmValue to_skip = this->Makefile->GetDefinition(
+ "_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_COUNT")) {
+ cmStrToLong(to_skip, &install_prefix_count);
+ }
+ if (cmValue install_value = this->Makefile->GetDefinition(
+ "_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_VALUE")) {
+ install_path_to_remove = *install_value;
+ }
+
+ if (remove_install_prefix && install_prefix_in_list &&
+ install_prefix_count > 0 && !install_path_to_remove.empty()) {
+ cmValue prefix_paths =
+ this->Makefile->GetDefinition("CMAKE_SYSTEM_PREFIX_PATH");
+
+ // remove entry from CMAKE_SYSTEM_PREFIX_PATH
+ std::vector<std::string> expanded = cmExpandedList(*prefix_paths);
+ long index_to_remove = 0;
+ for (const auto& path : expanded) {
+ if (path == install_path_to_remove && --install_prefix_count == 0) {
+ break;
+ }
+ ++index_to_remove;
+ }
+ expanded.erase(expanded.begin() + index_to_remove);
+ paths.AddPrefixPaths(expanded,
+ this->Makefile->GetCurrentSourceDirectory().c_str());
+ } else if (add_install_prefix && !install_prefix_in_list) {
+
+ paths.AddCMakePrefixPath("CMAKE_INSTALL_PREFIX");
+ paths.AddCMakePrefixPath("CMAKE_SYSTEM_PREFIX_PATH");
+ } else {
+ // Otherwise the current setup of `CMAKE_SYSTEM_PREFIX_PATH` is correct
+ paths.AddCMakePrefixPath("CMAKE_SYSTEM_PREFIX_PATH");
+ }
+
std::string var = cmStrCat("CMAKE_SYSTEM_", this->CMakePathName, "_PATH");
- paths.AddCMakePrefixPath("CMAKE_SYSTEM_PREFIX_PATH");
paths.AddCMakePath(var);
if (this->CMakePathName == "PROGRAM") {
@@ -496,7 +549,9 @@ cmFindBaseDebugState::~cmFindBaseDebugState()
" CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: ",
!this->FindCommand->NoSystemEnvironmentPath, "\n",
" CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: ",
- !this->FindCommand->NoCMakeSystemPath, "\n");
+ !this->FindCommand->NoCMakeSystemPath, "\n",
+ " CMAKE_FIND_USE_INSTALL_PREFIX: ",
+ !this->FindCommand->NoCMakeInstallPath, "\n");
}
buffer +=
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 7106e4b3ad..9fd712aa9e 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -39,6 +39,7 @@ cmFindCommon::cmFindCommon(cmExecutionStatus& status)
this->NoCMakeEnvironmentPath = false;
this->NoSystemEnvironmentPath = false;
this->NoCMakeSystemPath = false;
+ this->NoCMakeInstallPath = false;
// OS X Bundle and Framework search policy. The default is to
// search frameworks first on apple.
@@ -179,14 +180,15 @@ void cmFindCommon::SelectDefaultMacMode()
void cmFindCommon::SelectDefaultSearchModes()
{
- const std::array<std::pair<bool&, std::string>, 5> search_paths = {
+ const std::array<std::pair<bool&, std::string>, 6> search_paths = {
{ { this->NoPackageRootPath, "CMAKE_FIND_USE_PACKAGE_ROOT_PATH" },
{ this->NoCMakePath, "CMAKE_FIND_USE_CMAKE_PATH" },
{ this->NoCMakeEnvironmentPath,
"CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH" },
{ this->NoSystemEnvironmentPath,
"CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH" },
- { this->NoCMakeSystemPath, "CMAKE_FIND_USE_CMAKE_SYSTEM_PATH" } }
+ { this->NoCMakeSystemPath, "CMAKE_FIND_USE_CMAKE_SYSTEM_PATH" },
+ { this->NoCMakeInstallPath, "CMAKE_FIND_USE_INSTALL_PREFIX" } }
};
for (auto const& path : search_paths) {
@@ -348,6 +350,8 @@ bool cmFindCommon::CheckCommonArgument(std::string const& arg)
this->NoSystemEnvironmentPath = true;
} else if (arg == "NO_CMAKE_SYSTEM_PATH") {
this->NoCMakeSystemPath = true;
+ } else if (arg == "NO_CMAKE_INSTALL_PREFIX") {
+ this->NoCMakeInstallPath = true;
} else if (arg == "NO_CMAKE_FIND_ROOT_PATH") {
this->FindRootPathMode = RootPathModeNever;
} else if (arg == "ONLY_CMAKE_FIND_ROOT_PATH") {
diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h
index 5d9b3e1a47..4c02df0133 100644
--- a/Source/cmFindCommon.h
+++ b/Source/cmFindCommon.h
@@ -130,6 +130,7 @@ protected:
bool NoCMakeEnvironmentPath;
bool NoSystemEnvironmentPath;
bool NoCMakeSystemPath;
+ bool NoCMakeInstallPath;
std::vector<std::string> SearchPathSuffixes;
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 18457a7405..9a89935c48 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1682,7 +1682,57 @@ void cmFindPackageCommand::FillPrefixesCMakeSystemVariable()
{
cmSearchPath& paths = this->LabeledPaths[PathLabel::CMakeSystem];
- paths.AddCMakePath("CMAKE_SYSTEM_PREFIX_PATH");
+ const bool install_prefix_in_list =
+ !this->Makefile->IsOn("CMAKE_FIND_NO_INSTALL_PREFIX");
+ const bool remove_install_prefix = this->NoCMakeInstallPath;
+ const bool add_install_prefix = !this->NoCMakeInstallPath &&
+ this->Makefile->IsDefinitionSet("CMAKE_FIND_USE_INSTALL_PREFIX");
+
+ // We have 3 possible states for `CMAKE_SYSTEM_PREFIX_PATH` and
+ // `CMAKE_INSTALL_PREFIX`.
+ // Either we need to remove `CMAKE_INSTALL_PREFIX`, add
+ // `CMAKE_INSTALL_PREFIX`, or do nothing.
+ //
+ // When we need to remove `CMAKE_INSTALL_PREFIX` we remove the Nth occurrence
+ // of `CMAKE_INSTALL_PREFIX` from `CMAKE_SYSTEM_PREFIX_PATH`, where `N` is
+ // computed by `CMakeSystemSpecificInformation.cmake` while constructing
+ // `CMAKE_SYSTEM_PREFIX_PATH`. This ensures that if projects / toolchains
+ // have removed `CMAKE_INSTALL_PREFIX` from the list, we don't remove
+ // some other entry by mistake
+ long install_prefix_count = -1;
+ std::string install_path_to_remove;
+ if (cmValue to_skip = this->Makefile->GetDefinition(
+ "_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_COUNT")) {
+ cmStrToLong(to_skip, &install_prefix_count);
+ }
+ if (cmValue install_value = this->Makefile->GetDefinition(
+ "_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_VALUE")) {
+ install_path_to_remove = *install_value;
+ }
+
+ if (remove_install_prefix && install_prefix_in_list &&
+ install_prefix_count > 0 && !install_path_to_remove.empty()) {
+
+ cmValue prefix_paths =
+ this->Makefile->GetDefinition("CMAKE_SYSTEM_PREFIX_PATH");
+ // remove entry from CMAKE_SYSTEM_PREFIX_PATH
+ std::vector<std::string> expanded = cmExpandedList(*prefix_paths);
+ long count = 0;
+ for (const auto& path : expanded) {
+ bool to_add =
+ !(path == install_path_to_remove && ++count == install_prefix_count);
+ if (to_add) {
+ paths.AddPath(path);
+ }
+ }
+ } else if (add_install_prefix && !install_prefix_in_list) {
+ paths.AddCMakePath("CMAKE_INSTALL_PREFIX");
+ paths.AddCMakePath("CMAKE_SYSTEM_PREFIX_PATH");
+ } else {
+ // Otherwise the current setup of `CMAKE_SYSTEM_PREFIX_PATH` is correct
+ paths.AddCMakePath("CMAKE_SYSTEM_PREFIX_PATH");
+ }
+
paths.AddCMakePath("CMAKE_SYSTEM_FRAMEWORK_PATH");
paths.AddCMakePath("CMAKE_SYSTEM_APPBUNDLE_PATH");
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index f405a0446b..9c334a5e59 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -425,13 +425,6 @@ void cmGlobalGhsMultiGenerator::Generate()
this->WriteFileHeader(ftarget);
this->WriteCustomTargetBOD(ftarget);
ftarget.Close();
-
- // create the stamp file when running CMake
- if (!this->StampFile.empty()) {
- cmGeneratedFileStream fstamp(this->StampFile);
- fstamp.SetCopyIfDifferent(false);
- fstamp.Close();
- }
}
void cmGlobalGhsMultiGenerator::OutputTopLevelProject(
@@ -695,10 +688,16 @@ bool cmGlobalGhsMultiGenerator::AddCheckTarget()
listFiles.erase(newEnd, listFiles.end());
// Create a rule to re-run CMake and create output file.
+ cmCustomCommandLines commandLines;
+ commandLines.emplace_back(
+ cmMakeCommandLine({ cmSystemTools::GetCMakeCommand(), "-E", "rm", "-f",
+ this->StampFile }));
std::string argS = cmStrCat("-S", lg.GetSourceDirectory());
std::string argB = cmStrCat("-B", lg.GetBinaryDirectory());
- cmCustomCommandLines commandLines = cmMakeSingleCommandLine(
- { cmSystemTools::GetCMakeCommand(), argS, argB });
+ commandLines.emplace_back(
+ cmMakeCommandLine({ cmSystemTools::GetCMakeCommand(), argS, argB }));
+ commandLines.emplace_back(cmMakeCommandLine(
+ { cmSystemTools::GetCMakeCommand(), "-E", "touch", this->StampFile }));
/* Create the target(Exclude from ALL_BUILD).
*
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 627f59d0b4..eb7537d4bb 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -195,18 +195,22 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
Indent indentNN = indentN.Next();
Indent indentNNN = indentNN.Next();
/* clang-format off */
- os << indentN << "file(DIFFERENT EXPORT_FILE_CHANGED FILES\n"
+ os << indentN << "file(DIFFERENT _cmake_export_file_changed FILES\n"
<< indentN << " \"" << installedFile << "\"\n"
<< indentN << " \"" << this->MainImportFile << "\")\n";
- os << indentN << "if(EXPORT_FILE_CHANGED)\n";
- os << indentNN << "file(GLOB OLD_CONFIG_FILES \"" << installedDir
+ os << indentN << "if(_cmake_export_file_changed)\n";
+ os << indentNN << "file(GLOB _cmake_old_config_files \"" << installedDir
<< this->EFGen->GetConfigImportFileGlob() << "\")\n";
- os << indentNN << "if(OLD_CONFIG_FILES)\n";
+ os << indentNN << "if(_cmake_old_config_files)\n";
+ os << indentNNN << "string(REPLACE \";\" \", \" _cmake_old_config_files_text \"${_cmake_old_config_files}\")\n";
os << indentNNN << R"(message(STATUS "Old export file \")" << installedFile
- << "\\\" will be replaced. Removing files [${OLD_CONFIG_FILES}].\")\n";
- os << indentNNN << "file(REMOVE ${OLD_CONFIG_FILES})\n";
+ << "\\\" will be replaced. Removing files [${_cmake_old_config_files_text}].\")\n";
+ os << indentNNN << "unset(_cmake_old_config_files_text)\n";
+ os << indentNNN << "file(REMOVE ${_cmake_old_config_files})\n";
os << indentNN << "endif()\n";
+ os << indentNN << "unset(_cmake_old_config_files)\n";
os << indentN << "endif()\n";
+ os << indentN << "unset(_cmake_export_file_changed)\n";
os << indent << "endif()\n";
/* clang-format on */
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index 4cfeb477e7..00eb8c31ae 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -160,9 +160,9 @@ void cmInstallGenerator::AddInstallRule(
std::string cmInstallGenerator::CreateComponentTest(
const std::string& component, bool exclude_from_all)
{
- std::string result = R"("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "x)";
+ std::string result = "CMAKE_INSTALL_COMPONENT STREQUAL \"";
result += component;
- result += "x\"";
+ result += "\"";
if (!exclude_from_all) {
result += " OR NOT CMAKE_INSTALL_COMPONENT";
}
diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx
index 5ac7be9680..437b93854f 100644
--- a/Source/cmScriptGenerator.cxx
+++ b/Source/cmScriptGenerator.cxx
@@ -52,8 +52,7 @@ static void cmScriptGeneratorEncodeConfig(const std::string& config,
std::string cmScriptGenerator::CreateConfigTest(const std::string& config)
{
- std::string result =
- cmStrCat("\"${", this->RuntimeConfigVariable, "}\" MATCHES \"^(");
+ std::string result = cmStrCat(this->RuntimeConfigVariable, " MATCHES \"^(");
if (!config.empty()) {
cmScriptGeneratorEncodeConfig(config, result);
}
@@ -64,8 +63,7 @@ std::string cmScriptGenerator::CreateConfigTest(const std::string& config)
std::string cmScriptGenerator::CreateConfigTest(
std::vector<std::string> const& configs)
{
- std::string result =
- cmStrCat("\"${", this->RuntimeConfigVariable, "}\" MATCHES \"^(");
+ std::string result = cmStrCat(this->RuntimeConfigVariable, " MATCHES \"^(");
const char* sep = "";
for (std::string const& config : configs) {
result += sep;
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 900854e0fd..c3ee6959e4 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -55,7 +55,6 @@ bool joinImpl(std::vector<std::string> const& args, std::string const& glue,
bool HandleHashCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
-#if !defined(CMAKE_BOOTSTRAP)
if (args.size() != 3) {
status.SetError(
cmStrCat(args[0], " requires an output variable and an input string"));
@@ -69,10 +68,6 @@ bool HandleHashCommand(std::vector<std::string> const& args,
return true;
}
return false;
-#else
- status.SetError(cmStrCat(args[0], " not available during bootstrap"));
- return false;
-#endif
}
bool HandleToUpperLowerCommand(std::vector<std::string> const& args,
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 024c388e57..c2677a0214 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -76,7 +76,7 @@ function(add_RunCMake_test_group test types)
endfunction()
# Some tests use python for extra checks.
-find_package(PythonInterp QUIET)
+find_package(Python QUIET)
if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 6.1)
set(Swift_ARGS -DXCODE_BELOW_6_1=1)
@@ -302,7 +302,7 @@ add_RunCMake_test(ExcludeFromAll)
add_RunCMake_test(ExternalData)
add_RunCMake_test(FeatureSummary)
add_RunCMake_test(FPHSA)
-add_RunCMake_test(FileAPI -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+add_RunCMake_test(FileAPI -DPython_EXECUTABLE=${Python_EXECUTABLE}
-DCMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID})
add_RunCMake_test(FindBoost)
add_RunCMake_test(FindLua)
@@ -400,7 +400,7 @@ add_RunCMake_test(build_command)
add_executable(exit_code exit_code.c)
set(execute_process_ARGS
-DEXIT_CODE_EXE=$<TARGET_FILE:exit_code>
- -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+ -DPython_EXECUTABLE=${Python_EXECUTABLE}
)
if(NOT CMake_TEST_EXTERNAL_CMAKE)
list(APPEND execute_process_ARGS -DTEST_ENCODING_EXE=$<TARGET_FILE:testEncoding>)
@@ -748,7 +748,7 @@ endif()
add_executable(pseudo_llvm-rc pseudo_llvm-rc.c)
add_RunCMake_test(CommandLine -DLLVM_RC=$<TARGET_FILE:pseudo_llvm-rc> -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
- -DCYGWIN=${CYGWIN} -DMSYS=${MSYS} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+ -DCYGWIN=${CYGWIN} -DMSYS=${MSYS} -DPython_EXECUTABLE=${Python_EXECUTABLE}
-DEXIT_CODE_EXE=$<TARGET_FILE:exit_code>)
add_RunCMake_test(CommandLineTar)
@@ -784,7 +784,7 @@ if(CMake_TEST_RunCMake_ExternalProject_DOWNLOAD_SERVER_TIMEOUT)
endif()
add_RunCMake_test(ExternalProject)
add_RunCMake_test(FetchContent)
-set(CTestCommandLine_ARGS -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE})
+set(CTestCommandLine_ARGS -DPython_EXECUTABLE=${Python_EXECUTABLE})
if(NOT CMake_TEST_EXTERNAL_CMAKE)
list(APPEND CTestCommandLine_ARGS -DTEST_AFFINITY=$<TARGET_FILE:testAffinity>)
endif()
@@ -968,16 +968,16 @@ add_RunCMake_test(PrecompileHeaders -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
add_RunCMake_test("UnityBuild")
add_RunCMake_test(CMakePresets
- -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+ -DPython_EXECUTABLE=${Python_EXECUTABLE}
-DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
)
add_RunCMake_test(CMakePresetsBuild
- -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+ -DPython_EXECUTABLE=${Python_EXECUTABLE}
-DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
)
add_RunCMake_test(CMakePresetsTest
- -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+ -DPython_EXECUTABLE=${Python_EXECUTABLE}
-DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
)
diff --git a/Tests/RunCMake/CMakePresets/check.cmake b/Tests/RunCMake/CMakePresets/check.cmake
index cef43f46e3..03f96a9554 100644
--- a/Tests/RunCMake/CMakePresets/check.cmake
+++ b/Tests/RunCMake/CMakePresets/check.cmake
@@ -1,4 +1,4 @@
-if(PYTHON_EXECUTABLE AND CMake_TEST_JSON_SCHEMA)
+if(Python_EXECUTABLE AND CMake_TEST_JSON_SCHEMA)
if(NOT CMakePresets_SCHEMA_EXPECTED_RESULT)
set(CMakePresets_SCHEMA_EXPECTED_RESULT 0)
endif()
diff --git a/Tests/RunCMake/CMakePresets/validate_schema.cmake b/Tests/RunCMake/CMakePresets/validate_schema.cmake
index 68b638f16a..ed60760d63 100644
--- a/Tests/RunCMake/CMakePresets/validate_schema.cmake
+++ b/Tests/RunCMake/CMakePresets/validate_schema.cmake
@@ -4,7 +4,7 @@ function(validate_schema file expected_result)
endif()
execute_process(
- COMMAND "${PYTHON_EXECUTABLE}" "${CMakePresets_VALIDATE_SCRIPT_PATH}" "${file}"
+ COMMAND "${Python_EXECUTABLE}" "${CMakePresets_VALIDATE_SCRIPT_PATH}" "${file}"
RESULT_VARIABLE _result
OUTPUT_VARIABLE _output
ERROR_VARIABLE _error
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index 68358347e2..8ac174759b 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -342,14 +342,14 @@ endfunction()
run_TestStdin()
function(show_only_json_check_python v)
- if(RunCMake_TEST_FAILED OR NOT PYTHON_EXECUTABLE)
+ if(RunCMake_TEST_FAILED OR NOT Python_EXECUTABLE)
return()
endif()
set(json_file "${RunCMake_TEST_BINARY_DIR}/ctest.json")
file(WRITE "${json_file}" "${actual_stdout}")
set(actual_stdout "" PARENT_SCOPE)
execute_process(
- COMMAND ${PYTHON_EXECUTABLE} "${RunCMake_SOURCE_DIR}/show-only_json-v${v}_check.py" "${json_file}"
+ COMMAND ${Python_EXECUTABLE} "${RunCMake_SOURCE_DIR}/show-only_json-v${v}_check.py" "${json_file}"
RESULT_VARIABLE result
OUTPUT_VARIABLE output
ERROR_VARIABLE output
diff --git a/Tests/RunCMake/CommandLine/trace-json-v1-check.cmake b/Tests/RunCMake/CommandLine/trace-json-v1-check.cmake
index 66af03966d..e9a4a5900f 100644
--- a/Tests/RunCMake/CommandLine/trace-json-v1-check.cmake
+++ b/Tests/RunCMake/CommandLine/trace-json-v1-check.cmake
@@ -1,6 +1,6 @@
-if(PYTHON_EXECUTABLE)
+if(Python_EXECUTABLE)
execute_process(
- COMMAND ${PYTHON_EXECUTABLE} "${RunCMake_SOURCE_DIR}/trace-json-v1-check.py" "${RunCMake_BINARY_DIR}/json-v1.trace"
+ COMMAND ${Python_EXECUTABLE} "${RunCMake_SOURCE_DIR}/trace-json-v1-check.py" "${RunCMake_BINARY_DIR}/json-v1.trace"
RESULT_VARIABLE result
OUTPUT_VARIABLE output
ERROR_VARIABLE output
diff --git a/Tests/RunCMake/CommandLine/trace-json-v1-expand-check.cmake b/Tests/RunCMake/CommandLine/trace-json-v1-expand-check.cmake
index 7916d2ea86..79079e182d 100644
--- a/Tests/RunCMake/CommandLine/trace-json-v1-expand-check.cmake
+++ b/Tests/RunCMake/CommandLine/trace-json-v1-expand-check.cmake
@@ -1,6 +1,6 @@
-if(PYTHON_EXECUTABLE)
+if(Python_EXECUTABLE)
execute_process(
- COMMAND ${PYTHON_EXECUTABLE} "${RunCMake_SOURCE_DIR}/trace-json-v1-check.py" --expand "${RunCMake_BINARY_DIR}/json-v1-expand.trace"
+ COMMAND ${Python_EXECUTABLE} "${RunCMake_SOURCE_DIR}/trace-json-v1-check.py" --expand "${RunCMake_BINARY_DIR}/json-v1-expand.trace"
RESULT_VARIABLE result
OUTPUT_VARIABLE output
ERROR_VARIABLE output
diff --git a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake
index ae3d179596..61dce17bd8 100644
--- a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake
@@ -18,12 +18,12 @@ in directory:
endfunction()
function(check_python case)
- if(RunCMake_TEST_FAILED OR NOT PYTHON_EXECUTABLE)
+ if(RunCMake_TEST_FAILED OR NOT Python_EXECUTABLE)
return()
endif()
file(GLOB index ${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/reply/index-*.json)
execute_process(
- COMMAND ${PYTHON_EXECUTABLE} "${RunCMake_SOURCE_DIR}/${case}-check.py" "${index}" "${CMAKE_CXX_COMPILER_ID}"
+ COMMAND ${Python_EXECUTABLE} "${RunCMake_SOURCE_DIR}/${case}-check.py" "${index}" "${CMAKE_CXX_COMPILER_ID}"
"${RunCMake_TEST_BINARY_DIR}"
RESULT_VARIABLE result
OUTPUT_VARIABLE output
diff --git a/Tests/RunCMake/execute_process/AnyCommandAbnormalExit.cmake b/Tests/RunCMake/execute_process/AnyCommandAbnormalExit.cmake
index 5ac0c21d09..1017e0f851 100644
--- a/Tests/RunCMake/execute_process/AnyCommandAbnormalExit.cmake
+++ b/Tests/RunCMake/execute_process/AnyCommandAbnormalExit.cmake
@@ -1,4 +1,4 @@
-execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c
+execute_process(COMMAND "${Python_EXECUTABLE}" -c
"import os; os.kill(os.getpid(),11)"
COMMAND ${CMAKE_COMMAND} -E true
COMMAND_ERROR_IS_FATAL ANY
diff --git a/Tests/RunCMake/execute_process/LastCommandAbnormalExit-1.cmake b/Tests/RunCMake/execute_process/LastCommandAbnormalExit-1.cmake
index 5a4574c378..e4a125d884 100644
--- a/Tests/RunCMake/execute_process/LastCommandAbnormalExit-1.cmake
+++ b/Tests/RunCMake/execute_process/LastCommandAbnormalExit-1.cmake
@@ -1,11 +1,11 @@
-execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c
+execute_process(COMMAND "${Python_EXECUTABLE}" -c
"import os; os.kill(os.getpid(),11)"
COMMAND ${CMAKE_COMMAND} -E true
RESULT_VARIABLE result
)
if(result EQUAL "0")
- execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c
+ execute_process(COMMAND "${Python_EXECUTABLE}" -c
"import os; os.kill(os.getpid(),11)"
COMMAND ${CMAKE_COMMAND} -E true
COMMAND_ERROR_IS_FATAL LAST
diff --git a/Tests/RunCMake/execute_process/LastCommandAbnormalExit-2.cmake b/Tests/RunCMake/execute_process/LastCommandAbnormalExit-2.cmake
index b87e0f7ba2..6c3fbf8b95 100644
--- a/Tests/RunCMake/execute_process/LastCommandAbnormalExit-2.cmake
+++ b/Tests/RunCMake/execute_process/LastCommandAbnormalExit-2.cmake
@@ -1,12 +1,12 @@
execute_process(COMMAND ${CMAKE_COMMAND} -E true
- COMMAND "${PYTHON_EXECUTABLE}" -c
+ COMMAND "${Python_EXECUTABLE}" -c
"import os; os.kill(os.getpid(),11)"
RESULT_VARIABLE result
)
if(NOT result EQUAL "0")
execute_process(COMMAND ${CMAKE_COMMAND} -E true
- COMMAND "${PYTHON_EXECUTABLE}" -c
+ COMMAND "${Python_EXECUTABLE}" -c
"import os; os.kill(os.getpid(),11)"
COMMAND_ERROR_IS_FATAL LAST
)
diff --git a/Tests/RunCMake/execute_process/RunCMakeTest.cmake b/Tests/RunCMake/execute_process/RunCMakeTest.cmake
index 35712f6a28..c2f914419d 100644
--- a/Tests/RunCMake/execute_process/RunCMakeTest.cmake
+++ b/Tests/RunCMake/execute_process/RunCMakeTest.cmake
@@ -35,8 +35,8 @@ run_cmake_command(LastCommandError ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/La
run_cmake_command(LastCommandTimeout ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/LastCommandTimeout.cmake)
run_cmake_command(LastCommandGood ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/LastCommandGood.cmake)
-if(UNIX AND PYTHON_EXECUTABLE)
- run_cmake_command(AnyCommandAbnormalExit ${CMAKE_COMMAND} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -P ${RunCMake_SOURCE_DIR}/AnyCommandAbnormalExit.cmake)
- run_cmake_command(LastCommandAbnormalExit-1 ${CMAKE_COMMAND} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -P ${RunCMake_SOURCE_DIR}/LastCommandAbnormalExit-1.cmake)
- run_cmake_command(LastCommandAbnormalExit-2 ${CMAKE_COMMAND} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -P ${RunCMake_SOURCE_DIR}/LastCommandAbnormalExit-2.cmake)
+if(UNIX AND Python_EXECUTABLE)
+ run_cmake_command(AnyCommandAbnormalExit ${CMAKE_COMMAND} -DPython_EXECUTABLE=${Python_EXECUTABLE} -P ${RunCMake_SOURCE_DIR}/AnyCommandAbnormalExit.cmake)
+ run_cmake_command(LastCommandAbnormalExit-1 ${CMAKE_COMMAND} -DPython_EXECUTABLE=${Python_EXECUTABLE} -P ${RunCMake_SOURCE_DIR}/LastCommandAbnormalExit-1.cmake)
+ run_cmake_command(LastCommandAbnormalExit-2 ${CMAKE_COMMAND} -DPython_EXECUTABLE=${Python_EXECUTABLE} -P ${RunCMake_SOURCE_DIR}/LastCommandAbnormalExit-2.cmake)
endif()
diff --git a/Tests/RunCMake/find_file/FromPATHEnvDebugVar-stderr.txt b/Tests/RunCMake/find_file/FromPATHEnvDebugVar-stderr.txt
index 38ed98c18a..edf2cabe72 100644
--- a/Tests/RunCMake/find_file/FromPATHEnvDebugVar-stderr.txt
+++ b/Tests/RunCMake/find_file/FromPATHEnvDebugVar-stderr.txt
@@ -8,6 +8,7 @@
CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 0
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 1
find_file considered the following locations:.*
The item was not found.*
@@ -21,5 +22,6 @@
CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 0
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 1
find_file considered the following locations:.*
diff --git a/Tests/RunCMake/find_file/PrefixInPATH-stderr.txt b/Tests/RunCMake/find_file/PrefixInPATH-stderr.txt
index 0d7757103b..93e625301d 100644
--- a/Tests/RunCMake/find_file/PrefixInPATH-stderr.txt
+++ b/Tests/RunCMake/find_file/PrefixInPATH-stderr.txt
@@ -8,6 +8,7 @@
CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 1
find_file considered the following locations:.*
.*include/PrefixInPATH.*
diff --git a/Tests/RunCMake/find_library/FromPATHEnv-stderr.txt b/Tests/RunCMake/find_library/FromPATHEnv-stderr.txt
index a690eecdc0..f367b3fffb 100644
--- a/Tests/RunCMake/find_library/FromPATHEnv-stderr.txt
+++ b/Tests/RunCMake/find_library/FromPATHEnv-stderr.txt
@@ -9,6 +9,7 @@
CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 0
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 1
find_library considered the following locations:.*
The item was not found.*
@@ -22,6 +23,7 @@
CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 1
find_library considered the following locations:.*
The item was found at.*
diff --git a/Tests/RunCMake/find_library/FromPATHEnvDebugVar-stderr.txt b/Tests/RunCMake/find_library/FromPATHEnvDebugVar-stderr.txt
index a690eecdc0..f367b3fffb 100644
--- a/Tests/RunCMake/find_library/FromPATHEnvDebugVar-stderr.txt
+++ b/Tests/RunCMake/find_library/FromPATHEnvDebugVar-stderr.txt
@@ -9,6 +9,7 @@
CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 0
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 1
find_library considered the following locations:.*
The item was not found.*
@@ -22,6 +23,7 @@
CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 1
find_library considered the following locations:.*
The item was found at.*
diff --git a/Tests/RunCMake/find_library/IgnoreInstallPrefix-stderr.txt b/Tests/RunCMake/find_library/IgnoreInstallPrefix-stderr.txt
new file mode 100644
index 0000000000..e977374e92
--- /dev/null
+++ b/Tests/RunCMake/find_library/IgnoreInstallPrefix-stderr.txt
@@ -0,0 +1,43 @@
+ find_library called with the following settings:.*
+ VAR: CREATED_LIBRARY
+ NAMES: \"created\"
+ Documentation.*
+ Framework.*
+ AppBundle.*
+ CMAKE_FIND_USE_CMAKE_PATH: 1
+ CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 0
+
+ find_library considered the following locations:.*
+ The item was not found.*
+ find_library called with the following settings:.*
+ VAR: CREATED_LIBRARY
+ NAMES: \"created\"
+ Documentation.*
+ Framework.*
+ AppBundle.*
+ CMAKE_FIND_USE_CMAKE_PATH: 1
+ CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 1
+
+ find_library considered the following locations:.*
+ The item was found at.*
+ .*IgnoreInstallPrefix-build/lib.*
+ find_library called with the following settings:.*
+ VAR: CREATED_LIBRARY
+ NAMES: \"created\"
+ Documentation.*
+ Framework.*
+ AppBundle.*
+ CMAKE_FIND_USE_CMAKE_PATH: 1
+ CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 0
+
+ find_library considered the following locations:.*
+ The item was not found.*
diff --git a/Tests/RunCMake/find_library/IgnoreInstallPrefix-stdout.txt b/Tests/RunCMake/find_library/IgnoreInstallPrefix-stdout.txt
new file mode 100644
index 0000000000..0c2824367b
--- /dev/null
+++ b/Tests/RunCMake/find_library/IgnoreInstallPrefix-stdout.txt
@@ -0,0 +1,3 @@
+-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND'
+-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/IgnoreInstallPrefix-build/lib/libcreated.a'
+-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND'
diff --git a/Tests/RunCMake/find_library/IgnoreInstallPrefix.cmake b/Tests/RunCMake/find_library/IgnoreInstallPrefix.cmake
new file mode 100644
index 0000000000..7ca8bcf9d1
--- /dev/null
+++ b/Tests/RunCMake/find_library/IgnoreInstallPrefix.cmake
@@ -0,0 +1,32 @@
+set(ENV_PATH "$ENV{PATH}")
+set(ENV_CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")
+set(ENV{PATH} "")
+set(ENV{CMAKE_PREFIX_PATH} "")
+
+list(APPEND CMAKE_FIND_LIBRARY_PREFIXES lib)
+list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .a)
+
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lib/libcreated.a" "created")
+
+set(CMAKE_FIND_DEBUG_MODE 1)
+set(CMAKE_FIND_USE_INSTALL_PREFIX OFF)
+
+find_library(CREATED_LIBRARY NAMES created)
+message(STATUS "CREATED_LIBRARY='${CREATED_LIBRARY}'")
+
+set(CMAKE_FIND_USE_INSTALL_PREFIX ON)
+find_library(CREATED_LIBRARY NAMES created)
+message(STATUS "CREATED_LIBRARY='${CREATED_LIBRARY}'")
+
+unset(CREATED_LIBRARY)
+unset(CREATED_LIBRARY CACHE)
+
+unset(CMAKE_FIND_USE_INSTALL_PREFIX)
+find_library(CREATED_LIBRARY NAMES created NO_CMAKE_INSTALL_PREFIX)
+message(STATUS "CREATED_LIBRARY='${CREATED_LIBRARY}'")
+
+set(CMAKE_FIND_DEBUG_MODE 0)
+
+set(ENV{PATH} "${ENV_PATH}")
+set(ENV{CMAKE_PREFIX_PATH} "${ENV_CMAKE_PREFIX_PATH}")
diff --git a/Tests/RunCMake/find_library/PrefixInPATH-stderr.txt b/Tests/RunCMake/find_library/PrefixInPATH-stderr.txt
index 1d24c84eac..899b471da2 100644
--- a/Tests/RunCMake/find_library/PrefixInPATH-stderr.txt
+++ b/Tests/RunCMake/find_library/PrefixInPATH-stderr.txt
@@ -8,6 +8,7 @@
CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 1
find_library considered the following locations:.*
.*/does_not_exist.*
diff --git a/Tests/RunCMake/find_library/RunCMakeTest.cmake b/Tests/RunCMake/find_library/RunCMakeTest.cmake
index eaaecf05b1..ef1ede60b9 100644
--- a/Tests/RunCMake/find_library/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_library/RunCMakeTest.cmake
@@ -3,6 +3,7 @@ include(RunCMake)
run_cmake(Created)
run_cmake(FromPrefixPath)
run_cmake(FromPATHEnv)
+run_cmake_with_options(IgnoreInstallPrefix "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/IgnoreInstallPrefix-build/")
if(UNIX AND NOT CYGWIN)
run_cmake(LibArchLink)
run_cmake(LibSymLink)
diff --git a/Tests/RunCMake/find_package/IgnoreInstallPrefix.cmake b/Tests/RunCMake/find_package/IgnoreInstallPrefix.cmake
new file mode 100644
index 0000000000..ee40d88b59
--- /dev/null
+++ b/Tests/RunCMake/find_package/IgnoreInstallPrefix.cmake
@@ -0,0 +1,17 @@
+
+find_package(Bar QUIET CONFIG NO_CMAKE_INSTALL_PREFIX)
+if(Bar_FOUND)
+ message(SEND_ERROR "Bar should not be found, was found in ${Bar_DIR}")
+endif()
+
+set(CMAKE_FIND_USE_INSTALL_PREFIX OFF)
+find_package(Bar QUIET CONFIG)
+if(Bar_FOUND)
+ message(SEND_ERROR "Bar should not be found, was found in ${Bar_DIR}")
+endif()
+
+set(CMAKE_FIND_USE_INSTALL_PREFIX ON)
+find_package(Bar QUIET CONFIG)
+if(NOT Bar_FOUND)
+ message(SEND_ERROR "Bar should be found via CMAKE_INSTALL_PREFIX")
+endif()
diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake
index 2b5fb1f797..b2d1bf689b 100644
--- a/Tests/RunCMake/find_package/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake
@@ -48,6 +48,7 @@ run_cmake(VersionRangeConfig2)
run_cmake(VersionRangeConfig02)
run_cmake(VersionRangeConfigStd)
run_cmake(VersionRangeConfigStd2)
+run_cmake_with_options(IgnoreInstallPrefix "-DCMAKE_INSTALL_PREFIX=${RunCMake_SOURCE_DIR}/PackageRoot/foo/cmake_root")
run_cmake(IgnorePath)
run_cmake(IgnorePrefixPath)
if(UNIX
diff --git a/Tests/RunCMake/find_path/FromPATHEnv-stderr.txt b/Tests/RunCMake/find_path/FromPATHEnv-stderr.txt
index 088efd559c..9340c7aa7a 100644
--- a/Tests/RunCMake/find_path/FromPATHEnv-stderr.txt
+++ b/Tests/RunCMake/find_path/FromPATHEnv-stderr.txt
@@ -8,6 +8,7 @@
CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 0
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 1
find_path considered the following locations:.*
The item was not found.*
@@ -21,6 +22,7 @@
CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 1
find_path considered the following locations:.*
The item was found at.*
diff --git a/Tests/RunCMake/find_path/FromPATHEnvDebugVar-stderr.txt b/Tests/RunCMake/find_path/FromPATHEnvDebugVar-stderr.txt
index 088efd559c..9340c7aa7a 100644
--- a/Tests/RunCMake/find_path/FromPATHEnvDebugVar-stderr.txt
+++ b/Tests/RunCMake/find_path/FromPATHEnvDebugVar-stderr.txt
@@ -8,6 +8,7 @@
CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 0
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 1
find_path considered the following locations:.*
The item was not found.*
@@ -21,6 +22,7 @@
CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 1
find_path considered the following locations:.*
The item was found at.*
diff --git a/Tests/RunCMake/find_program/EnvAndHints-stderr.txt b/Tests/RunCMake/find_program/EnvAndHints-stderr.txt
index 8951345ffd..83263e4294 100644
--- a/Tests/RunCMake/find_program/EnvAndHints-stderr.txt
+++ b/Tests/RunCMake/find_program/EnvAndHints-stderr.txt
@@ -8,6 +8,7 @@
CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 1
find_program considered the following locations:.*
The item was found at.*
@@ -23,6 +24,7 @@
CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 0
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 1
find_program considered the following locations:.*
The item was not found.*
diff --git a/Tests/RunCMake/find_program/EnvAndHintsDebugVar-stderr.txt b/Tests/RunCMake/find_program/EnvAndHintsDebugVar-stderr.txt
index 8951345ffd..83263e4294 100644
--- a/Tests/RunCMake/find_program/EnvAndHintsDebugVar-stderr.txt
+++ b/Tests/RunCMake/find_program/EnvAndHintsDebugVar-stderr.txt
@@ -8,6 +8,7 @@
CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 1
find_program considered the following locations:.*
The item was found at.*
@@ -23,6 +24,7 @@
CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 0
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+ CMAKE_FIND_USE_INSTALL_PREFIX: 1
find_program considered the following locations:.*
The item was not found.*
diff --git a/Tests/RunCMake/no_install_prefix/RunCMakeTest.cmake b/Tests/RunCMake/no_install_prefix/RunCMakeTest.cmake
index 292344999b..eb0ff233b5 100644
--- a/Tests/RunCMake/no_install_prefix/RunCMakeTest.cmake
+++ b/Tests/RunCMake/no_install_prefix/RunCMakeTest.cmake
@@ -11,5 +11,5 @@ run_cmake(with_install_prefix)
file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/prefix")
file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/prefix/NoPrefix")
file(WRITE "${RunCMake_BINARY_DIR}/prefix/NoPrefix/NoPrefixConfig.cmake" "")
-list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_FIND_NO_INSTALL_PREFIX=1")
+list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_FIND_NO_INSTALL_PREFIX=1" "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_BINARY_DIR}/prefix")
run_cmake(no_install_prefix)
diff --git a/Tests/RunCMake/no_install_prefix/do_test.cmake b/Tests/RunCMake/no_install_prefix/do_test.cmake
index 340c7dcc9e..ce94b50e20 100644
--- a/Tests/RunCMake/no_install_prefix/do_test.cmake
+++ b/Tests/RunCMake/no_install_prefix/do_test.cmake
@@ -1,2 +1,16 @@
+find_package(NoPrefix NO_CMAKE_INSTALL_PREFIX)
+if(NoPrefix_FOUND)
+ message(FATAL_ERROR "Should not find package when NO_CMAKE_INSTALL_PREFIX specified")
+endif()
+
+set(CMAKE_FIND_USE_INSTALL_PREFIX ON)
+find_package(NoPrefix)
+if(NOT NoPrefix_FOUND)
+ message(FATAL_ERROR "Should always find package when CMAKE_FIND_USE_INSTALL_PREFIX is enabled")
+endif()
+
+unset(CMAKE_FIND_USE_INSTALL_PREFIX)
+unset(NoPrefix_DIR CACHE)
+
find_package(NoPrefix REQUIRED)
diff --git a/Tests/RunCMake/no_install_prefix/no_install_prefix-stderr.txt b/Tests/RunCMake/no_install_prefix/no_install_prefix-stderr.txt
index 66c624123c..52bd094ac7 100644
--- a/Tests/RunCMake/no_install_prefix/no_install_prefix-stderr.txt
+++ b/Tests/RunCMake/no_install_prefix/no_install_prefix-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at do_test.cmake:2 \(find_package\):
+CMake Error at do_test.cmake:16 \(find_package\):
By not providing "FindNoPrefix.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "NoPrefix",
but CMake did not find one.
diff --git a/Utilities/Release/win/x86/cache-i386.txt b/Utilities/Release/win/x86/cache-i386.txt
index 31c89ce56e..7f58fdd5af 100644
--- a/Utilities/Release/win/x86/cache-i386.txt
+++ b/Utilities/Release/win/x86/cache-i386.txt
@@ -19,7 +19,7 @@ CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES:STRING=c:/qt-i386/plugins/pl
# Build documentation.
CMAKE_DOC_DIR:STRING=doc/cmake
-PYTHON_EXECUTABLE:FILEPATH=C:/python3/python.exe
+Python_EXECUTABLE:FILEPATH=C:/python3/python.exe
SPHINX_EXECUTABLE:FILEPATH=C:/python3/Scripts/sphinx-build.exe
SPHINX_HTML:BOOL=ON
SPHINX_MAN:BOOL=ON
diff --git a/Utilities/Release/win/x86/cache-x86_64.txt b/Utilities/Release/win/x86/cache-x86_64.txt
index b1e8dc1436..d034640034 100644
--- a/Utilities/Release/win/x86/cache-x86_64.txt
+++ b/Utilities/Release/win/x86/cache-x86_64.txt
@@ -19,7 +19,7 @@ CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES:STRING=c:/qt-x86_64/plugins/
# Build documentation.
CMAKE_DOC_DIR:STRING=doc/cmake
-PYTHON_EXECUTABLE:FILEPATH=C:/python3/python.exe
+Python_EXECUTABLE:FILEPATH=C:/python3/python.exe
SPHINX_EXECUTABLE:FILEPATH=C:/python3/Scripts/sphinx-build.exe
SPHINX_HTML:BOOL=ON
SPHINX_MAN:BOOL=ON
diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt
index 1259748660..c698e3b475 100644
--- a/Utilities/Sphinx/CMakeLists.txt
+++ b/Utilities/Sphinx/CMakeLists.txt
@@ -101,7 +101,7 @@ if(SPHINX_INFO)
)
endif()
if(SPHINX_QTHELP)
- find_package(PythonInterp REQUIRED)
+ find_package(Python REQUIRED)
find_program(QHELPGENERATOR_EXECUTABLE
NAMES qhelpgenerator-qt5 qhelpgenerator
@@ -124,7 +124,7 @@ if(SPHINX_QTHELP)
# Create proper identifiers. Workaround for
# https://bitbucket.org/birkenfeld/sphinx/issue/1491/qthelp-should-generate-identifiers-for
- COMMAND "${PYTHON_EXECUTABLE}"
+ COMMAND "${Python_EXECUTABLE}"
"${CMAKE_CURRENT_SOURCE_DIR}/create_identifiers.py"
"${CMAKE_CURRENT_BINARY_DIR}/qthelp/"