mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-09 15:20:56 -06:00
Ninja: Avoid non-standard output from ninja during try_compile
We sometimes parse the output from `ninja` during `try_compile`. Avoid unexpected characters. Fixes: #19316
This commit is contained in:
@@ -3238,6 +3238,14 @@ int cmMakefile::TryCompile(std::string const& srcdir,
|
||||
return 1;
|
||||
}
|
||||
|
||||
// unset the NINJA_STATUS environment variable while running try compile.
|
||||
// since we parse the output, we need to ensure there aren't any unexpected
|
||||
// characters that will cause issues, such as ANSI color escape codes.
|
||||
cm::optional<cmSystemTools::ScopedEnv> maybeNinjaStatus;
|
||||
if (this->GetGlobalGenerator()->IsNinja()) {
|
||||
maybeNinjaStatus.emplace("NINJA_STATUS=");
|
||||
}
|
||||
|
||||
// make sure the same generator is used
|
||||
// use this program as the cmake to be run, it should not
|
||||
// be run that way but the cmake object requires a valid path
|
||||
|
||||
Reference in New Issue
Block a user