diff --git a/CMakeLists.txt b/CMakeLists.txt index 80e213221..67f43d123 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 07ab0cc79..0f5747aeb 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -81,14 +81,6 @@ set(LIB_CORE_SRC include(CheckSymbolExists) check_symbol_exists(flock "sys/file.h" HAVE_FLOCK) -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) -else() - check_symbol_exists(backtrace "execinfo.h" HAVE_BACKTRACE) -endif() - if(ENABLE_ZSTD) include_directories(${LIBZSTD_INCLUDE_DIRS}) endif() diff --git a/src/gui/curses/CMakeLists.txt b/src/gui/curses/CMakeLists.txt index 1ec67614b..822504435 100644 --- a/src/gui/curses/CMakeLists.txt +++ b/src/gui/curses/CMakeLists.txt @@ -21,22 +21,6 @@ # along with WeeChat. If not, see . # -if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" AND HAVE_BACKTRACE) - list(APPEND EXTRA_LIBS "execinfo") -endif() - -if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS") - list(APPEND EXTRA_LIBS "socket" "nsl") -endif() - -if(${CMAKE_SYSTEM_NAME} STREQUAL "Haiku") - list(APPEND EXTRA_LIBS "network") -endif() - -if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Haiku") - list(APPEND EXTRA_LIBS "pthread") -endif() - if(ENABLE_NCURSES) subdirs(normal) endif() diff --git a/tests/fuzz/CMakeLists.txt b/tests/fuzz/CMakeLists.txt index 8d11137e6..a6f591ee3 100644 --- a/tests/fuzz/CMakeLists.txt +++ b/tests/fuzz/CMakeLists.txt @@ -40,27 +40,6 @@ if(NOT CYGWIN) add_definitions(-fPIC) endif() -if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" AND HAVE_BACKTRACE) - list(APPEND EXTRA_LIBS "execinfo") -endif() - -if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS") - list(APPEND EXTRA_LIBS "socket" "nsl") -endif() - -if(${CMAKE_SYSTEM_NAME} STREQUAL "Haiku") - list(APPEND EXTRA_LIBS "network") -endif() - -if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Haiku") - list(APPEND EXTRA_LIBS "pthread") -endif() - -if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - # link with resolv lib on macOS - list(APPEND EXTRA_LIBS "resolv") -endif() - list(APPEND FUZZ_TARGET_LINK weechat_core weechat_plugins diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index d54ca35de..f06b3006d 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -206,17 +206,6 @@ endif() add_library(weechat_unit_tests_plugins MODULE ${LIB_WEECHAT_UNIT_TESTS_PLUGINS_SRC}) -if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD") - list(APPEND EXTRA_LIBS "intl") - if(HAVE_BACKTRACE) - list(APPEND EXTRA_LIBS "execinfo") - endif() -endif() - -if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Haiku") - list(APPEND EXTRA_LIBS "pthread") -endif() - # binary to run tests set(WEECHAT_TESTS_SRC tests.cpp tests.h