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 <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2021-06-24 16:25:17 +02:00
parent a527fbf179
commit dec84a56f5

View File

@ -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)