Skip to content

Commit 95efa31

Browse files
authored
svgscene: fix build when QT_VERSION_MAJOR=6 is specified at top level and Qt5 libraries are present (#157)
2 parents 2cfa890 + ce63bb0 commit 95efa31

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

external/svgscene/CMakeLists.txt

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
cmake_minimum_required(VERSION 3.10)
22
project(svgscene)
33

4+
set(QT_VERSION_MAJOR "auto" CACHE STRING "Qt major version to use. 5|6|auto")
5+
6+
if (NOT "${QT_VERSION_MAJOR}" MATCHES "5|6|auto")
7+
message(FATAL_ERROR "Invalid value for QT_VERSION_MAJOR: ${QT_VERSION_MAJOR} (expected 5, 6 or auto)")
8+
endif ()
9+
10+
if ("${QT_VERSION_MAJOR}" STREQUAL "auto")
11+
find_package(QT NAMES Qt5 Qt6 COMPONENTS Core REQUIRED)
12+
endif ()
413

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

0 commit comments

Comments
 (0)