[Cmake-commits] CMake branch, next, updated. v2.8.9-1087-gcc092ef

Stephen Kelly steveire at gmail.com
Mon Oct 15 04:39:24 EDT 2012


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  cc092ef82e5a1d4c28a566fc37b5e366752302ed (commit)
       via  47edd55dddf416211fce6592191d602c798349a0 (commit)
      from  316f5b036fb9ebe3dd444c103b1388111754faa7 (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=cc092ef82e5a1d4c28a566fc37b5e366752302ed
commit cc092ef82e5a1d4c28a566fc37b5e366752302ed
Merge: 316f5b0 47edd55
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Oct 15 04:39:20 2012 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Oct 15 04:39:20 2012 -0400

    Merge topic 'fix-NOTFOUND-processing' into next
    
    47edd55 Fix reporting about not-found include directories and libraries.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=47edd55dddf416211fce6592191d602c798349a0
commit 47edd55dddf416211fce6592191d602c798349a0
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Oct 15 10:27:42 2012 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Oct 15 10:30:10 2012 +0200

    Fix reporting about not-found include directories and libraries.
    
    This fixes a regression introduced in 290e92ada86c5b74669be48ee901494ae8e48ee3
    which loops over cmGeneratorTargets before they get created, so the container
    is empty.

diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 3f8e962..0dc09c0 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -129,3 +129,45 @@ cmCompiledGeneratorExpression::~cmCompiledGeneratorExpression()
     delete *it;
     }
 }
+
+std::string cmGeneratorExpression::Preprocess(const std::string &input,
+                                              GenerateContext context)
+{
+  std::string result;
+  std::string::size_type pos = 0;
+  std::string::size_type lastPos = pos;
+  while((pos = input.find("$<", lastPos)) != input.npos)
+    {
+    result += input.substr(lastPos, pos - lastPos);
+    pos += 2;
+    int nestingLevel = 1;
+    const char *c = input.c_str() + pos;
+    const char * const cStart = c;
+    for ( ; *c; ++c)
+      {
+      if(c[0] == '$' && c[1] == '<')
+        {
+        ++nestingLevel;
+        ++c;
+        continue;
+        }
+      if(c[0] == '>')
+        {
+        --nestingLevel;
+        if (nestingLevel == 0)
+          {
+          break;
+          }
+        }
+      }
+    const std::string::size_type traversed = (c - cStart) + 1;
+    if (!*c)
+      {
+      result += "$<" + input.substr(pos, traversed);
+      }
+    pos += traversed;
+    lastPos = pos;
+    }
+  result += input.substr(lastPos);
+  return result;
+}
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index d37ce97..f2e0465 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -48,6 +48,13 @@ public:
   const cmCompiledGeneratorExpression& Parse(std::string const& input);
   const cmCompiledGeneratorExpression& Parse(const char* input);
 
+  enum GenerateContext {
+    StripAllGeneratorExpressions
+  };
+
+  static std::string Preprocess(const std::string &input,
+                                GenerateContext context);
+
 private:
   cmGeneratorExpression(const cmGeneratorExpression &);
   void operator=(const cmGeneratorExpression &);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 09588f9..23ec08a 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -25,6 +25,7 @@
 #include "cmComputeTargetDepends.h"
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorTarget.h"
+#include "cmGeneratorExpression.h"
 
 #include <cmsys/Directory.hxx>
 
@@ -1152,13 +1153,13 @@ void cmGlobalGenerator::CheckLocalGenerators()
     {
     manager = this->LocalGenerators[i]->GetMakefile()->GetCacheManager();
     this->LocalGenerators[i]->ConfigureFinalPass();
-    cmGeneratorTargetsType targets =
-      this->LocalGenerators[i]->GetMakefile()->GetGeneratorTargets();
-    for (cmGeneratorTargetsType::iterator l = targets.begin();
+    cmTargets &targets =
+      this->LocalGenerators[i]->GetMakefile()->GetTargets();
+    for (cmTargets::iterator l = targets.begin();
          l != targets.end(); l++)
       {
       const cmTarget::LinkLibraryVectorType& libs =
-        l->second->Target->GetOriginalLinkLibraries();
+        l->second.GetOriginalLinkLibraries();
       for(cmTarget::LinkLibraryVectorType::const_iterator lib = libs.begin();
           lib != libs.end(); ++lib)
         {
@@ -1174,14 +1175,23 @@ void cmGlobalGenerator::CheckLocalGenerators()
             }
           std::string text = notFoundMap[varName];
           text += "\n    linked by target \"";
-          text += l->second->GetName();
+          text += l->second.GetName();
           text += "\" in directory ";
           text+=this->LocalGenerators[i]->GetMakefile()->GetCurrentDirectory();
           notFoundMap[varName] = text;
           }
         }
       std::vector<std::string> incs;
-      this->LocalGenerators[i]->GetIncludeDirectories(incs, l->second);
+      const char *incDirProp = l->second.GetProperty("INCLUDE_DIRECTORIES");
+      if (!incDirProp)
+        {
+        continue;
+        }
+
+      std::string incDirs = cmGeneratorExpression::Preprocess(incDirProp,
+                        cmGeneratorExpression::StripAllGeneratorExpressions);
+
+      cmSystemTools::ExpandListArgument(incDirs.c_str(), incs);
 
       for( std::vector<std::string>::const_iterator incDir = incs.begin();
             incDir != incs.end(); ++incDir)
diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx
index 75a76a4..2ae35ef 100644
--- a/Source/cmMakeDepend.cxx
+++ b/Source/cmMakeDepend.cxx
@@ -11,6 +11,7 @@
 ============================================================================*/
 #include "cmMakeDepend.h"
 #include "cmSystemTools.h"
+#include "cmGeneratorExpression.h"
 
 #include <cmsys/RegularExpression.hxx>
 
@@ -58,12 +59,22 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile)
   // Now extract any include paths from the targets
   std::set<std::string> uniqueIncludes;
   std::vector<std::string> orderedAndUniqueIncludes;
-  cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
-  for (cmGeneratorTargetsType::iterator l = targets.begin();
+  cmTargets &targets = this->Makefile->GetTargets();
+  for (cmTargets::iterator l = targets.begin();
        l != targets.end(); ++l)
     {
-    const std::vector<std::string>& includes =
-      l->second->GetIncludeDirectories();
+    const char *incDirProp = l->second.GetProperty("INCLUDE_DIRECTORIES");
+    if (!incDirProp)
+      {
+      continue;
+      }
+
+    std::string incDirs = cmGeneratorExpression::Preprocess(incDirProp,
+                      cmGeneratorExpression::StripAllGeneratorExpressions);
+
+    std::vector<std::string> includes;
+    cmSystemTools::ExpandListArgument(incDirs.c_str(), includes);
+
     for(std::vector<std::string>::const_iterator j = includes.begin();
         j != includes.end(); ++j)
       {
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 2fa7141..8c67625 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -53,6 +53,7 @@ add_RunCMake_test(ObjectLibrary)
 add_RunCMake_test(build_command)
 add_RunCMake_test(find_package)
 add_RunCMake_test(include)
+add_RunCMake_test(include_directories)
 add_RunCMake_test(list)
 
 if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]")
diff --git a/Tests/RunCMake/include_directories/CMakeLists.txt b/Tests/RunCMake/include_directories/CMakeLists.txt
new file mode 100644
index 0000000..e8db6b0
--- /dev/null
+++ b/Tests/RunCMake/include_directories/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/include_directories/NotFoundContent-result.txt b/Tests/RunCMake/include_directories/NotFoundContent-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/include_directories/NotFoundContent-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/include_directories/NotFoundContent-stderr.txt b/Tests/RunCMake/include_directories/NotFoundContent-stderr.txt
new file mode 100644
index 0000000..f608d63
--- /dev/null
+++ b/Tests/RunCMake/include_directories/NotFoundContent-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
+Please set them or make sure they are set and tested correctly in the CMake files:
+NotThere1
+   used as include directory in directory .*
+NotThere2
+   used as include directory in directory .*
diff --git a/Tests/RunCMake/include_directories/NotFoundContent.cmake b/Tests/RunCMake/include_directories/NotFoundContent.cmake
new file mode 100644
index 0000000..9677e0c
--- /dev/null
+++ b/Tests/RunCMake/include_directories/NotFoundContent.cmake
@@ -0,0 +1,9 @@
+
+include_directories(NotThere1-NOTFOUND)
+
+include_directories($<1:There1-NOTFOUND>)
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp" "int main(int,char**) { return 0; }\n")
+add_executable(dummy "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp")
+set_property(TARGET dummy APPEND PROPERTY INCLUDE_DIRECTORIES "NotThere2-NOTFOUND")
+set_property(TARGET dummy APPEND PROPERTY INCLUDE_DIRECTORIES "$<1:There2-NOTFOUND>")
diff --git a/Tests/RunCMake/include_directories/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake
new file mode 100644
index 0000000..aee3f79
--- /dev/null
+++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(NotFoundContent)

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

Summary of changes:
 Source/cmGeneratorExpression.cxx                   |   42 ++++++++++++++++++++
 Source/cmGeneratorExpression.h                     |    7 +++
 Source/cmGlobalGenerator.cxx                       |   22 +++++++---
 Source/cmMakeDepend.cxx                            |   19 +++++++--
 Tests/RunCMake/CMakeLists.txt                      |    1 +
 .../CMakeLists.txt                                 |    0
 .../NotFoundContent-result.txt}                    |    0
 .../include_directories/NotFoundContent-stderr.txt |    6 +++
 .../include_directories/NotFoundContent.cmake      |    9 ++++
 .../include_directories/RunCMakeTest.cmake         |    3 +
 10 files changed, 99 insertions(+), 10 deletions(-)
 copy Tests/RunCMake/{GeneratorExpression => include_directories}/CMakeLists.txt (100%)
 copy Tests/RunCMake/{GeneratorExpression/BadAND-result.txt => include_directories/NotFoundContent-result.txt} (100%)
 create mode 100644 Tests/RunCMake/include_directories/NotFoundContent-stderr.txt
 create mode 100644 Tests/RunCMake/include_directories/NotFoundContent.cmake
 create mode 100644 Tests/RunCMake/include_directories/RunCMakeTest.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list