Skip to content

Commit

Permalink
cmake: add version checks to more detection scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
awakecoding committed Nov 26, 2011
1 parent f5fd3d1 commit 50dd002
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 36 deletions.
6 changes: 2 additions & 4 deletions cmake/FindGCRYPT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(GCRYPT DEFAULT_MSG GCRYPT_LIBRARY GCRYPT_INCLUDE_DIR)

if(GCRYPT_FOUND)
set(GCRYPT_LIBRARIES ${GCRYPT_LIBRARY})
set(GCRYPT_INCLUDE_DIRS ${GCRYPT_INCLUDE_DIR})
endif()
set(GCRYPT_LIBRARIES ${GCRYPT_LIBRARY})
set(GCRYPT_INCLUDE_DIRS ${GCRYPT_INCLUDE_DIR})

mark_as_advanced(GCRYPT_INCLUDE_DIR GCRYPT_LIBRARY)

18 changes: 9 additions & 9 deletions cmake/FindSSH.cmake → cmake/FindLIBSSH.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@
# Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307, USA.

pkg_check_modules(PC_LIBSSH libssh)
find_package(PkgConfig)
pkg_check_modules(PC_LIBSSH libssh>=0.4)
set(LIBSSH_DEFINITIONS ${PC_LIBSSH_CFLAGS_OTHER})

find_path(SSH_INCLUDE_DIR NAMES libssh/libssh.h
find_path(LIBSSH_INCLUDE_DIR NAMES libssh/libssh.h
HINTS ${PC_LIBSSH_INCLUDEDIR} ${PC_LIBSSH_INCLUDE_DIRS})

find_library(SSH_LIBRARY NAMES ssh
find_library(LIBSSH_LIBRARY NAMES ssh
HINTS ${PC_LIBSSH_LIBDIR} ${PC_LIBSSH_LIBRARY_DIRS})

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(SSH DEFAULT_MSG SSH_LIBRARY SSH_INCLUDE_DIR)
find_package_handle_standard_args(LIBSSH DEFAULT_MSG LIBSSH_LIBRARY LIBSSH_INCLUDE_DIR)

if(SSH_FOUND)
set(SSH_LIBRARIES ${SSH_LIBRARY})
set(SSH_INCLUDE_DIRS ${SSH_INCLUDE_DIR})
endif()
set(LIBSSH_LIBRARIES ${LIBSSH_LIBRARY})
set(LIBSSH_INCLUDE_DIRS ${LIBSSH_INCLUDE_DIR})

mark_as_advanced(SSH_INCLUDE_DIR SSH_LIBRARY)
mark_as_advanced(LIBSSH_INCLUDE_DIR LIBSSH_LIBRARY)

16 changes: 10 additions & 6 deletions cmake/FindPTHREAD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,22 @@
# Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307, USA.

find_path(PTHREAD_INCLUDE_DIR NAMES pthread.h)
find_package(PkgConfig)
pkg_check_modules(PC_PTHREAD pthread)
set(PTHREAD_DEFINITIONS ${PC_PTHREAD_CFLAGS_OTHER})

find_library(PTHREAD_LIBRARY NAMES pthread)
find_path(PTHREAD_INCLUDE_DIR NAMES pthread.h
HINTS ${PC_PTHREAD_INCLUDEDIR} ${PC_PTHREAD_INCLUDE_DIRS})

find_library(PTHREAD_LIBRARY NAMES pthread
HINTS ${PC_PTHREAD_LIBDIR} ${PC_PTHREAD_LIBRARY_DIRS})

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(PTHREAD DEFAULT_MSG PTHREAD_LIBRARY PTHREAD_INCLUDE_DIR)

if(PTHREAD_FOUND)
set(PTHREAD_LIBRARIES ${PTHREAD_LIBRARY})
set(PTHREAD_INCLUDE_DIRS ${PTHREAD_INCLUDE_DIR})
endif()
set(PTHREAD_LIBRARIES ${PTHREAD_LIBRARY})
set(PTHREAD_INCLUDE_DIRS ${PTHREAD_INCLUDE_DIR})

mark_as_advanced(PTHREAD_INCLUDE_DIR PTHREAD_LIBRARY)

8 changes: 4 additions & 4 deletions cmake/FindTELEPATHY.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
# Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307, USA.

find_package(PkgConfig)
pkg_check_modules(PC_TELEPATHY telepathy-glib)
set(TELEPATHY_DEFINITIONS ${PC_TELEPATHY_CFLAGS_OTHER})

find_path(TELEPATHY_INCLUDE_DIR NAMES telepathy-glib/telepathy-glib.h
HINTS ${PC_TELEPATHY_INCLUDEDIR} ${PC_TELEPATHY_INCLUDE_DIRS}
Expand All @@ -29,10 +31,8 @@ include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(TELEPATHY DEFAULT_MSG TELEPATHY_LIBRARY TELEPATHY_INCLUDE_DIR)

if(TELEPATHY_FOUND)
set(TELEPATHY_LIBRARIES ${TELEPATHY_LIBRARY})
set(TELEPATHY_INCLUDE_DIRS ${TELEPATHY_INCLUDE_DIR})
endif()
set(TELEPATHY_LIBRARIES ${TELEPATHY_LIBRARY})
set(TELEPATHY_INCLUDE_DIRS ${TELEPATHY_INCLUDE_DIR})

mark_as_advanced(TELEPATHY_INCLUDE_DIR TELEPATHY_LIBRARY)

10 changes: 8 additions & 2 deletions remmina-plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@ if(GTK3_FOUND)
set(REMMINA_COMMON_LIBRARIES ${GTK3_LIBRARIES})
endif()

find_required_package(SSH)
find_suggested_package(LIBSSH)
if(LIBSSH_FOUND)
add_definitions(-DHAVE_LIBSSH)
include_directories(${SSH_INCLUDE_DIRS})
target_link_libraries(remmina ${SSH_LIBRARIES})
endif()

find_required_package(XKBFILE)

if(SSH_FOUND AND XKBFILE_FOUND)
if(LIBSSH_FOUND AND XKBFILE_FOUND)
add_subdirectory(nx)
endif()

Expand Down
4 changes: 2 additions & 2 deletions remmina-plugins/nx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ set(REMMINA_PLUGIN_NX_SRCS
add_library(remmina-plugin-nx ${REMMINA_PLUGIN_NX_SRCS})
set_target_properties(remmina-plugin-nx PROPERTIES PREFIX "")

include_directories(${REMMINA_COMMON_INCLUDE_DIRS} ${XKBFILE_INCLUDE_DIRS} ${SSH_INCLUDE_DIRS})
target_link_libraries(remmina-plugin-nx ${REMMINA_COMMON_LIBRARIES} ${XKBFILE_LIBRARIES} ${SSH_LIBRARIES})
include_directories(${REMMINA_COMMON_INCLUDE_DIRS} ${XKBFILE_INCLUDE_DIRS} ${LIBSSH_INCLUDE_DIRS})
target_link_libraries(remmina-plugin-nx ${REMMINA_COMMON_LIBRARIES} ${XKBFILE_LIBRARIES} ${LIBSSH_LIBRARIES})

install(TARGETS remmina-plugin-nx DESTINATION ${REMMINA_PLUGINDIR})

21 changes: 12 additions & 9 deletions remmina/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,19 @@ add_executable(remmina ${REMMINA_SRCS})
include_directories(${GTK3_INCLUDE_DIRS})
target_link_libraries(remmina ${GTK3_LIBRARIES})

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

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

if(AVAHI_FOUND)
add_definitions(-DHAVE_LIBAVAHI_UI)
add_definitions(-DHAVE_LIBAVAHI_CLIENT)
include_directories(${AVAHI_INCLUDE_DIRS})
target_link_libraries(remmina ${AVAHI_LIBRARIES})
endif()
Expand All @@ -115,12 +124,6 @@ if(APPINDICATOR_FOUND)
target_link_libraries(remmina ${APPINDICATOR_LIBRARIES})
endif()

find_suggested_package(GCRYPT)
if(GCRYPT_FOUND)
include_directories(${GCRYPT_INCLUDE_DIRS})
target_link_libraries(remmina ${GCRYPT_LIBRARIES})
endif()

add_subdirectory(po)
add_subdirectory(icons)
add_subdirectory(desktop)
Expand Down

0 comments on commit 50dd002

Please sign in to comment.