From dec84a56f53390423e7ac258e3f1860df5de4513 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Thu, 24 Jun 2021 16:25:17 +0200 Subject: Throw FATAL_ERROR if specified platform doesn't exist If user specifies non-existing platform build fails in some non-obvious place, since qplatfromdefs.h couldn't be found. Add an explicit error if the defined platform folder doesn't exists in Qt sources. Change-Id: Id847d57a6f9cc4f463e697b474b8a669cd041fb8 Reviewed-by: Alexandru Croitor --- cmake/QtBuild.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'cmake/QtBuild.cmake') diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 96d11196d9..2b88456878 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -385,6 +385,17 @@ elseif(QT_QMAKE_TARGET_MKSPEC) set(QT_DEFAULT_PLATFORM_DEFINITION_DIR "${INSTALL_MKSPECSDIR}/${QT_QMAKE_TARGET_MKSPEC}") # Used by qtbase itself and consumers of non-prefix builds via BUILD_INTERFACE (absolute path). set(QT_DEFAULT_PLATFORM_DEFINITION_DIR_ABSOLUTE "${QT_MKSPECS_DIR}/${QT_QMAKE_TARGET_MKSPEC}") + + if(NOT EXISTS "${QT_DEFAULT_PLATFORM_DEFINITION_DIR_ABSOLUTE}") + file(GLOB known_platforms + LIST_DIRECTORIES true + RELATIVE "${QT_MKSPECS_DIR}" + "${QT_MKSPECS_DIR}/*" + ) + list(JOIN known_platforms "\n " known_platforms) + message(FATAL_ERROR "Unknown platform ${QT_QMAKE_TARGET_MKSPEC}\n\ +Known platforms:\n ${known_platforms}") + endif() endif() if(NOT DEFINED QT_DEFAULT_PLATFORM_DEFINITIONS) -- cgit v1.2.3