CMake: Move -lpthread to the very end to fix Linux linking

This commit is contained in:
def 2018-12-23 23:13:41 +01:00
parent 969f3c2db4
commit 280ed3fc3d

View file

@ -726,9 +726,6 @@ set(DEPS ${DEP_JSON} ${DEP_MD5} ${ZLIB_DEP})
# Libraries
set(LIBS ${CRYPTO_LIBRARIES} ${WEBSOCKETS_LIBRARIES} ${ZLIB_LIBRARIES} ${PLATFORM_LIBS})
# Add pthreads (on non-Windows) at the end, so that other libraries can depend
# on it.
list(APPEND LIBS ${CMAKE_THREAD_LIBS_INIT})
# Targets
add_library(engine-shared EXCLUDE_FROM_ALL OBJECT ${ENGINE_INTERFACE} ${ENGINE_SHARED} ${ENGINE_UUID_SHARED} ${BASE})
@ -888,6 +885,10 @@ if(CLIENT)
${OGG_LIBRARIES}
${PLATFORM_CLIENT_LIBS}
# Add pthreads (on non-Windows) at the end, so that other libraries can depend
# on it.
${CMAKE_THREAD_LIBS_INIT}
)
if(TARGET_OS STREQUAL "windows")
@ -1031,7 +1032,13 @@ else()
endif()
# Libraries
set(LIBS_SERVER ${LIBS} ${MYSQL_LIBRARIES})
set(LIBS_SERVER
${LIBS}
${MYSQL_LIBRARIES}
# Add pthreads (on non-Windows) at the end, so that other libraries can depend
# on it.
${CMAKE_THREAD_LIBS_INIT}
)
# Target
set(TARGET_SERVER ${SERVER_EXECUTABLE})