diff --git a/CMakeLists.txt b/CMakeLists.txt index c99273c6f..8316b2339 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ # along with WeeChat. If not, see . # -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.12) project(weechat C) @@ -242,14 +242,12 @@ endif() # Check for CURL find_package(CURL REQUIRED) -# weechat_gui_common MUST be the first lib in the list -set(STATIC_LIBS weechat_gui_common) +set(STATIC_LIBS weechat_plugins) find_library(DL_LIBRARY NAMES dl PATHS /lib /usr/lib /usr/libexec /usr/local/lib /usr/local/libexec ) -list(APPEND STATIC_LIBS weechat_plugins) if(DL_LIBRARY) string(REGEX REPLACE "/[^/]*$" "" DL_LIBRARY_PATH "${DL_LIBRARY}") set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -L${DL_LIBRARY_PATH}") diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 5c88708c3..c2944d1c5 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -100,6 +100,6 @@ if(ENABLE_CJSON) endif() include_directories("${CMAKE_BINARY_DIR}") -add_library(weechat_core STATIC ${LIB_CORE_SRC}) +add_library(weechat_core OBJECT ${LIB_CORE_SRC}) target_link_libraries(weechat_core coverage_config) add_dependencies(weechat_core version_git) diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index dffab6415..6ccbc254b 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -43,7 +43,7 @@ set(LIB_GUI_COMMON_SRC ) include_directories("${CMAKE_BINARY_DIR}") -add_library(weechat_gui_common STATIC ${LIB_GUI_COMMON_SRC}) +add_library(weechat_gui_common OBJECT ${LIB_GUI_COMMON_SRC}) target_link_libraries(weechat_gui_common coverage_config) list(APPEND STATIC_LIBS weechat_gui_common) diff --git a/src/gui/curses/headless/CMakeLists.txt b/src/gui/curses/headless/CMakeLists.txt index cd79c32f4..6f65ccbfd 100644 --- a/src/gui/curses/headless/CMakeLists.txt +++ b/src/gui/curses/headless/CMakeLists.txt @@ -55,9 +55,7 @@ add_dependencies(${EXECUTABLE} weechat_ncurses_fake ) -# Due to circular references, we must link two times with libweechat_core.a and libweechat_gui_common.a target_link_libraries(${EXECUTABLE} - ${STATIC_LIBS} weechat_gui_headless weechat_ncurses_fake ${EXTRA_LIBS} diff --git a/src/gui/curses/normal/CMakeLists.txt b/src/gui/curses/normal/CMakeLists.txt index 16483a219..3fa7436b0 100644 --- a/src/gui/curses/normal/CMakeLists.txt +++ b/src/gui/curses/normal/CMakeLists.txt @@ -58,8 +58,12 @@ add_dependencies(${EXECUTABLE} weechat_gui_curses_normal) list(APPEND EXTRA_LIBS ${NCURSES_LIBRARY}) -# Due to circular references, we must link two times with libweechat_core.a and libweechat_gui_common.a -target_link_libraries(${EXECUTABLE} ${STATIC_LIBS} weechat_gui_curses_normal ${EXTRA_LIBS} ${STATIC_LIBS} coverage_config) +target_link_libraries(${EXECUTABLE} + weechat_gui_curses_normal + ${EXTRA_LIBS} + ${STATIC_LIBS} + coverage_config +) # Create a symbolic link weechat-curses -> weechat # This link is created for compatibility with old versions on /upgrade. diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d6842e417..a92df7481 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -226,8 +226,6 @@ target_link_libraries(tests weechat_gui_headless weechat_ncurses_fake weechat_unit_tests_core - # due to circular references, we must link two times with libweechat_core.a - weechat_core ${EXTRA_LIBS} ${CURL_LIBRARIES} ${ZLIB_LIBRARY}