summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorNiclas Rosenvik <nros@netbsd.org>2021-05-28 11:59:37 +0000
committerShawn Rutledge <shawn.rutledge@qt.io>2021-06-03 20:08:32 +0200
commit7920c03ff1954355d588baa466820a60afc9b587 (patch)
treee2382b6a6f0d73159aaacf1b10ac615949f20444 /cmake
parent5cc3105807a7f1868b067e5d9757acab0a2bb8e8 (diff)
Fix support for using system supplied md4c library
Add FindWrapSystemMd4c.cmake so that the old md4c target can be used as well as the new one and set WrapSystemMd4c_FOUND. Link to the imported target WrapSystemMd4c::WrapSystemMd4c if the system library is used. Add qt_find_package line to find the package in configure.cmake. Fix the condition for enabling system-textmarkdownreader, it includes testing for textmarkdownreader because even if the code would compile correctly without it, it looks strange when the output says "textmarkdownreader no" and under "using system libmd4c yes" even if libmd4c is not used. Use system include when system-markdownreader is enabled. Add library mapping for libmd4c. Change-Id: Id5d5b13d6691a8c1cdf627238887977c847c1e67 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindWrapSystemMd4c.cmake24
1 files changed, 24 insertions, 0 deletions
diff --git a/cmake/FindWrapSystemMd4c.cmake b/cmake/FindWrapSystemMd4c.cmake
new file mode 100644
index 0000000000..ea691a4590
--- /dev/null
+++ b/cmake/FindWrapSystemMd4c.cmake
@@ -0,0 +1,24 @@
+if(TARGET WrapSystemMd4c::WrapSystemMd4c)
+ set(WrapSystemMd4c_FOUND TRUE)
+ return()
+endif()
+
+find_package(md4c CONFIG)
+
+# md4c provides a md4c::md4c target but
+# older versions create a md4c target without
+# namespace. If we find the old variant create
+# a namespaced target out of the md4c target.
+if(TARGET md4c AND NOT TARGET md4c::md4c)
+ add_library(md4c::md4c INTERFACE IMPORTED)
+ target_link_libraries(md4c::md4c INTERFACE md4c)
+endif()
+
+if(TARGET md4c::md4c)
+ add_library(WrapSystemMd4c::WrapSystemMd4c INTERFACE IMPORTED)
+ target_link_libraries(WrapSystemMd4c::WrapSystemMd4c INTERFACE md4c::md4c)
+endif()
+
+if(TARGET WrapSystemMd4c::WrapSystemMd4c)
+ set(WrapSystemMd4c_FOUND TRUE)
+endif()