diff options
author | Brad King <brad.king@kitware.com> | 2008-06-09 19:09:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-06-09 19:09:14 (GMT) |
commit | fdb17d604cd8e353bfedcc256be2bf12f2071ded (patch) | |
tree | 192709e4f8ca236eef841bcf596355db0344b4e8 /Tests/CMakeTests | |
parent | 5b406c9044772ab56632edf6824759210c28f1c4 (diff) | |
download | CMake-fdb17d604cd8e353bfedcc256be2bf12f2071ded.zip CMake-fdb17d604cd8e353bfedcc256be2bf12f2071ded.tar.gz CMake-fdb17d604cd8e353bfedcc256be2bf12f2071ded.tar.bz2 |
ENH: Add test for new find_* command HINTS option.
Diffstat (limited to 'Tests/CMakeTests')
-rw-r--r-- | Tests/CMakeTests/A/include/cmake_i_do_not_exist_in_the_system.h | 1 | ||||
-rw-r--r-- | Tests/CMakeTests/FindBaseTest.cmake.in | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/Tests/CMakeTests/A/include/cmake_i_do_not_exist_in_the_system.h b/Tests/CMakeTests/A/include/cmake_i_do_not_exist_in_the_system.h new file mode 100644 index 0000000..2392aee --- /dev/null +++ b/Tests/CMakeTests/A/include/cmake_i_do_not_exist_in_the_system.h @@ -0,0 +1 @@ +/* empty header file */ diff --git a/Tests/CMakeTests/FindBaseTest.cmake.in b/Tests/CMakeTests/FindBaseTest.cmake.in index fff6d49..02f7001 100644 --- a/Tests/CMakeTests/FindBaseTest.cmake.in +++ b/Tests/CMakeTests/FindBaseTest.cmake.in @@ -6,6 +6,7 @@ get_filename_component(MY_SOURCE_DIR "${MY_SOURCE_DIR}" ABSOLUTE) set(_HEADER cmake_i_do_not_exist_in_the_system.h) set(_HEADER_FULL "${MY_SOURCE_DIR}/include/${_HEADER}") +set(_HEADER_FULL_A "${MY_SOURCE_DIR}/A/include/${_HEADER}") # at first check that the header isn't found without special measures find_file(FOO_H_1 ${_HEADER}) @@ -13,6 +14,19 @@ if(FOO_H_1) message(FATAL_ERROR "${_HEADER} found: ${FOO_H_1}, it should not exist !") endif(FOO_H_1) +# The HINTS option should override the system but the PATHS option +# should not. +set(CMAKE_SYSTEM_PREFIX_PATH ${MY_SOURCE_DIR}) +find_file(TEST_H_1 ${_HEADER} HINTS ${MY_SOURCE_DIR}/A/include) +find_file(TEST_H_2 ${_HEADER} PATHS ${MY_SOURCE_DIR}/A/include) +if(NOT "${TEST_H_1}" STREQUAL "${_HEADER_FULL_A}") + message(FATAL_ERROR "Did not find \"${_HEADER_FULL_A}\"\ngot \"${TEST_H_1}\" instead!") +endif(NOT "${TEST_H_1}" STREQUAL "${_HEADER_FULL_A}") +if(NOT "${TEST_H_2}" STREQUAL "${_HEADER_FULL}") + message(FATAL_ERROR "Did not find \"${_HEADER_FULL}\"\ngot \"${TEST_H_2}\" instead!") +endif(NOT "${TEST_H_2}" STREQUAL "${_HEADER_FULL}") +set(CMAKE_SYSTEM_PREFIX_PATH) + # with this it still should not be found, since the include/ subdir is still missing set(CMAKE_INCLUDE_PATH "${MY_SOURCE_DIR}") find_file(FOO_H_2 ${_HEADER}) |