CMake: sdbus through pkg-config, fallback to subproject

This commit is contained in:
Mihai Fufezan 2024-01-03 23:43:01 +02:00
parent bd110073cf
commit f46cff1df2
No known key found for this signature in database
1 changed files with 6 additions and 1 deletions

View File

@ -30,7 +30,6 @@ add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value
-fpermissive -Wno-address-of-temporary)
message(STATUS "Checking deps...")
add_subdirectory(subprojects/sdbus-cpp)
add_subdirectory(hyprland-share-picker)
find_package(Threads REQUIRED)
@ -38,6 +37,12 @@ find_package(Threads REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(deps REQUIRED IMPORTED_TARGET wayland-client wayland-protocols libpipewire-0.3 libspa-0.2 libdrm gbm hyprlang>=0.2.0)
# check whether we can find sdbus-c++ through pkg-config
pkg_check_modules(SDBUS IMPORTED_TARGET sdbus-c++)
if(NOT SDBUS_FOUND)
add_subdirectory(subprojects/sdbus-cpp)
endif()
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp")
add_executable(xdg-desktop-portal-hyprland ${SRCFILES})
target_link_libraries(xdg-desktop-portal-hyprland PRIVATE rt sdbus-c++ Threads::Threads PkgConfig::deps)