Skip to content

Commit

Permalink
build: propagate the static define for Swift
Browse files Browse the repository at this point in the history
When building a Swift target against this library we need to ensure that
we pass along `-DCMARK_GFM_STATIC_DEFINE` to the Clang Importer. This is
required to build SwiftFormat against this library statically.
  • Loading branch information
compnerd committed Jan 16, 2024
1 parent c5d1389 commit 33410d5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ add_library(libcmark-gfm
syntax_extension.c
utf8.c
xml.c)
target_compile_definitions(libcmark-gfm PUBLIC
$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:CMARK_GFM_STATIC_DEFINE>)
if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(libcmark-gfm PUBLIC
CMARK_GFM_STATIC_DEFINE)
target_compile_options(libcmark-gfm PUBLIC
$<$<COMPILE_LANGUAGE:Swift>:-Xcc -DCMARK_GFM_STATIC_DEFINE>)
endif()
target_include_directories(libcmark-gfm PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/include>
Expand Down

0 comments on commit 33410d5

Please sign in to comment.