Skip to content

Commit

Permalink
build: add exports targets for build tree usage
Browse files Browse the repository at this point in the history
This enables the use of the export targets from the build tree to allow
easy use of the CMark library in other projects.

Resolves: commonmark#307
  • Loading branch information
compnerd authored and jgm committed Jan 3, 2020
1 parent b6c73d8 commit 1ff180e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/cmarkConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 1ff180e

Please sign in to comment.