summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorhstejas <tejashs@rocketmail.com>2023-01-20 16:04:32 +0530
committerBrad King <brad.king@kitware.com>2023-01-27 10:33:10 -0500
commit1bba21821466c5f64f0853df155488227263f0fa (patch)
treef70230dc62fec3b47cd1f17694d161f2a1a80259 /Tests
parent7ac338be9830bdc936b52a4135504ed011418f3c (diff)
downloadcmake-1bba21821466c5f64f0853df155488227263f0fa.tar.gz
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')
-rw-r--r--Tests/CMakeLists.txt1
-rw-r--r--Tests/FindImageMagick/CMakeLists.txt10
-rw-r--r--Tests/FindImageMagick/Test/CMakeLists.txt13
-rw-r--r--Tests/FindImageMagick/Test/main_magick++.cxx10
-rw-r--r--Tests/FindImageMagick/Test/main_magick_wand.c8
5 files changed, 42 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index e5e592b10c..c22f70449d 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1480,6 +1480,7 @@ if(BUILD_TESTING)
GTK2
Iconv
ICU
+ ImageMagick
Intl
Jasper
JNI
diff --git a/Tests/FindImageMagick/CMakeLists.txt b/Tests/FindImageMagick/CMakeLists.txt
new file mode 100644
index 0000000000..8a3c70ccef
--- /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 0000000000..618226004a
--- /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 0000000000..d0208d420b
--- /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 0000000000..fa6d17094a
--- /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;
+}