summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-07-01 11:02:01 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-07-01 11:02:09 (GMT)
commit57ea0012477828d0f2d34dde994ec6fa18cdd7a1 (patch)
tree807817363d75d2228a8445e2d2f7f354376bbf8f /Tests
parentd8f9fb9c92584bfbd19998acab84743e8678a94d (diff)
parenta468cc431cf910a95d839594a2916a25165023e1 (diff)
downloadCMake-57ea0012477828d0f2d34dde994ec6fa18cdd7a1.zip
CMake-57ea0012477828d0f2d34dde994ec6fa18cdd7a1.tar.gz
CMake-57ea0012477828d0f2d34dde994ec6fa18cdd7a1.tar.bz2
Merge topic 'FindTIFF-tiffxx'
a468cc431c FindTIFF: add component CXX to include the C++ wrapper libtiffxx Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4934
Diffstat (limited to 'Tests')
-rw-r--r--Tests/FindTIFF/Test/CMakeLists.txt13
-rw-r--r--Tests/FindTIFF/Test/main.cxx16
2 files changed, 27 insertions, 2 deletions
diff --git a/Tests/FindTIFF/Test/CMakeLists.txt b/Tests/FindTIFF/Test/CMakeLists.txt
index 85453ed..e235db3 100644
--- a/Tests/FindTIFF/Test/CMakeLists.txt
+++ b/Tests/FindTIFF/Test/CMakeLists.txt
@@ -1,14 +1,23 @@
cmake_minimum_required(VERSION 3.1)
-project(TestFindTIFF C)
+project(TestFindTIFF)
include(CTest)
-find_package(TIFF REQUIRED)
+find_package(TIFF REQUIRED COMPONENTS CXX)
add_executable(test_tiff_tgt main.c)
target_link_libraries(test_tiff_tgt TIFF::TIFF)
add_test(NAME test_tiff_tgt COMMAND test_tiff_tgt)
+add_executable(test_tiffxx_tgt main.cxx)
+target_link_libraries(test_tiffxx_tgt TIFF::CXX)
+add_test(NAME test_tiffxx_tgt COMMAND test_tiffxx_tgt)
+
add_executable(test_tiff_var main.c)
target_include_directories(test_tiff_var PRIVATE ${TIFF_INCLUDE_DIRS})
target_link_libraries(test_tiff_var PRIVATE ${TIFF_LIBRARIES})
add_test(NAME test_tiff_var COMMAND test_tiff_var)
+
+add_executable(test_tiffxx_var main.cxx)
+target_include_directories(test_tiffxx_var PRIVATE ${TIFF_INCLUDE_DIRS})
+target_link_libraries(test_tiffxx_var PRIVATE ${TIFF_LIBRARIES})
+add_test(NAME test_tiffxx_var COMMAND test_tiffxx_var)
diff --git a/Tests/FindTIFF/Test/main.cxx b/Tests/FindTIFF/Test/main.cxx
new file mode 100644
index 0000000..f80a31f
--- /dev/null
+++ b/Tests/FindTIFF/Test/main.cxx
@@ -0,0 +1,16 @@
+#include <fstream>
+
+#include <assert.h>
+#include <tiffio.hxx>
+
+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);
+
+ std::ifstream s;
+ TIFF* tiffxx = TIFFStreamOpen("invalid.tiff", &s);
+ return 0;
+}