diff options
author | Brad King <brad.king@kitware.com> | 2021-10-07 13:21:55 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-10-07 13:22:11 (GMT) |
commit | 6e037a04e780f8516dd0a2b5221f2af4e6b20e1d (patch) | |
tree | a0a8bfacef7e4ece039a1b9054d42434f0c87247 /Tests | |
parent | eb724e938ae82e50f2b45a1d3dd9c4571fc4fec0 (diff) | |
parent | 6e8754c6251bc2f7edfb0d71303e1b85fce93f5e (diff) | |
download | CMake-6e037a04e780f8516dd0a2b5221f2af4e6b20e1d.zip CMake-6e037a04e780f8516dd0a2b5221f2af4e6b20e1d.tar.gz CMake-6e037a04e780f8516dd0a2b5221f2af4e6b20e1d.tar.bz2 |
Merge topic 'FindJasper-imported-target'
6e8754c625 FindJasper: Add IMPORTED target
bdbce845cd FindJasper: Add JASPER_INCLUDE_DIRS result variable
7f8413c309 FindJasper: Modernize documentation layout
524205a7a5 FindJasper: Modernize code layout
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4633
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/FindJasper/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/FindJasper/Test/CMakeLists.txt | 16 | ||||
-rw-r--r-- | Tests/FindJasper/Test/main.c | 17 |
4 files changed, 44 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 20b6e25..d1f7b69 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1466,6 +1466,7 @@ if(BUILD_TESTING) Iconv ICU Intl + Jasper JPEG JsonCpp LAPACK diff --git a/Tests/FindJasper/CMakeLists.txt b/Tests/FindJasper/CMakeLists.txt new file mode 100644 index 0000000..1bfae78 --- /dev/null +++ b/Tests/FindJasper/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindJasper.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindJasper/Test" + "${CMake_BINARY_DIR}/Tests/FindJasper/Test" + ${build_generator_args} + --build-project TestFindJasper + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindJasper/Test/CMakeLists.txt b/Tests/FindJasper/Test/CMakeLists.txt new file mode 100644 index 0000000..1e9467d --- /dev/null +++ b/Tests/FindJasper/Test/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.21) +project(TestFindJasper C) +include(CTest) + +find_package(Jasper) + +add_definitions(-DCMAKE_EXPECTED_JASPER_VERSION=${JASPER_VERSION_STRING}) + +add_executable(test_jasper_tgt main.c) +target_link_libraries(test_jasper_tgt Jasper::Jasper) +add_test(NAME test_jasper_tgt COMMAND test_jasper_tgt) + +add_executable(test_jasper_var main.c) +target_include_directories(test_jasper_var PRIVATE ${JASPER_INCLUDE_DIRS}) +target_link_libraries(test_jasper_var PRIVATE ${JASPER_LIBRARIES}) +add_test(NAME test_jasper_var COMMAND test_jasper_var) diff --git a/Tests/FindJasper/Test/main.c b/Tests/FindJasper/Test/main.c new file mode 100644 index 0000000..771344d --- /dev/null +++ b/Tests/FindJasper/Test/main.c @@ -0,0 +1,17 @@ +#include <assert.h> +// clang-format off +#include <stdio.h> +#include <jasper/jasper.h> +// clang-format on + +int main() +{ + /* Without any JPEG file to open, test that the call fails as + expected. This tests that linking worked. */ + jas_init(); + jas_image_t* img = jas_image_create0(); + jas_image_destroy(img); + jas_cleanup(); + + return (JAS_VERSION != CMAKE_EXPECTED_JASPER_VERSION); +} |