summaryrefslogtreecommitdiffstats
path: root/Tests/FindTIFF/Test
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@codelibre.net>2015-12-02 17:20:24 (GMT)
committerBrad King <brad.king@kitware.com>2015-12-07 14:20:08 (GMT)
commitebaca6290d2c0be7dec22452389632949a700d28 (patch)
tree52e2bc935c10f90e5eb61c12031335502e5ca9b0 /Tests/FindTIFF/Test
parent4ffeab0e3c451854a4a9d424b47b2179c6cf6c6b (diff)
downloadCMake-ebaca6290d2c0be7dec22452389632949a700d28.zip
CMake-ebaca6290d2c0be7dec22452389632949a700d28.tar.gz
CMake-ebaca6290d2c0be7dec22452389632949a700d28.tar.bz2
FindTIFF: Add imported targets and update documentation
- Add TIFF::TIFF imported target - Document imported target - Add testcase to test the standard variables and the imported target Also: - Add TIFF_INCLUDE_DIRS to match common practice - Update documentation generally, including documenting TIFF_INCLUDE_DIRS
Diffstat (limited to 'Tests/FindTIFF/Test')
-rw-r--r--Tests/FindTIFF/Test/CMakeLists.txt17
-rw-r--r--Tests/FindTIFF/Test/main.c12
2 files changed, 29 insertions, 0 deletions
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;
+}