diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cd9d08c..be908199 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,12 @@ endif() project(QtADS LANGUAGES CXX VERSION ${VERSION_SHORT}) +if(CMAKE_VERSION VERSION_LESS 3.21.0) + if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + set(QtADS_IS_TOP_LEVEL true) + endif() +endif() + option(BUILD_STATIC "Build the static library" OFF) option(BUILD_EXAMPLES "Build the examples" ON) @@ -52,6 +58,12 @@ else() set(ads_PlatformDir "${ADS_PLATFORM_DIR}") endif() +if(QtADS_IS_TOP_LEVEL) + if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.26.0) + cmake_policy(SET CMP0143 NEW) + endif() +endif() + add_subdirectory(src) if(BUILD_EXAMPLES) diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt index 792d49a5..34526af8 100644 --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -1,6 +1,10 @@ cmake_minimum_required(VERSION 3.16) project(ads_demo VERSION ${VERSION_SHORT}) +if(QtADS_IS_TOP_LEVEL) + set(CMAKE_FOLDER "Demo") +endif() + find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) find_package(Qt${QT_VERSION_MAJOR} 5.5 COMPONENTS Core Gui Widgets Quick QuickWidgets REQUIRED) if(WIN32 AND QT_VERSION_MAJOR LESS 6) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 59455085..5f3e4cf9 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,5 +1,10 @@ cmake_minimum_required(VERSION 3.16) project(QtADSExamples LANGUAGES CXX VERSION ${VERSION_SHORT}) + +if(QtADS_IS_TOP_LEVEL) + set(CMAKE_FOLDER "Examples") +endif() + add_subdirectory(simple) add_subdirectory(hideshow) add_subdirectory(sidebar)