[Cmake-commits] CMake branch, next, updated. v3.6.2-2049-g202b5bc

Brad King brad.king at kitware.com
Wed Sep 14 14:50:08 EDT 2016


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  202b5bc9b658502f0ca0b05b8d125011605ac449 (commit)
       via  7dc47338642ae77b09dd10b8b34f766043167904 (commit)
       via  0e742b994f51085188cdd0311b4de3c40b25c373 (commit)
       via  7e2004bb40b7887bb5ba7fa0a4477f22ad6fd97a (commit)
      from  ec58cf7272fe24baf829b3cd3b0ff0d5eb6d4109 (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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=202b5bc9b658502f0ca0b05b8d125011605ac449
commit 202b5bc9b658502f0ca0b05b8d125011605ac449
Merge: ec58cf7 7dc4733
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 14 14:50:07 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Sep 14 14:50:07 2016 -0400

    Merge topic 'refactor-target-construction' into next
    
    7dc47338 cmTarget: Inline SetType method at only remaining call site
    0e742b99 cmTarget: Construct with basic information up front
    7e2004bb fixup! cmTarget: Add method to get a copy adapted for a directory


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7dc47338642ae77b09dd10b8b34f766043167904
commit 7dc47338642ae77b09dd10b8b34f766043167904
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 14 14:34:36 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 14 14:35:39 2016 -0400

    cmTarget: Inline SetType method at only remaining call site

diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 15610e5..d964f00 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -63,6 +63,8 @@ cmTarget::cmTarget(std::string const& name, cmState::TargetType type,
                    Visibility vis, cmMakefile* mf)
 {
   assert(mf || type == cmState::GLOBAL_TARGET);
+  this->Name = name;
+  this->TargetTypeValue = type;
   this->Makefile = CM_NULLPTR;
   this->HaveInstallRule = false;
   this->DLLPlatform = false;
@@ -71,23 +73,18 @@ cmTarget::cmTarget(std::string const& name, cmState::TargetType type,
     (vis == VisibilityImported || vis == VisibilityImportedGlobally);
   this->ImportedGloballyVisible = vis == VisibilityImportedGlobally;
   this->BuildInterfaceIncludesAppended = false;
-  this->SetType(type, name);
-  if (mf) {
-    this->SetMakefile(mf);
-  }
-}
 
-void cmTarget::SetType(cmState::TargetType type, const std::string& name)
-{
-  this->Name = name;
   // only add dependency information for library targets
-  this->TargetTypeValue = type;
   if (this->TargetTypeValue >= cmState::STATIC_LIBRARY &&
       this->TargetTypeValue <= cmState::MODULE_LIBRARY) {
     this->RecordDependencies = true;
   } else {
     this->RecordDependencies = false;
   }
+
+  if (mf) {
+    this->SetMakefile(mf);
+  }
 }
 
 cmTarget cmTarget::CopyForDirectory(cmMakefile* mf) const
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 8a1d27e..ebc92f3 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -283,7 +283,6 @@ public:
   };
 
 private:
-  void SetType(cmState::TargetType f, const std::string& name);
   void SetMakefile(cmMakefile* mf);
 
   bool HandleLocationPropertyPolicy(cmMakefile* context) const;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0e742b994f51085188cdd0311b4de3c40b25c373
commit 0e742b994f51085188cdd0311b4de3c40b25c373
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 14 14:28:07 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 14 14:31:06 2016 -0400

    cmTarget: Construct with basic information up front
    
    Avoid having partially constructed cmTarget instances around,
    except for the special case of GLOBAL_TARGET construction.

diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index a0aefb8..6c31481 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -77,9 +77,8 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
 
   CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
 
-  cmTarget dummyHead;
-  dummyHead.SetType(cmState::EXECUTABLE, "try_compile_dummy_exe");
-  dummyHead.SetMakefile(tgt->Target->GetMakefile());
+  cmTarget dummyHead("try_compile_dummy_exe", cmState::EXECUTABLE,
+                     cmTarget::VisibilityNormal, tgt->Target->GetMakefile());
 
   cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator());
 
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 961d89d..e85d80e 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2352,8 +2352,8 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(
   const char* workingDirectory, bool uses_terminal)
 {
   // Package
-  cmTarget target;
-  target.SetType(cmState::GLOBAL_TARGET, name);
+  cmTarget target(name, cmState::GLOBAL_TARGET, cmTarget::VisibilityNormal,
+                  CM_NULLPTR);
   target.SetProperty("EXCLUDE_FROM_ALL", "TRUE");
 
   std::vector<std::string> no_outputs;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index eb39afa..508c670 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1925,10 +1925,10 @@ cmTarget* cmMakefile::AddNewTarget(cmState::TargetType type,
                                    const std::string& name)
 {
   cmTargets::iterator it =
-    this->Targets.insert(cmTargets::value_type(name, cmTarget())).first;
-  cmTarget& target = it->second;
-  target.SetType(type, name);
-  target.SetMakefile(this);
+    this->Targets
+      .insert(cmTargets::value_type(
+        name, cmTarget(name, type, cmTarget::VisibilityNormal, this)))
+      .first;
   this->GetGlobalGenerator()->IndexTarget(&it->second);
   return &it->second;
 }
@@ -3710,10 +3710,10 @@ cmTarget* cmMakefile::AddImportedTarget(const std::string& name,
                                         cmState::TargetType type, bool global)
 {
   // Create the target.
-  CM_AUTO_PTR<cmTarget> target(new cmTarget);
-  target->SetType(type, name);
-  target->MarkAsImported(global);
-  target->SetMakefile(this);
+  CM_AUTO_PTR<cmTarget> target(
+    new cmTarget(name, type, global ? cmTarget::VisibilityImportedGlobally
+                                    : cmTarget::VisibilityImported,
+                 this));
 
   // Add to the set of available imported targets.
   this->ImportedTargets[name] = target.get();
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index dc3944c..15610e5 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -59,15 +59,22 @@ public:
   std::vector<cmListFileBacktrace> LinkImplementationPropertyBacktraces;
 };
 
-cmTarget::cmTarget()
+cmTarget::cmTarget(std::string const& name, cmState::TargetType type,
+                   Visibility vis, cmMakefile* mf)
 {
+  assert(mf || type == cmState::GLOBAL_TARGET);
   this->Makefile = CM_NULLPTR;
   this->HaveInstallRule = false;
   this->DLLPlatform = false;
   this->IsAndroid = false;
-  this->IsImportedTarget = false;
-  this->ImportedGloballyVisible = false;
+  this->IsImportedTarget =
+    (vis == VisibilityImported || vis == VisibilityImportedGlobally);
+  this->ImportedGloballyVisible = vis == VisibilityImportedGlobally;
   this->BuildInterfaceIncludesAppended = false;
+  this->SetType(type, name);
+  if (mf) {
+    this->SetMakefile(mf);
+  }
 }
 
 void cmTarget::SetType(cmState::TargetType type, const std::string& name)
@@ -1071,12 +1078,6 @@ void cmTarget::CheckProperty(const std::string& prop,
   }
 }
 
-void cmTarget::MarkAsImported(bool global)
-{
-  this->IsImportedTarget = true;
-  this->ImportedGloballyVisible = global;
-}
-
 bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const
 {
   if (this->IsImported()) {
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index b0bfc72..8a1d27e 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -63,7 +63,16 @@ private:
 class cmTarget
 {
 public:
-  cmTarget();
+  enum Visibility
+  {
+    VisibilityNormal,
+    VisibilityImported,
+    VisibilityImportedGlobally
+  };
+
+  cmTarget(std::string const& name, cmState::TargetType type, Visibility vis,
+           cmMakefile* mf);
+
   enum CustomCommandType
   {
     PRE_BUILD,
@@ -76,21 +85,13 @@ public:
    */
   cmState::TargetType GetType() const { return this->TargetTypeValue; }
 
-  /**
-   * Set the target type
-   */
-  void SetType(cmState::TargetType f, const std::string& name);
-
-  void MarkAsImported(bool global = false);
-
   ///! Set/Get the name of the target
   const std::string& GetName() const { return this->Name; }
 
   /** Get a copy of this target adapted for the given directory.  */
   cmTarget CopyForDirectory(cmMakefile* mf) const;
 
-  ///! Set the cmMakefile that owns this target
-  void SetMakefile(cmMakefile* mf);
+  /** Get the cmMakefile that owns this target.  */
   cmMakefile* GetMakefile() const { return this->Makefile; }
 
 #define DECLARE_TARGET_POLICY(POLICY)                                         \
@@ -282,6 +283,9 @@ public:
   };
 
 private:
+  void SetType(cmState::TargetType f, const std::string& name);
+  void SetMakefile(cmMakefile* mf);
+
   bool HandleLocationPropertyPolicy(cmMakefile* context) const;
 
   const char* GetSuffixVariableInternal(bool implib) const;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7e2004bb40b7887bb5ba7fa0a4477f22ad6fd97a
commit 7e2004bb40b7887bb5ba7fa0a4477f22ad6fd97a
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 14 14:28:40 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 14 14:28:40 2016 -0400

    fixup! cmTarget: Add method to get a copy adapted for a directory

diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 77055af..dc3944c 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -85,6 +85,8 @@ void cmTarget::SetType(cmState::TargetType type, const std::string& name)
 
 cmTarget cmTarget::CopyForDirectory(cmMakefile* mf) const
 {
+  assert(this->GetType() == cmState::GLOBAL_TARGET);
+  assert(this->GetMakefile() == CM_NULLPTR);
   cmTarget result(*this);
   result.SetMakefile(mf);
   return result;

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

Summary of changes:
 Source/cmExportTryCompileFileGenerator.cxx |    5 ++---
 Source/cmGlobalGenerator.cxx               |    4 ++--
 Source/cmMakefile.cxx                      |   16 ++++++++--------
 Source/cmTarget.cxx                        |   28 ++++++++++++++--------------
 Source/cmTarget.h                          |   23 +++++++++++++----------
 5 files changed, 39 insertions(+), 37 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list