Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cmake Find/Use for system libraries #160

Merged
merged 1 commit into from
Apr 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions cmake/FindSSH2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# - Try to find the ssh2 libssh2 library
# Once done this will define
#
# SSH2_FOUND - system has the SSH2 libssh2 library
# SSH2_INCLUDE_DIR - the SSH2 libssh2 include directory
# SSH2_LIBRARIES - The libraries needed to use SSH2 libssh2

# only look in default directories
find_path(
SSH2_INCLUDE_DIR
NAMES libssh2.h
DOC "ssh2 include dir"
)

find_library(
SSH2_LIBRARY
NAMES ssh2 libssh2
DOC "ssh2 library"
)

set(SSH2_INCLUDE_DIRS ${SSH2_INCLUDE_DIR})
set(SSH2_LIBRARIES ${SSH2_LIBRARY})

# handle the QUIETLY and REQUIRED arguments and set CURL_FOUND to TRUE
# if all listed variables are TRUE, hide their existence from configuration view
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SSH2 DEFAULT_MSG
SSH2_LIBRARY SSH2_INCLUDE_DIR)
mark_as_advanced (SSH2_INCLUDE_DIR SSH2_LIBRARY)

14 changes: 14 additions & 0 deletions cmake/UseOpenSSL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function(eth_apply TARGET REQUIRED)
find_package (OpenSSL)

# cmake supplied FindOpenSSL doesn't set all our variables
set(OPENSSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})

eth_show_dependency(OPENSSL OpenSSL)
if (OPENSSL_FOUND)
target_include_directories(${TARGET} SYSTEM PUBLIC ${OPENSSL_INCLUDE_DIRS})
target_link_libraries(${TARGET} ${OPENSSL_LIBRARIES})
elseif (NOT ${REQUIRED} STREQUAL "OPTIONAL")
message(FATAL_ERROR "OpenSSL library not found")
endif()
endfunction()
11 changes: 11 additions & 0 deletions cmake/UseSSH2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function(eth_apply TARGET REQUIRED)
find_package (SSH2)
eth_show_dependency(SSH2 ssh2)

if (SSH2_FOUND)
target_include_directories(${TARGET} SYSTEM PUBLIC ${SSH2_INCLUDE_DIRS})
target_link_libraries(${TARGET} ${SSH2_LIBRARIES})
elseif (NOT ${REQUIRED} STREQUAL "OPTIONAL")
message(FATAL_ERROR "ssh2 library not found")
endif()
endfunction()
11 changes: 11 additions & 0 deletions cmake/UseZLIB.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function(eth_apply TARGET REQUIRED)
find_package (ZLIB)
eth_show_dependency(ZLIB Zlib)
if (ZLIB_FOUND)
target_include_directories(${TARGET} SYSTEM PUBLIC ${ZLIB_INCLUDE_DIRS})
# target_link_libraries(${TARGET} ${ZLIB_LIBRARIES})
target_link_libraries(${TARGET} z)
elseif (NOT ${REQUIRED} STREQUAL "OPTIONAL")
message(FATAL_ERROR "Zlib library not found")
endif()
endfunction()