1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

build: require CMake 3.12, resolve circular dependency

In order to resolve the circular dependency, we need to annotate the
respective static libraries as "object" libraries.

This requires cmake 3.12, where Debian 10 (old old stable) and Ubuntu
20.04 have 3.13 and 3.16 respectively.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
Emil Velikov
2021-07-09 16:49:40 +01:00
committed by Sébastien Helleu
parent 0e9f841974
commit fc7b00562c
6 changed files with 10 additions and 12 deletions
+2 -4
View File
@@ -19,7 +19,7 @@
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
#
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}")
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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)
-2
View File
@@ -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}
+6 -2
View File
@@ -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.
-2
View File
@@ -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}