Fix dl linking for FreeBSD, as discussed in #1989 (#2117)

* Revert "CMake patches for FreeBSD (#1989)"

This reverts commit 5d2dae5304c890dcf135dac8ef435626c6000ef9.

* Link against CMAKE_DL_LIBS instead of dl

This should be set to the right value for the target platform, see:

https://cmake.org/cmake/help/latest/variable/CMAKE_DL_LIBS.html
This commit is contained in:
Jochen Sprickerhof 2018-01-28 18:07:25 +01:00 committed by Aleksandar Fabijanic
parent bfc375821c
commit 6b48b5160e
2 changed files with 4 additions and 10 deletions

View File

@ -105,10 +105,6 @@ if(ANDROID)
set(SYSLIBS ${SYSLIBS} log)
endif(ANDROID)
if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(SYSLIBS ${SYSLIBS} dl rt)
endif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
# TODO: Why is this here?
add_definitions( -DPCRE_STATIC)

View File

@ -82,7 +82,7 @@ else (CYGWIN)
# Standard 'must be' defines
if (APPLE)
add_definitions( -DPOCO_HAVE_IPv6 -DPOCO_NO_STAT64)
set(SYSLIBS dl)
set(SYSLIBS ${CMAKE_DL_LIBS})
else (APPLE)
add_definitions( -D_REENTRANT -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 )
if (QNX)
@ -92,12 +92,10 @@ else (CYGWIN)
add_definitions(-D__IBMCPP_TR1__)
elseif(${CMAKE_SYSTEM} MATCHES "SunOS")
add_definitions(-m64)
set(SYSLIBS pthread dl rt)
elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
add_definitions( -D_XOPEN_SOURCE=500 -DPOCO_HAVE_FD_POLL)
set(SYSLIBS pthread ${CMAKE_DL_LIBS} rt)
else ()
add_definitions(-D_XOPEN_SOURCE=500 -DPOCO_HAVE_FD_EPOLL)
set(SYSLIBS pthread dl rt)
set(SYSLIBS pthread ${CMAKE_DL_LIBS} rt)
endif ()
endif (APPLE)
endif(UNIX AND NOT ANDROID )
@ -106,7 +104,7 @@ endif (CYGWIN)
if (CMAKE_SYSTEM MATCHES "SunOS")
# Standard 'must be' defines
add_definitions( -D_REENTRANT -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -m64 )
set(SYSLIBS pthread socket xnet nsl resolv rt dl)
set(SYSLIBS pthread socket xnet nsl resolv rt ${CMAKE_DL_LIBS})
endif(CMAKE_SYSTEM MATCHES "SunOS")
if (CMAKE_COMPILER_IS_MINGW)