diff --git a/cmake_export_symbol.cmake b/cmake_export_symbol.cmake index 2928c6b..cbc65f2 100644 --- a/cmake_export_symbol.cmake +++ b/cmake_export_symbol.cmake @@ -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")