diff options
-rw-r--r-- | 3rdParty/linenoise/CMakeLists.txt | 2 | ||||
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | cmake/find_gengetopt.cmake (renamed from cmake/gengetopt.cmake) | 0 | ||||
-rw-r--r-- | cmake/find_libssh.cmake | 21 | ||||
-rw-r--r-- | src/CMakeLists.txt | 4 |
5 files changed, 29 insertions, 4 deletions
diff --git a/3rdParty/linenoise/CMakeLists.txt b/3rdParty/linenoise/CMakeLists.txt index 6ccf4e0..e4df181 100644 --- a/3rdParty/linenoise/CMakeLists.txt +++ b/3rdParty/linenoise/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 2.6 FATAL_ERROR) -include_directories(${LIBSSH_PUBLIC_INCLUDE_DIRS}) +include_directories(${libssh_INCLUDE_PATH}) set(LINENOUSE_C_SRC linenoise.c diff --git a/CMakeLists.txt b/CMakeLists.txt index a134b6a..b5e5786 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,8 @@ cmake_minimum_required(VERSION 2.6 FATAL_ERROR) set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") -include(cmake/gengetopt.cmake) +include(cmake/find_gengetopt.cmake) +include(cmake/find_libssh.cmake) project(cssh C) @@ -10,6 +11,9 @@ set( CSSH_VERSION 0.0.1 ) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -D_XOPEN_SOURCE=700") +set( libssh_FIND_REQUIRED TRUE) +find_libssh( ) + enable_testing( ) add_subdirectory(3rdParty) diff --git a/cmake/gengetopt.cmake b/cmake/find_gengetopt.cmake index 3caea3e..3caea3e 100644 --- a/cmake/gengetopt.cmake +++ b/cmake/find_gengetopt.cmake diff --git a/cmake/find_libssh.cmake b/cmake/find_libssh.cmake new file mode 100644 index 0000000..30cf41f --- /dev/null +++ b/cmake/find_libssh.cmake @@ -0,0 +1,21 @@ + +MACRO( FIND_LIBSSH ) + find_path(libssh_INCLUDE_PATH NAMES libssh/libssh.h) + find_library(libssh_LIBRARY NAMES ssh) + if(libssh_INCLUDE_PATH AND libssh_LIBRARY) + set(libssh_FOUND TRUE) + endif(libssh_INCLUDE_PATH AND libssh_LIBRARY) + if(libssh_FOUND) + if(NOT libssh_FIND_QUIETLY) + message(STATUS "Found libssh: ${libssh_LIBRARY}") + message(STATUS "libssh include: ${libssh_INCLUDE_PATH}") + message(STATUS "libssh library: ${libssh_LIBRARY}") + endif(NOT libssh_FIND_QUIETLY) + else(libssh_FOUND) + if(libssh_FIND_REQUIRED) + message(FATAL_ERROR "Could not find libssh library.") + endif(libssh_FIND_REQUIRED) + endif(libssh_FOUND) + +ENDMACRO( FIND_LIBSSH ) + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d61aec9..6404868 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.6 FATAL_ERROR) include_directories( - ${LIBSSH_PUBLIC_INCLUDE_DIRS} + ${libssh_INCLUDE_PATH} "${PROJECT_BINARY_DIR}/src" "${PROJECT_SOURCE_DIR}/3rdParty/linenoise" ) @@ -16,6 +16,6 @@ ADD_GENGETOPT_FILES(SRC options.ggo) add_executable(cssh ${SRC}) -target_link_libraries(cssh ssh curses linenoise) +target_link_libraries(cssh ${libssh_LIBRARY} curses linenoise) install( TARGETS cssh RUNTIME DESTINATION bin ) |