Skip to content

Commit 0fc76cf

Browse files
committed
CMake: put all extra libraries in ADDITIONAL_LIBS
1 parent 0af81f6 commit 0fc76cf

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

CMakeLists.txt

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -197,26 +197,23 @@ if(Threads_FOUND)
197197
endif()
198198
if(ZLIB_FOUND)
199199
set(LIBVNCSERVER_HAVE_LIBZ 1)
200-
else()
201-
unset(ZLIB_LIBRARIES) # would otherwise contain -NOTFOUND, confusing target_link_libraries()
200+
list(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES})
202201
endif()
203202
if(LZO_FOUND)
204203
set(LIBVNCSERVER_HAVE_LZO 1)
205-
else()
206-
unset(LZO_LIBRARIES CACHE) # would otherwise contain -NOTFOUND, confusing target_link_libraries()
204+
list(APPEND ADDITIONAL_LIBS ${LZO_LIBRARIES})
207205
endif()
208206
if(JPEG_FOUND)
209207
set(LIBVNCSERVER_HAVE_LIBJPEG 1)
210-
else()
211-
unset(JPEG_LIBRARIES) # would otherwise confuse target_link_libraries()
208+
list(APPEND ADDITIONAL_LIBS ${JPEG_LIBRARIES})
212209
endif()
213210
if(PNG_FOUND)
214211
set(LIBVNCSERVER_HAVE_LIBPNG 1)
215212
else()
216213
unset(PNG_LIBRARIES) # would otherwise contain -NOTFOUND, confusing target_link_libraries()
217214
endif()
218-
if(NOT OPENSSL_FOUND)
219-
unset(OPENSSL_LIBRARIES) # would otherwise contain -NOTFOUND, confusing target_link_libraries()
215+
if(OPENSSL_FOUND)
216+
list(APPEND ADDITIONAL_LIBS ${OPENSSL_LIBRARIES})
220217
endif()
221218
if(SYSTEMD_FOUND)
222219
add_definitions(-DLIBVNCSERVER_WITH_SYSTEMD)
@@ -251,6 +248,7 @@ endif()
251248

252249
if(GNUTLS_FOUND)
253250
set(LIBVNCSERVER_HAVE_GNUTLS 1)
251+
list(APPEND ADDITIONAL_LIBS ${GNUTLS_LIBRARIES})
254252
endif()
255253

256254
if(OPENSSL_FOUND)
@@ -460,20 +458,10 @@ endif()
460458

461459
target_link_libraries(vncclient
462460
${ADDITIONAL_LIBS}
463-
${ZLIB_LIBRARIES}
464-
${LZO_LIBRARIES}
465-
${JPEG_LIBRARIES}
466-
${GNUTLS_LIBRARIES}
467-
${OPENSSL_LIBRARIES}
468461
)
469462
target_link_libraries(vncserver
470463
${ADDITIONAL_LIBS}
471-
${ZLIB_LIBRARIES}
472-
${LZO_LIBRARIES}
473-
${JPEG_LIBRARIES}
474464
${PNG_LIBRARIES}
475-
${GNUTLS_LIBRARIES}
476-
${OPENSSL_LIBRARIES}
477465
)
478466

479467
SET_TARGET_PROPERTIES(vncclient vncserver

0 commit comments

Comments
 (0)