[Cmake-commits] CMake branch, next, updated. v3.1.2-1076-g9d3b0df

Brad King brad.king at kitware.com
Fri Feb 6 12:54:58 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  9d3b0dfd93694ffee04c5b4b5795aa7ebf6ca059 (commit)
       via  d2fe4c420370727c644432549b7a5ca9dfef3a28 (commit)
       via  de63ff489d25095e41deae724f499ea3df05b6cf (commit)
       via  9924486f8a979bf937c8fd7749aaf37c1bd762e1 (commit)
      from  abee514ddbf3a5b3fb5fea1a4b755149100eaf5d (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=9d3b0dfd93694ffee04c5b4b5795aa7ebf6ca059
commit 9d3b0dfd93694ffee04c5b4b5795aa7ebf6ca059
Merge: abee514 d2fe4c4
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Feb 6 12:54:57 2015 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Feb 6 12:54:57 2015 -0500

    Merge topic 'xcode-flags-per-language' into next
    
    d2fe4c42 cmGlobalXCodeGenerator: Rename variable 'lang' => 'llang'
    de63ff48 Xcode: Generate Intel Fortran compiler flags in project files
    9924486f Xcode: Refactor generation of per-language compiler flags


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d2fe4c420370727c644432549b7a5ca9dfef3a28
commit d2fe4c420370727c644432549b7a5ca9dfef3a28
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Feb 6 10:31:08 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Feb 6 11:46:03 2015 -0500

    cmGlobalXCodeGenerator: Rename variable 'lang' => 'llang'
    
    In CreateBuildSettings the variable holds the linker language.
    Use a more distinctive variable name.

diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 0636910..30ed134 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1775,8 +1775,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
       AddCompileOptions(flags, &target, lang, configName);
     }
 
-  std::string lang = target.GetLinkerLanguage(configName);
-  if(binary && lang.empty())
+  std::string llang = target.GetLinkerLanguage(configName);
+  if(binary && llang.empty())
     {
     cmSystemTools::Error
       ("CMake can not determine linker language for target: ",
@@ -2001,7 +2001,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
       // in many ways as an application bundle, as far as
       // link flags go
       std::string createFlags =
-        this->LookupFlags("CMAKE_SHARED_MODULE_CREATE_", lang, "_FLAGS",
+        this->LookupFlags("CMAKE_SHARED_MODULE_CREATE_", llang, "_FLAGS",
                           "-bundle");
       if(!createFlags.empty())
         {
@@ -2029,7 +2029,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
                                   this->CreateString("NO"));
       // Add the flags to create an executable.
       std::string createFlags =
-        this->LookupFlags("CMAKE_", lang, "_LINK_FLAGS", "");
+        this->LookupFlags("CMAKE_", llang, "_LINK_FLAGS", "");
       if(!createFlags.empty())
         {
         extraLinkOptions += " ";
@@ -2040,7 +2040,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
       {
       // Add the flags to create a module.
       std::string createFlags =
-        this->LookupFlags("CMAKE_SHARED_MODULE_CREATE_", lang, "_FLAGS",
+        this->LookupFlags("CMAKE_SHARED_MODULE_CREATE_", llang, "_FLAGS",
                           "-bundle");
       if(!createFlags.empty())
         {
@@ -2074,7 +2074,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
       {
       // Add the flags to create a shared library.
       std::string createFlags =
-        this->LookupFlags("CMAKE_SHARED_LIBRARY_CREATE_", lang, "_FLAGS",
+        this->LookupFlags("CMAKE_SHARED_LIBRARY_CREATE_", llang, "_FLAGS",
                           "-dynamiclib");
       if(!createFlags.empty())
         {
@@ -2091,7 +2091,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
     {
     // Add the flags to create an executable.
     std::string createFlags =
-      this->LookupFlags("CMAKE_", lang, "_LINK_FLAGS", "");
+      this->LookupFlags("CMAKE_", llang, "_LINK_FLAGS", "");
     if(!createFlags.empty())
       {
       extraLinkOptions += " ";

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=de63ff489d25095e41deae724f499ea3df05b6cf
commit de63ff489d25095e41deae724f499ea3df05b6cf
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Feb 6 11:02:48 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Feb 6 11:45:28 2015 -0500

    Xcode: Generate Intel Fortran compiler flags in project files

diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 7b2ac8e..0636910 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2250,6 +2250,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
       buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS",
                                   this->CreateString(flags.c_str()));
       }
+    else if (*li == "Fortran")
+      {
+      buildSettings->AddAttribute("IFORT_OTHER_FLAGS",
+                                  this->CreateString(flags.c_str()));
+      }
     else if (*li == "C")
       {
       buildSettings->AddAttribute("OTHER_CFLAGS",

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9924486f8a979bf937c8fd7749aaf37c1bd762e1
commit 9924486f8a979bf937c8fd7749aaf37c1bd762e1
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Feb 6 11:01:48 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Feb 6 11:44:41 2015 -0500

    Xcode: Refactor generation of per-language compiler flags

diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index cd0dcc6..7b2ac8e 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1743,7 +1743,6 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
     return;
     }
 
-  std::string flags;
   std::string defFlags;
   bool shared = ((target.GetType() == cmTarget::SHARED_LIBRARY) ||
                  (target.GetType() == cmTarget::MODULE_LIBRARY));
@@ -1752,19 +1751,15 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
                  (target.GetType() == cmTarget::EXECUTABLE) ||
                  shared);
 
-  std::string lang = target.GetLinkerLanguage(configName);
-  std::string cflags;
-  if(!lang.empty())
+  // Compute the compilation flags for each language.
+  std::set<std::string> languages;
+  target.GetLanguages(languages, configName);
+  std::map<std::string, std::string> cflags;
+  for (std::set<std::string>::iterator li = languages.begin();
+       li != languages.end(); ++li)
     {
-    // for c++ projects get the c flags as well
-    if(lang == "CXX")
-      {
-      this->CurrentLocalGenerator->AddLanguageFlags(cflags, "C", configName);
-      this->CurrentLocalGenerator->AddCMP0018Flags(cflags, &target,
-                                                   "C", configName);
-      this->CurrentLocalGenerator->
-        AddCompileOptions(cflags, &target, "C", configName);
-      }
+    std::string const& lang = *li;
+    std::string& flags = cflags[lang];
 
     // Add language-specific flags.
     this->CurrentLocalGenerator->AddLanguageFlags(flags, lang, configName);
@@ -1779,13 +1774,15 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
     this->CurrentLocalGenerator->
       AddCompileOptions(flags, &target, lang, configName);
     }
-  else if(binary)
-  {
+
+  std::string lang = target.GetLinkerLanguage(configName);
+  if(binary && lang.empty())
+    {
     cmSystemTools::Error
       ("CMake can not determine linker language for target: ",
        target.GetName().c_str());
     return;
-  }
+    }
 
   // Add define flags
   this->CurrentLocalGenerator->
@@ -2178,53 +2175,58 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
     buildSettings->AddAttribute("HEADER_SEARCH_PATHS",
                                 dirs.CreateList());
     }
-  std::string oflagc = this->ExtractFlag("-O", cflags);
+
+  bool same_gflags = true;
+  std::map<std::string, std::string> gflags;
+  std::string const* last_gflag = 0;
   char optLevel[2];
   optLevel[0] = '0';
   optLevel[1] = 0;
-  if(oflagc.size() == 3)
-    {
-    optLevel[0] = oflagc[2];
-    }
-  if(oflagc.size() == 2)
-    {
-    optLevel[0] = '1';
-    }
-  std::string oflag = this->ExtractFlag("-O", flags);
-  if(oflag.size() == 3)
-    {
-    optLevel[0] = oflag[2];
-    }
-  if(oflag.size() == 2)
-    {
-    optLevel[0] = '1';
-    }
-  std::string gflagc = this->ExtractFlag("-g", cflags);
-  // put back gdwarf-2 if used since there is no way
-  // to represent it in the gui, but we still want debug yes
-  if(gflagc == "-gdwarf-2")
-    {
-    cflags += " ";
-    cflags += gflagc;
-    }
-  std::string gflag = this->ExtractFlag("-g", flags);
-  if(gflag == "-gdwarf-2")
+
+  // Minimal map of flags to build settings.
+  for (std::set<std::string>::iterator li = languages.begin();
+       li != languages.end(); ++li)
     {
-    flags += " ";
-    flags += gflag;
+    std::string& flags = cflags[*li];
+    std::string& gflag = gflags[*li];
+    std::string oflag = this->ExtractFlag("-O", flags);
+    if(oflag.size() == 3)
+      {
+      optLevel[0] = oflag[2];
+      }
+    if(oflag.size() == 2)
+      {
+      optLevel[0] = '1';
+      }
+    gflag = this->ExtractFlag("-g", flags);
+    // put back gdwarf-2 if used since there is no way
+    // to represent it in the gui, but we still want debug yes
+    if(gflag == "-gdwarf-2")
+      {
+      flags += " ";
+      flags += gflag;
+      }
+    if (last_gflag && *last_gflag != gflag)
+      {
+      same_gflags = false;
+      }
+    last_gflag = &gflag;
     }
+
   const char* debugStr = "YES";
-  // We can't set the Xcode flag differently depending on the language,
-  // so put them back in this case.
-  if( (lang == "CXX") && gflag != gflagc )
+  if (!same_gflags)
     {
-    cflags += " ";
-    cflags += gflagc;
-    flags += " ";
-    flags += gflag;
+    // We can't set the Xcode flag differently depending on the language,
+    // so put them back in this case.
+    for (std::set<std::string>::iterator li = languages.begin();
+         li != languages.end(); ++li)
+      {
+      cflags[*li] += " ";
+      cflags[*li] += gflags[*li];
+      }
     debugStr = "NO";
     }
-  if( gflag == "-g0" || gflag.size() == 0 )
+  else if (last_gflag && (last_gflag->empty() || *last_gflag == "-g0"))
     {
     debugStr = "NO";
     }
@@ -2239,24 +2241,20 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
                               this->CreateString("NO"));
   buildSettings->AddAttribute("GCC_INLINES_ARE_PRIVATE_EXTERN",
                               this->CreateString("NO"));
-  if(lang == "CXX")
-    {
-    flags += " ";
-    flags += defFlags;
-    buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS",
-                                this->CreateString(flags.c_str()));
-    cflags += " ";
-    cflags += defFlags;
-    buildSettings->AddAttribute("OTHER_CFLAGS",
-                                this->CreateString(cflags.c_str()));
-
-    }
-  else
+  for (std::set<std::string>::iterator li = languages.begin();
+       li != languages.end(); ++li)
     {
-    flags += " ";
-    flags += defFlags;
-    buildSettings->AddAttribute("OTHER_CFLAGS",
-                                this->CreateString(flags.c_str()));
+    std::string flags = cflags[*li] + " " + defFlags;
+    if (*li == "CXX")
+      {
+      buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS",
+                                  this->CreateString(flags.c_str()));
+      }
+    else if (*li == "C")
+      {
+      buildSettings->AddAttribute("OTHER_CFLAGS",
+                                  this->CreateString(flags.c_str()));
+      }
     }
 
   // Add Fortran source format attribute if property is set.

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

Summary of changes:
 Source/cmGlobalXCodeGenerator.cxx |  155 +++++++++++++++++++------------------
 1 file changed, 79 insertions(+), 76 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list