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
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9877cd7..5177904 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,8 +42,11 @@ macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of source buil
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
# search for libraries
+set(PC_LIBS_PRIVATE "")
+set(PC_REQUIRES_PRIVATE "")
if (WITH_ZLIB)
find_package(ZLIB REQUIRED)
+ string(APPEND PC_REQUIRES_PRIVATE "zlib")
endif (WITH_ZLIB)
if (WITH_GCRYPT)
@@ -53,6 +56,7 @@ elseif(WITH_MBEDTLS)
find_package(MbedTLS REQUIRED)
else()
find_package(OpenSSL 1.1.1 REQUIRED)
+ string(APPEND PC_REQUIRES_PRIVATE " libcrypto")
endif()
if (UNIT_TESTING)
@@ -96,7 +100,7 @@ add_subdirectory(include)
add_subdirectory(src)
# pkg-config file
-if (UNIX OR MINGW)
+if (1)
configure_file(libssh.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc @ONLY)
install(
FILES
@@ -106,7 +110,7 @@ install(
COMPONENT
pkgconfig
)
-endif (UNIX OR MINGW)
+endif (1)
# CMake config files
include(CMakePackageConfigHelpers)
diff --git a/libssh.pc.cmake b/libssh.pc.cmake
index f288b94..759525c 100644
--- a/libssh.pc.cmake
+++ b/libssh.pc.cmake
@@ -7,4 +7,6 @@ Name: @PROJECT_NAME@
Description: The SSH Library
Version: @PROJECT_VERSION@
Libs: -L${libdir} -lssh
+Libs.private: @PC_LIBS_PRIVATE@
+Requires.private: @PC_REQUIRES_PRIVATE@
Cflags: -I${includedir}
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e0243bb..b17d9e2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -54,6 +54,8 @@ if (MINGW AND Threads_FOUND)
${LIBSSH_LINK_LIBRARIES}
Threads::Threads
)
+ string(APPEND PC_LIBS_PRIVATE " ${CMAKE_THREAD_LIBS_INIT}")
+ set(PC_LIBS_PRIVATE "${PC_LIBS_PRIVATE}" PARENT_SCOPE)
endif()
# The ws2_32 needs to be last for mingw to build
@@ -64,6 +66,8 @@ if (WIN32)
iphlpapi
ws2_32
)
+ string(APPEND PC_LIBS_PRIVATE " -liphlpapi -lws2_32 -lshell32 -ladvapi32")
+ set(PC_LIBS_PRIVATE "${PC_LIBS_PRIVATE}" PARENT_SCOPE)
endif (WIN32)
if (BUILD_STATIC_LIB)
|