mirror of
https://github.com/upa/mscp.git
synced 2026-02-23 08:04:42 +08:00
build libssh-static from mscp cmake
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
build
|
build
|
||||||
|
compile_commands.json
|
||||||
.*.swp
|
.*.swp
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ project(mscp
|
|||||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
|
||||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
|
||||||
|
|
||||||
|
|
||||||
|
# add libssh static library
|
||||||
|
add_subdirectory(libssh EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
list(APPEND CMAKE_PREFIX_PATH /usr/local) # intel mac homebrew prefix
|
list(APPEND CMAKE_PREFIX_PATH /usr/local) # intel mac homebrew prefix
|
||||||
list(APPEND CMAKE_PREFIX_PATH /opt/homebrew) # arm mac homebrew prefix
|
list(APPEND CMAKE_PREFIX_PATH /opt/homebrew) # arm mac homebrew prefix
|
||||||
@@ -23,29 +27,20 @@ set(MSCP_LINK_DIRS "")
|
|||||||
set(MSCP_COMPILE_OPTS "")
|
set(MSCP_COMPILE_OPTS "")
|
||||||
set(MSCP_INCLUDE_DIRS ${mscp_SOURCE_DIR}/src)
|
set(MSCP_INCLUDE_DIRS ${mscp_SOURCE_DIR}/src)
|
||||||
|
|
||||||
if (LIBSSH_PATH)
|
list(APPEND MSCP_COMPILE_OPTS -iquote ${CMAKE_CURRENT_BINARY_DIR}/libssh/include)
|
||||||
# libssh.a must be placed before other shared libraries for gcc
|
list(APPEND MSCP_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/libssh/include)
|
||||||
list(APPEND MSCP_COMPILE_OPTS -iquote ${LIBSSH_PATH}/include)
|
list(APPEND MSCP_LINK_LIBS ssh-static)
|
||||||
list(APPEND MSCP_INCLUDE_DIRS ${LIBSSH_PATH}/include)
|
|
||||||
list(APPEND MSCP_LINK_DIRS ${LIBSSH_PATH}/lib)
|
|
||||||
list(APPEND MSCP_LINK_LIBS libssh.a)
|
|
||||||
|
|
||||||
find_package(GSSAPI)
|
find_package(GSSAPI)
|
||||||
list(APPEND MSCP_LINK_LIBS ${GSSAPI_LIBRARIES})
|
list(APPEND MSCP_LINK_LIBS ${GSSAPI_LIBRARIES})
|
||||||
|
|
||||||
find_package(OpenSSL)
|
find_package(OpenSSL)
|
||||||
list(APPEND MSCP_LINK_LIBS ${OPENSSL_LIBRARIES})
|
list(APPEND MSCP_LINK_LIBS ${OPENSSL_LIBRARIES})
|
||||||
|
|
||||||
find_package(ZLIB)
|
find_package(ZLIB)
|
||||||
list(APPEND MSCP_LINK_LIBS ${ZLIB_LIBRARIES})
|
list(APPEND MSCP_LINK_LIBS ${ZLIB_LIBRARIES})
|
||||||
else()
|
|
||||||
find_package(libssh REQUIRED)
|
|
||||||
list(APPEND MSCP_LINK_LIBS ssh)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (WITH_ASYNC_WRITE)
|
target_compile_definitions(mscp PUBLIC ASYNC_WRITE=1)
|
||||||
target_compile_definitions(mscp PUBLIC ASYNC_WRITE=1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_include_directories(mscp PRIVATE ${MSCP_INCLUDE_DIRS})
|
target_include_directories(mscp PRIVATE ${MSCP_INCLUDE_DIRS})
|
||||||
target_link_directories(mscp PRIVATE ${MSCP_LINK_DIRS})
|
target_link_directories(mscp PRIVATE ${MSCP_LINK_DIRS})
|
||||||
|
|||||||
Reference in New Issue
Block a user