CMakeLists: Use imported version of Threads::Threads
This requires bumping up to a minimum of CMake 3.1. The benefit of using the imported target is that you can switch to the -pthread compiler flag on request, which may be necessary for some systems if available.
This commit is contained in:
parent
0964a3ff53
commit
df81fa11fc
|
@ -1,6 +1,6 @@
|
||||||
# CMake 2.8.11 required for Qt5 settings to be applied automatically on
|
# CMake 3.1 required for Qt5 settings to be applied automatically on
|
||||||
# dependent libraries.
|
# dependent libraries and IMPORTED targets.
|
||||||
cmake_minimum_required(VERSION 2.8.11)
|
cmake_minimum_required(VERSION 3.1)
|
||||||
|
|
||||||
function(download_bundled_external remote_path lib_name prefix_var)
|
function(download_bundled_external remote_path lib_name prefix_var)
|
||||||
set(prefix "${CMAKE_BINARY_DIR}/externals/${lib_name}")
|
set(prefix "${CMAKE_BINARY_DIR}/externals/${lib_name}")
|
||||||
|
@ -135,6 +135,8 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/cmake-modules")
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
include_directories(${OPENGL_INCLUDE_DIR})
|
include_directories(${OPENGL_INCLUDE_DIR})
|
||||||
|
|
||||||
|
# Prefer the -pthread flag on Linux.
|
||||||
|
set (THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
if (ENABLE_SDL2)
|
if (ENABLE_SDL2)
|
||||||
|
|
|
@ -21,7 +21,7 @@ target_link_libraries(citra ${SDL2_LIBRARY} ${OPENGL_gl_LIBRARY} inih glad)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
target_link_libraries(citra getopt)
|
target_link_libraries(citra getopt)
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(citra ${PLATFORM_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
target_link_libraries(citra ${PLATFORM_LIBRARIES} Threads::Threads)
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD")
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD")
|
||||||
install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
||||||
|
|
Loading…
Reference in New Issue