summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-04-22 12:58:59 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-04-22 12:59:09 (GMT)
commit1bd85e8f3f57d4c279dcd2a3ea4c24a0cf3c5f58 (patch)
tree54736201fe3a5d967355197eb836a21f23d1ea5c /Tests
parent5e9c3e2f0734097aa7820a212723f8ef1ecb27a3 (diff)
parent42f7e397894c5132b4706f478e62ce5d648119c1 (diff)
downloadCMake-1bd85e8f3f57d4c279dcd2a3ea4c24a0cf3c5f58.zip
CMake-1bd85e8f3f57d4c279dcd2a3ea4c24a0cf3c5f58.tar.gz
CMake-1bd85e8f3f57d4c279dcd2a3ea4c24a0cf3c5f58.tar.bz2
Merge topic 'NO_CMAKE_INSTALL_PREFIX'
42f7e39789 Find: Support per call disabling of CMAKE_INSTALL_PREFIX Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7163
Diffstat (limited to 'Tests')
-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
18 files changed, 129 insertions, 2 deletions
diff --git a/Tests/RunCMake/find_file/FromPATHEnvDebugVar-stderr.txt b/Tests/RunCMake/find_file/FromPATHEnvDebugVar-stderr.txt
index 38ed98c..edf2cab 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 0d77571..93e6253 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 a690eec..f367b3f 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 a690eec..f367b3f 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 0000000..e977374
--- /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 0000000..0c28243
--- /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 0000000..7ca8bcf
--- /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 1d24c84..899b471 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 eaaecf0..ef1ede6 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 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
diff --git a/Tests/RunCMake/find_path/FromPATHEnv-stderr.txt b/Tests/RunCMake/find_path/FromPATHEnv-stderr.txt
index 088efd5..9340c7a 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 088efd5..9340c7a 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 8951345..83263e4 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 8951345..83263e4 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 2923449..eb0ff23 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 340c7dc..ce94b50 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 66c6241..52bd094 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.