Skip to content

Commit 33410d5

Browse files
committed
build: propagate the static define for Swift
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.
1 parent c5d1389 commit 33410d5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@ add_library(libcmark-gfm
3030
syntax_extension.c
3131
utf8.c
3232
xml.c)
33-
target_compile_definitions(libcmark-gfm PUBLIC
34-
$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:CMARK_GFM_STATIC_DEFINE>)
33+
if(NOT BUILD_SHARED_LIBS)
34+
target_compile_definitions(libcmark-gfm PUBLIC
35+
CMARK_GFM_STATIC_DEFINE)
36+
target_compile_options(libcmark-gfm PUBLIC
37+
$<$<COMPILE_LANGUAGE:Swift>:-Xcc -DCMARK_GFM_STATIC_DEFINE>)
38+
endif()
3539
target_include_directories(libcmark-gfm PUBLIC
3640
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
3741
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/include>

0 commit comments

Comments
 (0)