summaryrefslogtreecommitdiff
path: root/Tests/CMakeOnly/find_path
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2013-08-13 07:48:01 -0400
committerAnas Nashif <anas.nashif@intel.com>2013-08-13 07:48:01 -0400
commit297c63fa65327491a2b50e521b661c5835a19fe4 (patch)
treecf30d58014e240eb5e4417727d8f137cdbe75828 /Tests/CMakeOnly/find_path
parentef8aa19c33e83ff019595fd7f8fdc29c35c336a3 (diff)
downloadcmake-297c63fa65327491a2b50e521b661c5835a19fe4.tar.gz
cmake-297c63fa65327491a2b50e521b661c5835a19fe4.tar.bz2
cmake-297c63fa65327491a2b50e521b661c5835a19fe4.zip
Imported Upstream version 2.8.11.2upstream/2.8.11.2sandbox/pcoval/previous/upstream
Diffstat (limited to 'Tests/CMakeOnly/find_path')
-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
3 files changed, 31 insertions, 0 deletions
diff --git a/Tests/CMakeOnly/find_path/CMakeLists.txt b/Tests/CMakeOnly/find_path/CMakeLists.txt
new file mode 100644
index 000000000..0e64ed467
--- /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 000000000..e69de29bb
--- /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 000000000..e69de29bb
--- /dev/null
+++ b/Tests/CMakeOnly/find_path/include/test1.h