mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
cmake: consolidate non-linux library handling
Move the handling to the top-level, adding it _once_ to EXTRA_LIBS.
Thus avoiding some duplication across the board.
Note that final handling varies a bit, namely:
- OpenBSD/intl should be handled via the existing cmake/FindGettext.cmake
- Darwin/resolv should not be needed since commit e98a32373 ("core: check
if res_init requires linking with libresolv")
- the backtrace/execinfo handling has been consolidated and moved
In the unlikely case of unwanted over-linking, the platforms can add
`-Wl,--as-needed` to their linker flags. Something which is strongly
encouraged and has been the default across multiple (linux) distros for
years.
Alternatively, if move quirks are needed they should be handled in a
single place.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
committed by
Sébastien Helleu
parent
fc6003c74e
commit
323ab8810e
@@ -311,6 +311,25 @@ else()
|
||||
add_custom_target(translations COMMAND true)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||
find_library(EXECINFO_LIB_PATH execinfo /usr/local/lib)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${EXECINFO_LIB_PATH}")
|
||||
check_function_exists(backtrace HAVE_BACKTRACE)
|
||||
list(APPEND EXTRA_LIBS "execinfo")
|
||||
else()
|
||||
check_symbol_exists(backtrace "execinfo.h" HAVE_BACKTRACE)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Haiku")
|
||||
list(APPEND EXTRA_LIBS "network")
|
||||
else()
|
||||
list(APPEND EXTRA_LIBS "pthread")
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS")
|
||||
list(APPEND EXTRA_LIBS "socket" "nsl")
|
||||
endif()
|
||||
|
||||
list(APPEND EXTRA_LIBS "m")
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
Reference in New Issue
Block a user