aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2021-02-08 11:35:10 +0100
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2021-02-08 16:20:49 +0100
commit21a8b051aff9eaa523374cb01f219a539a85361f (patch)
treed4084e00b0bdc6e7cc8330ebe2bd0249f74af87f
parent6af3204a9b4352909489200f619198c6f3e9540f (diff)
Inform that you need to use qmake to build with Qt 5
We use the pro2cmake script found in Qt 6 to generate cmake files for TreeView. That scripts is not available in Qt 5, together with important functions like "qt_build_repo" and "qt_add_qml_module". Rather than investing a lot of time to support building TreeView with cmake and Qt 5, just inform that we only support building it with qmake for that version. Change-Id: Iae1a91de5e6cb10bb518ee21f9bcccdbff6c8561 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
-rw-r--r--CMakeLists.txt14
1 files changed, 14 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4964f28..9b34df3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,6 +2,20 @@
cmake_minimum_required(VERSION 3.15.0)
+execute_process (
+ COMMAND $ENV{CMAKE_PREFIX_PATH}/bin/qmake -query QT_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ OUTPUT_VARIABLE qt_version
+)
+
+string(SUBSTRING ${qt_version} 0 1 qt_major_version)
+if (${qt_major_version} EQUAL 5)
+ message(FATAL_ERROR
+ "You're building TreeView using Qt version ${qt_version} (read "
+ "from CMAKE_PREFIX_PATH/bin/qmake). When using Qt 5, you need to "
+ "build with qmake instead.")
+endif()
+
include(.cmake.conf)
project(QtTreeView
VERSION "${QT_REPO_MODULE_VERSION}"