Skip to content

Commit

Permalink
Remove "-rdynamic" flag for static builds (commonmark#300)
Browse files Browse the repository at this point in the history
cmake adds `-rdynamic` on linux, even for static builds.
This commit removes it for linux builds by resetting
`CMAKE_SHARED_LIBRARY_LINK_C_FLAGS`.
  • Loading branch information
ericpruitt authored and jgm committed May 29, 2019
1 parent a61c490 commit f4895a6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ option(CMARK_STATIC "Build static libcmark library" ON)
option(CMARK_SHARED "Build shared libcmark library" ON)
option(CMARK_LIB_FUZZER "Build libFuzzer fuzzing harness" OFF)

# The Linux modules distributed with CMake add "-rdynamic" to the build flags
# which is incompatible with static linking under certain configurations.
# Unsetting CMAKE_SHARED_LIBRARY_LINK_C_FLAGS ensures this does not happen.
if(CMARK_STATIC AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)
endif()

add_subdirectory(src)
if(CMARK_TESTS AND (CMARK_SHARED OR CMARK_STATIC))
add_subdirectory(api_test)
Expand Down

0 comments on commit f4895a6

Please sign in to comment.