Commit a624a3e1 authored by Brad King's avatar Brad King 💬

Ninja: Use deps=gcc for Intel Compiler on Windows

Ninja 1.9 supports the depfile format generated by this compiler.
Use `deps = gcc` when the version of Ninja is new enough.

Unfortunately the Intel Compiler for Windows does not properly
escape spaces in paths written to a depfile so if there is a
space in the path we must still fall back to `deps = msvc`.

Fixes: #18855
parent f4f3b6b9
Pipeline #129018 passed with stage
set(CMAKE_NINJA_DEPTYPE_C intel) # special value handled by CMake
set(_COMPILE_CXX " /TP")
set(CMAKE_NINJA_DEPTYPE_CXX intel) # special value handled by CMake
......@@ -173,8 +173,28 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags,
bool cmNinjaTargetGenerator::NeedDepTypeMSVC(const std::string& lang) const
return (this->GetMakefile()->GetSafeDefinition("CMAKE_NINJA_DEPTYPE_" +
lang) == "msvc");
std::string const& deptype =
this->GetMakefile()->GetSafeDefinition("CMAKE_NINJA_DEPTYPE_" + lang);
if (deptype == "msvc") {
return true;
if (deptype == "intel") {
// Ninja does not really define "intel", but we use it to switch based
// on whether this environment supports "gcc" or "msvc" deptype.
if (!this->GetGlobalGenerator()->SupportsMultilineDepfile()) {
// This ninja version is too old to support the Intel depfile format.
// Fall back to msvc deptype.
return true;
if ((this->Makefile->GetHomeDirectory().find(' ') != std::string::npos) ||
(this->Makefile->GetHomeOutputDirectory().find(' ') !=
std::string::npos)) {
// The Intel compiler does not properly escape spaces in a depfile.
// Fall back to msvc deptype.
return true;
return false;
// TODO: Refactor with
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment