Skip to content

Commit

Permalink
Add support for Qt 6
Browse files Browse the repository at this point in the history
  • Loading branch information
torarnv committed Apr 8, 2021
1 parent 701215d commit 5d1a280
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,17 @@ endif()

option(SENTRY_INTEGRATION_QT "Build Qt integration")
if(SENTRY_INTEGRATION_QT)
find_package(Qt5 COMPONENTS Core REQUIRED)
target_link_libraries(sentry PRIVATE Qt5::Core)
if(QT_DEFAULT_MAJOR_VERSION)
# Let user choose major version
set(Qt_VERSION_MAJOR ${QT_DEFAULT_MAJOR_VERSION})
else()
# Find best match, prioritizing Qt 6 if available
find_package(Qt NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
endif()
find_package(Qt${Qt_VERSION_MAJOR} COMPONENTS Core REQUIRED)
message(STATUS "Found Qt: ${Qt${Qt_VERSION_MAJOR}_DIR} "
"(found version \"${Qt${Qt_VERSION_MAJOR}_VERSION}\")")
target_link_libraries(sentry PRIVATE Qt${Qt_VERSION_MAJOR}::Core)
endif()

include(CMakePackageConfigHelpers)
Expand Down

0 comments on commit 5d1a280

Please sign in to comment.