Skip to content

Commit

Permalink
svgscene: fix build when QT_VERSION_MAJOR=6 is specified at top level…
Browse files Browse the repository at this point in the history
… and Qt5 libraries are present

Change fixes issue #156 Build with specified specified QT_VERSION_MAJOR=6
fails on Debian and probably other systems when Qt5 is installed

Signed-off-by: Pavel Pisa <[email protected]>
  • Loading branch information
ppisa committed Jan 1, 2025
1 parent 2dc5ac4 commit ce63bb0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion external/svgscene/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
cmake_minimum_required(VERSION 3.10)
project(svgscene)

set(QT_VERSION_MAJOR "auto" CACHE STRING "Qt major version to use. 5|6|auto")

if (NOT "${QT_VERSION_MAJOR}" MATCHES "5|6|auto")
message(FATAL_ERROR "Invalid value for QT_VERSION_MAJOR: ${QT_VERSION_MAJOR} (expected 5, 6 or auto)")
endif ()

if ("${QT_VERSION_MAJOR}" STREQUAL "auto")
find_package(QT NAMES Qt5 Qt6 COMPONENTS Core REQUIRED)
endif ()

find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
# Normally, we would use variable Qt5 or Qt6 to reference the Qt library. Here we do that through
# this variable based on detected version major of Qt.
set(QtLib "Qt${QT_VERSION_MAJOR}")
Expand Down

0 comments on commit ce63bb0

Please sign in to comment.