cmake: Require Qt 6 to build GUI

This commit is contained in:
Hennadii Stepanov
2025-04-02 09:11:48 +01:00
parent 930b237f16
commit 6d4214925f
12 changed files with 79 additions and 53 deletions

View File

@ -27,19 +27,6 @@ if(CMAKE_HOST_APPLE)
endif()
endif()
# Save CMAKE_FIND_ROOT_PATH_MODE_LIBRARY state.
unset(_qt_find_root_path_mode_library_saved)
if(DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
set(_qt_find_root_path_mode_library_saved ${CMAKE_FIND_ROOT_PATH_MODE_LIBRARY})
endif()
# The Qt config files internally use find_library() calls for all
# dependencies to ensure their availability. In turn, the find_library()
# inspects the well-known locations on the file system; therefore, it must
# be able to find platform-specific system libraries, for example:
# /usr/x86_64-w64-mingw32/lib/libm.a or /usr/arm-linux-gnueabihf/lib/libm.a.
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
find_package(Qt${Qt_FIND_VERSION_MAJOR} ${Qt_FIND_VERSION}
COMPONENTS ${Qt_FIND_COMPONENTS}
HINTS ${_qt_homebrew_prefix}
@ -47,14 +34,6 @@ find_package(Qt${Qt_FIND_VERSION_MAJOR} ${Qt_FIND_VERSION}
)
unset(_qt_homebrew_prefix)
# Restore CMAKE_FIND_ROOT_PATH_MODE_LIBRARY state.
if(DEFINED _qt_find_root_path_mode_library_saved)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ${_qt_find_root_path_mode_library_saved})
unset(_qt_find_root_path_mode_library_saved)
else()
unset(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Qt
REQUIRED_VARS Qt${Qt_FIND_VERSION_MAJOR}_DIR