CMake/Tests/RunCMake/no_install_prefix/RunCMakeTest.cmake
Stephen Kelly fe057ab3cd Allow disabling adding the install prefix to the prefix search path.
In certain scenarios, it is preferable to keep a 'dirty' install prefix
than to clear it, and to expect that content will not be found there.
Add a CMAKE_FIND_NO_INSTALL_PREFIX variable that can be set to disable
searching the install prefix.
2013-10-31 16:40:24 +01:00

16 lines
704 B
CMake

include(RunCMake)
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/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" "")
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_BINARY_DIR}/prefix")
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")
run_cmake(no_install_prefix)