diff options
author | Joachim Wuttke (h) <j.wuttke@fz-juelich.de> | 2020-06-23 09:50:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-06-29 15:55:22 (GMT) |
commit | a468cc431cf910a95d839594a2916a25165023e1 (patch) | |
tree | 91a0c4b9e648135c2b1e60961a2b5a70b7ad139b /Tests/FindTIFF/Test | |
parent | 9692931f8376c47ea335c90f3544e281ddc4ca8d (diff) | |
download | CMake-a468cc431cf910a95d839594a2916a25165023e1.zip CMake-a468cc431cf910a95d839594a2916a25165023e1.tar.gz CMake-a468cc431cf910a95d839594a2916a25165023e1.tar.bz2 |
FindTIFF: add component CXX to include the C++ wrapper libtiffxx
Fixes: #20860
Diffstat (limited to 'Tests/FindTIFF/Test')
-rw-r--r-- | Tests/FindTIFF/Test/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Tests/FindTIFF/Test/main.cxx | 16 |
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; +} |