Tests: Fix failures when running under the default install prefix (#15566)
Fix test cases whose behavior differs when their source or build tree is under CMAKE_INSTALL_PREFIX by setting an install prefix under the build tree. Otherwise they may fail when run under the default install prefix (e.g. /usr/local).
This commit is contained in:
parent
332ee3e305
commit
d430cb7c36
|
@ -1,6 +1,9 @@
|
||||||
cmake_minimum_required (VERSION 2.6)
|
cmake_minimum_required (VERSION 2.6)
|
||||||
project(FindPackageTest)
|
project(FindPackageTest)
|
||||||
|
|
||||||
|
# Protect tests from running inside the default install prefix.
|
||||||
|
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/NotDefaultPrefix")
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
# Look for a package which uses FindPackageHandleStandardArgs.cmake with the
|
# Look for a package which uses FindPackageHandleStandardArgs.cmake with the
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
include(RunCMake)
|
include(RunCMake)
|
||||||
|
|
||||||
|
# Protect tests from running inside the default install prefix.
|
||||||
|
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/NotDefaultPrefix")
|
||||||
|
|
||||||
run_cmake(CMP0041-OLD)
|
run_cmake(CMP0041-OLD)
|
||||||
run_cmake(CMP0041-NEW)
|
run_cmake(CMP0041-NEW)
|
||||||
run_cmake(CMP0041-WARN)
|
run_cmake(CMP0041-WARN)
|
||||||
|
|
|
@ -6,6 +6,9 @@ macro(run_cmake test)
|
||||||
_run_cmake(${test})
|
_run_cmake(${test})
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
# Protect tests from running inside the default install prefix.
|
||||||
|
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/NotDefaultPrefix")
|
||||||
|
|
||||||
run_cmake(RelativePathInInterface)
|
run_cmake(RelativePathInInterface)
|
||||||
run_cmake(RelativePathInGenex)
|
run_cmake(RelativePathInGenex)
|
||||||
run_cmake(export-NOWARN)
|
run_cmake(export-NOWARN)
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
include(RunCMake)
|
include(RunCMake)
|
||||||
|
|
||||||
|
# Protect tests from running inside the default install prefix.
|
||||||
|
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/NotDefaultPrefix")
|
||||||
|
|
||||||
run_cmake(NotFoundContent)
|
run_cmake(NotFoundContent)
|
||||||
run_cmake(DebugIncludes)
|
run_cmake(DebugIncludes)
|
||||||
run_cmake(TID-bad-target)
|
run_cmake(TID-bad-target)
|
||||||
|
|
Loading…
Reference in New Issue