diff options
author | Robert Maynard <rmaynard@nvidia.com> | 2022-03-21 19:05:39 (GMT) |
---|---|---|
committer | Robert Maynard <rmaynard@nvidia.com> | 2022-04-15 13:33:55 (GMT) |
commit | 42f7e397894c5132b4706f478e62ce5d648119c1 (patch) | |
tree | cbc53e9c4fad5d12e3c724011770a377fc572890 /Tests/RunCMake/find_package | |
parent | 7fc248bde34c529c6f1312a56c7e82303238b9c1 (diff) | |
download | CMake-42f7e397894c5132b4706f478e62ce5d648119c1.zip CMake-42f7e397894c5132b4706f478e62ce5d648119c1.tar.gz CMake-42f7e397894c5132b4706f478e62ce5d648119c1.tar.bz2 |
Find: Support per call disabling of CMAKE_INSTALL_PREFIX
Fixes #23359
Diffstat (limited to 'Tests/RunCMake/find_package')
-rw-r--r-- | Tests/RunCMake/find_package/IgnoreInstallPrefix.cmake | 17 | ||||
-rw-r--r-- | Tests/RunCMake/find_package/RunCMakeTest.cmake | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/Tests/RunCMake/find_package/IgnoreInstallPrefix.cmake b/Tests/RunCMake/find_package/IgnoreInstallPrefix.cmake new file mode 100644 index 0000000..ee40d88 --- /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 2b5fb1f..b2d1bf6 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 |