mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Fix hunter messing with pkg-config
This commit is contained in:
parent
a45d1bbeaa
commit
3a3735f67a
1 changed files with 56 additions and 8 deletions
|
@ -23,6 +23,23 @@ HunterGate(
|
||||||
LOCAL
|
LOCAL
|
||||||
)
|
)
|
||||||
|
|
||||||
|
macro(hunter_add_package_safe)
|
||||||
|
set(pkg_temp_backup_libdir "$ENV{PKG_CONFIG_LIBDIR}")
|
||||||
|
set(pkg_temp_backup_path "$ENV{PKG_CONFIG_PATH}")
|
||||||
|
hunter_add_package(${ARGV})
|
||||||
|
if("${pkg_temp_backup_path}" STREQUAL "")
|
||||||
|
unset(ENV{PKG_CONFIG_PATH})
|
||||||
|
else()
|
||||||
|
set(ENV{PKG_CONFIG_PATH} "${pkg_temp_backup_path}")
|
||||||
|
endif()
|
||||||
|
if("${pkg_temp_backup_libdir}" STREQUAL "")
|
||||||
|
unset(ENV{PKG_CONFIG_LIBDIR})
|
||||||
|
else()
|
||||||
|
set(ENV{PKG_CONFIG_LIBDIR} "${pkg_temp_backup_libdir}")
|
||||||
|
endif()
|
||||||
|
message("pkg_conf_path: '$ENV{PKG_CONFIG_PATH}', pkg_conf_libdir: '$ENV{PKG_CONFIG_LIBDIR}'")
|
||||||
|
endmacro()
|
||||||
|
|
||||||
option(USE_BUNDLED_SPDLOG "Use the bundled version of spdlog." ${HUNTER_ENABLED})
|
option(USE_BUNDLED_SPDLOG "Use the bundled version of spdlog." ${HUNTER_ENABLED})
|
||||||
option(USE_BUNDLED_OLM "Use the bundled version of libolm." ${HUNTER_ENABLED})
|
option(USE_BUNDLED_OLM "Use the bundled version of libolm." ${HUNTER_ENABLED})
|
||||||
option(USE_BUNDLED_GTEST "Use the bundled version of Google Test." ${HUNTER_ENABLED})
|
option(USE_BUNDLED_GTEST "Use the bundled version of Google Test." ${HUNTER_ENABLED})
|
||||||
|
@ -120,10 +137,16 @@ endif()
|
||||||
#
|
#
|
||||||
## Need to repeat all libevent deps?!?
|
## Need to repeat all libevent deps?!?
|
||||||
if (USE_BUNDLED_LIBEVENT)
|
if (USE_BUNDLED_LIBEVENT)
|
||||||
hunter_add_package(Libevent)
|
hunter_add_package_safe(Libevent)
|
||||||
find_package(Libevent CONFIG REQUIRED)
|
find_package(Libevent CONFIG REQUIRED)
|
||||||
else()
|
else()
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
|
if (HUNTER_ENABLED)
|
||||||
|
message("pkg_conf_path: '$ENV{PKG_CONFIG_PATH}', pkg_conf_libdir: '$ENV{PKG_CONFIG_LIBDIR}'")
|
||||||
|
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_LIBDIR}")
|
||||||
|
set(ENV{PKG_CONFIG_LIBDIR} "${pkg_temp_backup}")
|
||||||
|
message("pkg_conf_path: '$ENV{PKG_CONFIG_PATH}', pkg_conf_libdir: '$ENV{PKG_CONFIG_LIBDIR}'")
|
||||||
|
endif()
|
||||||
pkg_check_modules(libevent_core REQUIRED IMPORTED_TARGET libevent_core)
|
pkg_check_modules(libevent_core REQUIRED IMPORTED_TARGET libevent_core)
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
pkg_check_modules(libevent_windows REQUIRED IMPORTED_TARGET libevent_windows)
|
pkg_check_modules(libevent_windows REQUIRED IMPORTED_TARGET libevent_windows)
|
||||||
|
@ -135,16 +158,22 @@ endif()
|
||||||
|
|
||||||
# curl
|
# curl
|
||||||
if (USE_BUNDLED_LIBCURL)
|
if (USE_BUNDLED_LIBCURL)
|
||||||
hunter_add_package(CURL)
|
hunter_add_package_safe(CURL)
|
||||||
find_package(CURL CONFIG REQUIRED)
|
find_package(CURL CONFIG REQUIRED)
|
||||||
else()
|
else()
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
|
if (HUNTER_ENABLED)
|
||||||
|
message("pkg_conf_path: '$ENV{PKG_CONFIG_PATH}', pkg_conf_libdir: '$ENV{PKG_CONFIG_LIBDIR}'")
|
||||||
|
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_LIBDIR}")
|
||||||
|
set(ENV{PKG_CONFIG_LIBDIR} "${pkg_temp_backup}")
|
||||||
|
message("pkg_conf_path: '$ENV{PKG_CONFIG_PATH}', pkg_conf_libdir: '$ENV{PKG_CONFIG_LIBDIR}'")
|
||||||
|
endif()
|
||||||
pkg_check_modules(libcurl REQUIRED IMPORTED_TARGET libcurl)
|
pkg_check_modules(libcurl REQUIRED IMPORTED_TARGET libcurl)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# spdlog
|
# spdlog
|
||||||
if(USE_BUNDLED_SPDLOG)
|
if(USE_BUNDLED_SPDLOG)
|
||||||
hunter_add_package(spdlog)
|
hunter_add_package_safe(spdlog)
|
||||||
endif()
|
endif()
|
||||||
find_package(spdlog 1.0.0 CONFIG REQUIRED)
|
find_package(spdlog 1.0.0 CONFIG REQUIRED)
|
||||||
|
|
||||||
|
@ -153,7 +182,7 @@ find_package(spdlog 1.0.0 CONFIG REQUIRED)
|
||||||
#
|
#
|
||||||
#include(LMDB)
|
#include(LMDB)
|
||||||
if(USE_BUNDLED_LMDB)
|
if(USE_BUNDLED_LMDB)
|
||||||
hunter_add_package(lmdb)
|
hunter_add_package_safe(lmdb)
|
||||||
find_package(liblmdb CONFIG REQUIRED)
|
find_package(liblmdb CONFIG REQUIRED)
|
||||||
|
|
||||||
target_include_directories(liblmdb::lmdb INTERFACE
|
target_include_directories(liblmdb::lmdb INTERFACE
|
||||||
|
@ -170,6 +199,12 @@ find_package(Qt5QuickCompiler)
|
||||||
find_package(Qt5DBus)
|
find_package(Qt5DBus)
|
||||||
|
|
||||||
if (USE_BUNDLED_QTKEYCHAIN)
|
if (USE_BUNDLED_QTKEYCHAIN)
|
||||||
|
if (HUNTER_ENABLED)
|
||||||
|
message("pkg_conf_path: '$ENV{PKG_CONFIG_PATH}', pkg_conf_libdir: '$ENV{PKG_CONFIG_LIBDIR}'")
|
||||||
|
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_LIBDIR}")
|
||||||
|
set(ENV{PKG_CONFIG_LIBDIR} "${pkg_temp_backup}")
|
||||||
|
message("pkg_conf_path: '$ENV{PKG_CONFIG_PATH}', pkg_conf_libdir: '$ENV{PKG_CONFIG_LIBDIR}'")
|
||||||
|
endif()
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
qt5keychain
|
qt5keychain
|
||||||
|
@ -380,7 +415,7 @@ include(FeatureSummary)
|
||||||
|
|
||||||
|
|
||||||
if(USE_BUNDLED_OPENSSL)
|
if(USE_BUNDLED_OPENSSL)
|
||||||
hunter_add_package(OpenSSL)
|
hunter_add_package_safe(OpenSSL)
|
||||||
endif()
|
endif()
|
||||||
find_package(OpenSSL 1.1.0 REQUIRED)
|
find_package(OpenSSL 1.1.0 REQUIRED)
|
||||||
if(USE_BUNDLED_MTXCLIENT)
|
if(USE_BUNDLED_MTXCLIENT)
|
||||||
|
@ -414,7 +449,7 @@ else()
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
if(USE_BUNDLED_SPDLOG)
|
if(USE_BUNDLED_SPDLOG)
|
||||||
hunter_add_package(spdlog)
|
hunter_add_package_safe(spdlog)
|
||||||
endif()
|
endif()
|
||||||
find_package(spdlog 1.0.0 CONFIG REQUIRED)
|
find_package(spdlog 1.0.0 CONFIG REQUIRED)
|
||||||
|
|
||||||
|
@ -437,7 +472,7 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(USE_BUNDLED_JSON)
|
if(USE_BUNDLED_JSON)
|
||||||
hunter_add_package(nlohmann_json)
|
hunter_add_package_safe(nlohmann_json)
|
||||||
endif()
|
endif()
|
||||||
find_package(nlohmann_json 3.2.0)
|
find_package(nlohmann_json 3.2.0)
|
||||||
set_package_properties(nlohmann_json PROPERTIES
|
set_package_properties(nlohmann_json PROPERTIES
|
||||||
|
@ -474,8 +509,15 @@ else()
|
||||||
add_library(lmdbxx::lmdbxx ALIAS lmdbxx)
|
add_library(lmdbxx::lmdbxx ALIAS lmdbxx)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (HUNTER_ENABLED)
|
||||||
|
message("pkg_conf_path: '$ENV{PKG_CONFIG_PATH}', pkg_conf_libdir: '$ENV{PKG_CONFIG_LIBDIR}'")
|
||||||
|
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_LIBDIR}")
|
||||||
|
set(ENV{PKG_CONFIG_LIBDIR} "${pkg_temp_backup}")
|
||||||
|
unset(ENV{PKG_CONFIG_LIBDIR})
|
||||||
|
message("pkg_conf_path: '$ENV{PKG_CONFIG_PATH}', pkg_conf_libdir: '$ENV{PKG_CONFIG_LIBDIR}'")
|
||||||
|
endif()
|
||||||
include(FindPkgConfig)
|
include(FindPkgConfig)
|
||||||
pkg_check_modules(GSTREAMER IMPORTED_TARGET gstreamer-sdp-1.0>=1.18 gstreamer-webrtc-1.0>=1.18)
|
pkg_check_modules(GSTREAMER NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH IMPORTED_TARGET gstreamer-sdp-1.0>=1.18 gstreamer-webrtc-1.0>=1.18)
|
||||||
if (TARGET PkgConfig::GSTREAMER)
|
if (TARGET PkgConfig::GSTREAMER)
|
||||||
add_feature_info(voip ON "GStreamer found. Call support is enabled automatically.")
|
add_feature_info(voip ON "GStreamer found. Call support is enabled automatically.")
|
||||||
pkg_check_modules(XCB IMPORTED_TARGET xcb xcb-ewmh)
|
pkg_check_modules(XCB IMPORTED_TARGET xcb xcb-ewmh)
|
||||||
|
@ -700,6 +742,12 @@ elseif(coeurl_DIR)
|
||||||
target_link_libraries(nheko PUBLIC coeurl::coeurl)
|
target_link_libraries(nheko PUBLIC coeurl::coeurl)
|
||||||
else()
|
else()
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
|
if (HUNTER_ENABLED)
|
||||||
|
message("pkg_conf_path: '$ENV{PKG_CONFIG_PATH}', pkg_conf_libdir: '$ENV{PKG_CONFIG_LIBDIR}'")
|
||||||
|
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_LIBDIR}")
|
||||||
|
set(ENV{PKG_CONFIG_LIBDIR} "${pkg_temp_backup}")
|
||||||
|
message("pkg_conf_path: '$ENV{PKG_CONFIG_PATH}', pkg_conf_libdir: '$ENV{PKG_CONFIG_LIBDIR}'")
|
||||||
|
endif()
|
||||||
pkg_check_modules(coeurl REQUIRED IMPORTED_TARGET coeurl)
|
pkg_check_modules(coeurl REQUIRED IMPORTED_TARGET coeurl)
|
||||||
target_link_libraries(nheko PUBLIC PkgConfig::coeurl)
|
target_link_libraries(nheko PUBLIC PkgConfig::coeurl)
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in a new issue