aboutsummaryrefslogtreecommitdiff
path: root/libssh/CMakeLists.txt
blob: 62bf4b92a622fc22f017f468b6422add92095db4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
project(libssh-library)

set(LIBSSH_PUBLIC_INCLUDE_DIRS
  ${CMAKE_SOURCE_DIR}/include
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_SOURCE_DIR}
  CACHE INTERNAL "libssh public include directories"
)

set(LIBSSH_PRIVATE_INCLUDE_DIRS
  ${CMAKE_BINARY_DIR}
  ${ZLIB_INCLUDE_DIRS}
)

set(LIBSSH_LIBRARY
  ssh
  CACHE INTERNAL "libssh library"
)

set(LIBSSH_LINK_LIBRARIES
  ${LIBSSH_LIBRARY}
  ${ZLIB_LIBRARIES}
)

if (CRYPTO_LIBRARY)
  set(LIBSSH_PRIVATE_INCLUDE_DIRS
    ${LIBSSH_PRIVATE_INCLUDE_DIRS}
    ${OPENSSL_INCLUDE_DIRS}
  )
  set(LIBSSH_LINK_LIBRARIES
    ${LIBSSH_LINK_LIBRARIES}
    ${CRYPTO_LIBRARY}
  )
endif (CRYPTO_LIBRARY)

if (GCRYPT_LIBRARY)
  set(LIBSSH_PRIVATE_INCLUDE_DIRS
    ${LIBSSH_PRIVATE_INCLUDE_DIRS}
    ${GCRYPT_INCLUDE_DIRS}
  )
  set(LIBSSH_LINK_LIBRARIES
    ${LIBSSH_LINK_LIBRARIES}
    ${GCRYPT_LIBRARY}
  )
endif (GCRYPT_LIBRARY)


set(libssh_SRCS
  agent.c
  auth1.c
  auth.c
  base64.c
  buffer.c
  channels1.c
  channels.c
  client.c
  CMakeLists.txt
  connect.c
  crc32.c
  crypt.c
  dh.c
  error.c
  gcrypt_missing.c
  gzip.c
  init.c
  kex.c
  keyfiles.c
  keys.c
  libssh.vers
  log.c
  Makefile.am
  match.c
  messages.c
  misc.c
  options.c
  packet.c
  server.c
  session.c
  sftp.c
  sftpserver.c
  socket.c
  string.c
  wrapper.c
)

include_directories(
  ${LIBSSH_PUBLIC_INCLUDE_DIRS}
  ${LIBSSH_PRIVATE_INCLUDE_DIRS}
)

add_library(${LIBSSH_LIBRARY} SHARED ${libssh_SRCS})

target_link_libraries(${LIBSSH_LINK_LIBRARIES})

set_target_properties(
  ${LIBSSH_LIBRARY}
    PROPERTIES
      VERSION
        ${LIBRARY_VERSION}
      SOVERSION
        ${LIBRARY_SOVERSION}
)

install(
  TARGETS
    ${LIBSSH_LIBRARY}
  DESTINATION
    ${LIB_INSTALL_DIR}
  COMPONENT
    libraries
)