diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index bed16d26..25c8ed15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -96,6 +96,16 @@ endif() | |||
96 | # | 96 | # |
97 | ################################################################################ | 97 | ################################################################################ |
98 | 98 | ||
99 | # toxcore_PKGCONFIG_LIBS is what's added to the Libs: line in toxcore.pc. It | ||
100 | # needs to contain all the libraries a program using toxcore should link against | ||
101 | # if it's statically linked. If it's dynamically linked, there is no need to | ||
102 | # explicitly link against all the dependencies, but it doesn't harm much(*) | ||
103 | # either. | ||
104 | # | ||
105 | # (*) It allows client code to use symbols from our dependencies without | ||
106 | # explicitly linking against them. | ||
107 | set(toxcore_PKGCONFIG_LIBS) | ||
108 | |||
99 | # LAYER 1: Crypto core | 109 | # LAYER 1: Crypto core |
100 | # -------------------- | 110 | # -------------------- |
101 | add_library(toxcrypto ${LIBTYPE} | 111 | add_library(toxcrypto ${LIBTYPE} |
@@ -109,11 +119,22 @@ add_library(toxnetwork ${LIBTYPE} | |||
109 | toxcore/network.c | 119 | toxcore/network.c |
110 | toxcore/util.c) | 120 | toxcore/util.c) |
111 | target_link_libraries(toxnetwork toxcrypto) | 121 | target_link_libraries(toxnetwork toxcrypto) |
122 | |||
123 | if(CMAKE_THREAD_LIBS_INIT) | ||
124 | target_link_libraries(toxnetwork ${CMAKE_THREAD_LIBS_INIT}) | ||
125 | set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} "-l${CMAKE_THREAD_LIBS_INIT}") | ||
126 | endif() | ||
127 | |||
112 | if(RT_LIBRARIES) | 128 | if(RT_LIBRARIES) |
113 | target_link_libraries(toxnetwork ${RT_LIBRARIES}) | 129 | target_link_libraries(toxnetwork ${RT_LIBRARIES}) |
114 | set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} "-lrt") | 130 | set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} "-lrt") |
115 | endif() | 131 | endif() |
116 | 132 | ||
133 | if(WIN32) | ||
134 | target_link_libraries(toxnetwork ws2_32 iphlpapi) | ||
135 | set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} "-lws2_32 -liphlpapi") | ||
136 | endif() | ||
137 | |||
117 | # LAYER 3: Distributed Hash Table | 138 | # LAYER 3: Distributed Hash Table |
118 | # ------------------------------- | 139 | # ------------------------------- |
119 | add_library(toxdht ${LIBTYPE} | 140 | add_library(toxdht ${LIBTYPE} |
@@ -162,15 +183,6 @@ add_library(toxcore ${LIBTYPE} | |||
162 | toxcore/tox.c) | 183 | toxcore/tox.c) |
163 | target_link_libraries(toxcore toxgroup) | 184 | target_link_libraries(toxcore toxgroup) |
164 | 185 | ||
165 | target_link_libraries(toxcore ${CMAKE_THREAD_LIBS_INIT}) | ||
166 | if(CMAKE_THREAD_LIBS_INIT) | ||
167 | set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} "-l${CMAKE_THREAD_LIBS_INIT}") | ||
168 | endif() | ||
169 | |||
170 | if(WIN32) | ||
171 | target_link_libraries(toxcore ws2_32 iphlpapi) | ||
172 | endif() | ||
173 | |||
174 | 186 | ||
175 | ################################################################################ | 187 | ################################################################################ |
176 | # | 188 | # |