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

View file

@ -30,7 +30,6 @@ add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value
-fpermissive -Wno-address-of-temporary) -fpermissive -Wno-address-of-temporary)
message(STATUS "Checking deps...") message(STATUS "Checking deps...")
add_subdirectory(subprojects/sdbus-cpp)
add_subdirectory(hyprland-share-picker) add_subdirectory(hyprland-share-picker)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
@ -38,6 +37,12 @@ find_package(Threads REQUIRED)
find_package(PkgConfig 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) 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") file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp")
add_executable(xdg-desktop-portal-hyprland ${SRCFILES}) add_executable(xdg-desktop-portal-hyprland ${SRCFILES})
target_link_libraries(xdg-desktop-portal-hyprland PRIVATE rt sdbus-c++ Threads::Threads PkgConfig::deps) target_link_libraries(xdg-desktop-portal-hyprland PRIVATE rt sdbus-c++ Threads::Threads PkgConfig::deps)