File: CMakeLists.txt

package info (click to toggle)
libssh 0.6.3-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 2,824 kB
  • sloc: ansic: 38,301; cpp: 372; makefile: 40; sh: 22; python: 9
file content (125 lines) | stat: -rw-r--r-- 2,828 bytes parent folder | download | duplicates (2)
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
113
114
115
116
117
118
119
120
121
122
123
124
125
project(libssh-threads C)

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

set(LIBSSH_THREADS_PRIVATE_INCLUDE_DIRS
    ${CMAKE_BINARY_DIR}
)

set(LIBSSH_THREADS_SHARED_LIBRARY
  ssh_threads_shared
  CACHE INTERNAL "libssh threads shared library"
)

if (WITH_STATIC_LIB)
  set(LIBSSH_THREADS_STATIC_LIBRARY
    ssh_threads_static
    CACHE INTERNAL "libssh threads static library"
  )
endif (WITH_STATIC_LIB)

set(LIBSSH_THREADS_LINK_LIBRARIES
    ${LIBSSH_SHARED_LIBRARY}
)

set(libssh_threads_SRCS
)

# build and link pthread
if (CMAKE_USE_PTHREADS_INIT)
    set(libssh_threads_SRCS
        ${libssh_threads_SRCS}
        pthread.c
    )

    set(LIBSSH_THREADS_LINK_LIBRARIES
        ${LIBSSH_THREADS_LINK_LIBRARIES}
        ${CMAKE_THREAD_LIBS_INIT}
    )
endif (CMAKE_USE_PTHREADS_INIT)

set(LIBSSH_THREADS_LINK_LIBRARIES
  ${LIBSSH_THREADS_LINK_LIBRARIES}
  CACHE INTERNAL "libssh threads link libraries"
)

include_directories(
  ${LIBSSH_THREADS_PUBLIC_INCLUDE_DIRS}
  ${LIBSSH_THREADS_PRIVATE_INCLUDE_DIRS}
)

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
        ${LIBSSH_LIBRARY_NAME}_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
)

if (WITH_STATIC_LIB)
  add_library(${LIBSSH_THREADS_STATIC_LIBRARY} STATIC ${libssh_threads_SRCS})

  if (MSVC)
    set(OUTPUT_SUFFIX static)
  else (MSVC)
    set(OUTPUT_SUFFIX )
  endif (MSVC)

  set_target_properties(
    ${LIBSSH_THREADS_STATIC_LIBRARY}
      PROPERTIES
        VERSION
          ${LIBRARY_VERSION}
        SOVERSION
          ${LIBRARY_SOVERSION}
        OUTPUT_NAME
          ssh_threads
        ARCHIVE_OUTPUT_DIRECTORY
          ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_SUFFIX}
  )

  if (WIN32)
    set_target_properties(
        ${LIBSSH_THREADS_STATIC_LIBRARY}
            PROPERTIES
                COMPILE_FLAGS
                    "-DLIBSSH_STATIC"
  )
  endif (WIN32)

  install(
    TARGETS
      ${LIBSSH_THREADS_STATIC_LIBRARY}
    DESTINATION
      ${LIB_INSTALL_DIR}/${OUTPUT_SUFFIX}
    COMPONENT
      libraries
  )
endif (WITH_STATIC_LIB)