Merge topic 'fix-tests-in-usr-local'
d430cb7c
Tests: Fix failures when running under the default install prefix (#15566)332ee3e3
Tests: Fix CheckSourceTree test when build is under source (#15566)
This commit is contained in:
commit
e0a2be659f
|
@ -16,8 +16,13 @@ string(REPLACE "\\" "\\\\" HOME "${HOME}")
|
|||
# (i.e. - is it an "in source" build?)
|
||||
#
|
||||
set(in_source_build 0)
|
||||
set(build_under_source 0)
|
||||
|
||||
if(CMake_SOURCE_DIR STREQUAL "${CMake_BINARY_DIR}")
|
||||
string(FIND "${CMake_BINARY_DIR}" "${CMake_SOURCE_DIR}/" pos)
|
||||
if(pos EQUAL 0)
|
||||
message("build dir is *inside* source dir")
|
||||
set(build_under_source 1)
|
||||
elseif(CMake_SOURCE_DIR STREQUAL "${CMake_BINARY_DIR}")
|
||||
message("build dir *is* source dir")
|
||||
set(in_source_build 1)
|
||||
else()
|
||||
|
@ -39,8 +44,13 @@ message("bin_len='${bin_len}'")
|
|||
message("substr_len='${substr_len}'")
|
||||
message("bin_dir='${bin_dir}'")
|
||||
message("in_source_build='${in_source_build}'")
|
||||
message("build_under_source='${build_under_source}'")
|
||||
message("")
|
||||
|
||||
if(build_under_source)
|
||||
message(STATUS "Skipping rest of test because build tree is under source tree")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# If this does not appear to be a git checkout, just pass the test here
|
||||
# and now. (Do not let the test fail if it is run in a tree *exported* from a
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
cmake_minimum_required (VERSION 2.6)
|
||||
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})
|
||||
|
||||
# Look for a package which uses FindPackageHandleStandardArgs.cmake with the
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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-NEW)
|
||||
run_cmake(CMP0041-WARN)
|
||||
|
|
|
@ -6,6 +6,9 @@ macro(run_cmake test)
|
|||
_run_cmake(${test})
|
||||
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(RelativePathInGenex)
|
||||
run_cmake(export-NOWARN)
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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(DebugIncludes)
|
||||
run_cmake(TID-bad-target)
|
||||
|
|
Loading…
Reference in New Issue