[Cmake-commits] CMake branch, next, updated. v2.8.6-1655-gf016cb7

Stephen Kelly steveire at gmail.com
Tue Oct 25 06:02:27 EDT 2011


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  f016cb7cb6a4d761b5ed0d2559b8fe76f94576fd (commit)
       via  197441a176a6ca96479dbbd603ddc7e8440d9413 (commit)
       via  f642315dd7a12b98afe89ec5e14f5ef2493d26d7 (commit)
       via  79ae746598998250def197bda5e7cd3fb3cff3cd (commit)
      from  62015f6f64141f27a67f4063a297ac9d6cb201f2 (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=f016cb7cb6a4d761b5ed0d2559b8fe76f94576fd
commit f016cb7cb6a4d761b5ed0d2559b8fe76f94576fd
Merge: 62015f6 197441a
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 25 06:02:22 2011 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Oct 25 06:02:22 2011 -0400

    Merge topic 'target-link-libraries-interfaces' into next
    
    197441a Convert three booleans into an enum state machine.
    f642315 Use a more compact doc format for the new command signature
    79ae746 Introduce link interface specific keywords to target_link_libraries


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=197441a176a6ca96479dbbd603ddc7e8440d9413
commit 197441a176a6ca96479dbbd603ddc7e8440d9413
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Oct 7 17:19:46 2011 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Oct 7 17:19:46 2011 +0200

    Convert three booleans into an enum state machine.

diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 19125d6..2a40164 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -96,10 +96,8 @@ bool cmTargetLinkLibrariesCommand
 
   // Start with primary linking and switch to link interface
   // specification if the keyword is encountered as the first argument.
-  this->DoingInterface = false;
+  this->CurrentProcessingState = ProcessingLinkLibraries;
 
-  this->DoingPublicInterface = false;
-  this->DoingPrivateInterface = false;
   this->SpecifiesPublicAndPrivate = false;
 
   // add libraries, nothe that there is an optional prefix
@@ -108,7 +106,7 @@ bool cmTargetLinkLibrariesCommand
     {
     if(args[i] == "LINK_INTERFACE_LIBRARIES")
       {
-      this->DoingInterface = true;
+      this->CurrentProcessingState = ProcessingLinkInterface;
       if(i != 1)
         {
         this->Makefile->IssueMessage(
@@ -121,8 +119,7 @@ bool cmTargetLinkLibrariesCommand
       }
     else if(args[i] == "LINK_PUBLIC")
       {
-      this->DoingPublicInterface = true;
-      if(i != 1 && !this->DoingPrivateInterface)
+      if(i != 1 && this->CurrentProcessingState != ProcessingPrivateInterface)
         {
         this->Makefile->IssueMessage(
           cmake::FATAL_ERROR,
@@ -131,16 +128,15 @@ bool cmTargetLinkLibrariesCommand
           );
         return true;
         }
-        if (this->DoingPrivateInterface)
-          {
-          this->SpecifiesPublicAndPrivate = true;
-          }
-        this->DoingPrivateInterface = false;
+      if (this->CurrentProcessingState == ProcessingPrivateInterface)
+        {
+        this->SpecifiesPublicAndPrivate = true;
+        }
+      this->CurrentProcessingState = ProcessingPublicInterface;
       }
     else if(args[i] == "LINK_PRIVATE")
       {
-      this->DoingPrivateInterface = true;
-      if(i != 1 && !this->DoingPublicInterface)
+      if(i != 1 && this->CurrentProcessingState != ProcessingPublicInterface)
         {
         this->Makefile->IssueMessage(
           cmake::FATAL_ERROR,
@@ -149,11 +145,11 @@ bool cmTargetLinkLibrariesCommand
           );
         return true;
         }
-        if (this->DoingPublicInterface)
-          {
-          this->SpecifiesPublicAndPrivate = true;
-          }
-        this->DoingPublicInterface = false;
+      if (this->CurrentProcessingState == ProcessingPublicInterface)
+        {
+        this->SpecifiesPublicAndPrivate = true;
+        }
+      this->CurrentProcessingState = ProcessingPrivateInterface;
       }
     else if(args[i] == "debug")
       {
@@ -229,9 +225,10 @@ bool cmTargetLinkLibrariesCommand
   // If the INTERFACE option was given, make sure the
   // LINK_INTERFACE_LIBRARIES property exists.  This allows the
   // command to be used to specify an empty link interface.
-  if((this->DoingInterface &&
-     !this->Target->GetProperty("LINK_INTERFACE_LIBRARIES"))
-      || this->DoingPrivateInterface && !this->SpecifiesPublicAndPrivate)
+  if((this->CurrentProcessingState == ProcessingLinkInterface
+        || (this->CurrentProcessingState == ProcessingPrivateInterface
+          && !this->SpecifiesPublicAndPrivate))
+    && !this->Target->GetProperty("LINK_INTERFACE_LIBRARIES"))
     {
     this->Target->SetProperty("LINK_INTERFACE_LIBRARIES", "");
     }
@@ -258,11 +255,12 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
                                             cmTarget::LinkLibraryType llt)
 {
   // Handle normal case first.
-  if(!this->DoingInterface)
+  if(this->CurrentProcessingState != ProcessingLinkInterface)
     {
     this->Makefile
       ->AddLinkLibraryForTarget(this->Target->GetName(), lib, llt);
-    if (!this->DoingPublicInterface || this->DoingPrivateInterface)
+    if (this->CurrentProcessingState != ProcessingPublicInterface
+        || this->CurrentProcessingState == ProcessingPrivateInterface)
       {
       return;
       }
diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index 57be18a..1c59020 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -149,9 +149,15 @@ private:
   static const char* LinkLibraryTypeNames[3];
 
   cmTarget* Target;
-  bool DoingInterface;
-  bool DoingPublicInterface;
-  bool DoingPrivateInterface;
+  enum ProcessingState {
+    ProcessingLinkLibraries,
+    ProcessingLinkInterface,
+    ProcessingPublicInterface,
+    ProcessingPrivateInterface
+  };
+
+  ProcessingState CurrentProcessingState;
+
   bool SpecifiesPublicAndPrivate;
 
   void HandleLibrary(const char* lib, cmTarget::LinkLibraryType llt);

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f642315dd7a12b98afe89ec5e14f5ef2493d26d7
commit f642315dd7a12b98afe89ec5e14f5ef2493d26d7
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Oct 7 17:04:21 2011 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Oct 7 17:04:21 2011 +0200

    Use a more compact doc format for the new command signature

diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index 5017df1..57be18a 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -108,14 +108,9 @@ public:
       "treated as if specified for both \"debug\" and \"optimized\"."
       "\n"
       "  target_link_libraries(<target>\n"
-      "                        LINK_PUBLIC\n"
+      "                        <LINK_PRIVATE|LINK_PUBLIC>\n"
       "                          [[debug|optimized|general] <lib>] ...\n"
-      "                        [LINK_PRIVATE\n"
-      "                          [[debug|optimized|general] <lib>] ...])\n"
-      "  target_link_libraries(<target>"
-      "                        LINK_PRIVATE\n"
-      "                          [[debug|optimized|general] <lib>] ...\n"
-      "                        [LINK_PUBLIC\n"
+      "                        [<LINK_PRIVATE|LINK_PUBLIC>\n"
       "                          [[debug|optimized|general] <lib>] ...])\n"
       "The LINK_PUBLIC and LINK_PRIVATE modes can be used to specify both the"
       "link dependencies and the link interface in one command.  "

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=79ae746598998250def197bda5e7cd3fb3cff3cd
commit 79ae746598998250def197bda5e7cd3fb3cff3cd
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Oct 7 02:41:37 2011 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Oct 7 02:43:07 2011 +0200

    Introduce link interface specific keywords to target_link_libraries
    
    Makes it possible to specify the link dependencies and link
    interfaces in one command without repetition.

diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 805959d..19125d6 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -95,9 +95,13 @@ bool cmTargetLinkLibrariesCommand
   bool haveLLT = false;
 
   // Start with primary linking and switch to link interface
-  // specification when the keyword is encountered.
+  // specification if the keyword is encountered as the first argument.
   this->DoingInterface = false;
 
+  this->DoingPublicInterface = false;
+  this->DoingPrivateInterface = false;
+  this->SpecifiesPublicAndPrivate = false;
+
   // add libraries, nothe that there is an optional prefix
   // of debug and optimized than can be used
   for(unsigned int i=1; i < args.size(); ++i)
@@ -115,6 +119,42 @@ bool cmTargetLinkLibrariesCommand
         return true;
         }
       }
+    else if(args[i] == "LINK_PUBLIC")
+      {
+      this->DoingPublicInterface = true;
+      if(i != 1 && !this->DoingPrivateInterface)
+        {
+        this->Makefile->IssueMessage(
+          cmake::FATAL_ERROR,
+          "The LINK_PUBLIC or LINK_PRIVATE option must appear as the second "
+          "argument, just after the target name."
+          );
+        return true;
+        }
+        if (this->DoingPrivateInterface)
+          {
+          this->SpecifiesPublicAndPrivate = true;
+          }
+        this->DoingPrivateInterface = false;
+      }
+    else if(args[i] == "LINK_PRIVATE")
+      {
+      this->DoingPrivateInterface = true;
+      if(i != 1 && !this->DoingPublicInterface)
+        {
+        this->Makefile->IssueMessage(
+          cmake::FATAL_ERROR,
+          "The LINK_PUBLIC or LINK_PRIVATE option must appear as the second "
+          "argument, just after the target name."
+          );
+        return true;
+        }
+        if (this->DoingPublicInterface)
+          {
+          this->SpecifiesPublicAndPrivate = true;
+          }
+        this->DoingPublicInterface = false;
+      }
     else if(args[i] == "debug")
       {
       if(haveLLT)
@@ -189,8 +229,9 @@ bool cmTargetLinkLibrariesCommand
   // If the INTERFACE option was given, make sure the
   // LINK_INTERFACE_LIBRARIES property exists.  This allows the
   // command to be used to specify an empty link interface.
-  if(this->DoingInterface &&
+  if((this->DoingInterface &&
      !this->Target->GetProperty("LINK_INTERFACE_LIBRARIES"))
+      || this->DoingPrivateInterface && !this->SpecifiesPublicAndPrivate)
     {
     this->Target->SetProperty("LINK_INTERFACE_LIBRARIES", "");
     }
@@ -221,7 +262,10 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
     {
     this->Makefile
       ->AddLinkLibraryForTarget(this->Target->GetName(), lib, llt);
-    return;
+    if (!this->DoingPublicInterface || this->DoingPrivateInterface)
+      {
+      return;
+      }
     }
 
   // Get the list of configurations considered to be DEBUG.
diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index ce57df7..5017df1 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -107,6 +107,23 @@ public:
       "Libraries specified as \"general\" (or without any keyword) are "
       "treated as if specified for both \"debug\" and \"optimized\"."
       "\n"
+      "  target_link_libraries(<target>\n"
+      "                        LINK_PUBLIC\n"
+      "                          [[debug|optimized|general] <lib>] ...\n"
+      "                        [LINK_PRIVATE\n"
+      "                          [[debug|optimized|general] <lib>] ...])\n"
+      "  target_link_libraries(<target>"
+      "                        LINK_PRIVATE\n"
+      "                          [[debug|optimized|general] <lib>] ...\n"
+      "                        [LINK_PUBLIC\n"
+      "                          [[debug|optimized|general] <lib>] ...])\n"
+      "The LINK_PUBLIC and LINK_PRIVATE modes can be used to specify both the"
+      "link dependencies and the link interface in one command.  "
+      "Libraries and targets following LINK_PUBLIC are linked to, and are "
+      "made part of the LINK_INTERFACE_LIBRARIES. Libraries and targets "
+      "following LINK_PRIVATE are linked to, but are not made part of the "
+      "LINK_INTERFACE_LIBRARIES.  "
+      "\n"
       "The library dependency graph is normally acyclic (a DAG), but in the "
       "case of mutually-dependent STATIC libraries CMake allows the graph "
       "to contain cycles (strongly connected components).  "
@@ -138,6 +155,9 @@ private:
 
   cmTarget* Target;
   bool DoingInterface;
+  bool DoingPublicInterface;
+  bool DoingPrivateInterface;
+  bool SpecifiesPublicAndPrivate;
 
   void HandleLibrary(const char* lib, cmTarget::LinkLibraryType llt);
 };

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

Summary of changes:
 Source/cmTargetLinkLibrariesCommand.cxx |   56 +++++++++++++++++++++++++++----
 Source/cmTargetLinkLibrariesCommand.h   |   23 ++++++++++++-
 2 files changed, 71 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list