chore: fix multiple definitions on Windows

This commit is contained in:
Sebastian Ullrich 2021-07-22 16:10:01 +02:00
parent df5c1b2a3b
commit d9337fa39c
2 changed files with 3 additions and 2 deletions

View file

@ -321,8 +321,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(LEANC_SHARED_LINKER_FLAGS "${LEANC_SHARED_LINKER_FLAGS} -Wl,--export-all")
set(LEANSHARED_LINKER_FLAGS "${LEANSHARED_LINKER_FLAGS} -Wl,--export-all")
else()
set(LEANC_STATIC_LINKER_FLAGS "${LEANC_STATIC_LINKER_FLAGS} -ldl")
set(LEANC_SHARED_LINKER_FLAGS "${LEANC_SHARED_LINKER_FLAGS} -ldl")
set(LEANC_EXTRA_FLAGS "${LEANC_EXTRA_FLAGS} -ldl")
endif()
# On Windows, add bcrypt for random number generation

View file

@ -23,6 +23,8 @@ args=("$@")
for arg in "$@"; do
# passed -shared ~> switch to shared linker flags
[[ $arg == "-shared" ]] && ldflags_ext=(@LEANC_SHARED_LINKER_FLAGS@) && args=("-x" "c" "$@" "-x" "none")
# linking against libleanshared explicitly ~> do not link against static stdlib
[[ $arg == "-lleanshared" ]] && ldflags_ext=()
# Note the `-x c` for treating all input as C code
[[ $arg == "-c" ]] && ldflags=() && ldflags_ext=() && args=("-x" "c" "$@" "-x" "none")
[[ $arg == "--print-cflags" ]] && echo "${cflags[@]}" && exit