[Cmake-commits] CMake branch, next, updated. v2.8.12-4676-gc0e740d

Stephen Kelly steveire at gmail.com
Wed Oct 30 17:47:13 EDT 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  c0e740d9081bad1001428f5447b0186298c7eb05 (commit)
       via  f7c0649a8b486a16cc599eb055462e66e5840774 (commit)
      from  ab77811aaf12537ecbdd132e3812b5249109384b (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=c0e740d9081bad1001428f5447b0186298c7eb05
commit c0e740d9081bad1001428f5447b0186298c7eb05
Merge: ab77811 f7c0649
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Oct 30 17:47:12 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Oct 30 17:47:12 2013 -0400

    Merge topic 'target_compile_features' into next
    
    f7c0649 Base the target_compile_features command on cmTargetPropCommandBase.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f7c0649a8b486a16cc599eb055462e66e5840774
commit f7c0649a8b486a16cc599eb055462e66e5840774
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Oct 30 21:13:44 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 30 22:45:57 2013 +0100

    Base the target_compile_features command on cmTargetPropCommandBase.
    
    This gives us 'free' handling of IMPORTED, ALIAS, INTERFACE,
    non-compilable and missing targets.

diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx
index 4217eb3..6948717 100644
--- a/Source/cmTargetCompileFeaturesCommand.cxx
+++ b/Source/cmTargetCompileFeaturesCommand.cxx
@@ -15,51 +15,50 @@ bool cmTargetCompileFeaturesCommand::InitialPass(
   std::vector<std::string> const& args,
   cmExecutionStatus &)
 {
-  if (args.size() < 3)
-    {
-      this->SetError("called with wrong number of arguments.");
-      return false;
-    }
-  cmTarget *target = this->Makefile->FindTargetToUse(args[0].c_str());
+  return this->HandleArguments(args, "COMPILE_FEATURES", NO_FLAGS);
+}
 
-  if(!target)
-    {
-    this->SetError("specified invalid target.");
-    return false;
-    }
+void cmTargetCompileFeaturesCommand
+::HandleImportedTarget(const std::string &tgt)
+{
+  cmOStringStream e;
+  e << "Cannot specify compile features for imported target \""
+    << tgt << "\".";
+  this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+}
 
-  if(target->IsImported())
-    {
-    this->SetError("may not be used with an IMPORTED target.");
-    return false;
-    }
+void cmTargetCompileFeaturesCommand
+::HandleMissingTarget(const std::string &name)
+{
+  cmOStringStream e;
+  e << "Cannot specify compile features for target \"" << name << "\" "
+       "which is not built by this project.";
+  this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+}
 
-  const bool interfaceOnly = args[1] == "INTERFACE";
-  if(args[1] != "PRIVATE" && args[1] != "PUBLIC" && !interfaceOnly)
+//----------------------------------------------------------------------------
+std::string cmTargetCompileFeaturesCommand
+::Join(const std::vector<std::string> &content)
+{
+  std::string defs;
+  std::string sep;
+  for(std::vector<std::string>::const_iterator it = content.begin();
+    it != content.end(); ++it)
     {
-    this->SetError("called with invalid arguments.");
-    return false;
+    defs += sep + *it;
+    sep = ";";
     }
+  return defs;
+}
 
-  for (size_t i = 2; i < args.size(); ++i)
+//----------------------------------------------------------------------------
+void cmTargetCompileFeaturesCommand
+::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
+                                   bool, bool)
+{
+  for(std::vector<std::string>::const_iterator it = content.begin();
+    it != content.end(); ++it)
     {
-    std::string feature = args[i];
-
-    if (!interfaceOnly)
-      {
-      bool result = this->Makefile->AddRequiredTargetFeature(target,
-                                                            feature.c_str());
-
-      if (!result)
-        {
-        this->SetError("specified unknown feature.");
-        return false;
-        }
-      }
-    if (interfaceOnly || args[1] == "PUBLIC")
-      {
-      target->AppendProperty("INTERFACE_COMPILE_FEATURES", feature.c_str());
-      }
+    this->Makefile->AddRequiredTargetFeature(tgt, it->c_str());
     }
-  return true;
 }
diff --git a/Source/cmTargetCompileFeaturesCommand.h b/Source/cmTargetCompileFeaturesCommand.h
index 63beeca..9386c84 100644
--- a/Source/cmTargetCompileFeaturesCommand.h
+++ b/Source/cmTargetCompileFeaturesCommand.h
@@ -12,9 +12,9 @@
 #ifndef cmTargetCompileFeaturesCommand_h
 #define cmTargetCompileFeaturesCommand_h
 
-#include "cmCommand.h"
+#include "cmTargetPropCommandBase.h"
 
-class cmTargetCompileFeaturesCommand : public cmCommand
+class cmTargetCompileFeaturesCommand : public cmTargetPropCommandBase
 {
   virtual cmCommand* Clone()
     {
@@ -26,7 +26,16 @@ class cmTargetCompileFeaturesCommand : public cmCommand
 
   virtual const char* GetName() const { return "target_compile_features";}
 
-  cmTypeMacro(cmTargetCompileFeaturesCommand, cmCommand);
+  cmTypeMacro(cmTargetCompileFeaturesCommand, cmTargetPropCommandBase);
+
+private:
+  virtual void HandleImportedTarget(const std::string &tgt);
+  virtual void HandleMissingTarget(const std::string &name);
+
+  virtual void HandleDirectContent(cmTarget *tgt,
+                                   const std::vector<std::string> &content,
+                                   bool prepend, bool system);
+  virtual std::string Join(const std::vector<std::string> &content);
 };
 
 #endif

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

Summary of changes:
 Source/cmTargetCompileFeaturesCommand.cxx |   77 ++++++++++++++---------------
 Source/cmTargetCompileFeaturesCommand.h   |   15 +++++-
 2 files changed, 50 insertions(+), 42 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list