cmake_export_symbol: Darwin compatibility
The Darwin platform prefixes all C symbols with an underscore. At link-time of a shared library, libressl generates a list of symbols to export, but does not prefix each symbol with an underscore. This commit addresses that issue.
This commit is contained in:
parent
8b80bcdad8
commit
73e51e012f
@ -10,7 +10,13 @@ macro(export_symbol TARGET FILENAME)
|
||||
target_sources(${TARGET} PRIVATE ${DEF_FILENAME})
|
||||
|
||||
elseif(APPLE)
|
||||
set(FLAG "-exported_symbols_list ${FILENAME}")
|
||||
file(READ ${FILENAME} SYMBOLS)
|
||||
string(REGEX REPLACE "\n$" "" SYMBOLS ${SYMBOLS})
|
||||
string(REPLACE "\n" "\n_" SYMBOLS ${SYMBOLS})
|
||||
string(REGEX REPLACE "(.)$" "\\1\\n" SYMBOLS ${SYMBOLS})
|
||||
string(REPLACE ".sym" ".exp" EXP_FILENAME ${FILENAME})
|
||||
file(WRITE ${EXP_FILENAME} "_${SYMBOLS}")
|
||||
set(FLAG "-exported_symbols_list ${EXP_FILENAME}")
|
||||
set_target_properties(${TARGET} PROPERTIES LINK_FLAGS ${FLAG})
|
||||
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
|
||||
|
Loading…
Reference in New Issue
Block a user