Skip to content

Commit f248e1a

Browse files
committed
Add USE_SYSTEM_SDBUS_CPP_LIBS option
1 parent 6779fdf commit f248e1a

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

BUILDING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Use -D prefix when configuring the build.
4545
* USE_CCACHE_CACHING = ON | OFF, enable CCache support if available
4646
* USE_SYSTEM_MQTT_LIBS = ON | OFF, prefer system qMQTT libs
4747
* USE_SYSTEM_FLATBUFFERS_LIBS = ON | OFF, prefer system Flatbuffers libs
48+
* USE_SYSTEM_SDBUS_CPP_LIBS = ON | OFF, prefer system sdbus_c++ libs
4849
* USE_STATIC_QT_PLUGINS = ON | OFF, embed static QT-plugins into the application
4950
* USE_STANDARD_INSTALLER_NAME = ON | OFF, use standard Linux package naming
5051

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ SET ( DEFAULT_PROTOBUF ON )
3434
SET ( DEFAULT_WS281XPWM OFF )
3535
SET ( DEFAULT_USE_SYSTEM_FLATBUFFERS_LIBS ON )
3636
SET ( DEFAULT_USE_SYSTEM_MQTT_LIBS OFF )
37+
SET ( DEFAULT_USE_SYSTEM_SDBUS_CPP_LIBS OFF )
3738
SET ( DEFAULT_MF OFF )
3839
SET ( DEFAULT_DX OFF )
3940
SET ( DEFAULT_AVF OFF )
@@ -513,6 +514,9 @@ colorMe("USE_SYSTEM_MQTT_LIBS = " ${USE_SYSTEM_MQTT_LIBS})
513514
option(USE_SYSTEM_FLATBUFFERS_LIBS "Use system flatbuffers libs" ${DEFAULT_USE_SYSTEM_FLATBUFFERS_LIBS})
514515
colorMe("USE_SYSTEM_FLATBUFFERS_LIBS = " ${USE_SYSTEM_FLATBUFFERS_LIBS})
515516

517+
option(USE_SYSTEM_SDBUS_CPP_LIBS "Use system sdbus-c++ libs" ${DEFAULT_USE_SYSTEM_SDBUS_CPP_LIBS})
518+
colorMe("USE_SYSTEM_SDBUS_CPP_LIBS = " ${USE_SYSTEM_SDBUS_CPP_LIBS})
519+
516520
option(USE_STATIC_QT_PLUGINS "Enable static QT plugins" ${DEFAULT_STATIC_QT_PLUGINS})
517521
colorMe("USE_STATIC_QT_PLUGINS = " ${USE_STATIC_QT_PLUGINS})
518522

external/CMakeLists.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,20 @@ ENDIF()
262262
#=============================================================================
263263

264264
if (UNIX AND NOT APPLE AND (ENABLE_POWER_MANAGEMENT OR ENABLE_PIPEWIRE))
265-
set(SDBUSCPP_BUILD_DOCS OFF CACHE BOOL "No doc")
266-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/sdbus-cpp)
267-
set_target_properties(sdbus-c++-objlib PROPERTIES POSITION_INDEPENDENT_CODE ON)
265+
if (USE_SYSTEM_SDBUS_CPP_LIBS)
266+
pkg_check_modules (sdbus-c++ sdbus-c++>=2.0.0)
267+
268+
if(NOT sdbus-c++_FOUND)
269+
message( WARNING "Could not find: sdbus-c++>=2.0.0. Fallback to sdbus-c++ submodule." )
270+
endif()
271+
endif()
272+
273+
if(NOT sdbus-c++_FOUND)
274+
message( "Using sdbus-c++ submodule." )
275+
set(SDBUSCPP_BUILD_DOCS OFF CACHE BOOL "No doc")
276+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/sdbus-cpp)
277+
set_target_properties(sdbus-c++-objlib PROPERTIES POSITION_INDEPENDENT_CODE ON)
278+
endif()
268279
endif()
269280

270281
#=============================================================================

0 commit comments

Comments
 (0)