summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-12-07 14:22:56 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-12-07 14:22:56 (GMT)
commit128d569af02d95e455b5ee1d8dddec07251b7033 (patch)
tree3e8985cf80c3363beedbc8d9de32a266a93a0c3e /Tests
parentd9bbc8f02b8374d258c254b2e105b951620d795a (diff)
parentebaca6290d2c0be7dec22452389632949a700d28 (diff)
downloadCMake-128d569af02d95e455b5ee1d8dddec07251b7033.zip
CMake-128d569af02d95e455b5ee1d8dddec07251b7033.tar.gz
CMake-128d569af02d95e455b5ee1d8dddec07251b7033.tar.bz2
Merge topic 'FindTIFF-imported-targets'
ebaca629 FindTIFF: Add imported targets and update documentation
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt4
-rw-r--r--Tests/FindTIFF/CMakeLists.txt10
-rw-r--r--Tests/FindTIFF/Test/CMakeLists.txt17
-rw-r--r--Tests/FindTIFF/Test/main.c12
4 files changed, 43 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 509c7ee..5d492cf 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1370,6 +1370,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
add_subdirectory(FindOpenSSL)
endif()
+ if(CMake_TEST_FindTIFF)
+ add_subdirectory(FindTIFF)
+ endif()
+
if(CMake_TEST_FindXercesC)
add_subdirectory(FindXercesC)
endif()
diff --git a/Tests/FindTIFF/CMakeLists.txt b/Tests/FindTIFF/CMakeLists.txt
new file mode 100644
index 0000000..c4e0c6a
--- /dev/null
+++ b/Tests/FindTIFF/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindTIFF.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindTIFF/Test"
+ "${CMake_BINARY_DIR}/Tests/FindTIFF/Test"
+ ${build_generator_args}
+ --build-project TestFindTIFF
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindTIFF/Test/CMakeLists.txt b/Tests/FindTIFF/Test/CMakeLists.txt
new file mode 100644
index 0000000..f17cda7
--- /dev/null
+++ b/Tests/FindTIFF/Test/CMakeLists.txt
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 3.1)
+project(TestFindTIFF C)
+include(CTest)
+
+# CMake does not actually provide FindTIFF publicly.
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules)
+
+find_package(TIFF REQUIRED)
+
+add_executable(test_xercesc_tgt main.c)
+target_link_libraries(test_xercesc_tgt TIFF::TIFF)
+add_test(NAME test_xercesc_tgt COMMAND test_xercesc_tgt)
+
+add_executable(test_xercesc_var main.c)
+target_include_directories(test_xercesc_var PRIVATE ${TIFF_INCLUDE_DIRS})
+target_link_libraries(test_xercesc_var PRIVATE ${TIFF_LIBRARIES})
+add_test(NAME test_xercesc_var COMMAND test_xercesc_var)
diff --git a/Tests/FindTIFF/Test/main.c b/Tests/FindTIFF/Test/main.c
new file mode 100644
index 0000000..fc4f337
--- /dev/null
+++ b/Tests/FindTIFF/Test/main.c
@@ -0,0 +1,12 @@
+#include <assert.h>
+#include <tiffio.h>
+
+int main()
+{
+ /* Without any TIFF file to open, test that the call fails as
+ expected. This tests that linking worked. */
+ TIFF *tiff = TIFFOpen("invalid.tiff", "r");
+ assert(!tiff);
+
+ return 0;
+}