aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2021-03-12 14:53:23 +0100
committerJoerg Bornemann <joerg.bornemann@qt.io>2021-03-12 16:03:03 +0100
commit81096b44bb183772c979debca2ffd1f8b364bbc8 (patch)
treef1ac3db9efd6ab4e6aa2376396f96ab93dc86e75 /CMakeLists.txt
parent174a5114606b7add00e9f7b59b515ba332dd0ef8 (diff)
Do not error out on missing optional repository dependencies
Read the 'required' value from dependencies.yaml and store all required dependencies of repository 'qtfoo' in a global property QT_REQUIRED_DEPS_FOR_qtfoo. Check this property in the top-level CMakeLists.txt and only print informational messages instead of errors for optional dependencies. Fixes: QTBUG-91144 Change-Id: I0e1b84a70221857cebba1b9a27456ad3667bfe3a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt29
1 files changed, 22 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 547865a9..eb092c7d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -49,20 +49,35 @@ qt_internal_sort_module_dependencies("${BUILD_SUBMODULES}" BUILD_SUBMODULES
foreach(module IN LISTS BUILD_SUBMODULES)
# Check for unmet dependencies
if(NOT DEFINED BUILD_${module} OR BUILD_${module})
- message(NOTICE "Check dependencies of '${module}'")
+ message(NOTICE "Checking dependencies of '${module}'")
+ get_property(required_deps GLOBAL PROPERTY QT_REQUIRED_DEPS_FOR_${module})
foreach(dep IN LISTS "${qt_module_dependency_map_prefix}${module}")
if (dep STREQUAL "qtbase")
# Always available skip
continue()
endif()
+
+ set(required FALSE)
+ if(dep IN_LIST required_deps)
+ set(required TRUE)
+ endif()
+
+ set(error_reason "")
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")
+ set(error_reason "${dep}'s CMakeLists.txt couldn't be found")
+ elseif(DEFINED BUILD_${dep} AND NOT BUILD_${dep})
+ set(error_reason "building '${dep}' was explicitly disabled")
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")
+
+ if(NOT error_reason STREQUAL "")
+ if(required)
+ message(FATAL_ERROR "Module '${module}' depends on '${dep}', "
+ "but ${error_reason}.\n"
+ "Note: Use '-skip ${module}' to exclude it from the build.")
+ else()
+ message(NOTICE "Skipping optional dependency '${dep}' of '${module}', "
+ "because ${error_reason}.")
+ endif()
endif()
endforeach()
endif()