Skip to content

Commit

Permalink
Merge pull request #1274 from jabl/cmake_pthreads
Browse files Browse the repository at this point in the history
Simplify pthreads library detection
  • Loading branch information
antenore authored Sep 14, 2017
2 parents 205df66 + f739af1 commit 940b935
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 47 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,13 @@ add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")

find_required_package(GTK)
find_required_package(PTHREAD)

set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads REQUIRED)
if(NOT CMAKE_USE_PTHREADS_INIT)
message(FATAL_ERROR "pthreads thread library not found")
endif()

find_suggested_package(GCRYPT)
find_suggested_package(AVAHI)

Expand Down
38 changes: 0 additions & 38 deletions cmake/FindPTHREAD.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion remmina-plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ set(APPICON16_EMBLEMS_DIR "${REMMINA_DATADIR}/icons/hicolor/16x16/emblems")
set(APPICON22_EMBLEMS_DIR "${REMMINA_DATADIR}/icons/hicolor/22x22/emblems")

set(REMMINA_COMMON_INCLUDE_DIRS ${GTK_INCLUDE_DIRS})
set(REMMINA_COMMON_LIBRARIES ${GTK_LIBRARIES} ${PTHREAD_LIBRARY})
set(REMMINA_COMMON_LIBRARIES ${GTK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})

find_suggested_package(LIBSSH)
if(LIBSSH_FOUND)
Expand Down
4 changes: 2 additions & 2 deletions remmina-plugins/rdp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
# files in the program, then also delete it here.


set(CMAKE_THREAD_PREFER_PTHREAD)
find_package(Threads)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads REQUIRED)
find_package(X11)

set(REMMINA_PLUGIN_RDP_SRCS
Expand Down
7 changes: 2 additions & 5 deletions remmina/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,15 @@ find_package(X11)
include_directories(${X11_INCLUDE_DIR})
target_link_libraries(remmina ${X11_LIBRARIES})

target_link_libraries(remmina ${CMAKE_THREAD_LIBS_INIT})

find_suggested_package(LIBSSH)
if(LIBSSH_FOUND)
add_definitions(-DHAVE_LIBSSH)
include_directories(${LIBSSH_INCLUDE_DIRS})
target_link_libraries(remmina ${LIBSSH_LIBRARIES})
endif()

if(PTHREAD_FOUND)
include_directories(${PTHREAD_INCLUDE_DIRS})
target_link_libraries(remmina ${PTHREAD_LIBRARIES})
endif()

if(GCRYPT_FOUND)
include_directories(${GCRYPT_INCLUDE_DIRS})
target_link_libraries(remmina ${GCRYPT_LIBRARIES})
Expand Down

0 comments on commit 940b935

Please sign in to comment.