chore: fix compilation of executables containing code to be interpreted

This commit is contained in:
Sebastian Ullrich 2021-08-17 17:53:48 +02:00
parent c5f00f4bc2
commit 09a0347fdc
2 changed files with 6 additions and 1 deletions

View file

@ -299,9 +299,14 @@ endif()
# export all symbols for the interpreter
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
# for libraries compiled with `leanc -shared`
set(LEANC_SHARED_LINKER_FLAGS "${LEANC_SHARED_LINKER_FLAGS} -Wl,--export-all")
# for `leanshared` itself
set(LEANSHARED_LINKER_FLAGS "${LEANSHARED_LINKER_FLAGS} -Wl,--export-all")
# for executables containing code to be interpreted
set(LEAN_DYN_EXE_LINKER_FLAGS "${LEANSHARED_LINKER_FLAGS} -Wl,--export-all")
else()
set(LEAN_DYN_EXE_LINKER_FLAGS "${LEANSHARED_LINKER_FLAGS} -rdynamic")
set(LEANC_EXTRA_FLAGS "${LEANC_EXTRA_FLAGS} -ldl")
endif()

View file

@ -201,4 +201,4 @@ add_test(NAME leanpkgtest_user_attr_app
set -eu
export PATH=${LEAN_BIN}:$PATH
find . -name '*.olean' -delete
leanmake bin LINK_OPTS='${CMAKE_EXE_LINKER_FLAGS}' && build/bin/UserAttr")
leanmake bin LINK_OPTS='${LEAN_DYN_EXE_LINKER_FLAGS}' && build/bin/UserAttr")