Merge topic 'ninja-refactor-deptype-selection'

123de191 Ninja: Refactor selection of 'deps = ' value for MS-compatible toolchains
This commit is contained in:
Brad King 2015-10-21 09:16:53 -04:00 committed by CMake Topic Stage
commit 8bcf2c81fc
2 changed files with 6 additions and 12 deletions

View File

@ -302,6 +302,7 @@ macro(__windows_compiler_msvc lang)
set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG")
set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON) set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON)
set(CMAKE_NINJA_DEPTYPE_${lang} msvc)
if(NOT CMAKE_RC_COMPILER_INIT) if(NOT CMAKE_RC_COMPILER_INIT)
set(CMAKE_RC_COMPILER_INIT rc) set(CMAKE_RC_COMPILER_INIT rc)
@ -311,4 +312,5 @@ macro(__windows_compiler_msvc lang)
endif() endif()
enable_language(RC) enable_language(RC)
set(CMAKE_NINJA_CMCLDEPS_RC 1)
endmacro() endmacro()

View File

@ -148,17 +148,9 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags,
bool cmNinjaTargetGenerator::NeedDepTypeMSVC(const std::string& lang) const bool cmNinjaTargetGenerator::NeedDepTypeMSVC(const std::string& lang) const
{ {
if (lang == "C" || lang == "CXX") return strcmp(
{ this->GetMakefile()->GetSafeDefinition("CMAKE_NINJA_DEPTYPE_" + lang),
cmMakefile* mf = this->GetMakefile(); "msvc") == 0;
return (
strcmp(mf->GetSafeDefinition("CMAKE_C_COMPILER_ID"), "MSVC") == 0 ||
strcmp(mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID"), "MSVC") == 0 ||
strcmp(mf->GetSafeDefinition("CMAKE_C_SIMULATE_ID"), "MSVC") == 0 ||
strcmp(mf->GetSafeDefinition("CMAKE_CXX_SIMULATE_ID"), "MSVC") == 0
);
}
return false;
} }
// TODO: Refactor with // TODO: Refactor with
@ -359,7 +351,7 @@ cmNinjaTargetGenerator
depfile = ""; depfile = "";
flags += " /showIncludes"; flags += " /showIncludes";
} }
else if (lang == "RC" && this->NeedDepTypeMSVC("C")) else if (mf->IsOn("CMAKE_NINJA_CMCLDEPS_"+lang))
{ {
// For the MS resource compiler we need cmcldeps, but skip dependencies // For the MS resource compiler we need cmcldeps, but skip dependencies
// for source-file try_compile cases because they are always fresh. // for source-file try_compile cases because they are always fresh.