diff options
author | Brad King <brad.king@kitware.com> | 2020-07-01 11:02:01 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-07-01 11:02:09 (GMT) |
commit | 57ea0012477828d0f2d34dde994ec6fa18cdd7a1 (patch) | |
tree | 807817363d75d2228a8445e2d2f7f354376bbf8f /Tests | |
parent | d8f9fb9c92584bfbd19998acab84743e8678a94d (diff) | |
parent | a468cc431cf910a95d839594a2916a25165023e1 (diff) | |
download | CMake-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.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; +} |