Move dependencies above mtxclient in CMake

This commit is contained in:
SyldraTheCat 2022-06-09 00:41:25 +00:00
parent 3af5331c62
commit ba180fbe41
No known key found for this signature in database
GPG Key ID: 280A2D3028A3E9C7
1 changed files with 41 additions and 31 deletions

View File

@ -179,6 +179,32 @@ if(USE_BUNDLED_SPDLOG)
endif()
find_package(spdlog 1.0.0 CONFIG REQUIRED)
if(USE_BUNDLED_COEURL)
include(FetchContent)
FetchContent_Declare(
coeurl
GIT_REPOSITORY https://nheko.im/Nheko-Reborn/coeurl.git
GIT_TAG v0.1.2
)
FetchContent_MakeAvailable(coeurl)
set(COEURL_TARGET_NAME coeurl::coeurl)
else()
# FindPkgConfig sets this as a cache variable, which breaks find_package
if(DEFINED coeurl_FOUND)
unset(coeurl_FOUND CACHE)
endif()
find_package(coeurl 0.1.1 CONFIG)
if (coeurl_FOUND)
set(COEURL_TARGET_NAME coeurl::coeurl)
endif()
endif()
if(NOT COEURL_TARGET_NAME)
find_package(PkgConfig REQUIRED)
pkg_check_modules(coeurl REQUIRED IMPORTED_TARGET coeurl>=0.1.1)
set(COEURL_TARGET_NAME PkgConfig::coeurl)
endif()
#
# LMDB
#
@ -398,19 +424,6 @@ if(USE_BUNDLED_OPENSSL)
hunter_add_package_safe(OpenSSL)
endif()
find_package(OpenSSL 1.1.0 REQUIRED)
if(USE_BUNDLED_MTXCLIENT)
include(FetchContent)
FetchContent_Declare(
MatrixClient
GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git
GIT_TAG 754800d226f71864d8b6925e47542d509333e998
)
set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "")
set(BUILD_LIB_TESTS OFF CACHE INTERNAL "")
FetchContent_MakeAvailable(MatrixClient)
else()
find_package(MatrixClient 0.6.2 REQUIRED)
endif()
if(USE_BUNDLED_OLM)
include(FetchContent)
FetchContent_Declare(
@ -489,6 +502,20 @@ else()
add_library(lmdbxx::lmdbxx ALIAS lmdbxx)
endif()
if(USE_BUNDLED_MTXCLIENT)
include(FetchContent)
FetchContent_Declare(
MatrixClient
GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git
GIT_TAG 754800d226f71864d8b6925e47542d509333e998
)
set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "")
set(BUILD_LIB_TESTS OFF CACHE INTERNAL "")
FetchContent_MakeAvailable(MatrixClient)
else()
find_package(MatrixClient 0.6.2 REQUIRED)
endif()
if (VOIP)
include(FindPkgConfig)
pkg_check_modules(GSTREAMER REQUIRED IMPORTED_TARGET gstreamer-sdp-1.0>=1.18 gstreamer-webrtc-1.0>=1.18)
@ -663,6 +690,7 @@ if (USE_BUNDLED_QTKEYCHAIN)
endif()
target_link_libraries(nheko PRIVATE
${COEURL_TARGET_NAME}
MatrixClient::MatrixClient
cmark::cmark
spdlog::spdlog
@ -696,24 +724,6 @@ if (TARGET PkgConfig::GSTREAMER)
endif()
endif()
if(USE_BUNDLED_COEURL)
include(FetchContent)
FetchContent_Declare(
coeurl
GIT_REPOSITORY https://nheko.im/Nheko-Reborn/coeurl.git
GIT_TAG v0.1.2
)
FetchContent_MakeAvailable(coeurl)
target_link_libraries(nheko PUBLIC coeurl::coeurl)
elseif(coeurl_DIR)
find_package(coeurl CONFIG REQUIRED)
target_link_libraries(nheko PUBLIC coeurl::coeurl)
else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(coeurl REQUIRED IMPORTED_TARGET coeurl>=0.1.1)
target_link_libraries(nheko PUBLIC PkgConfig::coeurl)
endif()
if(MSVC)
target_link_libraries(nheko PRIVATE ntdll)
endif()