diff options
author | hstejas <tejashs@rocketmail.com> | 2023-01-20 10:34:32 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-01-27 15:33:10 (GMT) |
commit | 1bba21821466c5f64f0853df155488227263f0fa (patch) | |
tree | f70230dc62fec3b47cd1f17694d161f2a1a80259 /Tests/FindImageMagick | |
parent | 7ac338be9830bdc936b52a4135504ed011418f3c (diff) | |
download | CMake-1bba21821466c5f64f0853df155488227263f0fa.zip CMake-1bba21821466c5f64f0853df155488227263f0fa.tar.gz CMake-1bba21821466c5f64f0853df155488227263f0fa.tar.bz2 |
FindImageMagick: Define targets for specific components
- With this change we can use e.g. ImageMagick::Magick++ directly
in targt_link_libraries.
- This change also adds CFLAGS which was missing before.
- Also adds example on how to use the targets.
Diffstat (limited to 'Tests/FindImageMagick')
-rw-r--r-- | Tests/FindImageMagick/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/FindImageMagick/Test/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Tests/FindImageMagick/Test/main_magick++.cxx | 10 | ||||
-rw-r--r-- | Tests/FindImageMagick/Test/main_magick_wand.c | 8 |
4 files changed, 41 insertions, 0 deletions
diff --git a/Tests/FindImageMagick/CMakeLists.txt b/Tests/FindImageMagick/CMakeLists.txt new file mode 100644 index 0000000..8a3c70c --- /dev/null +++ b/Tests/FindImageMagick/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindImageMagick.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindImageMagick/Test" + "${CMake_BINARY_DIR}/Tests/FindImageMagick/Test" + ${build_generator_args} + --build-project TestFindImageMagick + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindImageMagick/Test/CMakeLists.txt b/Tests/FindImageMagick/Test/CMakeLists.txt new file mode 100644 index 0000000..6182260 --- /dev/null +++ b/Tests/FindImageMagick/Test/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.4) +project(FindImageMagick C CXX) +include(CTest) + +find_package(ImageMagick REQUIRED COMPONENTS Magick++ MagickWand) + +add_executable(test_magick++ main_magick++.cxx) +target_link_libraries(test_magick++ PRIVATE ImageMagick::Magick++) +add_test(NAME test_magick++ COMMAND test_magick++) + +add_executable(test_magick_wand main_magick_wand.c) +target_link_libraries(test_magick_wand ImageMagick::MagickWand) +add_test(NAME test_magick_wand COMMAND test_magick_wand) diff --git a/Tests/FindImageMagick/Test/main_magick++.cxx b/Tests/FindImageMagick/Test/main_magick++.cxx new file mode 100644 index 0000000..d0208d4 --- /dev/null +++ b/Tests/FindImageMagick/Test/main_magick++.cxx @@ -0,0 +1,10 @@ +#include <iostream> +#include <string> + +#include <Magick++.h> + +int main() +{ + Magick::InitializeMagick(""); + return 0; +} diff --git a/Tests/FindImageMagick/Test/main_magick_wand.c b/Tests/FindImageMagick/Test/main_magick_wand.c new file mode 100644 index 0000000..fa6d170 --- /dev/null +++ b/Tests/FindImageMagick/Test/main_magick_wand.c @@ -0,0 +1,8 @@ +#include <wand/MagickWand.h> + +int main() +{ + MagickWand* wand = NewMagickWand(); + wand = DestroyMagickWand(wand); + return 0; +} |