aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2020-11-13 13:42:42 +0100
committerAlexey Edelev <alexey.edelev@qt.io>2020-11-14 13:10:30 +0000
commita2683113e2c4f204687daaca4f10b28c6e1a98a3 (patch)
tree0497055d1e0b4b33de29a8610f4f3ee703b7974f /CMakeLists.txt
parent4e2e65c7f17e57727ccf13c7a079cc04bed6c8fe (diff)
CMake: Fix dependency handling when module is skipped
Put dependencies of all modules to top-level variables and check for unmet dependencies before module configuring. Fixes: QTBUG-88214 Change-Id: I089feb474687652f3f8fd1bb1959179ea1114983 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt43
1 files changed, 23 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0b438cee..77fc641b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,10 +42,32 @@ if (NOT BUILD_SUBMODULES)
qt_internal_find_modules(BUILD_SUBMODULES)
endif()
-qt_internal_sort_module_dependencies("${BUILD_SUBMODULES}" BUILD_SUBMODULES)
+set(qt_module_dependency_map_prefix "__qt_module_dependencies_")
+qt_internal_sort_module_dependencies("${BUILD_SUBMODULES}" BUILD_SUBMODULES
+ "${qt_module_dependency_map_prefix}")
foreach(module IN LISTS BUILD_SUBMODULES)
message(NOTICE "Configuring '${module}'")
+
+ # Check for unmet dependencies
+ if(NOT DEFINED BUILD_${module} OR BUILD_${module})
+ foreach(dep IN LISTS "${qt_module_dependency_map_prefix}${module}")
+ if (dep STREQUAL "qtbase")
+ # Always available skip
+ continue()
+ endif()
+ if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${dep}/CMakeLists.txt")
+ message(FATAL_ERROR "Module '${module}' depends on '${dep}', but ${dep}'s \
+ CMakeLists.txt couldn't be found.\nNote: Use '-skip ${module}' to exclude it \
+ from build.\n")
+ endif()
+ if(DEFINED BUILD_${dep} AND NOT BUILD_${dep})
+ message(FATAL_ERROR "Module '${module}' depends on '${dep}', but '${dep}' \
+ will not be built.\nNote: Use '-skip ${module}' to exclude it from build.\n")
+ endif()
+ endforeach()
+ endif()
+
ecm_optional_add_subdirectory("${module}")
if(module STREQUAL "qtbase")
@@ -56,25 +78,6 @@ foreach(module IN LISTS BUILD_SUBMODULES)
endif()
endforeach()
-# Check for unmet dependencies
-foreach(module IN LISTS BUILD_SUBMODULES)
- foreach(dep IN LISTS "${qt_module_prop_prefix}${module}_depends")
- if (dep STREQUAL qtbase)
- # Always available skip
- continue()
- endif()
- if (DEFINED BUILD_${module} AND BUILD_${module})
- if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${dep}/CMakeLists.txt")
- message(FATAL_ERROR "Module '${module} depends on '${dep}', but ${deps}'s CMakeLists.txt couldn't be found.\n")
- endif()
- if(NOT BUILD_${dep})
- message(FATAL_ERROR "Module '${module} depends on '${dep}', but ${deps} will not be built.\n")
- endif()
- endif()
- endforeach()
-endforeach()
-
-
if(NOT QT_BUILD_STANDALONE_TESTS)
# Display a summary of everything
include(QtBuildInformation)