From 4228754ffb430a10d9ebac38290aaab32391725b Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Thu, 28 Sep 2023 22:11:48 +0100 Subject: [PATCH 01/12] Use imported targets in cmake more consistently --- CMakeLists.txt | 4 ++-- modules/CMakeLists.txt | 3 +-- src/CMakeLists.txt | 12 ++++-------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e76842c..9e00a4f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,7 +110,7 @@ set(HAVE_ZLIB "${ZLIB_FOUND}") tristate_option(CYRUS "Support authentication with Cyrus") if(WANT_CYRUS) - pkg_check_modules(CYRUS libsasl2) + pkg_check_modules(CYRUS IMPORTED_TARGET libsasl2) if(NOT CYRUS_FOUND) # libsasl2.pc is missing on 2.1.25 which is on ubuntu 14.04 # next ubuntu version has 2.1.26 which has libsasl2.pc @@ -143,7 +143,7 @@ set(ZNC_HAVE_ARGON "${ARGON_FOUND}") tristate_option(ICU "Support character encodings") if(WANT_ICU) - pkg_check_modules(ICU ${TRISTATE_ICU_REQUIRED} icu-uc) + pkg_check_modules(ICU ${TRISTATE_ICU_REQUIRED} IMPORTED_TARGET icu-uc) endif() set(HAVE_ICU "${ICU_FOUND}") diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 1a0f73eb..a71dcf03 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -54,8 +54,7 @@ function(add_python_module mod modpath) endfunction() if(CYRUS_FOUND) - set(modcompile_cyrusauth PRIVATE ${CYRUS_CFLAGS}) - set(modlink_cyrusauth ${CYRUS_LDFLAGS}) + set(modlink_cyrusauth PkgConfig::CYRUS) else() set(moddisable_cyrusauth true) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c3eb3008..51fc0e3f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -67,20 +67,16 @@ set(znc_include_dirs "$") target_link_libraries(znclib PRIVATE ${CMAKE_DL_LIBS} Threads::Threads) if(OPENSSL_FOUND) - target_link_libraries(znclib PUBLIC ${OPENSSL_LIBRARIES}) - list(APPEND znc_include_dirs "${OPENSSL_INCLUDE_DIR}") + target_link_libraries(znclib PUBLIC OpenSSL::SSL) endif() if(ZLIB_FOUND) - target_link_libraries(znclib PRIVATE ${ZLIB_LIBRARIES}) - list(APPEND znc_include_dirs ${ZLIB_INCLUDE_DIRS}) + target_link_libraries(znclib PRIVATE ZLIB::ZLIB) endif() if(ICU_FOUND) - target_link_libraries(znclib PUBLIC ${ICU_LDFLAGS}) - list(APPEND znc_include_dirs ${ICU_INCLUDE_DIRS}) + target_link_libraries(znclib PUBLIC PkgConfig::ICU) endif() if(Boost_FOUND) - target_link_libraries(znclib PRIVATE ${Boost_LIBRARIES}) - list(APPEND znc_include_dirs ${Boost_INCLUDE_DIRS}) + target_link_libraries(znclib PRIVATE Boost::locale) endif() if(ZNC_HAVE_ARGON) target_link_libraries(znclib PRIVATE PkgConfig::ARGON) From a69e6b8566f0a7a10874c69d5058a463d0301f45 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Thu, 28 Sep 2023 22:36:48 +0100 Subject: [PATCH 02/12] Maybe fix build on macos --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e76842c..ae6cda77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -297,6 +297,10 @@ else() add_library(cctz::cctz ALIAS cctz) target_include_directories(cctz INTERFACE $) + if (APPLE) + find_library(CoreFoundation CoreFoundation REQUIRED) + target_link_libraries(cctz INTERFACE ${CoreFoundation}) + endif() endif() check_cxx_symbol_exists(getopt_long "getopt.h" HAVE_GETOPT_LONG) From 1987eb37aec194ace3a9a7bdcf31911a6c5b11ad Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Sat, 30 Sep 2023 00:11:10 +0100 Subject: [PATCH 03/12] Add necessary find_dependency() to ZNCConfig.cmake --- CMakeLists.txt | 8 +++ ZNCConfig.cmake.in | 4 ++ cmake/CMakeFindDependencyMacroPC.cmake | 99 ++++++++++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 cmake/CMakeFindDependencyMacroPC.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e00a4f1..6906bb45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,6 +79,8 @@ macro(tristate_option opt help) endif() endmacro() +set(ZNC_CMAKE_FIND_DEPS "") + tristate_option(OPENSSL "Support SSL") if(WANT_OPENSSL) find_package(OpenSSL ${TRISTATE_OPENSSL_REQUIRED}) @@ -95,6 +97,8 @@ if(WANT_OPENSSL) HAVE_SSL_SESSION_get0_cipher) endfunction() check_SSL_SESSION_get0_cipher() + set(ZNC_CMAKE_FIND_DEPS + "${ZNC_CMAKE_FIND_DEPS}\nfind_dependency(OpenSSL)") endif() endif() set(HAVE_LIBSSL "${OPENSSL_FOUND}") @@ -146,6 +150,9 @@ if(WANT_ICU) pkg_check_modules(ICU ${TRISTATE_ICU_REQUIRED} IMPORTED_TARGET icu-uc) endif() set(HAVE_ICU "${ICU_FOUND}") +if(ICU_FOUND) + set(ZNC_CMAKE_FIND_DEPS "${ZNC_CMAKE_FIND_DEPS}\nfind_dependency_pc(ICU icu-uc)") +endif() set(WANT_PERL false CACHE BOOL "Support Perl modules") set(WANT_PYTHON false CACHE BOOL "Support Python modules") @@ -421,6 +428,7 @@ include(CMakePackageConfigHelpers) write_basic_package_version_file("ZNCConfigVersion.cmake" COMPATIBILITY AnyNewerVersion) install(FILES + "${PROJECT_SOURCE_DIR}/cmake/CMakeFindDependencyMacroPC.cmake" "${PROJECT_BINARY_DIR}/ZNCConfig.cmake" "${PROJECT_BINARY_DIR}/ZNCConfigVersion.cmake" DESTINATION "${CMAKE_INSTALL_DATADIR}/znc/cmake") diff --git a/ZNCConfig.cmake.in b/ZNCConfig.cmake.in index a41aa78d..68d3e82f 100644 --- a/ZNCConfig.cmake.in +++ b/ZNCConfig.cmake.in @@ -14,6 +14,10 @@ # limitations under the License. # +include(CMakeFindDependencyMacro) +include("${CMAKE_CURRENT_LIST_DIR}/CMakeFindDependencyMacroPC.cmake") +@ZNC_CMAKE_FIND_DEPS@ + include("${CMAKE_CURRENT_LIST_DIR}/znc_internal.cmake") include("${CMAKE_CURRENT_LIST_DIR}/znc_public.cmake") include(CMakeParseArguments) diff --git a/cmake/CMakeFindDependencyMacroPC.cmake b/cmake/CMakeFindDependencyMacroPC.cmake new file mode 100644 index 00000000..6dda0ec4 --- /dev/null +++ b/cmake/CMakeFindDependencyMacroPC.cmake @@ -0,0 +1,99 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +CMakeFindDependencyMacro +------------------------ + +.. command:: find_dependency + + The ``find_dependency()`` macro wraps a :command:`find_package` call for + a package dependency:: + + find_dependency( [...]) + + It is designed to be used in a + :ref:`Package Configuration File ` + (``Config.cmake``). ``find_dependency`` forwards the correct + parameters for ``QUIET`` and ``REQUIRED`` which were passed to + the original :command:`find_package` call. Any additional arguments + specified are forwarded to :command:`find_package`. + + If the dependency could not be found it sets an informative diagnostic + message and calls :command:`return` to end processing of the calling + package configuration file and return to the :command:`find_package` + command that loaded it. + + .. note:: + + The call to :command:`return` makes this macro unsuitable to call + from :ref:`Find Modules`. + +Package Dependency Search Optimizations +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If ``find_dependency`` is called with arguments identical to a previous +call in the same directory, perhaps due to diamond-shaped package +dependencies, the underlying call to :command:`find_package` is optimized +out. This optimization is important to support large package dependency +graphs while avoiding a combinatorial explosion of repeated searches. +However, the heuristic cannot account for ambient variables that +affect package behavior, such as ``_USE_STATIC_LIBS``, +offered by some packages. Therefore package configuration files should +avoid setting such variables before their calls to ``find_dependency``. + +.. versionchanged:: 3.15 + Previously, the underlying call to :command:`find_package` was always + optimized out if the package had already been found. CMake 3.15 + removed the optimization to support cases in which ``find_dependency`` + call arguments request different components. + +.. versionchanged:: 3.26 + The pre-3.15 optimization was restored, but with the above-described + heuristic to account for varying ``find_dependency`` call arguments. + +#]=======================================================================] + +macro(find_dependency_pc dep) +find_dependency(PkgConfig) + string(SHA256 cmake_fd_call_hash "${dep};${ARGN};${${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED}") + if(_CMAKE_${dep}_${cmake_fd_call_hash}_FOUND) + unset(cmake_fd_call_hash) + else() + list(APPEND _CMAKE_${dep}_HASH_STACK ${cmake_fd_call_hash}) + set(cmake_fd_quiet_arg) + if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) + set(cmake_fd_quiet_arg QUIET) + endif() + set(cmake_fd_required_arg) + if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) + set(cmake_fd_required_arg REQUIRED) + endif() + + get_property(cmake_fd_alreadyTransitive GLOBAL PROPERTY + _CMAKE_${dep}_TRANSITIVE_DEPENDENCY + ) + + pkg_check_modules(${dep} + ${cmake_fd_quiet_arg} + ${cmake_fd_required_arg} + IMPORTED_TARGET ${ARGN} + ) + list(POP_BACK _CMAKE_${dep}_HASH_STACK cmake_fd_call_hash) + set("_CMAKE_${dep}_${cmake_fd_call_hash}_FOUND" "${${dep}_FOUND}") + + if(NOT DEFINED cmake_fd_alreadyTransitive OR cmake_fd_alreadyTransitive) + set_property(GLOBAL PROPERTY _CMAKE_${dep}_TRANSITIVE_DEPENDENCY TRUE) + endif() + + unset(cmake_fd_alreadyTransitive) + unset(cmake_fd_call_hash) + unset(cmake_fd_quiet_arg) + unset(cmake_fd_required_arg) + if (NOT ${dep}_FOUND) + set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency ${dep} could not be found.") + set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False) + return() + endif() + endif() +endmacro() From 901c318028382af08ff18b9291c06840d98625fc Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Sat, 30 Sep 2023 03:11:30 +0100 Subject: [PATCH 04/12] Maybe fix macos build again --- CMakeLists.txt | 3 +++ modules/CMakeLists.txt | 5 +---- src/CMakeLists.txt | 7 +------ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86a9f62d..2c671de8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,6 +80,7 @@ macro(tristate_option opt help) endmacro() set(ZNC_CMAKE_FIND_DEPS "") +set(zncpubdeps) tristate_option(OPENSSL "Support SSL") if(WANT_OPENSSL) @@ -99,6 +100,7 @@ if(WANT_OPENSSL) check_SSL_SESSION_get0_cipher() set(ZNC_CMAKE_FIND_DEPS "${ZNC_CMAKE_FIND_DEPS}\nfind_dependency(OpenSSL)") + list(APPEND zncpubdeps OpenSSL::SSL) endif() endif() set(HAVE_LIBSSL "${OPENSSL_FOUND}") @@ -152,6 +154,7 @@ endif() set(HAVE_ICU "${ICU_FOUND}") if(ICU_FOUND) set(ZNC_CMAKE_FIND_DEPS "${ZNC_CMAKE_FIND_DEPS}\nfind_dependency_pc(ICU icu-uc)") + list(APPEND zncpubdeps PkgConfig::ICU) endif() set(WANT_PERL false CACHE BOOL "Support Perl modules") diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index a71dcf03..a737285d 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -37,11 +37,8 @@ function(add_cxx_module mod modpath) if(moddepend_${mod}) add_dependencies("module_${mod}" ${moddepend_${mod}}) endif() - # ${znclib_LIB_DEPENDS} is to overcome OSX's need for -undefined suppress - # when accessing symbols exported by dependencies of znclib (e.g. - # openssl), but not used in znclib itself target_link_libraries("module_${mod}" PRIVATE ZNC ${modlink_${mod}} - ${znclib_LIB_DEPENDS}) + ${zncpubdeps}) set_target_properties("module_${mod}" PROPERTIES "" "" ${modprop_${mod}}) install(TARGETS "module_${mod}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/znc") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 51fc0e3f..961ffc95 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -66,21 +66,16 @@ set(znc_include_dirs "$" "$") target_link_libraries(znclib PRIVATE ${CMAKE_DL_LIBS} Threads::Threads) -if(OPENSSL_FOUND) - target_link_libraries(znclib PUBLIC OpenSSL::SSL) -endif() if(ZLIB_FOUND) target_link_libraries(znclib PRIVATE ZLIB::ZLIB) endif() -if(ICU_FOUND) - target_link_libraries(znclib PUBLIC PkgConfig::ICU) -endif() if(Boost_FOUND) target_link_libraries(znclib PRIVATE Boost::locale) endif() if(ZNC_HAVE_ARGON) target_link_libraries(znclib PRIVATE PkgConfig::ARGON) endif() +target_link_libraries(znclib PUBLIC ${zncpubdeps}) target_link_libraries(znclib PRIVATE cctz::cctz) target_include_directories(znc PUBLIC ${znc_include_dirs}) target_include_directories(znclib PUBLIC ${znc_include_dirs}) From 31e883f4a6b05356757d03cc086a3fdfa3268b16 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Sat, 30 Sep 2023 03:14:19 +0100 Subject: [PATCH 05/12] Re-enable macos CI --- .github/workflows/build.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64e1e7cb..7f6fb252 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -100,18 +100,18 @@ jobs: #CXXFLAGS: "-fsanitize=undefined -O1 -fPIE -fno-sanitize-recover" #LDFLAGS: "-fsanitize=undefined -pie -fno-sanitize-recover" - #macos: - #name: macOS - #runs-on: macos-latest - #steps: - #- uses: actions/checkout@v3 - #with: - #submodules: true - #- run: | - #brew update - #brew install icu4c qt5 gettext pkg-config cpanminus boost - #- run: source .github/build.sh - #- uses: codecov/codecov-action@v3 + macos: + name: macOS + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - run: | + brew update + brew install icu4c qt5 gettext pkg-config cpanminus boost + - run: source .github/build.sh + - uses: codecov/codecov-action@v3 docker: name: Docker push From 5f2f3b29347b83ac5edf926fac922263c1e1cb6e Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Sat, 30 Sep 2023 09:24:44 +0100 Subject: [PATCH 06/12] Apple libsasl2 is still missing the .pc file --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c671de8..b27d2072 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -132,7 +132,9 @@ if(WANT_CYRUS) CYRUS_HARDCODED) set(CMAKE_REQUIRED_LIBRARIES "${_old_cmake_required_libraries}") if(CYRUS_HARDCODED) - set(CYRUS_LDFLAGS -lsasl2) + add_library(HardcodedCyrusDep INTERFACE) + add_library(PkgConfig::CYRUS ALIAS HardcodedCyrusDep) + target_link_libraries(HardcodedCyrusDep INTERFACE sasl2) set(CYRUS_FOUND true) endif() endif() From 57188cda045a6464e5f995e4c565ac2ad09757fd Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Sat, 30 Sep 2023 10:07:21 +0100 Subject: [PATCH 07/12] Pass list of deps to modperl and modpython bindings too --- modules/modperl/CMakeLists.txt | 2 +- modules/modpython/CMakeLists.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/modperl/CMakeLists.txt b/modules/modperl/CMakeLists.txt index baac04e0..59befc29 100644 --- a/modules/modperl/CMakeLists.txt +++ b/modules/modperl/CMakeLists.txt @@ -82,7 +82,7 @@ target_include_directories(modperl_lib PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/.." "${CMAKE_CURRENT_SOURCE_DIR}/.." ${PERL_INCLUDE_DIRS}) -target_link_libraries(modperl_lib ${znc_link}) +target_link_libraries(modperl_lib ${znc_link} ${zncpubdeps}) set_target_properties(modperl_lib PROPERTIES PREFIX "" SUFFIX ".${perl_ext}" diff --git a/modules/modpython/CMakeLists.txt b/modules/modpython/CMakeLists.txt index 8c1fcc24..8a217041 100644 --- a/modules/modpython/CMakeLists.txt +++ b/modules/modpython/CMakeLists.txt @@ -75,7 +75,8 @@ target_include_directories(modpython_lib PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/.." "${CMAKE_CURRENT_SOURCE_DIR}/.." ${Python3_INCLUDE_DIRS}) -target_link_libraries(modpython_lib ${znc_link} ${Python3_LDFLAGS}) +target_link_libraries(modpython_lib ${znc_link} ${Python3_LDFLAGS} + ${zncpubdeps}) set_target_properties(modpython_lib PROPERTIES PREFIX "_" OUTPUT_NAME "znc_core" From 40875f1dbda4468482a3febbda7e727486f7ca85 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Sat, 30 Sep 2023 10:56:26 +0100 Subject: [PATCH 08/12] Use use_homebrew in znc-buildmod --- CMakeLists.txt | 1 + ZNCConfig.cmake.in | 1 + 2 files changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b27d2072..63375083 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -438,6 +438,7 @@ write_basic_package_version_file("ZNCConfigVersion.cmake" COMPATIBILITY AnyNewerVersion) install(FILES "${PROJECT_SOURCE_DIR}/cmake/CMakeFindDependencyMacroPC.cmake" + "${PROJECT_SOURCE_DIR}/cmake/use_homebrew.cmake" "${PROJECT_BINARY_DIR}/ZNCConfig.cmake" "${PROJECT_BINARY_DIR}/ZNCConfigVersion.cmake" DESTINATION "${CMAKE_INSTALL_DATADIR}/znc/cmake") diff --git a/ZNCConfig.cmake.in b/ZNCConfig.cmake.in index 68d3e82f..1760bb46 100644 --- a/ZNCConfig.cmake.in +++ b/ZNCConfig.cmake.in @@ -16,6 +16,7 @@ include(CMakeFindDependencyMacro) include("${CMAKE_CURRENT_LIST_DIR}/CMakeFindDependencyMacroPC.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/use_homebrew.cmake") @ZNC_CMAKE_FIND_DEPS@ include("${CMAKE_CURRENT_LIST_DIR}/znc_internal.cmake") From 66faa38f6712ccf0d188aa0f470a0a2ea6ad61df Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Sat, 30 Sep 2023 11:33:29 +0100 Subject: [PATCH 09/12] Maybe fix znc-buildmod on macos --- ZNCConfig.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ZNCConfig.cmake.in b/ZNCConfig.cmake.in index 1760bb46..c2591fad 100644 --- a/ZNCConfig.cmake.in +++ b/ZNCConfig.cmake.in @@ -47,7 +47,7 @@ function(znc_setup_module) SUFFIX ".so" NO_SONAME true CXX_VISIBILITY_PRESET "hidden") - target_link_libraries("${znc_mod_TARGET}" PRIVATE ZNC::ZNC) + target_link_libraries("${znc_mod_TARGET}" PRIVATE ZNC::ZNC @zncpubdeps@) endfunction() message(STATUS "Found ZNC @ZNC_VERSION@") From afe94158a75a68ddeb398e96b091008fa2b0c4e0 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Sat, 30 Sep 2023 11:59:53 +0100 Subject: [PATCH 10/12] Try to simplify building modules --- ZNCConfig.cmake.in | 2 +- modules/CMakeLists.txt | 3 +-- modules/modperl/CMakeLists.txt | 2 +- modules/modpython/CMakeLists.txt | 3 +-- src/CMakeLists.txt | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ZNCConfig.cmake.in b/ZNCConfig.cmake.in index c2591fad..1760bb46 100644 --- a/ZNCConfig.cmake.in +++ b/ZNCConfig.cmake.in @@ -47,7 +47,7 @@ function(znc_setup_module) SUFFIX ".so" NO_SONAME true CXX_VISIBILITY_PRESET "hidden") - target_link_libraries("${znc_mod_TARGET}" PRIVATE ZNC::ZNC @zncpubdeps@) + target_link_libraries("${znc_mod_TARGET}" PRIVATE ZNC::ZNC) endfunction() message(STATUS "Found ZNC @ZNC_VERSION@") diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index a737285d..409e1f27 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -37,8 +37,7 @@ function(add_cxx_module mod modpath) if(moddepend_${mod}) add_dependencies("module_${mod}" ${moddepend_${mod}}) endif() - target_link_libraries("module_${mod}" PRIVATE ZNC ${modlink_${mod}} - ${zncpubdeps}) + target_link_libraries("module_${mod}" PRIVATE ZNC ${modlink_${mod}}) set_target_properties("module_${mod}" PROPERTIES "" "" ${modprop_${mod}}) install(TARGETS "module_${mod}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/znc") diff --git a/modules/modperl/CMakeLists.txt b/modules/modperl/CMakeLists.txt index 59befc29..4edf5191 100644 --- a/modules/modperl/CMakeLists.txt +++ b/modules/modperl/CMakeLists.txt @@ -82,7 +82,7 @@ target_include_directories(modperl_lib PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/.." "${CMAKE_CURRENT_SOURCE_DIR}/.." ${PERL_INCLUDE_DIRS}) -target_link_libraries(modperl_lib ${znc_link} ${zncpubdeps}) +target_link_libraries(modperl_lib ZNC) set_target_properties(modperl_lib PROPERTIES PREFIX "" SUFFIX ".${perl_ext}" diff --git a/modules/modpython/CMakeLists.txt b/modules/modpython/CMakeLists.txt index 8a217041..bc92b428 100644 --- a/modules/modpython/CMakeLists.txt +++ b/modules/modpython/CMakeLists.txt @@ -75,8 +75,7 @@ target_include_directories(modpython_lib PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/.." "${CMAKE_CURRENT_SOURCE_DIR}/.." ${Python3_INCLUDE_DIRS}) -target_link_libraries(modpython_lib ${znc_link} ${Python3_LDFLAGS} - ${zncpubdeps}) +target_link_libraries(modpython_lib ZNC ${Python3_LDFLAGS}) set_target_properties(modpython_lib PROPERTIES PREFIX "_" OUTPUT_NAME "znc_core" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 961ffc95..cf919088 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -100,7 +100,7 @@ target_compile_features(znc PUBLIC ${required_cxx11_features}) target_compile_features(znclib PUBLIC ${required_cxx11_features}) add_library(ZNC INTERFACE) -target_link_libraries(ZNC INTERFACE ${znc_link}) +target_link_libraries(ZNC INTERFACE ${znc_link} ${zncpubdeps}) target_compile_definitions(ZNC INTERFACE "znc_export_lib_EXPORTS") if(HAVE_I18N) From 72d1544dc2c87e6971884df508665741b721ac15 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Sat, 30 Sep 2023 12:02:01 +0100 Subject: [PATCH 11/12] Use llvm-cov in macos CI --- .github/build.sh | 3 +++ .github/workflows/build.yml | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/.github/build.sh b/.github/build.sh index 3a277a6b..527e9196 100644 --- a/.github/build.sh +++ b/.github/build.sh @@ -43,6 +43,9 @@ case "${CC:-gcc}" in lcov --list lcov-coverage.txt ;; clang) + if [[ x$(uname) == xDarwin ]]; then + export PATH=$PATH:/Library/Developer/CommandLineTools/usr/bin + fi llvm-profdata merge unittest.profraw -o unittest.profdata llvm-profdata merge inttest.profraw -o inttest.profdata llvm-cov show -show-line-counts-or-regions -instr-profile=unittest.profdata test/unittest_bin > unittest-cmake-coverage.txt diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7f6fb252..7bd10638 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -103,6 +103,10 @@ jobs: macos: name: macOS runs-on: macos-latest + env: + # This doesn't make big difference, since it's the same compiler, but we also use this variable to select lcov vs llvm-cov + CXX: clang++ + CC: clang steps: - uses: actions/checkout@v3 with: From 2b9a582d3e37780d93e3ba2e97637198c88477e9 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Sat, 30 Sep 2023 14:43:15 +0100 Subject: [PATCH 12/12] Bump cmake requirements in subprojects too --- cmake/cxx11check/CMakeLists.txt | 2 +- cmake/perl_check/CMakeLists.txt | 2 +- src/CMakeLists.txt | 5 ----- test/integration/CMakeLists.txt | 2 +- znc-buildmod.cmake.in | 2 +- 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/cmake/cxx11check/CMakeLists.txt b/cmake/cxx11check/CMakeLists.txt index eef4b966..c9da4946 100644 --- a/cmake/cxx11check/CMakeLists.txt +++ b/cmake/cxx11check/CMakeLists.txt @@ -14,7 +14,7 @@ # limitations under the License. # -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.13) project(cxx11check LANGUAGES CXX) set(CMAKE_VERBOSE_MAKEFILE true) diff --git a/cmake/perl_check/CMakeLists.txt b/cmake/perl_check/CMakeLists.txt index c8f02258..7ecf7504 100644 --- a/cmake/perl_check/CMakeLists.txt +++ b/cmake/perl_check/CMakeLists.txt @@ -14,7 +14,7 @@ # limitations under the License. # -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.13) project(perl_check LANGUAGES CXX) set(CMAKE_VERBOSE_MAKEFILE true) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cf919088..d9ef245c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,11 +14,6 @@ # limitations under the License. # -if(CMAKE_VERSION VERSION_LESS 3.2) - # Since 3.2 it does this automatically from BYPRODUCTS - set_source_files_properties("versionc.cpp" PROPERTIES GENERATED true) -endif() - set(znc_cpp "ZNCString.cpp" "znc.cpp" "IRCNetwork.cpp" "Translation.cpp" "IRCSock.cpp" "Client.cpp" "Chan.cpp" "Nick.cpp" "Server.cpp" "Modules.cpp" "MD5.cpp" "Buffer.cpp" "Utils.cpp" "FileUtils.cpp" diff --git a/test/integration/CMakeLists.txt b/test/integration/CMakeLists.txt index 211998ea..5b16001f 100644 --- a/test/integration/CMakeLists.txt +++ b/test/integration/CMakeLists.txt @@ -14,7 +14,7 @@ # limitations under the License. # -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.13) project(ZNCIntegrationTest LANGUAGES CXX) set(CMAKE_CXX_STANDARD 11) diff --git a/znc-buildmod.cmake.in b/znc-buildmod.cmake.in index 9645d060..aae49ede 100755 --- a/znc-buildmod.cmake.in +++ b/znc-buildmod.cmake.in @@ -56,7 +56,7 @@ args = parser.parse_args() with tempfile.TemporaryDirectory() as cmdir: with open(os.path.join(cmdir, 'CMakeLists.txt'), 'w') as cm: - print('cmake_minimum_required(VERSION 3.1)', file=cm) + print('cmake_minimum_required(VERSION 3.13)', file=cm) print('project(ExternalModules LANGUAGES CXX)', file=cm) print('find_package(ZNC @ZNC_VERSION_MAJOR@.@ZNC_VERSION_MINOR@ HINTS ' '@CMAKE_INSTALL_FULL_DATADIR@/znc REQUIRED)', file=cm)