summary refs log tree commit diff
path: root/cmake
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-09-11 14:56:09 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-09-11 14:56:09 +0300
commit074608dec15e10a61decdcc017cc1927b99b8dc3 (patch)
tree26344012b3b0874affd54bfe6b5a17aba38fe2fb /cmake
parentFix the docker build (diff)
downloadnheko-074608dec15e10a61decdcc017cc1927b99b8dc3.tar.xz
Switch to libcmark
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Findcmark.cmake39
1 files changed, 39 insertions, 0 deletions
diff --git a/cmake/Findcmark.cmake b/cmake/Findcmark.cmake
new file mode 100644
index 00000000..fd7d062a
--- /dev/null
+++ b/cmake/Findcmark.cmake
@@ -0,0 +1,39 @@
+#
+# CMake module to search for the cmark library
+#
+
+find_path(CMARK_INCLUDE_DIR
+          NAMES cmark.h
+          PATHS /usr/include
+                /usr/local/include
+                $ENV{LIB_DIR}/include
+                $ENV{LIB_DIR}/include/cmark)
+
+find_library(CMARK_LIBRARY
+             NAMES cmark
+             PATHS /usr/lib /usr/local/lib $ENV{LIB_DIR}/lib)
+
+if(OLM_FOUND)
+  set(OLM_INCLUDE_DIRS ${CMARK_INCLUDE_DIR})
+
+  if(NOT OLM_LIBRARIES)
+    set(OLM_LIBRARIES ${CMARK_LIBRARY})
+  endif()
+endif()
+
+if(NOT TARGET cmark::cmark)
+  add_library(cmark::cmark UNKNOWN IMPORTED)
+  set_target_properties(cmark::cmark
+                        PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
+                                   ${CMARK_INCLUDE_DIR})
+  set_property(TARGET cmark::cmark APPEND
+               PROPERTY IMPORTED_LOCATION ${CMARK_LIBRARY})
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(cmark
+                                  DEFAULT_MSG
+                                  CMARK_INCLUDE_DIR
+                                  CMARK_LIBRARY)
+
+mark_as_advanced(CMARK_LIBRARY CMARK_INCLUDE_DIR)