use natural sorting to choose the highest version found if not specified

This commit is contained in:
Alexander Kavon 2024-01-18 20:30:44 -05:00
parent 9f9fafe9ef
commit 3bae894f18
1 changed files with 6 additions and 1 deletions

View File

@ -5,7 +5,12 @@
macro(qsk_setup_Qt)
# relying on cmake heuristics to select a specific Qt version is no good idea.
# set vars for correct natural sort order and direction (ex. Qt6, Qt5)
# cmake bug: https://gitlab.kitware.com/cmake/cmake/-/issues/23575
if (NOT CMAKE_FIND_PACKAGE_SORT_ORDER AND NOT CMAKE_FIND_PACKAGE_SORT_DIRECTION)
set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
endif()
# using -DCMAKE_PREFIX_PATH="..." is highly recommended
find_package(QT "5.15" NAMES Qt6 Qt5 REQUIRED COMPONENTS Quick)