net: link necessary libraries in Solaris

Solaris needs programs to link to socket and nsl in order to use BSD
sockets. Tell CMake to do so, this time for real.

Thanks to boyski for bearing with me through the various iterations of
this patch.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
This commit is contained in:
Carlos Martín Nieto 2011-07-14 17:05:22 +02:00
parent 52e50c1a80
commit e944cfa949

View File

@ -92,6 +92,8 @@ ADD_LIBRARY(git2 ${SRC} ${SRC_ZLIB})
IF (WIN32)
TARGET_LINK_LIBRARIES(git2 ws2_32)
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
TARGET_LINK_LIBRARIES(git2 socket nsl)
ENDIF ()
TARGET_LINK_LIBRARIES(git2 ${CMAKE_THREAD_LIBS_INIT})
@ -117,6 +119,11 @@ IF (BUILD_TESTS)
ADD_EXECUTABLE(libgit2_test tests/test_main.c tests/test_lib.c tests/test_helpers.c ${SRC} ${SRC_TEST} ${SRC_ZLIB})
TARGET_LINK_LIBRARIES(libgit2_test ${CMAKE_THREAD_LIBS_INIT})
IF (WIN32)
TARGET_LINK_LIBRARIES(libgit2_test ws2_32)
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
TARGET_LINK_LIBRARIES(libgit2_test socket nsl)
ENDIF ()
ENABLE_TESTING()
ADD_TEST(libgit2_test libgit2_test)