diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,15 @@ # if this option is set, srtm.jpg will not be installed but the generated tiles instead option(MOBILE "Create a Marble version optimized for handheld devices") +#################################################### +# Build a D-Bus interface for the Marble widget +# This is disabled by default for all win32, apple and Android +if(WIN32 OR APPLE OR CMAKE_SYSTEM_NAME STREQUAL Android) + option(BUILD_WITH_DBUS "Build the D-Bus interface for the Marble widget" OFF) +else() + option(BUILD_WITH_DBUS "Build the D-Bus interface for the Marble widget" ON) +endif() + ####################################################### # Specific options for building for different platforms @@ -67,7 +76,6 @@ else() find_package(Qt5WebKit) find_package(Qt5WebKitWidgets) - find_package(Qt5DBus REQUIRED) if ( NOT Qt5WebKitWidgets_FOUND ) set ( MARBLE_NO_WEBKITWIDGETS TRUE ) @@ -86,6 +94,15 @@ find_package(Qt5Quick REQUIRED) find_package(Qt5PrintSupport REQUIRED) +if (BUILD_WITH_DBUS) + find_package(Qt5DBus) + if (NOT Qt5DBus_FOUND) + set(MARBLE_NO_DBUS TRUE) + endif() +else() + set(MARBLE_NO_DBUS TRUE) +endif() + if(QTONLY) # Forward the old QTONLY=TRUE option to the new WITH_KDE=FALSE # needs to be written to cache and forcefully, otherwise macro_optional_find_package's @@ -106,15 +123,6 @@ endif( WIN32 ) #################################################### -# Build a D-Bus interface for marble -# This is disabled by default for all win32, apple and Qt-Only builds -if(WIN32 OR APPLE OR CMAKE_SYSTEM_NAME STREQUAL Android) - option(BUILD_WITH_DBUS "Build the D-Bus interface for the Marble widget" OFF) -else() - option(BUILD_WITH_DBUS "Build the D-Bus interface for the Marble widget" ON) -endif() - -#################################################### # build unit tests INCLUDE (CTest) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,9 +3,9 @@ add_definitions(-D_USE_MATH_DEFINES=1) endif(MSVC) -if(BUILD_WITH_DBUS) -add_definitions(-DMARBLE_DBUS) -endif(BUILD_WITH_DBUS) +if(NOT MARBLE_NO_DBUS) + add_definitions(-DMARBLE_DBUS) +endif() if( Qt5Quick_FOUND ) OPTION(IGNORE_CMAKE_INSTALL_PREFIX_FOR_DECLARATIVE_PLUGINS "Install Marble Qt Declarative plugins to QT_IMPORTS_DIR even if that is out of the CMAKE_INSTALL_PREFIX") diff --git a/src/apps/marble-ui/CMakeLists.txt b/src/apps/marble-ui/CMakeLists.txt --- a/src/apps/marble-ui/CMakeLists.txt +++ b/src/apps/marble-ui/CMakeLists.txt @@ -22,8 +22,13 @@ Qt5::PrintSupport LINK_PRIVATE Qt5::Network - Qt5::DBus ) +if (NOT MARBLE_NO_DBUS) + target_link_libraries( marbleui + LINK_PRIVATE + Qt5::DBus + ) +endif () if(WIN32) # TODO: PUBLIC or can be PRIVATE? diff --git a/src/lib/marble/CMakeLists.txt b/src/lib/marble/CMakeLists.txt --- a/src/lib/marble/CMakeLists.txt +++ b/src/lib/marble/CMakeLists.txt @@ -295,7 +295,7 @@ ) endif() -if (NOT QT_NO_DBUS AND NOT CMAKE_SYSTEM_NAME STREQUAL Android) +if (NOT MARBLE_NO_DBUS) LIST(APPEND marblewidget_SRCS MarbleDBusInterface.cpp ) @@ -389,7 +389,7 @@ Qt5::WebKitWidgets ) endif () -if (NOT QT_NO_DBUS AND NOT CMAKE_SYSTEM_NAME STREQUAL Android) +if (NOT MARBLE_NO_DBUS) TARGET_LINK_LIBRARIES (${MARBLEWIDGET} LINK_PRIVATE Qt5::DBus