[Cmake-commits] CMake branch, next, updated. v3.1.1-2478-g35165bd

Brad King brad.king at kitware.com
Thu Jan 29 15:36:50 EST 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  35165bdcdac5a6450b8123a9eaf925f94ad90448 (commit)
       via  8a93d3ea1806229460f16c447b3d5ebcc80ed29c (commit)
      from  d283f43620dc720d7fbac6095464f9b59c606911 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=35165bdcdac5a6450b8123a9eaf925f94ad90448
commit 35165bdcdac5a6450b8123a9eaf925f94ad90448
Merge: d283f43 8a93d3e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jan 29 15:36:50 2015 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Jan 29 15:36:50 2015 -0500

    Merge topic 'ninja-msvc-only-C-and-CXX' into next
    
    8a93d3ea Ninja: Use "deps = msvc" only for C and CXX (#15253)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8a93d3ea1806229460f16c447b3d5ebcc80ed29c
commit 8a93d3ea1806229460f16c447b3d5ebcc80ed29c
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jan 29 11:02:06 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jan 29 15:34:24 2015 -0500

    Ninja: Use "deps = msvc" only for C and CXX (#15253)
    
    The "/showIncludes" flag is only available with MS C and C++ compilers,
    and on compilers that "simulate" them (like Intel for Windows).  Fix our
    logic to choose this type only for MS tools with these languages.  All
    other cases need to use "deps = gcc" and define DEP_FILE in the build
    rule.

diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index ff41f6d..cfd8937 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -200,21 +200,21 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source,
   return flags;
 }
 
-
-bool cmNinjaTargetGenerator::needsDepFile(const std::string& lang)
+bool cmNinjaTargetGenerator::NeedDepTypeMSVC(const std::string& lang) const
 {
-  cmMakefile* mf = this->GetMakefile();
-
-  const bool usingMSVC = std::string("MSVC") ==
-                       (mf->GetDefinition("CMAKE_C_COMPILER_ID") ?
-                    mf->GetSafeDefinition("CMAKE_C_COMPILER_ID") :
-                    mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID"));
-
-  return !usingMSVC || lang == "RC";
+  if (lang == "C" || lang == "CXX")
+    {
+    cmMakefile* mf = this->GetMakefile();
+    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
 // void cmMakefileTargetGenerator::WriteTargetLanguageFlags().
 std::string
@@ -391,22 +391,22 @@ cmNinjaTargetGenerator
 
   cmMakefile* mf = this->GetMakefile();
 
-  const std::string cId = mf->GetDefinition("CMAKE_C_COMPILER_ID")
-                          ? mf->GetSafeDefinition("CMAKE_C_COMPILER_ID")
-                          : mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID");
-  const std::string sId = mf->GetDefinition("CMAKE_C_SIMULATE_ID")
-                          ? mf->GetSafeDefinition("CMAKE_C_SIMULATE_ID")
-                          : mf->GetSafeDefinition("CMAKE_CXX_SIMULATE_ID");
-  const bool usingMSVC = (cId == "MSVC" || sId == "MSVC");
-
   // Tell ninja dependency format so all deps can be loaded into a database
   std::string deptype;
   std::string depfile;
   std::string cldeps;
   std::string flags = "$FLAGS";
-  if (usingMSVC)
+  if (this->NeedDepTypeMSVC(lang))
     {
-    if (!mf->GetIsSourceFileTryCompile() && lang == "RC")
+    deptype = "msvc";
+    depfile = "";
+    flags += " /showIncludes";
+    }
+  else if (lang == "RC" && this->NeedDepTypeMSVC("C"))
+    {
+    // For the MS resource compiler we need cmcldeps, but skip dependencies
+    // for source-file try_compile cases because they are always fresh.
+    if (!mf->GetIsSourceFileTryCompile())
       {
       deptype = "gcc";
       depfile = "$DEP_FILE";
@@ -419,12 +419,6 @@ cmNinjaTargetGenerator
       cldeps += mf->GetSafeDefinition("CMAKE_CL_SHOWINCLUDES_PREFIX");
       cldeps += "\" \"" + cl + "\" ";
       }
-    else
-      {
-      deptype = "msvc";
-      depfile = "";
-      flags += " /showIncludes";
-      }
     }
   else
     {
@@ -636,7 +630,7 @@ cmNinjaTargetGenerator
   cmNinjaVars vars;
   vars["FLAGS"] = this->ComputeFlagsForObject(source, language);
   vars["DEFINES"] = this->ComputeDefines(source, language);
-  if (needsDepFile(language)) {
+  if (!this->NeedDepTypeMSVC(language)) {
     vars["DEP_FILE"] =
             cmGlobalNinjaGenerator::EncodeDepfileSpace(objectFileName + ".d");
   }
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 17cf517..5733fde 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -42,7 +42,7 @@ public:
 
   std::string GetTargetName() const;
 
-  bool needsDepFile(const std::string& lang);
+  bool NeedDepTypeMSVC(const std::string& lang) const;
 
 protected:
 

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list