Mercurial > irccd
changeset 1107:02c1b78b9b58
cmake: rename some targets and explain
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 20 Oct 2021 15:07:37 +0200 |
parents | 5facd2f604b6 |
children | a09d4c9b8518 |
files | CMakeLists.txt irccd/CMakeLists.txt irccdctl/CMakeLists.txt lib/CMakeLists.txt |
diffstat | 4 files changed, 29 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Wed Oct 20 14:55:20 2021 +0200 +++ b/CMakeLists.txt Wed Oct 20 15:07:37 2021 +0200 @@ -16,6 +16,22 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # +# +# Overview of projects targets +# ============================ +# +# Irccd is a host program that loads C native plugins, to do so it exports the +# public API by its own and plugins must not link to the library code itself. +# But for unit testing the project we don't want to compile over and over the +# same files that *must* link against the library code so we split: +# +# - libirccd (lib/, static library): contains the public API for C plugins. +# - irccd-static (irccd/, object code): contains all irccd(1) code *without* +# the main entry point. This code isn't publicly exposed to the plugins. +# - irccd (irccd/, executable): contains main and config parser code. +# - irccdctl (irccdctl, executable): contain irccdctl(1) utility. +# + cmake_minimum_required(VERSION 2.20) cmake_policy(SET CMP0048 NEW) project(irccd @@ -42,6 +58,9 @@ option(IRCCD_WITH_SSL "Enable SSL (requires OpenSSL)" On) option(IRCCD_WITH_TESTS "Enable unit tests" On) +# Check presence of POSIX m library +find_library(M_LIBRARY m libm) + include(GNUInstallDirs) include(cmake/IrccdDefinePlugin.cmake) @@ -54,8 +73,6 @@ add_subdirectory(extern/libduktape) endif () -# Check presence of POSIX m library -find_library(M_LIBRARY m libm) add_subdirectory(extern/libutlist) add_subdirectory(extern/libketopt)
--- a/irccd/CMakeLists.txt Wed Oct 20 14:55:20 2021 +0200 +++ b/irccd/CMakeLists.txt Wed Oct 20 15:07:37 2021 +0200 @@ -16,19 +16,6 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # -# -# Overview of projects and targets here. Irccd is a host program that loads C -# native plugins, to do so it exports the public API by its own and plugins -# must not link to the library code itself. But for unit testing the project -# we don't want to compile over and over the same files that *must* link -# against the library code so we split: -# -# - libirccd-static (static library): contains the public API for C plugins. -# - irccd-static (static library): contains all irccd(1) code *without* the -# main entry point. This code isn't publicly exposed to the plugins. -# - irccd (executable): contains main and config parser code. -# - project(irccd) set( @@ -83,7 +70,7 @@ add_flex_bison_dependency(lex yacc) # -# irccd-static +# libirccd-static # ------------------------------------------------------------------- # add_library( @@ -101,7 +88,7 @@ irccd-static ${CMAKE_DL_LIBS} Threads::Threads - libirccd-static + libirccd ) set_target_properties(irccd-static PROPERTIES PREFIX "")
--- a/irccdctl/CMakeLists.txt Wed Oct 20 14:55:20 2021 +0200 +++ b/irccdctl/CMakeLists.txt Wed Oct 20 15:07:37 2021 +0200 @@ -19,6 +19,6 @@ project(irccdctl) add_executable(irccdctl ${irccdctl_SOURCE_DIR}/irccdctl.c) -target_link_libraries(irccdctl libirccd-static libirccd-ketopt) +target_link_libraries(irccdctl libirccd libirccd-ketopt) source_group(TREE ${irccdctl_SOURCE_DIR} FILES ${irccdctl_SOURCE_DIR}/irccdctl.c) install(TARGETS irccdctl DESTINATION ${CMAKE_INSTALL_BINDIR})
--- a/lib/CMakeLists.txt Wed Oct 20 14:55:20 2021 +0200 +++ b/lib/CMakeLists.txt Wed Oct 20 15:07:37 2021 +0200 @@ -57,11 +57,11 @@ ${libirccd_BINARY_DIR}/irccd/config.h ) -add_library(libirccd-static STATIC ${LIBBSD_SOURCES} ${SOURCES}) -target_link_libraries(libirccd-static PUBLIC libirccd-utlist) -target_compile_definitions(libirccd-static PUBLIC _XOPEN_SOURCE=700) +add_library(libirccd STATIC ${LIBBSD_SOURCES} ${SOURCES}) +target_link_libraries(libirccd PUBLIC libirccd-utlist) +target_compile_definitions(libirccd PUBLIC _XOPEN_SOURCE=700) target_include_directories( - libirccd-static + libirccd PUBLIC $<BUILD_INTERFACE:${libirccd_SOURCE_DIR}> $<BUILD_INTERFACE:${libirccd_BINARY_DIR}> @@ -69,13 +69,13 @@ PRIVATE $<BUILD_INTERFACE:${libirccd_BINARY_DIR}/irccd> ) -set_target_properties(libirccd-static PROPERTIES PREFIX "") +set_target_properties(libirccd PROPERTIES PREFIX "") if (IRCCD_WITH_JS) - target_link_libraries(libirccd-static PUBLIC libirccd-duktape) + target_link_libraries(libirccd PUBLIC libirccd-duktape) endif () if (IRCCD_WITH_SSL) - target_link_libraries(libirccd-static PUBLIC OpenSSL::SSL OpenSSL::Crypto) + target_link_libraries(libirccd PUBLIC OpenSSL::SSL OpenSSL::Crypto) endif () source_group(extern/libbsd FILES ${LIBBSD_SOURCES})