1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-01 17:36:21 +03:00

Configuration - Enhance Qt5 directory detection for Windows #419

Update the detection Qt5 folder to search for bin folder.
That will affected for the starting DRAW or samples as a part of env.
This commit is contained in:
Pasukhin Dmitry 2025-03-09 18:04:44 +00:00 committed by GitHub
parent 94637ac370
commit 3840d19d7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -31,13 +31,26 @@ if (NOT ${Qt5_FOUND})
# Now we can apply standard CMake finder for Qt. We do this mostly
# to have qt4_wrap_cpp() function available
find_package(Qt4)
else()
set (3RDPARTY_QT_DIR ${Qt5_DIR} CACHE PATH "The directory containing Qt" FORCE)
elseif(NOT ${USE_QT_FROM_3RDPARTY_DIR} AND WIN32)
# Qt5_DIR typically points to lib/cmake/Qt5, need to go up to Qt root
get_filename_component(QT_CMAKE_DIR "${Qt5_DIR}" DIRECTORY)
get_filename_component(QT_LIB_DIR "${QT_CMAKE_DIR}" DIRECTORY)
get_filename_component(QT_ROOT_DIR "${QT_LIB_DIR}" DIRECTORY)
# Verify this is indeed the Qt root by checking for bin and packages directories
if(EXISTS "${QT_ROOT_DIR}/bin")
set(3RDPARTY_QT_DIR ${QT_ROOT_DIR} CACHE PATH "The directory containing Qt" FORCE)
else()
message(WARNING "Found Qt5 at ${Qt5_DIR} but could not determine Qt root directory with bin/ and plugins/ folders")
set(3RDPARTY_QT_DIR ${Qt5_DIR} CACHE PATH "The directory containing Qt" FORCE)
endif()
elseif(NOT ${USE_QT_FROM_3RDPARTY_DIR})
set(3RDPARTY_QT_DIR ${Qt5_DIR} CACHE PATH "The directory containing Qt" FORCE)
endif()
set (USED_3RDPARTY_QT_DIR "${3RDPARTY_QT_DIR}")
if (3RDPARTY_QT_DIR OR EXISTS "${3RDPARTY_QT_DIR}")
if (3RDPARTY_QT_DIR OR EXISTS "${3RDPARTY_QT_DIR}/bin")
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_QT_DIR}/bin")
else()
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_QT_DLL_DIR)