mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-02 16:20:01 +00:00
Added libssh2 cmake module
This commit is contained in:
parent
574b86b722
commit
7369b3c3bf
2
.gitignore
vendored
2
.gitignore
vendored
@ -24,8 +24,8 @@ msvc/Release/
|
|||||||
*.sdf
|
*.sdf
|
||||||
*.opensdf
|
*.opensdf
|
||||||
*.aps
|
*.aps
|
||||||
CMake*
|
|
||||||
*.cmake
|
*.cmake
|
||||||
|
!cmake/Modules/*.cmake
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*~
|
*~
|
||||||
tags
|
tags
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
PROJECT(libgit2 C)
|
PROJECT(libgit2 C)
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||||
|
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
||||||
|
|
||||||
# Build options
|
# Build options
|
||||||
#
|
#
|
||||||
OPTION( SONAME "Set the (SO)VERSION of the target" ON )
|
OPTION( SONAME "Set the (SO)VERSION of the target" ON )
|
||||||
@ -138,6 +140,15 @@ ELSE()
|
|||||||
FILE(GLOB SRC_ZLIB deps/zlib/*.c)
|
FILE(GLOB SRC_ZLIB deps/zlib/*.c)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
IF(NOT LIBSSH2_LIBRARY)
|
||||||
|
FIND_PACKAGE(LIBSSH2 QUIET)
|
||||||
|
ENDIF()
|
||||||
|
IF (LIBSSH2_FOUND)
|
||||||
|
ADD_DEFINITIONS(-DGIT_SSH)
|
||||||
|
INCLUDE_DIRECTORIES(${LIBSSH2_INCLUDE_DIR})
|
||||||
|
SET(SSH_LIBRARIES ${LIBSSH2_LIBRARIES})
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
# Platform specific compilation flags
|
# Platform specific compilation flags
|
||||||
IF (MSVC)
|
IF (MSVC)
|
||||||
|
|
||||||
@ -280,6 +291,7 @@ FILE(GLOB SRC_GIT2 src/*.c src/transports/*.c src/xdiff/*.c)
|
|||||||
# Compile and link libgit2
|
# Compile and link libgit2
|
||||||
ADD_LIBRARY(git2 ${SRC_GIT2} ${SRC_OS} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1} ${WIN_RC})
|
ADD_LIBRARY(git2 ${SRC_GIT2} ${SRC_OS} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1} ${WIN_RC})
|
||||||
TARGET_LINK_LIBRARIES(git2 ${SSL_LIBRARIES})
|
TARGET_LINK_LIBRARIES(git2 ${SSL_LIBRARIES})
|
||||||
|
TARGET_LINK_LIBRARIES(git2 ${SSH_LIBRARIES})
|
||||||
TARGET_OS_LIBRARIES(git2)
|
TARGET_OS_LIBRARIES(git2)
|
||||||
|
|
||||||
# Workaround for Cmake bug #0011240 (see http://public.kitware.com/Bug/view.php?id=11240)
|
# Workaround for Cmake bug #0011240 (see http://public.kitware.com/Bug/view.php?id=11240)
|
||||||
@ -340,6 +352,7 @@ IF (BUILD_CLAR)
|
|||||||
ADD_EXECUTABLE(libgit2_clar ${SRC_GIT2} ${SRC_OS} ${SRC_CLAR} ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1})
|
ADD_EXECUTABLE(libgit2_clar ${SRC_GIT2} ${SRC_OS} ${SRC_CLAR} ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1})
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(libgit2_clar ${SSL_LIBRARIES})
|
TARGET_LINK_LIBRARIES(libgit2_clar ${SSL_LIBRARIES})
|
||||||
|
TARGET_LINK_LIBRARIES(libgit2_clar ${SSH_LIBRARIES})
|
||||||
TARGET_OS_LIBRARIES(libgit2_clar)
|
TARGET_OS_LIBRARIES(libgit2_clar)
|
||||||
MSVC_SPLIT_SOURCES(libgit2_clar)
|
MSVC_SPLIT_SOURCES(libgit2_clar)
|
||||||
|
|
||||||
|
44
cmake/Modules/FindLibSSH2.cmake
Normal file
44
cmake/Modules/FindLibSSH2.cmake
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
if (LIBSSH2_LIBRARIES AND LIBSSH2_INCLUDE_DIRS)
|
||||||
|
set(LIBSSH2_FOUND TRUE)
|
||||||
|
else (LIBSSH2_LIBRARIES AND LIBSSH2_INCLUDE_DIRS)
|
||||||
|
find_path(LIBSSH2_INCLUDE_DIR
|
||||||
|
NAMES
|
||||||
|
libssh2.h
|
||||||
|
PATHS
|
||||||
|
/usr/include
|
||||||
|
/usr/local/include
|
||||||
|
/opt/local/include
|
||||||
|
/sw/include
|
||||||
|
${CMAKE_INCLUDE_PATH}
|
||||||
|
${CMAKE_INSTALL_PREFIX}/include
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(LIBSSH2_LIBRARY
|
||||||
|
NAMES
|
||||||
|
ssh2
|
||||||
|
libssh2
|
||||||
|
PATHS
|
||||||
|
/usr/lib
|
||||||
|
/usr/local/lib
|
||||||
|
/opt/local/lib
|
||||||
|
/sw/lib
|
||||||
|
${CMAKE_LIBRARY_PATH}
|
||||||
|
${CMAKE_INSTALL_PREFIX}/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
if (LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY)
|
||||||
|
set(LIBSSH2_FOUND TRUE)
|
||||||
|
endif (LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY)
|
||||||
|
|
||||||
|
if (LIBSSH2_FOUND)
|
||||||
|
set(LIBSSH2_INCLUDE_DIRS
|
||||||
|
${LIBSSH2_INCLUDE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
set(LIBSSH2_LIBRARIES
|
||||||
|
${LIBSSH2_LIBRARIES}
|
||||||
|
${LIBSSH2_LIBRARY}
|
||||||
|
)
|
||||||
|
endif (LIBSSH2_FOUND)
|
||||||
|
endif (LIBSSH2_LIBRARIES AND LIBSSH2_INCLUDE_DIRS)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user