Use imported targets in cmake more consistently

This commit is contained in:
Alexey Sokolov
2023-09-28 22:11:48 +01:00
parent 458063a860
commit 4228754ffb
3 changed files with 7 additions and 12 deletions

View File

@@ -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}")

View File

@@ -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()

View File

@@ -67,20 +67,16 @@ set(znc_include_dirs
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_FULL_INCLUDEDIR}>")
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)