cmark

My personal build of CMark ✏️

Commit
1ff180e23cc38ae82f30615e12b07e98f0794676
Parent
b6c73d8b5c23000b1c548a01db4019e0a3a53c02
Author
Saleem Abdulrasool <compnerd@compnerd.org>
Date

build: add exports targets for build tree usage

This enables the use of the export targets from the build tree to allow easy use of the CMark library in other projects.

Resolves: #307

Diffstat

2 files changed, 11 insertions, 0 deletions

Status File Name N° Changes Insertions Deletions
Modified src/CMakeLists.txt 4 4 0
Added src/cmarkConfig.cmake.in 7 7 0
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
@@ -136,6 +136,10 @@ if(CMARK_SHARED OR CMARK_STATIC)
     )
 
   install(EXPORT cmark DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
+
+  configure_file(cmarkConfig.cmake.in
+    ${CMAKE_CURRENT_BINARY_DIR}/cmarkConfig.cmake)
+  export(TARGETS ${CMARK_INSTALL} FILE cmarkTargets.cmake)
 endif()
 
 # Feature tests
diff --git a/src/cmarkConfig.cmake.in b/src/cmarkConfig.cmake.in
@@ -0,0 +1,7 @@
+set(HAVE_LIBCMARK_STATIC @CMARK_STATIC@)
+set(HAVE_LIBCMARK_SHARED @CMARK_SHARED@)
+
+if((HAVE_LIBCMARK_STATIC AND NOT TARGET libcmark_static) OR
+   (HAVE_LIBCMARK_SHARED AND NOT TARGET libcmark))
+  include(cmarkTargets.cmake)
+endif()