diff options
author | Mateusz Loskot <mateusz@loskot.net> | 2018-04-17 21:52:53 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-04-18 12:59:06 (GMT) |
commit | 87f2cf3b1ce0ef7b8e71eae0f44cf9753660d423 (patch) | |
tree | ba042fc7de4a29acecb7385dc7fca0da70f8d038 /Tests/FindJPEG | |
parent | 13952a3b7fb930baeeda299bf186e29d57d794fe (diff) | |
download | CMake-87f2cf3b1ce0ef7b8e71eae0f44cf9753660d423.zip CMake-87f2cf3b1ce0ef7b8e71eae0f44cf9753660d423.tar.gz CMake-87f2cf3b1ce0ef7b8e71eae0f44cf9753660d423.tar.bz2 |
FindJPEG: Add imported target support and full test
Diffstat (limited to 'Tests/FindJPEG')
-rw-r--r-- | Tests/FindJPEG/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/FindJPEG/Test/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/FindJPEG/Test/main.c | 16 |
3 files changed, 40 insertions, 0 deletions
diff --git a/Tests/FindJPEG/CMakeLists.txt b/Tests/FindJPEG/CMakeLists.txt new file mode 100644 index 0000000..c8663c5 --- /dev/null +++ b/Tests/FindJPEG/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindJPEG.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindJPEG/Test" + "${CMake_BINARY_DIR}/Tests/FindJPEG/Test" + ${build_generator_args} + --build-project TestFindJPEG + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindJPEG/Test/CMakeLists.txt b/Tests/FindJPEG/Test/CMakeLists.txt new file mode 100644 index 0000000..a744f85 --- /dev/null +++ b/Tests/FindJPEG/Test/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.1) +project(TestFindJPEG C) +include(CTest) + +find_package(JPEG) + +add_executable(test_jpeg_tgt main.c) +target_link_libraries(test_jpeg_tgt JPEG::JPEG) +add_test(NAME test_jpeg_tgt COMMAND test_jpeg_tgt) + +add_executable(test_jpeg_var main.c) +target_include_directories(test_jpeg_var PRIVATE ${JPEG_INCLUDE_DIRS}) +target_link_libraries(test_jpeg_var PRIVATE ${JPEG_LIBRARIES}) +add_test(NAME test_jpeg_var COMMAND test_jpeg_var) diff --git a/Tests/FindJPEG/Test/main.c b/Tests/FindJPEG/Test/main.c new file mode 100644 index 0000000..c6e48f0 --- /dev/null +++ b/Tests/FindJPEG/Test/main.c @@ -0,0 +1,16 @@ +#include <assert.h> +#include <stdio.h> + +#include <jpeglib.h> + +int main() +{ + /* Without any JPEG file to open, test that the call fails as + expected. This tests that linking worked. */ + struct jpeg_decompress_struct cinfo; + struct jpeg_error_mgr jerr; + cinfo.err = jpeg_std_error(&jerr); + jpeg_create_decompress(&cinfo); + + return 0; +} |