mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-09 16:50:01 -06:00
cmake --build: Restore expected path encoding on Windows
In commit c71e3abbad (cmake --build: Factor out a struct holding build
parameters, 2025-12-02) we used `filesystem::path` to store the path to
the build directory. It performs encoding conversions that violate our
internal UTF-8 encoding.
Issue: #27472
This commit is contained in:
@@ -8,8 +8,6 @@
|
||||
#include <ratio>
|
||||
#include <utility>
|
||||
|
||||
#include <cm/filesystem>
|
||||
|
||||
#include "cmBuildArgs.h"
|
||||
#include "cmBuildOptions.h"
|
||||
#include "cmCTest.h"
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
file LICENSE.rst or https://cmake.org/licensing for details. */
|
||||
#pragma once
|
||||
|
||||
#include <cm/filesystem>
|
||||
#include <cm/string>
|
||||
#include <string>
|
||||
|
||||
#include "cmDuration.h"
|
||||
|
||||
@@ -14,7 +13,7 @@ public:
|
||||
static constexpr int DEFAULT_BUILD_PARALLEL_LEVEL = 0;
|
||||
|
||||
std::string projectName;
|
||||
cm::filesystem::path binaryDir;
|
||||
std::string binaryDir;
|
||||
int jobs = NO_BUILD_PARALLEL_LEVEL;
|
||||
bool verbose = false;
|
||||
std::string config;
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
#include <cm/filesystem>
|
||||
#include <cm/memory>
|
||||
#include <cm/optional>
|
||||
#include <cmext/algorithm>
|
||||
@@ -2225,8 +2224,8 @@ int cmGlobalGenerator::Build(cmBuildArgs const& buildArgs,
|
||||
/**
|
||||
* Run an executable command and put the stdout in output.
|
||||
*/
|
||||
cmWorkingDirectory workdir(buildArgs.binaryDir.string());
|
||||
ostr << "Change Dir: '" << buildArgs.binaryDir.string() << '\'' << std::endl;
|
||||
cmWorkingDirectory workdir(buildArgs.binaryDir);
|
||||
ostr << "Change Dir: '" << buildArgs.binaryDir << '\'' << std::endl;
|
||||
if (workdir.Failed()) {
|
||||
cmSystemTools::SetRunCommandHideConsole(hideconsole);
|
||||
std::string const& err = workdir.GetError();
|
||||
@@ -2246,9 +2245,9 @@ int cmGlobalGenerator::Build(cmBuildArgs const& buildArgs,
|
||||
std::string outputBuf;
|
||||
|
||||
std::vector<GeneratedMakeCommand> makeCommand = this->GenerateBuildCommand(
|
||||
makeCommandCSTR, buildArgs.projectName, buildArgs.binaryDir.string(),
|
||||
targets, realConfig, buildArgs.jobs, buildArgs.verbose, buildOptions,
|
||||
nativeOptions, isInTryCompile);
|
||||
makeCommandCSTR, buildArgs.projectName, buildArgs.binaryDir, targets,
|
||||
realConfig, buildArgs.jobs, buildArgs.verbose, buildOptions, nativeOptions,
|
||||
isInTryCompile);
|
||||
|
||||
// Workaround to convince some commands to produce output.
|
||||
if (outputMode == cmSystemTools::OUTPUT_PASSTHROUGH &&
|
||||
@@ -2260,8 +2259,8 @@ int cmGlobalGenerator::Build(cmBuildArgs const& buildArgs,
|
||||
if (buildOptions.Clean) {
|
||||
std::vector<GeneratedMakeCommand> cleanCommand =
|
||||
this->GenerateBuildCommand(makeCommandCSTR, buildArgs.projectName,
|
||||
buildArgs.binaryDir.string(), { "clean" },
|
||||
realConfig, buildArgs.jobs, buildArgs.verbose,
|
||||
buildArgs.binaryDir, { "clean" }, realConfig,
|
||||
buildArgs.jobs, buildArgs.verbose,
|
||||
buildOptions);
|
||||
ostr << "\nRun Clean Command: " << cleanCommand.front().QuotedPrintable()
|
||||
<< std::endl;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
|
||||
#include <cm/filesystem>
|
||||
#include <cm/memory>
|
||||
#include <cm/optional>
|
||||
#include <cm/string_view>
|
||||
@@ -3962,13 +3961,12 @@ int cmake::Build(cmBuildArgs buildArgs, std::vector<std::string> targets,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!cmSystemTools::FileIsDirectory(buildArgs.binaryDir.string())) {
|
||||
std::cerr << "Error: " << buildArgs.binaryDir.string()
|
||||
<< " is not a directory\n";
|
||||
if (!cmSystemTools::FileIsDirectory(buildArgs.binaryDir)) {
|
||||
std::cerr << "Error: " << buildArgs.binaryDir << " is not a directory\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::string cachePath = FindCacheFile(buildArgs.binaryDir.string());
|
||||
std::string cachePath = FindCacheFile(buildArgs.binaryDir);
|
||||
if (!this->LoadCache(cachePath)) {
|
||||
std::cerr
|
||||
<< "Error: not a CMake build directory (missing CMakeCache.txt)\n";
|
||||
@@ -4069,7 +4067,7 @@ int cmake::Build(cmBuildArgs buildArgs, std::vector<std::string> targets,
|
||||
}
|
||||
|
||||
#if !defined(CMAKE_BOOTSTRAP)
|
||||
cmInstrumentation instrumentation(buildArgs.binaryDir.string());
|
||||
cmInstrumentation instrumentation(buildArgs.binaryDir);
|
||||
if (instrumentation.HasErrors()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <cm/filesystem>
|
||||
#include <cm/optional>
|
||||
#include <cmext/algorithm>
|
||||
|
||||
@@ -449,7 +448,7 @@ int extract_job_number(std::string const& command,
|
||||
return jobs;
|
||||
}
|
||||
std::function<bool(std::string const&)> extract_job_number_lambda_builder(
|
||||
cm::filesystem::path& dir, int& jobs, std::string const& flag)
|
||||
std::string& dir, int& jobs, std::string const& flag)
|
||||
{
|
||||
return [&dir, &jobs, flag](std::string const& value) -> bool {
|
||||
jobs = extract_job_number(flag, value);
|
||||
@@ -805,7 +804,7 @@ int do_install(int ac, char const* const* av)
|
||||
std::string component;
|
||||
std::string defaultDirectoryPermissions;
|
||||
std::string prefix;
|
||||
cm::filesystem::path dir;
|
||||
std::string dir;
|
||||
int jobs = 0;
|
||||
bool strip = false;
|
||||
bool verbose = cmSystemTools::HasEnv("VERBOSE");
|
||||
@@ -919,8 +918,8 @@ int do_install(int ac, char const* const* av)
|
||||
|
||||
args.emplace_back("-P");
|
||||
|
||||
cmInstrumentation instrumentation(dir.string());
|
||||
auto handler = cmInstallScriptHandler(dir.string(), component, config, args);
|
||||
cmInstrumentation instrumentation(dir);
|
||||
auto handler = cmInstallScriptHandler(dir, component, config, args);
|
||||
int ret = 0;
|
||||
if (!jobs && handler.IsParallel()) {
|
||||
jobs = 1;
|
||||
|
||||
Reference in New Issue
Block a user