From 8a3b02f68dad8f5dd2f236e26d44dd67b3597be4 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 23 Sep 2011 08:00:25 +0200 Subject: cmake: Fix library linking. --- CMakeLists.txt | 6 +++--- ConfigureChecks.cmake | 1 - DefineOptions.cmake | 4 ++-- src/CMakeLists.txt | 39 ++++++++++++++++++++++++--------------- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bae373e..7ecad05e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,9 +44,9 @@ include(MacroAddPlugin) include(MacroCopyFile) # search for libraries -if (WITH_LIBZ) +if (WITH_ZLIB) find_package(ZLIB REQUIRED) -endif (WITH_LIBZ) +endif (WITH_ZLIB) if (WITH_GCRYPT) find_package(GCrypt REQUIRED) @@ -101,7 +101,7 @@ endif (WITH_TESTING) message(STATUS "********************************************") message(STATUS "********** ${PROJECT_NAME} build options : **********") -message(STATUS "zlib support: ${WITH_LIBZ}") +message(STATUS "zlib support: ${WITH_ZLIB}") message(STATUS "libgcrypt support: ${WITH_GCRYPT}") message(STATUS "SSH-1 support: ${WITH_SSH1}") message(STATUS "SFTP support: ${WITH_SFTP}") diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index bd592444..197ae21d 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -140,7 +140,6 @@ set(LIBSSH_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CACHE INTERNAL "libssh # LIBRARIES if (OPENSSL_FOUND) set(HAVE_LIBCRYPTO 1) - endif (OPENSSL_FOUND) if (GCRYPT_FOUND) diff --git a/DefineOptions.cmake b/DefineOptions.cmake index 1340b442..ea8265c0 100644 --- a/DefineOptions.cmake +++ b/DefineOptions.cmake @@ -13,9 +13,9 @@ option(WITH_CLIENT_TESTING "Build with client tests; requires a running sshd" OF option(WITH_BENCHMARKS "Build benchmarks tools" OFF) if (WITH_ZLIB) - set(WITH_ZLIB ON) + set(WITH_LIBZ ON) else (WITH_ZLIB) - set(WITH_ZLIB OFF) + set(WITH_LIBZ OFF) endif (WITH_ZLIB) if(WITH_BENCHMARKS) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1e8aefb1..f03cf5df 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,25 +8,10 @@ set(LIBSSH_PUBLIC_INCLUDE_DIRS set(LIBSSH_PRIVATE_INCLUDE_DIRS ${CMAKE_BINARY_DIR} ${OPENSSL_INCLUDE_DIRS} - ${GCRYPT_INCLUDE_DIRS} - ${ZLIB_INCLUDE_DIRS} ) -set(LIBSSH_SHARED_LIBRARY - ssh_shared - CACHE INTERNAL "libssh shared library" -) - -if (WITH_STATIC_LIB) - set(LIBSSH_STATIC_LIBRARY - ssh_static - CACHE INTERNAL "libssh static library" - ) -endif (WITH_STATIC_LIB) - set(LIBSSH_LINK_LIBRARIES ${LIBSSH_REQUIRED_LIBRARIES} - ${ZLIB_LIBRARIES} ) if (WIN32) @@ -67,11 +52,35 @@ if (GCRYPT_LIBRARY) ) endif (GCRYPT_LIBRARY) +if (WITH_ZLIB) + set(LIBSSH_PRIVATE_INCLUDE_DIRS + ${LIBSSH_PRIVATE_INCLUDE_DIRS} + ${ZLIB_INCLUDE_DIRS} + ) + + set(LIBSSH_LINK_LIBRARIES + ${LIBSSH_LINK_LIBRARIES} + ${ZLIB_LIBRARY} + ) +endif (WITH_ZLIB) + set(LIBSSH_LINK_LIBRARIES ${LIBSSH_LINK_LIBRARIES} CACHE INTERNAL "libssh link libraries" ) +set(LIBSSH_SHARED_LIBRARY + ssh_shared + CACHE INTERNAL "libssh shared library" +) + +if (WITH_STATIC_LIB) + set(LIBSSH_STATIC_LIBRARY + ssh_static + CACHE INTERNAL "libssh static library" + ) +endif (WITH_STATIC_LIB) + set(libssh_SRCS agent.c auth.c -- cgit v1.2.3