diff options
author | Brad King <brad.king@kitware.com> | 2019-01-30 19:25:56 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-01-30 19:59:23 (GMT) |
commit | a624a3e1b3105e94ad30722e3053679a3b7d5b7e (patch) | |
tree | c7edfd0cb497d2a4140fd09b7e5488ba1fffa9f5 /Source/cmNinjaTargetGenerator.cxx | |
parent | f4f3b6b9af13366b16ce5a3be7af6c2b68c8be09 (diff) | |
download | CMake-a624a3e1b3105e94ad30722e3053679a3b7d5b7e.zip CMake-a624a3e1b3105e94ad30722e3053679a3b7d5b7e.tar.gz CMake-a624a3e1b3105e94ad30722e3053679a3b7d5b7e.tar.bz2 |
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
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index c85a6f7..c29c657 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -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 |