Skip to content

Commit 1ff180e

Browse files
compnerdjgm
authored andcommitted
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: commonmark#307
1 parent b6c73d8 commit 1ff180e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ if(CMARK_SHARED OR CMARK_STATIC)
136136
)
137137

138138
install(EXPORT cmark DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
139+
140+
configure_file(cmarkConfig.cmake.in
141+
${CMAKE_CURRENT_BINARY_DIR}/cmarkConfig.cmake)
142+
export(TARGETS ${CMARK_INSTALL} FILE cmarkTargets.cmake)
139143
endif()
140144

141145
# Feature tests

src/cmarkConfig.cmake.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
set(HAVE_LIBCMARK_STATIC @CMARK_STATIC@)
2+
set(HAVE_LIBCMARK_SHARED @CMARK_SHARED@)
3+
4+
if((HAVE_LIBCMARK_STATIC AND NOT TARGET libcmark_static) OR
5+
(HAVE_LIBCMARK_SHARED AND NOT TARGET libcmark))
6+
include(cmarkTargets.cmake)
7+
endif()

0 commit comments

Comments
 (0)