Link libwinpthread statically if LINK_STD_STATICALLY is on.

This commit is contained in:
Deukhoofd 2021-09-30 22:42:16 +02:00
parent 8d95b099b4
commit 45122c12c5
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 8 additions and 2 deletions

View File

@ -164,8 +164,14 @@ endif()
if (LINK_STD_STATICALLY) if (LINK_STD_STATICALLY)
message(STATUS "Linking std libraries statically") message(STATUS "Linking std libraries statically")
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed") set(as_LINKS -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++)
target_link_libraries(${ANGELSCRIPT_LIBRARY_NAME} -lpthread -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ ) if (MSVC)
set(as_LINKS "${as_LINKS} -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive")
else()
set(as_LINKS "${as_LINKS} -Wl,-Bdynamic -lpthread")
endif(MSVC)
message(STATUS "Angelscript LINKS ${as_LINKS}")
target_link_libraries(${ANGELSCRIPT_LIBRARY_NAME} ${as_LINKS})
else() else()
set(THREADS_PREFER_PTHREAD_FLAG ON) set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)