CMakePM: Copy auto package-manager to ${buildDir}/.qtc/ directory

By copying the ${IDE:ResourcePath}/package-manager to
${buildDir}/.qtc/ the problem with hardcoding paths
to old an Qt Creator version can no longer occur.

This also fixes the issue with remote projects by reffering
to the code residing on the host.

With the above issues fixed, enable "Package manager auto setup"
by default.

Change-Id: Ia49654a3b9059f83886e64d065019b2d55e9299c
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Cristian Adam
2023-02-07 18:15:58 +01:00
parent f5bd330277
commit a6ccfb09e5
7 changed files with 31 additions and 13 deletions

View File

@@ -1126,13 +1126,11 @@ static CommandLine defaultInitialCMakeCommand(const Kit *k, const QString buildT
if (!buildType.isEmpty() && !CMakeGeneratorKitAspect::isMultiConfigGenerator(k))
cmd.addArg("-DCMAKE_BUILD_TYPE:STRING=" + buildType);
auto settings = Internal::CMakeSpecificSettings::instance();
// Package manager auto setup. The file auto-setup.cmake resides on the host,
// so it's not accessible for remotely running cmakes. We need to exclude that case.
if (!cmd.executable().needsDevice() && settings->packageManagerAutoSetup.value()) {
cmd.addArg("-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH="
"%{IDE:ResourcePath}/package-manager/auto-setup.cmake");
// Package manager auto setup
if (Internal::CMakeSpecificSettings::instance()->packageManagerAutoSetup.value()) {
cmd.addArg(QString("-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH="
"%{buildDir}/%1/auto-setup.cmake")
.arg(Constants::PACKAGE_MANAGER_DIR));
}
// Cross-compilation settings: