[Cmake-commits] CMake branch, next, updated. v3.5.2-1540-g95d23d0

Brad King brad.king at kitware.com
Tue May 24 11:50:28 EDT 2016


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  95d23d0699bf39764f6e3f07bc29b7a84a91367a (commit)
       via  47f1e3ecc7ea6802f6894712758292fe354cdbd6 (commit)
       via  4419909756751170d6fd4248b205c96767220dee (commit)
       via  a896043bacdd0cb2597fa10074302ed8a9a5e138 (commit)
      from  489d882aa966193309a87b92294d206fbeb0b952 (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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=95d23d0699bf39764f6e3f07bc29b7a84a91367a
commit 95d23d0699bf39764f6e3f07bc29b7a84a91367a
Merge: 489d882 47f1e3e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue May 24 11:50:26 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue May 24 11:50:26 2016 -0400

    Merge topic 'standard-include-directories' into next
    
    47f1e3ec Add a variable to specify language-wide system include directories
    44199097 cmMakefile: Optimize AddSystemIncludeDirectories for empty set
    a896043b GHS: Compute include directories consistently with other generators


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=47f1e3ecc7ea6802f6894712758292fe354cdbd6
commit 47f1e3ecc7ea6802f6894712758292fe354cdbd6
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue May 24 11:39:25 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue May 24 11:40:53 2016 -0400

    Add a variable to specify language-wide system include directories
    
    Create a `CMAKE_<LANG>_STANDARD_INCLUDE_DIRECTORIES` variable to specify
    system include directories for for `<LANG>` compiler command lines.
    This plays a role for include directories as the existing
    `CMAKE_<LANG>_STANDARD_LIBRARIES` variable does for link libraries.

diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 925b70c..b8c8bea 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -365,6 +365,7 @@ Variables for Languages
    /variable/CMAKE_LANG_SIMULATE_VERSION
    /variable/CMAKE_LANG_SIZEOF_DATA_PTR
    /variable/CMAKE_LANG_SOURCE_FILE_EXTENSIONS
+   /variable/CMAKE_LANG_STANDARD_INCLUDE_DIRECTORIES
    /variable/CMAKE_LANG_STANDARD_LIBRARIES
    /variable/CMAKE_USER_MAKE_RULES_OVERRIDE_LANG
 
diff --git a/Help/release/dev/standard-include-directories.rst b/Help/release/dev/standard-include-directories.rst
new file mode 100644
index 0000000..a03d7db
--- /dev/null
+++ b/Help/release/dev/standard-include-directories.rst
@@ -0,0 +1,6 @@
+standard-include-directories
+----------------------------
+
+* A :variable:`CMAKE_<LANG>_STANDARD_INCLUDE_DIRECTORIES` variable was
+  added for use by toolchain files to specify system include directories
+  to be appended to all compiler command lines.
diff --git a/Help/variable/CMAKE_LANG_STANDARD_INCLUDE_DIRECTORIES.rst b/Help/variable/CMAKE_LANG_STANDARD_INCLUDE_DIRECTORIES.rst
new file mode 100644
index 0000000..c8e3d57
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_STANDARD_INCLUDE_DIRECTORIES.rst
@@ -0,0 +1,14 @@
+CMAKE_<LANG>_STANDARD_INCLUDE_DIRECTORIES
+-----------------------------------------
+
+Include directories to be used for every source file compiled with
+the ``<LANG>`` compiler.  This is meant for specification of system
+include directories needed by the language for the current platform.
+The directories always appear at the end of the include path passed
+to the compiler.
+
+This variable should not be set by project code.  It is meant to be set by
+CMake's platform information modules for the current toolchain, or by a
+toolchain file when used with :variable:`CMAKE_TOOLCHAIN_FILE`.
+
+See also :variable:`CMAKE_<LANG>_STANDARD_LIBRARIES`.
diff --git a/Help/variable/CMAKE_LANG_STANDARD_LIBRARIES.rst b/Help/variable/CMAKE_LANG_STANDARD_LIBRARIES.rst
index ad3b911..ba6df93 100644
--- a/Help/variable/CMAKE_LANG_STANDARD_LIBRARIES.rst
+++ b/Help/variable/CMAKE_LANG_STANDARD_LIBRARIES.rst
@@ -8,3 +8,5 @@ libraries needed by the language for the current platform.
 This variable should not be set by project code.  It is meant to be set by
 CMake's platform information modules for the current toolchain, or by a
 toolchain file when used with :variable:`CMAKE_TOOLCHAIN_FILE`.
+
+See also :variable:`CMAKE_<LANG>_STANDARD_INCLUDE_DIRECTORIES`.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 31fff9f..842876d 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -2415,6 +2415,13 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
 
   cmDeleteAll(linkInterfaceIncludeDirectoriesEntries);
 
+  // Add standard include directories for this language.
+  std::string const standardIncludesVar =
+    "CMAKE_" + lang + "_STANDARD_INCLUDE_DIRECTORIES";
+  std::string const standardIncludes =
+    this->Makefile->GetSafeDefinition(standardIncludesVar);
+  cmSystemTools::ExpandListArgument(standardIncludes, includes);
+
   return includes;
 }
 
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 3f4c22f..ea2842f 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1385,6 +1385,9 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
 
 void cmGlobalGenerator::FinalizeTargetCompileInfo()
 {
+  std::vector<std::string> const langs =
+    this->CMakeInstance->GetState()->GetEnabledLanguages();
+
   // Construct per-target generator information.
   for (unsigned int i = 0; i < this->Makefiles.size(); ++i) {
     cmMakefile* mf = this->Makefiles[i];
@@ -1429,6 +1432,23 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
         }
       }
     }
+
+    // The standard include directories for each language
+    // should be treated as system include directories.
+    std::set<std::string> standardIncludesSet;
+    for (std::vector<std::string>::const_iterator li = langs.begin();
+         li != langs.end(); ++li) {
+      std::string const standardIncludesVar =
+        "CMAKE_" + *li + "_STANDARD_INCLUDE_DIRECTORIES";
+      std::string const standardIncludesStr =
+        mf->GetSafeDefinition(standardIncludesVar);
+      std::vector<std::string> standardIncludesVec;
+      cmSystemTools::ExpandListArgument(standardIncludesStr,
+                                        standardIncludesVec);
+      standardIncludesSet.insert(standardIncludesVec.begin(),
+                                 standardIncludesVec.end());
+    }
+    mf->AddSystemIncludeDirectories(standardIncludesSet);
   }
 }
 
diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt
index 9ee1957..523c4f7 100644
--- a/Tests/IncludeDirectories/CMakeLists.txt
+++ b/Tests/IncludeDirectories/CMakeLists.txt
@@ -63,6 +63,7 @@ else()
     PROPERTIES COMPILE_FLAGS "-ITarProp")
 endif()
 
+add_subdirectory(StandardIncludeDirectories)
 add_subdirectory(TargetIncludeDirectories)
 
 set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}")
diff --git a/Tests/IncludeDirectories/StandardIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/StandardIncludeDirectories/CMakeLists.txt
new file mode 100644
index 0000000..dcbc566
--- /dev/null
+++ b/Tests/IncludeDirectories/StandardIncludeDirectories/CMakeLists.txt
@@ -0,0 +1,5 @@
+# Normally this variable should be set by a platform information module or
+# a toolchain file, but for purposes of this test we simply set it here.
+set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/StdDir)
+
+add_executable(StandardIncludeDirectories main.c)
diff --git a/Tests/IncludeDirectories/StandardIncludeDirectories/StdDir/StdIncDir.h b/Tests/IncludeDirectories/StandardIncludeDirectories/StdDir/StdIncDir.h
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/IncludeDirectories/StandardIncludeDirectories/main.c b/Tests/IncludeDirectories/StandardIncludeDirectories/main.c
new file mode 100644
index 0000000..edfe9ce
--- /dev/null
+++ b/Tests/IncludeDirectories/StandardIncludeDirectories/main.c
@@ -0,0 +1,5 @@
+#include "StdIncDir.h"
+int main()
+{
+  return 0;
+}

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4419909756751170d6fd4248b205c96767220dee
commit 4419909756751170d6fd4248b205c96767220dee
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue May 24 11:38:18 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue May 24 11:40:35 2016 -0400

    cmMakefile: Optimize AddSystemIncludeDirectories for empty set
    
    Do not bother looping over all targets if we have no system include
    directories to add anyway.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 7e99f2c..e684689 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1574,6 +1574,10 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string>& incs,
 
 void cmMakefile::AddSystemIncludeDirectories(const std::set<std::string>& incs)
 {
+  if (incs.empty()) {
+    return;
+  }
+
   this->SystemIncludeDirectories.insert(incs.begin(), incs.end());
 
   for (cmTargets::iterator l = this->Targets.begin(); l != this->Targets.end();

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a896043bacdd0cb2597fa10074302ed8a9a5e138
commit a896043bacdd0cb2597fa10074302ed8a9a5e138
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue May 24 09:37:09 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue May 24 11:40:35 2016 -0400

    GHS: Compute include directories consistently with other generators
    
    All generators use cmLocalGenerator::GetIncludeDirectories to construct
    the final list of include directories for a target.

diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 5e13d4c..8565fdb 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -322,8 +322,10 @@ void cmGhsMultiTargetGenerator::WriteCompilerDefinitions(
 void cmGhsMultiTargetGenerator::WriteIncludes(const std::string& config,
                                               const std::string& language)
 {
-  std::vector<std::string> includes =
-    this->GeneratorTarget->GetIncludeDirectories(config, language);
+  std::vector<std::string> includes;
+  this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget,
+                                              language, config);
+
   for (std::vector<std::string>::const_iterator includes_i = includes.begin();
        includes_i != includes.end(); ++includes_i) {
     *this->GetFolderBuildStreams() << "    -I\"" << *includes_i << "\""

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

Summary of changes:
 Help/manual/cmake-variables.7.rst                  |    1 +
 Help/release/dev/standard-include-directories.rst  |    6 ++++++
 .../CMAKE_LANG_STANDARD_INCLUDE_DIRECTORIES.rst    |   14 ++++++++++++++
 Help/variable/CMAKE_LANG_STANDARD_LIBRARIES.rst    |    2 ++
 Source/cmGeneratorTarget.cxx                       |    7 +++++++
 Source/cmGhsMultiTargetGenerator.cxx               |    6 ++++--
 Source/cmGlobalGenerator.cxx                       |   20 ++++++++++++++++++++
 Source/cmMakefile.cxx                              |    4 ++++
 Tests/IncludeDirectories/CMakeLists.txt            |    1 +
 .../StandardIncludeDirectories/CMakeLists.txt      |    5 +++++
 .../StandardIncludeDirectories/StdDir/StdIncDir.h  |    0
 .../StandardIncludeDirectories}/main.c             |    1 +
 12 files changed, 65 insertions(+), 2 deletions(-)
 create mode 100644 Help/release/dev/standard-include-directories.rst
 create mode 100644 Help/variable/CMAKE_LANG_STANDARD_INCLUDE_DIRECTORIES.rst
 create mode 100644 Tests/IncludeDirectories/StandardIncludeDirectories/CMakeLists.txt
 copy Modules/IntelVSImplicitPath/hello.f => Tests/IncludeDirectories/StandardIncludeDirectories/StdDir/StdIncDir.h (100%)
 copy Tests/{ExportImport => IncludeDirectories/StandardIncludeDirectories}/main.c (54%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list