@@ -3,7 +3,7 @@ cmake_policy(VERSION 3.10)
33
44project (QtRVSim
55 LANGUAGES C CXX
6- VERSION 0.9.7
6+ VERSION 0.9.8
77 DESCRIPTION "RISC-V CPU simulator for education purposes" )
88
99set (KAREL_KOCI "Karel Koci <cynerd@email.cz>" )
@@ -47,11 +47,16 @@ set(PACKAGE_OUTPUT_PATH "${EXECUTABLE_OUTPUT_PATH}/pkg"
4747 CACHE STRING "Absolute path to place generated package files." )
4848set (FORCE_COLORED_OUTPUT false CACHE BOOL "Always produce ANSI-colored output (GNU/Clang only)." )
4949set (USE_ALTERNATE_LINKER "" CACHE STRING "Use alternate linker. Leave empty for system default; alternatives are 'gold', 'lld', 'bfd', 'mold'" )
50+ set (QT_VERSION_MAJOR "auto" CACHE STRING "Qt major version to use. 5|6|auto" )
5051
5152# =============================================================================
5253# Generated variables
5354# =============================================================================
5455
56+ if (NOT "${QT_VERSION_MAJOR} " MATCHES "5|6|auto" )
57+ message (FATAL_ERROR "Invalid value for QT_VERSION_MAJOR: ${QT_VERSION_MAJOR} (expected 5, 6 or auto)" )
58+ endif ()
59+
5560if (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten" )
5661 set (WASM true )
5762else ()
@@ -241,7 +246,10 @@ endif ()
241246# Based on article https://www.steinzone.de/wordpress/how-to-support-both-qt5-and-qt6-using-cmake/
242247# Cannot use version-less approach due to Qt 5.9.5 support constraint.
243248
244- find_package (QT NAMES Qt5 Qt6 COMPONENTS Core REQUIRED)
249+ if ("${QT_VERSION_MAJOR} " STREQUAL "auto" )
250+ find_package (QT NAMES Qt5 Qt6 COMPONENTS Core REQUIRED)
251+ endif ()
252+
245253# Normally, we would use variable Qt5 or Qt6 to reference the Qt library. Here we do that through
246254# this variable based on detected version major of Qt.
247255set (QtLib "Qt${QT_VERSION_MAJOR} " )
0 commit comments