diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2018-08-13 10:27:17 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-08-13 13:49:21 +0200 |
commit | c4d4731ddf6f232bd1f996b76a0a75bb9aed043a (patch) | |
tree | b3d8c40176dbada6a5759074e4a3b11dc63be4ae | |
parent | 139ccaa78cf4caad68c699cac608ba3f0f9fead3 (diff) | |
download | libssh-c4d4731ddf6f232bd1f996b76a0a75bb9aed043a.tar.gz libssh-c4d4731ddf6f232bd1f996b76a0a75bb9aed043a.tar.xz libssh-c4d4731ddf6f232bd1f996b76a0a75bb9aed043a.zip |
cmake: Only install static lib if built WITH_STATIC_LIB
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 83898f3f6c89b55a806aba89549a970788aa4d29)
-rw-r--r-- | DefineOptions.cmake | 6 | ||||
-rw-r--r-- | src/CMakeLists.txt | 24 |
2 files changed, 17 insertions, 13 deletions
diff --git a/DefineOptions.cmake b/DefineOptions.cmake index eb60b097..3b9e4279 100644 --- a/DefineOptions.cmake +++ b/DefineOptions.cmake @@ -29,8 +29,12 @@ if(WITH_BENCHMARKS) set(UNIT_TESTING ON) endif(WITH_BENCHMARKS) +if (WITH_STATIC_LIB) + set(BUILD_STATIC_LIB ON) +endif (WITH_STATIC_LIB) + if (UNIT_TESTING) - set(WITH_STATIC_LIB ON) + set(BUILD_STATIC_LIB ON) endif (UNIT_TESTING) if (WITH_NACL) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e5746b15..7171b4a8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -106,12 +106,12 @@ set(LIBSSH_SHARED_LIBRARY CACHE INTERNAL "libssh shared library" ) -if (WITH_STATIC_LIB) +if (BUILD_STATIC_LIB) set(LIBSSH_STATIC_LIBRARY ssh_static CACHE INTERNAL "libssh static library" ) -endif (WITH_STATIC_LIB) +endif (BUILD_STATIC_LIB) set(libssh_SRCS agent.c @@ -340,7 +340,7 @@ install( COMPONENT libraries ) -if (WITH_STATIC_LIB) +if (BUILD_STATIC_LIB) add_library(${LIBSSH_STATIC_LIBRARY} STATIC ${libssh_SRCS}) if (MSVC) @@ -370,14 +370,14 @@ if (WITH_STATIC_LIB) ) endif (WIN32) - install( - TARGETS - ${LIBSSH_STATIC_LIBRARY} - DESTINATION - ${LIB_INSTALL_DIR}/${OUTPUT_SUFFIX} - COMPONENT - libraries - ) -endif (WITH_STATIC_LIB) + if (WITH_STATIC_LIB) + install(TARGETS + ${LIBSSH_STATIC_LIBRARY} + DESTINATION + ${LIB_INSTALL_DIR}/${OUTPUT_SUFFIX} + COMPONENT + libraries) + endif (WITH_STATIC_LIB) +endif (BUILD_STATIC_LIB) message(STATUS "Threads_FOUND=${Threads_FOUND}") |