From 8f975e23298726bd277428e8a1a57134e9971f06 Mon Sep 17 00:00:00 2001 From: scribam Date: Sun, 29 Apr 2018 08:39:12 +0200 Subject: [PATCH] cmake: improve pthread inclusion --- rpcs3/CMakeLists.txt | 8 ++++++-- rpcs3/cmake_modules/ConfigureCompiler.cmake | 3 --- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index 678b2ac7a4..794586a221 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -406,6 +406,10 @@ add_dependencies(rpcs3 GitVersion) if(NOT MSVC) find_package(GLEW 1.13.0 REQUIRED) target_link_libraries(rpcs3 GLEW::GLEW) + + set(CMAKE_THREAD_PREFER_PTHREAD 1) + find_package(Threads REQUIRED) + target_link_libraries(rpcs3 Threads::Threads) endif() if(UNIX) @@ -419,7 +423,7 @@ target_link_libraries(rpcs3 xxhash) if(WIN32) target_link_libraries(rpcs3 ws2_32.lib Winmm.lib Psapi.lib gdi32.lib VKstatic.1 glslang OSDependent OGLCompiler SPIRV HLSL setupapi.lib hidapi-hid Shlwapi.lib) if(NOT MSVC) - target_link_libraries(rpcs3 ${OPENGL_LIBRARIES} opengl32.lib glu32.lib libpthread) + target_link_libraries(rpcs3 ${OPENGL_LIBRARIES} opengl32.lib glu32.lib) else() target_link_libraries(rpcs3 dxgi.lib d2d1.lib dwrite.lib) endif() @@ -438,7 +442,7 @@ else() if(VULKAN_FOUND) target_link_libraries(rpcs3 ${VULKAN_LIBRARIES}) endif() - target_link_libraries(rpcs3 ${CMAKE_DL_LIBS} -lpthread ZLIB::ZLIB ${ADDITIONAL_LIBS}) + target_link_libraries(rpcs3 ${CMAKE_DL_LIBS} ZLIB::ZLIB ${ADDITIONAL_LIBS}) if(USE_SYSTEM_FFMPEG) link_libraries(${FFMPEG_LIBRARY_DIR}) target_link_libraries(rpcs3 libavformat.so libavcodec.so libavutil.so libswscale.so) diff --git a/rpcs3/cmake_modules/ConfigureCompiler.cmake b/rpcs3/cmake_modules/ConfigureCompiler.cmake index 8f6838ca58..13226dd922 100644 --- a/rpcs3/cmake_modules/ConfigureCompiler.cmake +++ b/rpcs3/cmake_modules/ConfigureCompiler.cmake @@ -28,7 +28,4 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") if(APPLE) add_compile_options(-stdlib=libc++) endif() - if(WIN32) - add_compile_options(-pthread) - endif() endif()