mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
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
This commit is contained in:
@@ -1,2 +1,4 @@
|
||||
include(Platform/Windows-Intel)
|
||||
__windows_compiler_intel(C)
|
||||
set(CMAKE_NINJA_DEPTYPE_C intel) # special value handled by CMake
|
||||
set(CMAKE_DEPFILE_FLAGS_C "-QMMD -QMT <OBJECT> -QMF <DEPFILE>")
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
include(Platform/Windows-Intel)
|
||||
set(_COMPILE_CXX " /TP")
|
||||
__windows_compiler_intel(CXX)
|
||||
set(CMAKE_NINJA_DEPTYPE_CXX intel) # special value handled by CMake
|
||||
set(CMAKE_DEPFILE_FLAGS_CXX "-QMMD -QMT <OBJECT> -QMF <DEPFILE>")
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user