From a01c39d9de9d0ba188313fc09b00c207557c50b1 Mon Sep 17 00:00:00 2001 From: Tadej Novak Date: Sun, 8 Oct 2023 15:31:20 +0200 Subject: [PATCH] Allow building only core --- CMakeLists.txt | 16 +++++++++++++--- src/CMakeLists.txt | 10 ++++++++-- test/CMakeLists.txt | 8 ++++++-- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 25496a7..496e0ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,12 +29,22 @@ set(MLN_QT_WIDGETS_LIB QMapLibreWidgets) set(MLN_QT_GEOSERVICES_PLUGIN qtgeoservices_maplibre) set(MLN_QT_QML_PLUGIN declarative_locationplugin_maplibre) +# Options +set(MLN_QT_WITH_LOCATION ON CACHE BOOL "Build QMapLibreLocation") +set(MLN_QT_WITH_WIDGETS ON CACHE BOOL "Build QMapLibreWidgets") + # Find Qt find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui Network REQUIRED) # main dependencies -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Location REQUIRED) # location -if (Qt6_FOUND) - find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL OpenGLWidgets REQUIRED) +if (MLN_QT_WITH_LOCATION) + find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Location REQUIRED) # location +endif() +if (MLN_QT_WITH_WIDGETS) + if (Qt6_FOUND) + find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGLWidgets REQUIRED) + else() + find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL REQUIRED) + endif() endif() message(STATUS "Using Qt${QT_VERSION_MAJOR}") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6544199..63bccb1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,3 +1,9 @@ add_subdirectory(core) -add_subdirectory(location) -add_subdirectory(widgets) +if (MLN_QT_WITH_LOCATION) + add_subdirectory(location) + message(STATUS "Building location module") +endif() +if (MLN_QT_WITH_WIDGETS) + add_subdirectory(widgets) + message(STATUS "Building widgets module") +endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index afcd1f4..758e38f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,5 +3,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") endif() add_subdirectory(core) -add_subdirectory(qml) -add_subdirectory(widgets) +if (MLN_QT_WITH_LOCATION) + add_subdirectory(qml) +endif() +if (MLN_QT_WITH_WIDGETS) + add_subdirectory(widgets) +endif()