[Cmake-commits] CMake branch, next, updated. v2.8.10.2-1975-gac37dfb

Stephen Kelly steveire at gmail.com
Thu Feb 7 04:07:53 EST 2013


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  ac37dfb6628e9c43da6912885c255e3bef216257 (commit)
       via  b5f8a0c3fb2378d9deeb7ba7a3d03f9210be8d30 (commit)
       via  f333f14374afd3774e3d48e2ede7e2692e4bfa63 (commit)
       via  431c5a60fc295329bdd36c21ac6a956b9c84d131 (commit)
       via  611c7798202afec651d07ddabfd70688dee1432d (commit)
       via  13965a7b3d51c0deba29ae566ff09165527f07d4 (commit)
       via  2e04459b56a63eb52af17ab55136661846d7d5f2 (commit)
       via  1714c27a74c1616e5998a1a51fe42848a1f1c389 (commit)
      from  b6947b77d5109c192cb2c64b061fb0cb771882f8 (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=ac37dfb6628e9c43da6912885c255e3bef216257
commit ac37dfb6628e9c43da6912885c255e3bef216257
Merge: b6947b7 b5f8a0c
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Feb 7 04:07:38 2013 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Feb 7 04:07:38 2013 -0500

    Merge topic 'minor-fixes' into next
    
    b5f8a0c Fix generation of COMPILE_DEFINITIONS in DependInfo.cmake.
    f333f14 Ensure type specific compatible interface properties do not intersect.
    431c5a6 The COMPATIBLE_INTERFACE does not affect the target it is set on.
    611c779 Test printing origin of include dirs from tll().
    13965a7 De-duplicate validation of genex target names.
    2e04459 Deduplicate the isGeneratorExpression method.
    1714c27 Process generator expressions for 'system' include directories.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b5f8a0c3fb2378d9deeb7ba7a3d03f9210be8d30
commit b5f8a0c3fb2378d9deeb7ba7a3d03f9210be8d30
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Feb 7 01:49:17 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Feb 7 10:07:19 2013 +0100

    Fix generation of COMPILE_DEFINITIONS in DependInfo.cmake.
    
    As INTERFACE_COMPILE_DEFINITIONS are now possible, we can have
    situations like this:
    
     add_library(foo ...)
     add_library(bar ...)
     target_link_libraries(foo bar)
    
     target_compile_definitions(bar INTERFACE SOME_DEF)
    
    The INTERFACE_COMPILE_DEFINITIONS of bar determine how foo should be
    compiled, and if they change, foo should be rebuilt.
    
    Additionally, as of commit d1446ca7 (Append the COMPILE_DEFINITIONS
    from the Makefile to all targets., 2012-09-17), we don't need to
    read definitions from the makefile if we read them from the target,
    so also de-duplicate the cached info.
    
    The DependInfo for INTERFACE_INCLUDE_DIRECTORIES is already handled
    correctly.

diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index d629e71..f6ab0d0 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1961,34 +1961,17 @@ void cmLocalUnixMakefileGenerator3
     }
 
   // Build a list of preprocessor definitions for the target.
-  std::vector<std::string> defines;
-  {
-  std::string defPropName = "COMPILE_DEFINITIONS_";
-  defPropName += cmSystemTools::UpperCase(this->ConfigurationName);
-  if(const char* ddefs = this->Makefile->GetProperty("COMPILE_DEFINITIONS"))
-    {
-    cmSystemTools::ExpandListArgument(ddefs, defines);
-    }
-  if(const char* cdefs = target.GetProperty("COMPILE_DEFINITIONS"))
-    {
-    cmSystemTools::ExpandListArgument(cdefs, defines);
-    }
-  if(const char* dcdefs = this->Makefile->GetProperty(defPropName.c_str()))
-    {
-    cmSystemTools::ExpandListArgument(dcdefs, defines);
-    }
-  if(const char* ccdefs = target.GetProperty(defPropName.c_str()))
-    {
-    cmSystemTools::ExpandListArgument(ccdefs, defines);
-    }
-  }
+  std::set<std::string> defines;
+  this->AppendDefines(defines, target.GetCompileDefinitions());
+  this->AppendDefines(defines, target.GetCompileDefinitions(
+                                            this->ConfigurationName.c_str()));
   if(!defines.empty())
     {
     cmakefileStream
       << "\n"
       << "# Preprocessor definitions for this target.\n"
       << "SET(CMAKE_TARGET_DEFINITIONS\n";
-    for(std::vector<std::string>::const_iterator di = defines.begin();
+    for(std::set<std::string>::const_iterator di = defines.begin();
         di != defines.end(); ++di)
       {
       cmakefileStream

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f333f14374afd3774e3d48e2ede7e2692e4bfa63
commit f333f14374afd3774e3d48e2ede7e2692e4bfa63
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Feb 7 00:47:31 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Feb 7 10:07:19 2013 +0100

    Ensure type specific compatible interface properties do not intersect.
    
    Before, the boolean version would always win, and the string one would
    be ignored.

diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 4109929..b92bf77 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -906,7 +906,10 @@ void cmTarget::DefineProperties(cmake *cm)
      "consistent with each other, and with the \"FOO\" property in the "
      "dependee.  Consistency in this sense has the meaning that if the "
      "property is set, then it must have the same boolean value as all "
-     "others, and if the property is not set, then it is ignored.");
+     "others, and if the property is not set, then it is ignored.  Note that "
+     "for each dependee, the set of properties from this property must not "
+     "intersect with the set of properties from the "
+     "COMPATIBLE_INTERFACE_STRING property.");
 
   cm->DefineProperty
     ("COMPATIBLE_INTERFACE_STRING", cmProperty::TARGET,
@@ -917,7 +920,10 @@ void cmTarget::DefineProperties(cmake *cm)
      "if a property \"FOO\" appears in the list, then for each dependee, the "
      "\"INTERFACE_FOO\" property content in all of its dependencies must be "
      "equal with each other, and with the \"FOO\" property in the dependee.  "
-     "If the property is not set, then it is ignored.");
+     "If the property is not set, then it is ignored.  Note that for each "
+     "dependee, the set of properties from this property must not intersect "
+     "with the set of properties from the COMPATIBLE_INTERFACE_BOOL "
+     "property.");
 
   cm->DefineProperty
     ("POST_INSTALL_SCRIPT", cmProperty::TARGET,
@@ -5616,7 +5622,8 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
 {
   const cmComputeLinkInformation::ItemVector &deps = info->GetItems();
 
-  std::set<cmStdString> emitted;
+  std::set<cmStdString> emittedBools;
+  std::set<cmStdString> emittedStrings;
 
   for(cmComputeLinkInformation::ItemVector::const_iterator li =
       deps.begin();
@@ -5629,19 +5636,36 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
 
     checkPropertyConsistency<bool>(this, li->Target,
                                    "COMPATIBLE_INTERFACE_BOOL",
-                                   emitted, config, 0);
+                                   emittedBools, config, 0);
     if (cmSystemTools::GetErrorOccuredFlag())
       {
       return;
       }
     checkPropertyConsistency<const char *>(this, li->Target,
                                            "COMPATIBLE_INTERFACE_STRING",
-                                           emitted, config, 0);
+                                           emittedStrings, config, 0);
     if (cmSystemTools::GetErrorOccuredFlag())
       {
       return;
       }
     }
+
+  for(std::set<cmStdString>::const_iterator li = emittedBools.begin();
+      li != emittedBools.end(); ++li)
+    {
+    const std::set<cmStdString>::const_iterator si = emittedStrings.find(*li);
+    if (si != emittedStrings.end())
+      {
+      cmOStringStream e;
+      e << "Property \"" << *li << "\" appears in both the "
+      "COMPATIBLE_INTERFACE_BOOL and the COMPATIBLE_INTERFACE_STRING "
+      "property in the dependencies of target \"" << this->GetName() <<
+      "\".  This is not allowed. A property may only require compatibility "
+      "in a boolean interpretation or a string interpretation, but not both.";
+      this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+      break;
+      }
+    }
 }
 
 //----------------------------------------------------------------------------
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-stderr.txt
new file mode 100644
index 0000000..5a8f99d
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error in CMakeLists.txt:
+  Property "SOMETHING" appears in both the COMPATIBLE_INTERFACE_BOOL and the
+  COMPATIBLE_INTERFACE_STRING property in the dependencies of target "user".
+  This is not allowed.  A property may only require compatibility in a
+  boolean interpretation or a string interpretation, but not both.
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict.cmake
new file mode 100644
index 0000000..711368a
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict.cmake
@@ -0,0 +1,9 @@
+
+add_library(foo UNKNOWN IMPORTED)
+add_library(bar UNKNOWN IMPORTED)
+
+set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMETHING)
+set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING SOMETHING)
+
+add_executable(user main.cpp)
+target_link_libraries(user foo bar)
diff --git a/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake b/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake
index 922ad7f..9768151 100644
--- a/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake
@@ -8,3 +8,4 @@ run_cmake(InterfaceString-mismatch-depends)
 run_cmake(InterfaceString-mismatch-depend-self)
 run_cmake(InterfaceString-mismatched-use)
 run_cmake(InterfaceString-builtin-prop)
+run_cmake(InterfaceString-Bool-Conflict)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=431c5a60fc295329bdd36c21ac6a956b9c84d131
commit 431c5a60fc295329bdd36c21ac6a956b9c84d131
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Feb 7 00:43:54 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Feb 7 10:07:18 2013 +0100

    The COMPATIBLE_INTERFACE does not affect the target it is set on.
    
    Test and document this.

diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 2eaf1c1..4109929 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -900,24 +900,24 @@ void cmTarget::DefineProperties(cmake *cm)
      "Properties which must be compatible with their link interface",
      "The COMPATIBLE_INTERFACE_BOOL property may contain a list of properties"
      "for this target which must be consistent when evaluated as a boolean "
-     "in the INTERFACE of all linked dependencies.  For example, if a "
-     "property \"FOO\" appears in the list, then the \"INTERFACE_FOO\" "
-     "property content in all dependencies must be consistent with each "
-     "other, and with the \"FOO\" property in this target.  "
-     "Consistency in this sense has the meaning that if the property is set,"
-     "then it must have the same boolean value as all others, and if the "
-     "property is not set, then it is ignored.");
+     "in the INTERFACE of all linked dependees.  For example, if a "
+     "property \"FOO\" appears in the list, then for each dependee, the "
+     "\"INTERFACE_FOO\" property content in all of its dependencies must be "
+     "consistent with each other, and with the \"FOO\" property in the "
+     "dependee.  Consistency in this sense has the meaning that if the "
+     "property is set, then it must have the same boolean value as all "
+     "others, and if the property is not set, then it is ignored.");
 
   cm->DefineProperty
     ("COMPATIBLE_INTERFACE_STRING", cmProperty::TARGET,
      "Properties which must be string-compatible with their link interface",
      "The COMPATIBLE_INTERFACE_STRING property may contain a list of "
      "properties for this target which must be the same when evaluated as "
-     "a string in the INTERFACE of all linked dependencies.  For example, "
-     "if a property \"FOO\" appears in the list, then the \"INTERFACE_FOO\" "
-     "property content in all dependencies must be equal with each "
-     "other, and with the \"FOO\" property in this target.  If the "
-     "property is not set, then it is ignored.");
+     "a string in the INTERFACE of all linked dependees.  For example, "
+     "if a property \"FOO\" appears in the list, then for each dependee, the "
+     "\"INTERFACE_FOO\" property content in all of its dependencies must be "
+     "equal with each other, and with the \"FOO\" property in the dependee.  "
+     "If the property is not set, then it is ignored.");
 
   cm->DefineProperty
     ("POST_INSTALL_SCRIPT", cmProperty::TARGET,
diff --git a/Tests/CompatibleInterface/CMakeLists.txt b/Tests/CompatibleInterface/CMakeLists.txt
index 329510b..cd0a37d 100644
--- a/Tests/CompatibleInterface/CMakeLists.txt
+++ b/Tests/CompatibleInterface/CMakeLists.txt
@@ -67,3 +67,18 @@ target_compile_definitions(CompatibleInterface
   PRIVATE
     $<$<BOOL:$<TARGET_PROPERTY:Iface2_PROP>>:SOME_DEFINE>
 )
+
+# The COMPATIBLE_INTERFACE_* properties are only read from dependencies
+# in the interface. Populating it on the CompatibleInterface target does
+# not have any affect on the interpretation of the INTERFACE variants
+# in dependencies.
+set_property(TARGET iface1 PROPERTY
+  INTERFACE_NON_RELEVANT_PROP ON
+)
+set_property(TARGET iface2 PROPERTY
+  INTERFACE_NON_RELEVANT_PROP ON
+)
+set_property(TARGET CompatibleInterface APPEND PROPERTY
+  COMPATIBLE_INTERFACE_BOOL
+    NON_RELEVANT_PROP
+)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=611c7798202afec651d07ddabfd70688dee1432d
commit 611c7798202afec651d07ddabfd70688dee1432d
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Feb 5 10:24:39 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Feb 7 10:07:18 2013 +0100

    Test printing origin of include dirs from tll().

diff --git a/Tests/RunCMake/include_directories/DebugIncludes-stderr.txt b/Tests/RunCMake/include_directories/DebugIncludes-stderr.txt
index 736fe69..c17e0ae 100644
--- a/Tests/RunCMake/include_directories/DebugIncludes-stderr.txt
+++ b/Tests/RunCMake/include_directories/DebugIncludes-stderr.txt
@@ -23,13 +23,21 @@ CMake Debug Log at DebugIncludes.cmake:18 \(include_directories\):
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)
 +
-CMake Debug Log at DebugIncludes.cmake:25 \(set_property\):
+CMake Debug Log at DebugIncludes.cmake:26 \(target_link_libraries\):
   Used includes for target lll:
 
    \* .*/Tests/RunCMake/include_directories/five
+
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
++
+CMake Debug Log at DebugIncludes.cmake:29 \(set_property\):
+  Used includes for target lll:
+
    \* .*/Tests/RunCMake/include_directories/six
+   \* .*/Tests/RunCMake/include_directories/seven
 
 Call Stack \(most recent call first\):
-  DebugIncludes.cmake:35 \(some_macro\)
-  DebugIncludes.cmake:38 \(some_function\)
+  DebugIncludes.cmake:40 \(some_macro\)
+  DebugIncludes.cmake:43 \(some_function\)
   CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/include_directories/DebugIncludes.cmake b/Tests/RunCMake/include_directories/DebugIncludes.cmake
index 51daf74..794a852 100644
--- a/Tests/RunCMake/include_directories/DebugIncludes.cmake
+++ b/Tests/RunCMake/include_directories/DebugIncludes.cmake
@@ -21,6 +21,10 @@ include_directories(
   "${CMAKE_CURRENT_SOURCE_DIR}/four"
 )
 
+add_library(foo "${CMAKE_CURRENT_BINARY_DIR}/DebugIncludes.cpp")
+target_include_directories(foo INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/five")
+target_link_libraries(lll foo)
+
 macro(some_macro)
   set_property(TARGET lll APPEND PROPERTY
       INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/one"
@@ -28,6 +32,7 @@ macro(some_macro)
                           "${CMAKE_CURRENT_SOURCE_DIR}/four"
                           "${CMAKE_CURRENT_SOURCE_DIR}/five"
                           "${CMAKE_CURRENT_SOURCE_DIR}/six"
+                          "${CMAKE_CURRENT_SOURCE_DIR}/seven"
   )
 endmacro()
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=13965a7b3d51c0deba29ae566ff09165527f07d4
commit 13965a7b3d51c0deba29ae566ff09165527f07d4
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 6 13:32:15 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Feb 7 10:07:18 2013 +0100

    De-duplicate validation of genex target names.

diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index c9f784b..60bf179 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -371,10 +371,20 @@ std::string::size_type cmGeneratorExpression::Find(const std::string &input)
 {
   const std::string::size_type openpos = input.find("$<");
   if (openpos != std::string::npos
-        && input.find(">", openpos) != std::string::npos)
-      {
-      return openpos;
-      }
+      && input.find(">", openpos) != std::string::npos)
+    {
+    return openpos;
     }
   return std::string::npos;
 }
+
+//----------------------------------------------------------------------------
+bool cmGeneratorExpression::IsValidTargetName(const std::string &input)
+{
+  cmsys::RegularExpression targetNameValidator;
+  // The ':' is supported to allow use with IMPORTED targets. At least
+  // Qt 4 and 5 IMPORTED targets use ':' as the namespace delimiter.
+  targetNameValidator.compile("^[A-Za-z0-9_.:-]+$");
+
+  return targetNameValidator.find(input.c_str());
+}
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index d487919..4eab2dd 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -64,6 +64,8 @@ public:
 
   static std::string::size_type Find(const std::string &input);
 
+  static bool IsValidTargetName(const std::string &input);
+
 private:
   cmGeneratorExpression(const cmGeneratorExpression &);
   void operator=(const cmGeneratorExpression &);
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 5d94718..4779b11 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -333,10 +333,6 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
           "$<TARGET_PROPERTY:...> expression requires one or two parameters");
       return std::string();
       }
-    cmsys::RegularExpression targetNameValidator;
-    // The ':' is supported to allow use with IMPORTED targets. At least
-    // Qt 4 and 5 IMPORTED targets use ':' as the namespace delimiter.
-    targetNameValidator.compile("^[A-Za-z0-9_.:-]+$");
     cmsys::RegularExpression propertyNameValidator;
     propertyNameValidator.compile("^[A-Za-z0-9_]+$");
 
@@ -372,7 +368,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
 
       std::string targetName = parameters.front();
       propertyName = parameters[1];
-      if (!targetNameValidator.find(targetName.c_str()))
+      if (!cmGeneratorExpression::IsValidTargetName(targetName))
         {
         if (!propertyNameValidator.find(propertyName.c_str()))
           {
@@ -867,10 +863,7 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
     // Lookup the referenced target.
     std::string name = *parameters.begin();
 
-    cmsys::RegularExpression targetValidator;
-    // The ':' is supported to allow use with IMPORTED targets.
-    targetValidator.compile("^[A-Za-z0-9_.:-]+$");
-    if (!targetValidator.find(name.c_str()))
+    if (!cmGeneratorExpression::IsValidTargetName(name))
       {
       ::reportError(context, content->GetOriginalExpression(),
                     "Expression syntax not recognized.");
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index cb913f5..520c7a8 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -11,6 +11,8 @@
 ============================================================================*/
 #include "cmTargetLinkLibrariesCommand.h"
 
+#include "cmGeneratorExpression.h"
+
 const char* cmTargetLinkLibrariesCommand::LinkLibraryTypeNames[3] =
 {
   "general",
@@ -279,9 +281,8 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
 {
   const bool isGenex = isGeneratorExpression(lib);
 
-  cmsys::RegularExpression targetNameValidator;
-  targetNameValidator.compile("^[A-Za-z0-9_.:-]+$");
-  const bool potentialTargetName = targetNameValidator.find(lib);
+  const bool potentialTargetName
+                              = cmGeneratorExpression::IsValidTargetName(lib);
 
   if (potentialTargetName || isGenex)
     {

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2e04459b56a63eb52af17ab55136661846d7d5f2
commit 2e04459b56a63eb52af17ab55136661846d7d5f2
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 6 13:18:10 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Feb 7 10:07:18 2013 +0100

    Deduplicate the isGeneratorExpression method.
    
    This API seems like the most appropriate.

diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 7e4c3df..fbed95a 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -315,14 +315,6 @@ cmExportFileGenerator::AddTargetNamespace(std::string &input,
 }
 
 //----------------------------------------------------------------------------
-static bool isGeneratorExpression(const std::string &lib)
-{
-  const std::string::size_type openpos = lib.find("$<");
-  return (openpos != std::string::npos)
-      && (lib.find(">", openpos) != std::string::npos);
-}
-
-//----------------------------------------------------------------------------
 void
 cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
                                     std::string &input,
@@ -344,7 +336,7 @@ cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
   for(std::vector<std::string>::iterator li = parts.begin();
       li != parts.end(); ++li)
     {
-    if (!isGeneratorExpression(*li))
+    if (cmGeneratorExpression::Find(*li) == std::string::npos)
       {
       this->AddTargetNamespace(*li, target, missingTargets);
       }
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 7add1bf..c9f784b 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -365,3 +365,16 @@ std::string cmGeneratorExpression::Preprocess(const std::string &input,
   assert(!"cmGeneratorExpression::Preprocess called with invalid args");
   return std::string();
 }
+
+//----------------------------------------------------------------------------
+std::string::size_type cmGeneratorExpression::Find(const std::string &input)
+{
+  const std::string::size_type openpos = input.find("$<");
+  if (openpos != std::string::npos
+        && input.find(">", openpos) != std::string::npos)
+      {
+      return openpos;
+      }
+    }
+  return std::string::npos;
+}
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 700fe03..d487919 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -62,6 +62,8 @@ public:
   static void Split(const std::string &input,
                     std::vector<std::string> &output);
 
+  static std::string::size_type Find(const std::string &input);
+
 private:
   cmGeneratorExpression(const cmGeneratorExpression &);
   void operator=(const cmGeneratorExpression &);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index ca0e24b..2eaf1c1 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2270,14 +2270,6 @@ static std::string targetNameGenex(const char *lib)
 }
 
 //----------------------------------------------------------------------------
-static bool isGeneratorExpression(const std::string &lib)
-{
-  const std::string::size_type openpos = lib.find("$<");
-  return (openpos != std::string::npos)
-      && (lib.find(">", openpos) != std::string::npos);
-}
-
-//----------------------------------------------------------------------------
 void cmTarget::AddLinkLibrary(cmMakefile& mf,
                               const char *target, const char* lib,
                               LinkLibraryType llt)
@@ -2300,7 +2292,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
                                                           llt).c_str());
   }
 
-  if (isGeneratorExpression(lib))
+  if (cmGeneratorExpression::Find(lib) != std::string::npos)
     {
     return;
     }
diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx
index eaacfa9..808806a 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.cxx
+++ b/Source/cmTargetIncludeDirectoriesCommand.cxx
@@ -41,14 +41,6 @@ void cmTargetIncludeDirectoriesCommand
 }
 
 //----------------------------------------------------------------------------
-static bool isGeneratorExpression(const std::string &lib)
-{
-  const std::string::size_type openpos = lib.find("$<");
-  return (openpos != std::string::npos)
-      && (lib.find(">", openpos) != std::string::npos);
-}
-
-//----------------------------------------------------------------------------
 std::string cmTargetIncludeDirectoriesCommand
 ::Join(const std::vector<std::string> &content)
 {
@@ -59,7 +51,7 @@ std::string cmTargetIncludeDirectoriesCommand
     it != content.end(); ++it)
     {
     if (cmSystemTools::FileIsFullPath(it->c_str())
-        || isGeneratorExpression(*it))
+        || cmGeneratorExpression::Find(*it) != std::string::npos)
       {
       dirs += sep + *it;
       }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1714c27a74c1616e5998a1a51fe42848a1f1c389
commit 1714c27a74c1616e5998a1a51fe42848a1f1c389
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Jan 25 09:26:35 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Feb 7 10:03:30 2013 +0100

    Process generator expressions for 'system' include directories.
    
    Since commit 08cb4fa4 (Process generator expressions in the
    INCLUDE_DIRECTORIES property., 2012-09-18), it is possible to use
    generator expressions with the include_directories command.
    
    As that command can also have a SYSTEM argument, ensure that the
    result of using that argument with generator expressions gives a
    sane result.

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index ecf6b41..dc39fdc 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1212,7 +1212,8 @@ cmLocalGenerator::ConvertToIncludeReference(std::string const& path)
 //----------------------------------------------------------------------------
 std::string cmLocalGenerator::GetIncludeFlags(
                                      const std::vector<std::string> &includes,
-                                     const char* lang, bool forResponseFile)
+                                     const char* lang, bool forResponseFile,
+                                     const char *config)
 {
   if(!lang)
     {
@@ -1285,7 +1286,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
     if(!flagUsed || repeatFlag)
       {
       if(sysIncludeFlag &&
-         this->Makefile->IsSystemIncludeDirectory(i->c_str()))
+         this->Makefile->IsSystemIncludeDirectory(i->c_str(), config))
         {
         includeFlags << sysIncludeFlag;
         }
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index b2ff0c4..84cf6ca 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -149,7 +149,8 @@ public:
   virtual void AppendFlags(std::string& flags, const char* newFlags);
   ///! Get the include flags for the current makefile and language
   std::string GetIncludeFlags(const std::vector<std::string> &includes,
-                              const char* lang, bool forResponseFile = false);
+                              const char* lang, bool forResponseFile = false,
+                              const char *config = 0);
 
   /**
    * Encode a list of preprocessor definitions for the compiler
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index e7a1500..58e3f8e 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -23,6 +23,7 @@
 #include "cmListFileCache.h"
 #include "cmCommandArgumentParserHelper.h"
 #include "cmDocumentCompileDefinitions.h"
+#include "cmGeneratorExpression.h"
 #include "cmTest.h"
 #ifdef CMAKE_BUILD_WITH_CMAKE
 #  include "cmVariableWatch.h"
@@ -1665,10 +1666,24 @@ cmMakefile::AddSystemIncludeDirectories(const std::set<cmStdString> &incs)
 }
 
 //----------------------------------------------------------------------------
-bool cmMakefile::IsSystemIncludeDirectory(const char* dir)
+bool cmMakefile::IsSystemIncludeDirectory(const char* dir, const char *config)
 {
-  return (this->SystemIncludeDirectories.find(dir) !=
-          this->SystemIncludeDirectories.end());
+  for (std::set<cmStdString>::const_iterator
+      it = this->SystemIncludeDirectories.begin();
+      it != this->SystemIncludeDirectories.end(); ++it)
+    {
+    cmListFileBacktrace lfbt;
+    cmGeneratorExpression ge(lfbt);
+
+    std::vector<std::string> incs;
+    cmSystemTools::ExpandListArgument(ge.Parse(*it)
+                                       ->Evaluate(this, config, false), incs);
+    if (std::find(incs.begin(), incs.end(), dir) != incs.end())
+      {
+      return true;
+      }
+    }
+  return false;
 }
 
 void cmMakefile::AddDefinition(const char* name, const char* value)
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index a2783f2..c0020bf 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -547,7 +547,7 @@ public:
    * Mark include directories as system directories.
    */
   void AddSystemIncludeDirectories(const std::set<cmStdString> &incs);
-  bool IsSystemIncludeDirectory(const char* dir);
+  bool IsSystemIncludeDirectory(const char* dir, const char *config);
 
   /** Expand out any arguements in the vector that have ; separated
    *  strings into multiple arguements.  A new vector is created

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list