OSDN Git Service

link QSocketNotifier test to socket and nsl libraries
authorIvailo Monev <xakepa10@gmail.com>
Sat, 18 Sep 2021 23:46:48 +0000 (02:46 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Sat, 18 Sep 2021 23:46:48 +0000 (02:46 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
CMakeLists.txt
tests/auto/qsocketnotifier/CMakeLists.txt

index 940e292..dab0ddd 100644 (file)
@@ -423,6 +423,19 @@ endif()
 # only Solaris is known to have these
 find_library(SOCKET_LIBRARY NAMES socket)
 find_library(NSL_LIBRARY NAMES nsl)
+set(SOCKET_AND_NSL_LIBRARIES)
+if(SOCKET_LIBRARY)
+    set(SOCKET_AND_NSL_LIBRARIES
+        ${SOCKET_AND_NSL_LIBRARIES}
+        ${SOCKET_LIBRARY}
+    )
+endif()
+if(NSL_LIBRARY)
+    set(SOCKET_AND_NSL_LIBRARIES
+        ${SOCKET_AND_NSL_LIBRARIES}
+        ${NSL_LIBRARY}
+    )
+endif()
 
 # used in components, tests and JavaScriptCore
 katie_check_header("cxxabi.h")
@@ -449,20 +462,7 @@ katie_check_function(pthread_setname_np "pthread.h")
 cmake_reset_check_state()
 
 cmake_reset_check_state()
-set(socket_and_nls_libraries)
-if(SOCKET_LIBRARY)
-    set(socket_and_nls_libraries
-        ${socket_and_nls_libraries}
-        ${SOCKET_LIBRARY}
-    )
-endif()
-if(NSL_LIBRARY)
-    set(socket_and_nls_libraries
-        ${socket_and_nls_libraries}
-        ${NSL_LIBRARY}
-    )
-endif()
-set(CMAKE_REQUIRED_LIBRARIES ${socket_and_nls_libraries})
+set(CMAKE_REQUIRED_LIBRARIES ${SOCKET_AND_NSL_LIBRARIES})
 katie_check_function(getifaddrs "ifaddrs.h")
 katie_check_function(accept4 "sys/socket.h")
 katie_check_function(paccept "sys/socket.h")
index 1119e3c..9e19e3d 100644 (file)
@@ -2,4 +2,4 @@ katie_test(tst_qsocketnotifier
     ${CMAKE_CURRENT_SOURCE_DIR}/tst_qsocketnotifier.cpp
 )
 
-target_link_libraries(tst_qsocketnotifier KtNetwork)
+target_link_libraries(tst_qsocketnotifier KtNetwork ${SOCKET_AND_NSL_LIBRARIES})