Skip to content

Commit

Permalink
🔨 Only look for qt if not Qt::Core target exists
Browse files Browse the repository at this point in the history
This fix issue if upper project use `find_package(Qt5)` and Qt6 is also installed.
This require at least Qt5.15 to use versionless `Qt` target namespace
  • Loading branch information
OlivierLDff committed Oct 3, 2022
1 parent cc2a3ac commit f7cb8fd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,10 @@ endif()

# ───── DEPENDENCIES ─────

find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Qml REQUIRED)
if(NOT TARGET Qt::Core)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Qml REQUIRED)
endif()

# ───── LIBRARY ─────

Expand Down

0 comments on commit f7cb8fd

Please sign in to comment.