diff options
| author | Eric Pruitt <eric.pruitt@gmail.com> | 2019-05-29 09:28:07 -0700 | 
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2019-05-29 12:28:07 -0400 | 
| commit | f4895a6c6275c807415c3105db6cba325d579b83 (patch) | |
| tree | dee4bb4b6250115a3dff540650b62661fae92c98 | |
| parent | a61c4902f07789d40a717daef710da29e7899485 (diff) | |
Remove "-rdynamic" flag for static builds (#300)
cmake adds `-rdynamic` on linux, even for static builds.
This commit removes it for linux builds by resetting
`CMAKE_SHARED_LIBRARY_LINK_C_FLAGS`.
| -rwxr-xr-x | CMakeLists.txt | 7 | 
1 files changed, 7 insertions, 0 deletions
| diff --git a/CMakeLists.txt b/CMakeLists.txt index 1107fb3..d9488dd 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) | 
