Browse Source

ERR: Do not link nsl if not necessary

Andy Cedilnik 22 years ago
parent
commit
70d3fe1a34
1 changed files with 6 additions and 1 deletions
  1. 6 1
      Source/CTest/Curl/CMakeLists.txt

+ 6 - 1
Source/CTest/Curl/CMakeLists.txt

@@ -95,10 +95,15 @@ MACRO(CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE)
 ENDMACRO(CHECK_LIBRARY_EXISTS_CONCAT)
 
 # Check for all needed libraries
-CHECK_LIBRARY_EXISTS_CONCAT("nsl"    gethostname  HAVE_LIBNSL)
 CHECK_LIBRARY_EXISTS_CONCAT("dl"     dlopen       HAVE_LIBDL)
 CHECK_LIBRARY_EXISTS_CONCAT("ucb"    gethostname  HAVE_LIBUCB)
 CHECK_LIBRARY_EXISTS_CONCAT("socket" connect      HAVE_LIBSOCKET)
+CHECK_LIBRARY_EXISTS("c" gethostname "" NOT_NEED_LIBNSL)
+
+IF(NOT NOT_NEED_LIBNSL)
+  CHECK_LIBRARY_EXISTS_CONCAT("nsl"    gethostname  HAVE_LIBNSL)
+ENDIF(NOT NOT_NEED_LIBNSL)
+
 CHECK_LIBRARY_EXISTS_CONCAT("ws2_32" getch        HAVE_LIBWS2_32)
 CHECK_LIBRARY_EXISTS_CONCAT("winmm"  getch        HAVE_LIBWINMM)
 CHECK_LIBRARY_EXISTS_CONCAT("z"      inflateEnd   HAVE_LIBZ)