1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-25 07:44:38 +01:00

Always link threads, fix linking cURL

Threads are currently used throughout the codebase so they need to be
required. CURL is required when using HTTP, not when using Networking.
This commit is contained in:
Tom Lankhorst
2019-03-02 08:55:21 +01:00
parent dcf750f004
commit e7d875dd04

View File

@@ -34,14 +34,20 @@ else ()
endif ()
endif ()
# Third party libraries (optional)
if (NOT DISABLE_HTTP_TWITCH OR NOT DISABLE_NETWORK)
if (NOT DISABLE_HTTP)
if (MSVC)
find_package(curl REQUIRED)
set(LIBCURL_LIBRARIES ${CURL_LIBRARIES})
else ()
PKG_CHECK_MODULES(LIBCURL REQUIRED libcurl)
endif ()
if (STATIC)
target_link_libraries(${PROJECT} ${LIBCURL_STATIC_LIBRARIES}
${SSL_STATIC_LIBRARIES})
else ()
target_link_libraries(${PROJECT} ${LIBCURL_LIBRARIES}
${OPENSSL_LIBRARIES})
endif ()
endif ()
if (NOT DISABLE_NETWORK)
find_package(OpenSSL 1.0.0 REQUIRED)
@@ -107,21 +113,12 @@ if (NOT DISABLE_NETWORK)
if (WIN32)
target_link_libraries(${PROJECT} ws2_32 crypt32 wldap32 version winmm imm32 advapi32 shell32 ole32)
endif ()
# our HTTP implementation requires use of threads
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT} Threads::Threads)
if (STATIC)
target_link_libraries(${PROJECT} ${LIBCURL_STATIC_LIBRARIES}
${SSL_STATIC_LIBRARIES})
else ()
target_link_libraries(${PROJECT} ${LIBCURL_LIBRARIES}
${OPENSSL_LIBRARIES})
endif ()
endif ()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT} Threads::Threads)
if (NOT MINGW AND NOT MSVC)
# For unicode code page conversion.
find_package(ICU 59.0 REQUIRED COMPONENTS uc)