[Cmake-commits] CMake branch, next, updated. v2.8.10.2-1795-g65dbbcb

Stephen Kelly steveire at gmail.com
Sun Jan 27 17:28:49 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  65dbbcb7f43aef11090cebb9f1a0712a616f955b (commit)
       via  6fcdd6e4d47d0469baad228a84ebb9269dceb488 (commit)
      from  19bdcddcaf48a72e060a2e57ad9fb16b882e2abe (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=65dbbcb7f43aef11090cebb9f1a0712a616f955b
commit 65dbbcb7f43aef11090cebb9f1a0712a616f955b
Merge: 19bdcdd 6fcdd6e
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Jan 27 17:28:47 2013 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sun Jan 27 17:28:47 2013 -0500

    Merge topic 'interface-commands-lazy-target-check' into next
    
    6fcdd6e Check lazily for whether parameters are targets

diff --cc Tests/ExportImport/Export/CMakeLists.txt
index 47521d8,4448cd8..efbccea
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@@ -165,9 -150,11 +165,11 @@@ set_property(TARGET testLibRequired APP
      $<BUILD_INTERFACE:$<TARGET_PROPERTY:testLibIncludeRequired5,INTERFACE_INCLUDE_DIRECTORIES>>
      $<INSTALL_INTERFACE:$<TARGET_PROPERTY:testLibIncludeRequired6,INTERFACE_INCLUDE_DIRECTORIES>>
      # Test that the below is non-fatal
 -    $<$<TARGET_DEFINED:no_a_target>:$<TARGET_PROPERTY:no_a_target,INTERFACE_INCLUDE_DIRECTORIES>>
 +    $<$<TARGET_DEFINED:not_a_target>:$<TARGET_PROPERTY:not_a_target,INTERFACE_INCLUDE_DIRECTORIES>>
  )
  
+ target_compile_definitions(testLibRequired PUBLIC testSharedLibRequired)
+ 
  set_property(TARGET testLibRequired APPEND PROPERTY
    INTERFACE_COMPILE_DEFINITIONS
      testLibRequired_IFACE_DEFINE

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6fcdd6e4d47d0469baad228a84ebb9269dceb488
commit 6fcdd6e4d47d0469baad228a84ebb9269dceb488
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Jan 26 11:31:54 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jan 26 12:23:31 2013 +0100

    Check lazily for whether parameters are targets
    
    The target_link_libraries command can evaluate lazily whether
    a parameter is a target, so these commands should too.
    
    In the case of target_include_directories, content is either an absolute
    path or a target. So, if it is not an absolute path we can be sure
    it is a target at generate-time (or report an error). That is done
    by using the TARGET_PROPERTY command without first checking if the
    target is defined.
    
    There is the disadvantage that the case of
    
     target_compile_definitions(foo PRIVATE SOME_DEFINE)
    
    now expands in the COMPILE_DEFINITIONS property to
    
     "$<$<TARGET_DEFINED:SOME_DEFINE>:$<TARGET_PROPERTY:SOME_DEFINE,INTERFACE_COMPILE_DEFINITIONS>;$<$<NOT:$<TARGET_DEFINED:SOME_DEFINE>>:SOME_DEFINE>"
    
    This may be a reason to document that all-uppercase content
    to target_compile_definitions is always treated as a compile
    definition, never as a target (but not vice-versa). Content such
    as 'SOME_DEFINE=bar' is already treated only as a define, as it
    does not match the targetNameValidator.

diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx
index 683eff6..312d625 100644
--- a/Source/cmTargetCompileDefinitionsCommand.cxx
+++ b/Source/cmTargetCompileDefinitionsCommand.cxx
@@ -37,16 +37,6 @@ void cmTargetCompileDefinitionsCommand
   this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
 }
 
-bool cmTargetCompileDefinitionsCommand
-::HandleNonTargetArg(std::string &content,
-                   const std::string &sep,
-                   const std::string &entry,
-                   const std::string &)
-{
-  content += sep + entry;
-  return true;
-}
-
 void cmTargetCompileDefinitionsCommand
 ::HandleDirectContent(cmTarget *tgt, const std::string &content,
                                    bool)
diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h
index d49b9e8..6e8fc84 100644
--- a/Source/cmTargetCompileDefinitionsCommand.h
+++ b/Source/cmTargetCompileDefinitionsCommand.h
@@ -81,11 +81,6 @@ private:
   virtual void HandleImportedTarget(const std::string &tgt);
   virtual void HandleMissingTarget(const std::string &name);
 
-  virtual bool HandleNonTargetArg(std::string &content,
-                          const std::string &sep,
-                          const std::string &entry,
-                          const std::string &tgt);
-
   virtual void HandleDirectContent(cmTarget *tgt, const std::string &content,
                                    bool prepend);
 };
diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx
index aeba468..af0179f 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.cxx
+++ b/Source/cmTargetIncludeDirectoriesCommand.cxx
@@ -41,23 +41,20 @@ void cmTargetIncludeDirectoriesCommand
 }
 
 //----------------------------------------------------------------------------
-bool cmTargetIncludeDirectoriesCommand
-::HandleNonTargetArg(std::string &content,
-                   const std::string &sep,
-                   const std::string &entry,
-                   const std::string &tgt)
+void cmTargetIncludeDirectoriesCommand
+::HandleMaybeTargetArg(std::string &content,
+                       const std::string &sep,
+                       const std::string &entry,
+                       const std::string &fragment)
 {
   if (!cmSystemTools::FileIsFullPath(entry.c_str()))
     {
-    cmOStringStream e;
-    e << "Cannot specify relative include directory \"" << entry << "\" for "
-         "target \"" << tgt << "\". Only absolute paths are permitted";
-    this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
-    return false;
+    content += sep + fragment;
+    }
+  else
+    {
+    content += sep + entry;
     }
-
-  content += sep + entry;
-  return true;
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h
index 5a5f859..a20549f 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.h
+++ b/Source/cmTargetIncludeDirectoriesCommand.h
@@ -85,10 +85,10 @@ private:
   virtual void HandleImportedTarget(const std::string &tgt);
   virtual void HandleMissingTarget(const std::string &name);
 
-  virtual bool HandleNonTargetArg(std::string &content,
-                          const std::string &sep,
-                          const std::string &entry,
-                          const std::string &tgt);
+  virtual void HandleMaybeTargetArg(std::string &content,
+                                    const std::string &sep,
+                                    const std::string &entry,
+                                    const std::string &fragment);
 
   virtual void HandleDirectContent(cmTarget *tgt, const std::string &content,
                                    bool prepend);
diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx
index e1eb1d2..0ed04f3 100644
--- a/Source/cmTargetPropCommandBase.cxx
+++ b/Source/cmTargetPropCommandBase.cxx
@@ -108,18 +108,31 @@ bool cmTargetPropCommandBase
       this->PopulateTargetProperies(scope, content, prepend);
       return true;
       }
-    if (this->Makefile->FindTargetToUse(args[i].c_str()))
-      {
-      content += sep + "$<TARGET_PROPERTY:" + args[i]
-                      + ",INTERFACE_" + this->Property + ">";
-      }
-    else if(isGeneratorExpression(args[i]))
+    if(isGeneratorExpression(args[i]))
       {
       content += sep + args[i];
       }
-    else if (!this->HandleNonTargetArg(content, sep, args[i], args[0]))
+    else
       {
-      return false;
+      cmsys::RegularExpression targetNameValidator;
+      targetNameValidator.compile("^[A-Za-z0-9_.:-]+$");
+      if (!targetNameValidator.find(args[i].c_str()))
+        {
+        content += sep + args[i];
+        }
+      else
+        {
+        const std::string fragment = "$<TARGET_PROPERTY:" + args[i]
+                                   + ",INTERFACE_" + this->Property + ">";
+        if (this->Makefile->FindTargetToUse(args[i].c_str()))
+          {
+          content += sep + fragment;
+          }
+        else
+          {
+          this->HandleMaybeTargetArg(content, sep, args[i], fragment);
+          }
+        }
       }
     sep = ";";
     }
@@ -129,6 +142,19 @@ bool cmTargetPropCommandBase
 
 //----------------------------------------------------------------------------
 void cmTargetPropCommandBase
+::HandleMaybeTargetArg(std::string &content,
+                       const std::string &sep,
+                       const std::string &entry,
+                       const std::string &fragment)
+{
+  content += sep + "$<$<TARGET_DEFINED:"
+                  + entry + ">:" + fragment + ">";
+  content += ";$<$<NOT:$<TARGET_DEFINED:"
+                  + entry + ">>:" + entry + ">";
+}
+
+//----------------------------------------------------------------------------
+void cmTargetPropCommandBase
 ::PopulateTargetProperies(const std::string &scope,
                           const std::string &content, bool prepend)
 {
diff --git a/Source/cmTargetPropCommandBase.h b/Source/cmTargetPropCommandBase.h
index 15a78c9..9b1e276 100644
--- a/Source/cmTargetPropCommandBase.h
+++ b/Source/cmTargetPropCommandBase.h
@@ -35,10 +35,10 @@ private:
   virtual void HandleImportedTarget(const std::string &tgt) = 0;
   virtual void HandleMissingTarget(const std::string &name) = 0;
 
-  virtual bool HandleNonTargetArg(std::string &content,
-                          const std::string &sep,
-                          const std::string &entry,
-                          const std::string &tgt) = 0;
+  virtual void HandleMaybeTargetArg(std::string &content,
+                                    const std::string &sep,
+                                    const std::string &entry,
+                                    const std::string &fragment);
 
   virtual void HandleDirectContent(cmTarget *tgt,
                                    const std::string &content,
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index 3f7206b..4448cd8 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -153,6 +153,8 @@ set_property(TARGET testLibRequired APPEND PROPERTY
     $<$<TARGET_DEFINED:no_a_target>:$<TARGET_PROPERTY:no_a_target,INTERFACE_INCLUDE_DIRECTORIES>>
 )
 
+target_compile_definitions(testLibRequired PUBLIC testSharedLibRequired)
+
 set_property(TARGET testLibRequired APPEND PROPERTY
   INTERFACE_COMPILE_DEFINITIONS
     testLibRequired_IFACE_DEFINE
@@ -191,6 +193,7 @@ set_property(TARGET testSharedLibRequired
   PROPERTY
     INTERFACE_CUSTOM_STRING testcontent
 )
+target_compile_definitions(testSharedLibRequired INTERFACE SOME_NON_TARGET_DEFINE)
 
 add_library(testSharedLibDepends SHARED testSharedLibDepends.cpp)
 set_property(TARGET testSharedLibDepends APPEND PROPERTY
diff --git a/Tests/ExportImport/Export/testLibRequired.c b/Tests/ExportImport/Export/testLibRequired.c
index e126d44..e10383c 100644
--- a/Tests/ExportImport/Export/testLibRequired.c
+++ b/Tests/ExportImport/Export/testLibRequired.c
@@ -1 +1,6 @@
+
+#ifndef SOME_NON_TARGET_DEFINE
+#error Expected SOME_NON_TARGET_DEFINE
+#endif
+
 int testLibRequired(void) { return 0; }

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

Summary of changes:
 Source/cmTargetCompileDefinitionsCommand.cxx |   10 ------
 Source/cmTargetCompileDefinitionsCommand.h   |    5 ---
 Source/cmTargetIncludeDirectoriesCommand.cxx |   23 ++++++--------
 Source/cmTargetIncludeDirectoriesCommand.h   |    8 ++--
 Source/cmTargetPropCommandBase.cxx           |   42 +++++++++++++++++++++-----
 Source/cmTargetPropCommandBase.h             |    8 ++--
 Tests/ExportImport/Export/CMakeLists.txt     |    3 ++
 Tests/ExportImport/Export/testLibRequired.c  |    5 +++
 8 files changed, 60 insertions(+), 44 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list