summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeOnly
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-11-26 22:01:43 (GMT)
committerBrad King <brad.king@kitware.com>2012-11-26 22:06:12 (GMT)
commitda1d9bac63d486d430b0c61ee8d3928f8d09ab26 (patch)
treee89bb2df1fda4ba9c6053cf5e7963cb21f74b587 /Tests/CMakeOnly
parentb96f6fc2aabed8a77cd45c0f87af7abb6a687576 (diff)
downloadCMake-da1d9bac63d486d430b0c61ee8d3928f8d09ab26.zip
CMake-da1d9bac63d486d430b0c61ee8d3928f8d09ab26.tar.gz
CMake-da1d9bac63d486d430b0c61ee8d3928f8d09ab26.tar.bz2
Test find_path multiarch support (#13742)
Diffstat (limited to 'Tests/CMakeOnly')
-rw-r--r--Tests/CMakeOnly/CMakeLists.txt1
-rw-r--r--Tests/CMakeOnly/find_path/CMakeLists.txt31
-rw-r--r--Tests/CMakeOnly/find_path/include/arch/test1arch.h0
-rw-r--r--Tests/CMakeOnly/find_path/include/test1.h0
4 files changed, 32 insertions, 0 deletions
diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt
index 1b4ebc4..be7ddbc 100644
--- a/Tests/CMakeOnly/CMakeLists.txt
+++ b/Tests/CMakeOnly/CMakeLists.txt
@@ -32,6 +32,7 @@ add_CMakeOnly_test(SelectLibraryConfigurations)
add_CMakeOnly_test(TargetScope)
add_CMakeOnly_test(find_library)
+add_CMakeOnly_test(find_path)
add_test(CMakeOnly.ProjectInclude ${CMAKE_CMAKE_COMMAND}
-DTEST=ProjectInclude
diff --git a/Tests/CMakeOnly/find_path/CMakeLists.txt b/Tests/CMakeOnly/find_path/CMakeLists.txt
new file mode 100644
index 0000000..0e64ed4
--- /dev/null
+++ b/Tests/CMakeOnly/find_path/CMakeLists.txt
@@ -0,0 +1,31 @@
+cmake_minimum_required(VERSION 2.8)
+project(FindPathTest NONE)
+
+set(CMAKE_FIND_DEBUG_MODE 1)
+
+macro(test_find_path expected)
+ unset(HDR CACHE)
+ find_path(HDR ${ARGN}
+ NO_CMAKE_ENVIRONMENT_PATH
+ NO_SYSTEM_ENVIRONMENT_PATH
+ )
+ if(HDR)
+ # Convert to relative path for comparison to expected location.
+ file(RELATIVE_PATH REL_HDR "${CMAKE_CURRENT_SOURCE_DIR}" "${HDR}")
+
+ # Check and report failure.
+ if(NOT "${REL_HDR}" STREQUAL "${expected}")
+ message(SEND_ERROR "Header ${expected} found as [${REL_HDR}]")
+ elseif(CMAKE_FIND_DEBUG_MODE)
+ message(STATUS "Header ${expected} found as [${REL_HDR}]")
+ endif()
+ else()
+ message(SEND_ERROR "Header ${expected} NOT FOUND")
+ endif()
+endmacro()
+
+set(CMAKE_SYSTEM_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+set(CMAKE_LIBRARY_ARCHITECTURE arch)
+
+test_find_path(include NAMES test1.h)
+test_find_path(include/arch NAMES test1arch.h)
diff --git a/Tests/CMakeOnly/find_path/include/arch/test1arch.h b/Tests/CMakeOnly/find_path/include/arch/test1arch.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/CMakeOnly/find_path/include/arch/test1arch.h
diff --git a/Tests/CMakeOnly/find_path/include/test1.h b/Tests/CMakeOnly/find_path/include/test1.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/CMakeOnly/find_path/include/test1.h