Skip to content

Commit 8d5e204

Browse files
committed
ENH: Improve Qt include directory detection in generator CMake
Enhanced logic to handle potential subdirectories like "QtCore" and added fallback for frameworks without "QtCore" suffixed, improving compatibility with various Qt installations.
1 parent 5b1bf63 commit 8d5e204

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

generator/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,18 @@ endforeach()
6565

6666
get_target_property(_qtcore_include_dirs Qt${QT_VERSION_MAJOR}::Core INTERFACE_INCLUDE_DIRECTORIES)
6767
foreach(_qtcore_include_dir IN LISTS _qtcore_include_dirs)
68+
# Some versions of Qt may have subdirectories like "QtCore" for header files
6869
if (IS_DIRECTORY "${_qtcore_include_dir}/QtCore")
6970
set(_qt_include_prefix "${_qtcore_include_dir}")
7071
break()
72+
else()
73+
# If frameworks, then no QtCore should be suffixed
74+
if (IS_DIRECTORY "${_qtcore_include_dir}")
75+
set(_qt_include_prefix "${_qtcore_include_dir}")
76+
break()
77+
endif()
7178
endif()
79+
7280
endforeach()
7381

7482
add_custom_command(OUTPUT ${PYTHONQT_WRAPPER_SOURCES}

0 commit comments

Comments
 (0)