CMakePM: Use junctions for source/build dirs on Windows

This way we have fixed small (max 64 bytes) paths for CMake's configure
/ build / install steps.

This allows the user to have longer paths and still compile with MSVC /
GCC MinGW compilers.

Fixes: QTCREATORBUG-26786
Task-number: QTBUG-117413
Change-Id: I0cff6521626dd2ce78d0223d46f0b480e977d5c5
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Cristian Adam
2024-01-31 09:49:56 +01:00
parent 656a30b407
commit e7e593b2f6
7 changed files with 185 additions and 3 deletions

View File

@@ -11,6 +11,7 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <utils/hostosinfo.h>
#include <utils/layoutbuilder.h>
using namespace Utils;
@@ -34,6 +35,7 @@ CMakeSpecificSettings::CMakeSpecificSettings()
askBeforePresetsReload,
showSourceSubFolders,
showAdvancedOptionsByDefault,
useJunctionsForSourceAndBuildDirectories,
st
};
});
@@ -87,6 +89,21 @@ CMakeSpecificSettings::CMakeSpecificSettings()
showAdvancedOptionsByDefault.setLabelText(
::CMakeProjectManager::Tr::tr("Show advanced options by default"));
useJunctionsForSourceAndBuildDirectories.setSettingsKey(
"UseJunctionsForSourceAndBuildDirectories");
useJunctionsForSourceAndBuildDirectories.setDefaultValue(false);
useJunctionsForSourceAndBuildDirectories.setLabelText(::CMakeProjectManager::Tr::tr(
"Use Junctions for CMake configuration and build operations"));
useJunctionsForSourceAndBuildDirectories.setVisible(Utils::HostOsInfo().isWindowsHost());
useJunctionsForSourceAndBuildDirectories.setToolTip(::CMakeProjectManager::Tr::tr(
"Create and use junctions for the source and build directories. This helps to overcome "
"issues with long paths on Windows.<br><br>"
"They are stored under <tt>C:\\ProgramData\\QtCreator\\Links</tt> (overridable via "
"<tt>QTC_CMAKE_JUNCTIONS_DIR</tt> environment variable).<br><br>"
"With <tt>QTC_CMAKE_JUNCTIONS_HASH_LENGTH</tt> the MD5 hash key length can be shortened "
"to a value smaller than the default length value of 32.<br><br>"
"They are used for CMake configure, build and install operations."));
readSettings();
}