summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-09-01 20:33:24 (GMT)
committerBrad King <brad.king@kitware.com>2015-09-02 14:17:22 (GMT)
commitfdbfc9f6777696bdba60feafb9bb9a2f3fe02828 (patch)
tree42658d535a1a57f0e2c6996e64daf8fce558c3f3
parent907a919be15e262eee75c10d06ce314e912abdbe (diff)
downloadCMake-fdbfc9f6777696bdba60feafb9bb9a2f3fe02828.zip
CMake-fdbfc9f6777696bdba60feafb9bb9a2f3fe02828.tar.gz
CMake-fdbfc9f6777696bdba60feafb9bb9a2f3fe02828.tar.bz2
Tests: Add explicit testing for find_program
Previously this command was tested only implicitly as part of larger tests. Add a RunCMake.find_program test to cover find_program cases specifically and independently.
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rwxr-xr-xTests/RunCMake/find_program/A/testA1
-rwxr-xr-xTests/RunCMake/find_program/B/testB1
-rw-r--r--Tests/RunCMake/find_program/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/find_program/DirsPerName-stdout.txt1
-rw-r--r--Tests/RunCMake/find_program/DirsPerName.cmake6
-rw-r--r--Tests/RunCMake/find_program/RunCMakeTest.cmake8
-rwxr-xr-xTests/RunCMake/find_program/Win/testCom.com0
-rwxr-xr-xTests/RunCMake/find_program/Win/testCom.exe0
-rwxr-xr-xTests/RunCMake/find_program/Win/testExe.exe0
-rw-r--r--Tests/RunCMake/find_program/WindowsCom-stdout.txt1
-rw-r--r--Tests/RunCMake/find_program/WindowsCom.cmake6
-rw-r--r--Tests/RunCMake/find_program/WindowsExe-stdout.txt1
-rw-r--r--Tests/RunCMake/find_program/WindowsExe.cmake6
14 files changed, 35 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 2955db2..5bc9af8 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -183,6 +183,7 @@ add_RunCMake_test(find_file)
add_RunCMake_test(find_library)
add_RunCMake_test(find_package)
add_RunCMake_test(find_path)
+add_RunCMake_test(find_program -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
add_RunCMake_test(get_filename_component)
add_RunCMake_test(get_property)
add_RunCMake_test(if)
diff --git a/Tests/RunCMake/find_program/A/testA b/Tests/RunCMake/find_program/A/testA
new file mode 100755
index 0000000..1a24852
--- /dev/null
+++ b/Tests/RunCMake/find_program/A/testA
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/Tests/RunCMake/find_program/B/testB b/Tests/RunCMake/find_program/B/testB
new file mode 100755
index 0000000..1a24852
--- /dev/null
+++ b/Tests/RunCMake/find_program/B/testB
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/Tests/RunCMake/find_program/CMakeLists.txt b/Tests/RunCMake/find_program/CMakeLists.txt
new file mode 100644
index 0000000..74b3ff8
--- /dev/null
+++ b/Tests/RunCMake/find_program/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.3)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/find_program/DirsPerName-stdout.txt b/Tests/RunCMake/find_program/DirsPerName-stdout.txt
new file mode 100644
index 0000000..f763bb0
--- /dev/null
+++ b/Tests/RunCMake/find_program/DirsPerName-stdout.txt
@@ -0,0 +1 @@
+-- PROG='[^']*/Tests/RunCMake/find_program/B/testB'
diff --git a/Tests/RunCMake/find_program/DirsPerName.cmake b/Tests/RunCMake/find_program/DirsPerName.cmake
new file mode 100644
index 0000000..54db6dd
--- /dev/null
+++ b/Tests/RunCMake/find_program/DirsPerName.cmake
@@ -0,0 +1,6 @@
+find_program(PROG
+ NAMES testB testA
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG='${PROG}'")
diff --git a/Tests/RunCMake/find_program/RunCMakeTest.cmake b/Tests/RunCMake/find_program/RunCMakeTest.cmake
new file mode 100644
index 0000000..1a99f0a
--- /dev/null
+++ b/Tests/RunCMake/find_program/RunCMakeTest.cmake
@@ -0,0 +1,8 @@
+include(RunCMake)
+
+run_cmake(DirsPerName)
+
+if(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN)$")
+ run_cmake(WindowsCom)
+ run_cmake(WindowsExe)
+endif()
diff --git a/Tests/RunCMake/find_program/Win/testCom.com b/Tests/RunCMake/find_program/Win/testCom.com
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_program/Win/testCom.com
diff --git a/Tests/RunCMake/find_program/Win/testCom.exe b/Tests/RunCMake/find_program/Win/testCom.exe
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_program/Win/testCom.exe
diff --git a/Tests/RunCMake/find_program/Win/testExe.exe b/Tests/RunCMake/find_program/Win/testExe.exe
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_program/Win/testExe.exe
diff --git a/Tests/RunCMake/find_program/WindowsCom-stdout.txt b/Tests/RunCMake/find_program/WindowsCom-stdout.txt
new file mode 100644
index 0000000..e386fce
--- /dev/null
+++ b/Tests/RunCMake/find_program/WindowsCom-stdout.txt
@@ -0,0 +1 @@
+-- PROG='[^']*/Tests/RunCMake/find_program/Win/testCom.com'
diff --git a/Tests/RunCMake/find_program/WindowsCom.cmake b/Tests/RunCMake/find_program/WindowsCom.cmake
new file mode 100644
index 0000000..b32d9e8
--- /dev/null
+++ b/Tests/RunCMake/find_program/WindowsCom.cmake
@@ -0,0 +1,6 @@
+find_program(PROG
+ NAMES testCom
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/Win
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG='${PROG}'")
diff --git a/Tests/RunCMake/find_program/WindowsExe-stdout.txt b/Tests/RunCMake/find_program/WindowsExe-stdout.txt
new file mode 100644
index 0000000..bdf48aa
--- /dev/null
+++ b/Tests/RunCMake/find_program/WindowsExe-stdout.txt
@@ -0,0 +1 @@
+-- PROG='[^']*/Tests/RunCMake/find_program/Win/testExe.exe'
diff --git a/Tests/RunCMake/find_program/WindowsExe.cmake b/Tests/RunCMake/find_program/WindowsExe.cmake
new file mode 100644
index 0000000..3a336ec
--- /dev/null
+++ b/Tests/RunCMake/find_program/WindowsExe.cmake
@@ -0,0 +1,6 @@
+find_program(PROG
+ NAMES testExe
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/Win
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG='${PROG}'")