aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt71
1 files changed, 37 insertions, 34 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1fff3d0e..b163500c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,17 +2,15 @@
# 3.16 is the absolute minimum though.
cmake_minimum_required(VERSION 3.16...3.21)
-
# set QT_SUPERBUILD early, so that qtbase/.cmake.conf can check it
set(QT_SUPERBUILD TRUE)
# Include qtbase's .cmake.conf for access to QT_REPO_MODULE_VERSION
set(__qt6_qtbase_src_path "${CMAKE_CURRENT_SOURCE_DIR}/qtbase")
include("${__qt6_qtbase_src_path}/.cmake.conf")
+include("${__qt6_qtbase_src_path}/cmake/QtBaseTopLevelHelpers.cmake")
-# Run platform auto-detection /before/ the first project() call and thus
-# before the toolchain file is loaded.
-include("${__qt6_qtbase_src_path}/cmake/QtAutoDetect.cmake")
+qt_internal_top_level_setup_autodetect()
project(Qt
VERSION "${QT_REPO_MODULE_VERSION}"
@@ -21,38 +19,48 @@ project(Qt
LANGUAGES CXX C ASM
)
-# Required so we can call ctest from the root build directory
-enable_testing()
-
-set(qt_module_prop_prefix "__qt_prop_")
+qt_internal_top_level_setup_after_project()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
-if (NOT QT_BUILD_STANDALONE_TESTS)
- list(APPEND CMAKE_MODULE_PATH "${__qt6_qtbase_src_path}/cmake")
- list(APPEND CMAKE_MODULE_PATH
- "${__qt6_qtbase_src_path}/cmake/3rdparty/extra-cmake-modules/find-modules")
- list(APPEND CMAKE_MODULE_PATH "${__qt6_qtbase_src_path}/cmake/3rdparty/kwin")
-endif()
+qt_internal_top_level_setup_cmake_module_path()
include(QtTopLevelHelpers)
include(ECMOptionalAddSubdirectory)
-# Also make sure the CMake config files do not recreate the already-existing targets
-if (NOT QT_BUILD_STANDALONE_TESTS)
- set(QT_NO_CREATE_TARGETS TRUE)
-endif()
+qt_internal_top_level_before_build_submodules()
+qt_internal_find_modules(known_submodules)
# Get submodule list if not already defined
if(NOT QT_BUILD_SUBMODULES)
if(DEFINED ENV{QT_BUILD_SUBMODULES})
set(QT_BUILD_SUBMODULES "$ENV{QT_BUILD_SUBMODULES}")
else()
- qt_internal_find_modules(QT_BUILD_SUBMODULES)
+ set(QT_BUILD_SUBMODULES "${known_submodules}")
endif()
endif()
set(QT_BUILD_SUBMODULES "${QT_BUILD_SUBMODULES}" CACHE STRING "Submodules to build")
-qt_internal_sort_module_dependencies("${QT_BUILD_SUBMODULES}" QT_BUILD_SUBMODULES)
+# Preliminary check if module should be skipped since -skip <module> or BUILD_<module>
+# are provided.
+set(explicitly_skipped_modules "")
+foreach(module IN LISTS known_submodules)
+ if(DEFINED BUILD_${module} AND NOT BUILD_${module})
+ list(APPEND explicitly_skipped_modules ${module})
+ endif()
+endforeach()
+
+foreach(module IN LISTS QT_BUILD_SUBMODULES)
+ if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${module}/CMakeLists.txt)
+ message(FATAL_ERROR
+ "Module '${module}' cannot be found. Please double-check the "
+ "spelling and try again. Or run\n"
+ "`./configure -init-submodules -submodules ${module}` "
+ "to clone the submodule and its dependencies.")
+ endif()
+endforeach()
+
+qt_internal_sort_module_dependencies("${QT_BUILD_SUBMODULES}" QT_BUILD_SUBMODULES
+ SKIP_MODULES ${explicitly_skipped_modules})
foreach(module IN LISTS QT_BUILD_SUBMODULES)
# Check for unmet dependencies
@@ -80,9 +88,15 @@ foreach(module IN LISTS QT_BUILD_SUBMODULES)
if(NOT error_reason STREQUAL "")
if(required)
+ if(QT_INTERNAL_CALLED_FROM_CONFIGURE)
+ set(skip_argument "-skip ${module}")
+ else()
+ set(skip_argument "-DBUILD_${module}=OFF")
+ endif()
+
message(FATAL_ERROR "Module '${module}' depends on '${dep}', "
"but ${error_reason}.\n"
- "Note: Use '-skip ${module}' to exclude it from the build.")
+ "Note: Use '${skip_argument}' to exclude it from the build.")
else()
message(STATUS "Skipping optional dependency '${dep}' of '${module}', "
"because ${error_reason}.")
@@ -100,18 +114,7 @@ foreach(module IN LISTS QT_BUILD_SUBMODULES)
message(STATUS "Configuring submodule '${module}'")
ecm_optional_add_subdirectory("${module}")
- if(module STREQUAL "qtbase")
- if (NOT QT_BUILD_STANDALONE_TESTS)
- list(APPEND CMAKE_PREFIX_PATH "${QtBase_BINARY_DIR}/${INSTALL_LIBDIR}/cmake")
- list(APPEND CMAKE_FIND_ROOT_PATH "${QtBase_BINARY_DIR}")
- endif()
- endif()
+ qt_internal_top_level_after_add_subdirectory()
endforeach()
-if(NOT QT_BUILD_STANDALONE_TESTS)
- # Display a summary of everything
- include(QtBuildInformation)
- include(QtPlatformSupport)
- qt_print_feature_summary()
- qt_print_build_instructions()
-endif()
+qt_internal_top_level_end()