diff options
author | Brad King <brad.king@kitware.com> | 2018-04-19 12:26:28 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-04-19 12:26:34 (GMT) |
commit | c14497191bf4412b7b7f5241030f251373e4c0ae (patch) | |
tree | 3531b463471a188f58dfa53b43069ba726945230 /Tests | |
parent | 1a2eb621053c3f32c6eca2a962af436c0bd1044a (diff) | |
parent | 87f2cf3b1ce0ef7b8e71eae0f44cf9753660d423 (diff) | |
download | CMake-c14497191bf4412b7b7f5241030f251373e4c0ae.zip CMake-c14497191bf4412b7b7f5241030f251373e4c0ae.tar.gz CMake-c14497191bf4412b7b7f5241030f251373e4c0ae.tar.bz2 |
Merge topic 'FindJPEG-imported-targets'
87f2cf3b1c FindJPEG: Add imported target support and full test
13952a3b7f FindJPEG: Add multi config support and associated docs
1f6649b7d1 FindJPEG: Add version detection and associated test update and docs
8d07408a62 FindJPEG: Cleanup documentation formatting
e70da3f0f3 FindJPEG: Clean up whitepaces and lowercase function names
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1974
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/CMakeOnly/AllFindModules/CMakeLists.txt | 2 | ||||
-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 |
5 files changed, 45 insertions, 1 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index aad7cfc..38b4828 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1359,6 +1359,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindICU) endif() + if(CMake_TEST_FindJPEG) + add_subdirectory(FindJPEG) + endif() + if(CMake_TEST_FindJsonCpp) add_subdirectory(FindJsonCpp) endif() diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index 443d366..a53e441 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -86,7 +86,7 @@ foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HG endforeach() foreach(VTEST BISON Boost CUDA DOXYGEN FLEX GIF GTK2 - HDF5 LibArchive OPENSCENEGRAPH RUBY SWIG Protobuf) + HDF5 JPEG LibArchive OPENSCENEGRAPH RUBY SWIG Protobuf) check_version_string(${VTEST} ${VTEST}_VERSION) endforeach() 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; +} |