Skip to content

Commit 3840d19

Browse files
authored
Configuration - Enhance Qt5 directory detection for Windows Open-Cascade-SAS#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.
1 parent 94637ac commit 3840d19

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

adm/cmake/qt.cmake

+16-3
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,26 @@ if (NOT ${Qt5_FOUND})
3131
# Now we can apply standard CMake finder for Qt. We do this mostly
3232
# to have qt4_wrap_cpp() function available
3333
find_package(Qt4)
34-
else()
35-
set (3RDPARTY_QT_DIR ${Qt5_DIR} CACHE PATH "The directory containing Qt" FORCE)
34+
elseif(NOT ${USE_QT_FROM_3RDPARTY_DIR} AND WIN32)
35+
# Qt5_DIR typically points to lib/cmake/Qt5, need to go up to Qt root
36+
get_filename_component(QT_CMAKE_DIR "${Qt5_DIR}" DIRECTORY)
37+
get_filename_component(QT_LIB_DIR "${QT_CMAKE_DIR}" DIRECTORY)
38+
get_filename_component(QT_ROOT_DIR "${QT_LIB_DIR}" DIRECTORY)
39+
40+
# Verify this is indeed the Qt root by checking for bin and packages directories
41+
if(EXISTS "${QT_ROOT_DIR}/bin")
42+
set(3RDPARTY_QT_DIR ${QT_ROOT_DIR} CACHE PATH "The directory containing Qt" FORCE)
43+
else()
44+
message(WARNING "Found Qt5 at ${Qt5_DIR} but could not determine Qt root directory with bin/ and plugins/ folders")
45+
set(3RDPARTY_QT_DIR ${Qt5_DIR} CACHE PATH "The directory containing Qt" FORCE)
46+
endif()
47+
elseif(NOT ${USE_QT_FROM_3RDPARTY_DIR})
48+
set(3RDPARTY_QT_DIR ${Qt5_DIR} CACHE PATH "The directory containing Qt" FORCE)
3649
endif()
3750

3851
set (USED_3RDPARTY_QT_DIR "${3RDPARTY_QT_DIR}")
3952

40-
if (3RDPARTY_QT_DIR OR EXISTS "${3RDPARTY_QT_DIR}")
53+
if (3RDPARTY_QT_DIR OR EXISTS "${3RDPARTY_QT_DIR}/bin")
4154
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_QT_DIR}/bin")
4255
else()
4356
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_QT_DLL_DIR)

0 commit comments

Comments
 (0)