[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Add option to disable shared libs
[Thread Prev] | [Thread Next]
- Subject: Add option to disable shared libs
- From: Tony Theodore <tony.t@xxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Sun, 29 Oct 2017 11:46:01 +1100
- To: libssh@xxxxxxxxxx
Hi, It’s sometimes useful to separate the build of static and shared libs, the patch below is fairly straightforward but I’ve broken it in two as I can’t the get re-indentation to display as a single hunk. Cheers, Tony From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tony Theodore <tonyt@xxxxxxxxxx> Date: Sun, 29 Oct 2017 00:11:28 +1100 Subject: [PATCH] add option to disable shared libs diff --git a/DefineOptions.cmake b/DefineOptions.cmake index 1111111..2222222 100644 --- a/DefineOptions.cmake +++ b/DefineOptions.cmake @@ -3,6 +3,7 @@ option(WITH_ZLIB "Build with ZLIB support" ON) option(WITH_SSH1 "Build with SSH1 support" OFF) option(WITH_SFTP "Build with SFTP support" ON) option(WITH_SERVER "Build with SSH server support" ON) +option(WITH_SHARED_LIB "Build with a shared library" ON) option(WITH_STATIC_LIB "Build with a static library" OFF) option(WITH_DEBUG_CRYPTO "Build with cryto debug output" OFF) option(WITH_DEBUG_CALLTRACE "Build with calltrace debug output" ON) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1111111..2222222 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -225,6 +225,7 @@ include_directories( ${LIBSSH_PRIVATE_INCLUDE_DIRS} ) +if (WITH_SHARED_LIB) add_library(${LIBSSH_SHARED_LIBRARY} SHARED ${libssh_SRCS}) target_link_libraries(${LIBSSH_SHARED_LIBRARY} ${LIBSSH_LINK_LIBRARIES}) @@ -259,6 +260,7 @@ install( ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT libraries ) +endif (WITH_SHARED_LIB) if (WITH_STATIC_LIB) add_library(${LIBSSH_STATIC_LIBRARY} STATIC ${libssh_SRCS}) diff --git a/src/threads/CMakeLists.txt b/src/threads/CMakeLists.txt index 1111111..2222222 100644 --- a/src/threads/CMakeLists.txt +++ b/src/threads/CMakeLists.txt @@ -59,6 +59,7 @@ include_directories( if (libssh_threads_SRCS) set(LIBSSH_THREADS ON CACHE "libssh threads lib" INTERNAL) + if (WITH_SHARED_LIB) add_library(${LIBSSH_THREADS_SHARED_LIBRARY} SHARED ${libssh_threads_SRCS}) target_link_libraries(${LIBSSH_THREADS_SHARED_LIBRARY} ${LIBSSH_THREADS_LINK_LIBRARIES}) @@ -88,6 +89,7 @@ if (libssh_threads_SRCS) ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT libraries ) + endif (WITH_SHARED_LIB) if (WITH_STATIC_LIB) add_library(${LIBSSH_THREADS_STATIC_LIBRARY} STATIC ${libssh_threads_SRCS}) From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tony Theodore <tonyt@xxxxxxxxxx> Date: Sun, 29 Oct 2017 00:45:55 +1100 Subject: [PATCH] add indentation for shared lib hunks diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1111111..2222222 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -226,40 +226,40 @@ include_directories( ) if (WITH_SHARED_LIB) -add_library(${LIBSSH_SHARED_LIBRARY} SHARED ${libssh_SRCS}) - -target_link_libraries(${LIBSSH_SHARED_LIBRARY} ${LIBSSH_LINK_LIBRARIES}) - -set_target_properties( - ${LIBSSH_SHARED_LIBRARY} - PROPERTIES - VERSION - ${LIBRARY_VERSION} - SOVERSION - ${LIBRARY_SOVERSION} - OUTPUT_NAME - ssh - DEFINE_SYMBOL - LIBSSH_EXPORTS -) + add_library(${LIBSSH_SHARED_LIBRARY} SHARED ${libssh_SRCS}) + + target_link_libraries(${LIBSSH_SHARED_LIBRARY} ${LIBSSH_LINK_LIBRARIES}) + + set_target_properties( + ${LIBSSH_SHARED_LIBRARY} + PROPERTIES + VERSION + ${LIBRARY_VERSION} + SOVERSION + ${LIBRARY_SOVERSION} + OUTPUT_NAME + ssh + DEFINE_SYMBOL + LIBSSH_EXPORTS + ) -if (WITH_VISIBILITY_HIDDEN) - set_target_properties(${LIBSSH_SHARED_LIBRARY} PROPERTIES COMPILE_FLAGS "-fvisibility=hidden") -endif (WITH_VISIBILITY_HIDDEN) + if (WITH_VISIBILITY_HIDDEN) + set_target_properties(${LIBSSH_SHARED_LIBRARY} PROPERTIES COMPILE_FLAGS "-fvisibility=hidden") + endif (WITH_VISIBILITY_HIDDEN) -if (MINGW) - set_target_properties(${LIBSSH_SHARED_LIBRARY} PROPERTIES LINK_FLAGS "-Wl,--enable-stdcall-fixup") -endif () + if (MINGW) + set_target_properties(${LIBSSH_SHARED_LIBRARY} PROPERTIES LINK_FLAGS "-Wl,--enable-stdcall-fixup") + endif () -install( - TARGETS - ${LIBSSH_SHARED_LIBRARY} - RUNTIME DESTINATION ${BIN_INSTALL_DIR} - LIBRARY DESTINATION ${LIB_INSTALL_DIR} - ARCHIVE DESTINATION ${LIB_INSTALL_DIR} - COMPONENT libraries -) + install( + TARGETS + ${LIBSSH_SHARED_LIBRARY} + RUNTIME DESTINATION ${BIN_INSTALL_DIR} + LIBRARY DESTINATION ${LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${LIB_INSTALL_DIR} + COMPONENT libraries + ) endif (WITH_SHARED_LIB) if (WITH_STATIC_LIB) diff --git a/src/threads/CMakeLists.txt b/src/threads/CMakeLists.txt index 1111111..2222222 100644 --- a/src/threads/CMakeLists.txt +++ b/src/threads/CMakeLists.txt @@ -60,35 +60,35 @@ if (libssh_threads_SRCS) set(LIBSSH_THREADS ON CACHE "libssh threads lib" INTERNAL) if (WITH_SHARED_LIB) - add_library(${LIBSSH_THREADS_SHARED_LIBRARY} SHARED ${libssh_threads_SRCS}) - - target_link_libraries(${LIBSSH_THREADS_SHARED_LIBRARY} ${LIBSSH_THREADS_LINK_LIBRARIES}) - - set_target_properties( - ${LIBSSH_THREADS_SHARED_LIBRARY} - PROPERTIES - VERSION - ${LIBRARY_VERSION} - SOVERSION - ${LIBRARY_SOVERSION} - OUTPUT_NAME - ssh_threads - DEFINE_SYMBOL - LIBSSH_EXPORTS - ) + add_library(${LIBSSH_THREADS_SHARED_LIBRARY} SHARED ${libssh_threads_SRCS}) - if (WITH_VISIBILITY_HIDDEN) - set_target_properties(${LIBSSH_THREADS_SHARED_LIBRARY} PROPERTIES COMPILE_FLAGS "-fvisibility=hidden") - endif (WITH_VISIBILITY_HIDDEN) + target_link_libraries(${LIBSSH_THREADS_SHARED_LIBRARY} ${LIBSSH_THREADS_LINK_LIBRARIES}) - install( - TARGETS + set_target_properties( ${LIBSSH_THREADS_SHARED_LIBRARY} - RUNTIME DESTINATION ${BIN_INSTALL_DIR} - LIBRARY DESTINATION ${LIB_INSTALL_DIR} - ARCHIVE DESTINATION ${LIB_INSTALL_DIR} - COMPONENT libraries - ) + PROPERTIES + VERSION + ${LIBRARY_VERSION} + SOVERSION + ${LIBRARY_SOVERSION} + OUTPUT_NAME + ssh_threads + DEFINE_SYMBOL + LIBSSH_EXPORTS + ) + + if (WITH_VISIBILITY_HIDDEN) + set_target_properties(${LIBSSH_THREADS_SHARED_LIBRARY} PROPERTIES COMPILE_FLAGS "-fvisibility=hidden") + endif (WITH_VISIBILITY_HIDDEN) + + install( + TARGETS + ${LIBSSH_THREADS_SHARED_LIBRARY} + RUNTIME DESTINATION ${BIN_INSTALL_DIR} + LIBRARY DESTINATION ${LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${LIB_INSTALL_DIR} + COMPONENT libraries + ) endif (WITH_SHARED_LIB) if (WITH_STATIC_LIB)
Re: Add option to disable shared libs | Andreas Schneider <asn@xxxxxxxxxxxxxx> |