aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@qt.io>2024-04-15 18:29:39 +0200
committerTim Jenssen <tim.jenssen@qt.io>2024-04-15 18:57:28 +0000
commit792cac6503ef3e8723e360fb928d822e02c576d5 (patch)
treeedb286437afa6face56b9a064f69fdeea8c5138a
parenta25d7f6250ca865f746f0252b7b0b301c0a106a2 (diff)
warn user about long path as early as possible
Even cmake command project with language CXX and C checks stuff in build directory which can fail. So we can not use cmake variables like CMAKE_SYSTEM_NAME. Instead we use execute_process with ERROR_QUIET. Change-Id: Ib38a0645a6c39c1e587d27245b702fdb9c2c9ce0 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
-rw-r--r--CMakeLists.txt23
1 files changed, 23 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fefe009..d4c1f03 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,28 @@
cmake_minimum_required(VERSION 3.16)
+if (NOT IGNORE_TOO_LONG_PATH_CHECK)
+ execute_process(
+ COMMAND cmd /c "ver"
+ RESULT_VARIABLE EXIT_CODE_RETURN
+ OUTPUT_VARIABLE OS_VERSION
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
+ if(NOT EXIT_CODE_RETURN AND OS_VERSION MATCHES "Microsoft Windows")
+ string(LENGTH
+ ${CMAKE_BINARY_DIR}/src/imports/compat/Components/QuickUltraLiteStudioComponentsplugin_autogen/include/QuickUltraLiteStudioComponentsplugin_QtQuickUltralite_Studio_ComponentsPlugin.moc
+ BINARY_DIR_LENGTH)
+ if(BINARY_DIR_LENGTH GREATER 250)
+ message(FATAL_ERROR "The path to the build directory results in excessively long file"
+ " paths. This may cause build issues on Windows. Please use a shorter"
+ " build directory."
+ " Or you can try to build by adding -DIGNORE_TOO_LONG_PATH_CHECK=ON"
+ " to your CMAKE command.")
+ endif()
+ endif()
+endif()
+
project(QtQuickDesignerComponents
DESCRIPTION "QtQuick Designer Components"
HOMEPAGE_URL "https://qt.io/"