CMakePM: Fix qmake detection on Windows for CMake import builds

The cross-compiled builds of Qt seem to deliver both qmake and qmake.bat
as scripts that point to the host qmake binary.

The qmake detection code would look after "qmake qmake.bat" and since
both are present "qmake" would be picked.

This broke the Qt detection on Windows for Android import builds. This
includes CMake presets.

Change-Id: I7a0272e721a19926bc58cd50282a3f6de274a05e
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Cristian Adam
2025-06-04 09:45:02 +02:00
parent 2ae5ebdcc0
commit 9fde85444e

View File

@@ -546,8 +546,11 @@ static QMakeAndCMakePrefixPath qtInfoFromCMakeCache(const CMakeConfig &config,
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
if (CMAKE_CROSSCOMPILING)
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(qmake_script_suffix ".bat")
endif()
find_program(qmake_binary
NAMES qmake qmake.bat
NAMES qmake${qmake_script_suffix}
PATHS "${Qt${QT_VERSION_MAJOR}_DIR}/../../../bin"
NO_DEFAULT_PATH)
file(WRITE "${CMAKE_SOURCE_DIR}/qmake-location.txt" "${qmake_binary}")