[libssh] Only build one flavor at a time, don't build examples.

This commit is contained in:
Robert Schumacher 2018-03-13 07:37:20 -07:00
parent 50a93f0197
commit 9de17844e0
3 changed files with 41 additions and 9 deletions

View File

@ -1,4 +1,4 @@
Source: libssh
Version: 0.7.5-2
Version: 0.7.5-3
Description: libssh is a multiplatform C library implementing the SSHv2 and SSHv1 protocol on client and server side
Build-Depends: zlib, openssl

View File

@ -0,0 +1,20 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1012ddf..612f0ba 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -225,6 +225,7 @@ include_directories(
${LIBSSH_PRIVATE_INCLUDE_DIRS}
)
+if (NOT WITH_STATIC_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()
if (WITH_STATIC_LIB)
add_library(${LIBSSH_STATIC_LIBRARY} STATIC ${libssh_SRCS})

View File

@ -1,7 +1,7 @@
include(vcpkg_common_functions)
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
message(FATAL_ERROR "WindowsStore not supported")
message(FATAL_ERROR "WindowsStore not supported")
endif()
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libssh-0.7.5)
vcpkg_download_distfile(ARCHIVE
@ -11,23 +11,35 @@ vcpkg_download_distfile(ARCHIVE
)
vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES ${CMAKE_CURRENT_LIST_DIR}/build-one-flavor.patch
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" WITH_STATIC_LIB)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS -DWITH_STATIC_LIB=ON
OPTIONS
-DWITH_STATIC_LIB=${WITH_STATIC_LIB}
-DWITH_EXAMPLES=OFF
-DWITH_TESTING=OFF
-DWITH_NACL=OFF
-DWITH_GSSAPI=OFF
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/static/ssh.lib ${CURRENT_PACKAGES_DIR}/lib/ssh.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/static/ssh.lib ${CURRENT_PACKAGES_DIR}/debug/lib/ssh.lib)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/static/ssh.lib ${CURRENT_PACKAGES_DIR}/lib/ssh.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/static/ssh.lib ${CURRENT_PACKAGES_DIR}/debug/lib/ssh.lib)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
file(READ ${CURRENT_PACKAGES_DIR}/include/libssh/libssh.h _contents)
string(REPLACE "#ifdef LIBSSH_STATIC" "#if 1" _contents "${_contents}")
file(WRITE ${CURRENT_PACKAGES_DIR}/include/libssh/libssh.h "${_contents}")
file(READ ${CURRENT_PACKAGES_DIR}/include/libssh/libssh.h _contents)
string(REPLACE "#ifdef LIBSSH_STATIC" "#if 1" _contents "${_contents}")
file(WRITE ${CURRENT_PACKAGES_DIR}/include/libssh/libssh.h "${_contents}")
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/static ${CURRENT_PACKAGES_DIR}/debug/lib/static)