[Cmake-commits] CMake branch, next, updated. v3.7.0-rc1-537-gd1f0e30

Stephen Kelly steveire at gmail.com
Sun Oct 16 06:09:55 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  d1f0e3064827cbaa929e8d55ae69ec40fda43a45 (commit)
       via  d94460ce3ff089c7746d24378f899008a2e5385d (commit)
       via  4b9292a9458d25a9394190de5ac9d9d056768070 (commit)
       via  a89dc5374b8798e6dbe699b7a074ec7cd9be36e8 (commit)
      from  0fde927b36aa8972da15fefa3e0f01ee22c6bcef (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=d1f0e3064827cbaa929e8d55ae69ec40fda43a45
commit d1f0e3064827cbaa929e8d55ae69ec40fda43a45
Merge: 0fde927b d94460c
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Oct 16 06:09:54 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sun Oct 16 06:09:54 2016 -0400

    Merge topic 'extract-computed-target-properties' into next
    
    d94460ce cmTarget: Implement GetProperty in terms of cmState::Snapshot
    4b9292a9 cmTarget: Group code for checking written properties together
    a89dc537 cmTarget: Move sanity checks and computed property access to callers


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d94460ce3ff089c7746d24378f899008a2e5385d
commit d94460ce3ff089c7746d24378f899008a2e5385d
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Oct 13 00:18:26 2016 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Oct 16 12:09:43 2016 +0200

    cmTarget: Implement GetProperty in terms of cmState::Snapshot

diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index d8bc64a..b2b7cd6 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1215,10 +1215,16 @@ const char* cmTarget::GetProperty(const std::string& prop) const
       return this->GetName().c_str();
     }
     if (prop == propBINARY_DIR) {
-      return this->GetMakefile()->GetCurrentBinaryDirectory();
+      return this->GetMakefile()
+        ->GetStateSnapshot()
+        .GetDirectory()
+        .GetCurrentBinary();
     }
     if (prop == propSOURCE_DIR) {
-      return this->GetMakefile()->GetCurrentSourceDirectory();
+      return this->GetMakefile()
+        ->GetStateSnapshot()
+        .GetDirectory()
+        .GetCurrentSource();
     }
   }
 
@@ -1227,7 +1233,8 @@ const char* cmTarget::GetProperty(const std::string& prop) const
     const bool chain = this->GetMakefile()->GetState()->IsPropertyChained(
       prop, cmProperty::TARGET);
     if (chain) {
-      return this->Makefile->GetProperty(prop, chain);
+      return this->Makefile->GetStateSnapshot().GetDirectory().GetProperty(
+        prop, chain);
     }
   }
   return retVal;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4b9292a9458d25a9394190de5ac9d9d056768070
commit 4b9292a9458d25a9394190de5ac9d9d056768070
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Oct 13 00:18:26 2016 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Oct 16 12:09:42 2016 +0200

    cmTarget: Group code for checking written properties together

diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index ef13b26..d8bc64a 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -852,7 +852,20 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
     e << "NAME property is read-only\n";
     this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
     return;
+  } else if (prop == "EXPORT_NAME" && this->IsImported()) {
+    std::ostringstream e;
+    e << "EXPORT_NAME property can't be set on imported targets (\""
+      << this->Name << "\")\n";
+    this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+    return;
+  } else if (prop == "SOURCES" && this->IsImported()) {
+    std::ostringstream e;
+    e << "SOURCES property can't be set on imported targets (\"" << this->Name
+      << "\")\n";
+    this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+    return;
   }
+
   if (prop == "INCLUDE_DIRECTORIES") {
     this->Internal->IncludeDirectoriesEntries.clear();
     this->Internal->IncludeDirectoriesBacktraces.clear();
@@ -885,11 +898,6 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
       cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
       this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
     }
-  } else if (prop == "EXPORT_NAME" && this->IsImported()) {
-    std::ostringstream e;
-    e << "EXPORT_NAME property can't be set on imported targets (\""
-      << this->Name << "\")\n";
-    this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
   } else if (prop == "LINK_LIBRARIES") {
     this->Internal->LinkImplementationPropertyEntries.clear();
     this->Internal->LinkImplementationPropertyBacktraces.clear();
@@ -899,14 +907,6 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
       this->Internal->LinkImplementationPropertyBacktraces.push_back(lfbt);
     }
   } else if (prop == "SOURCES") {
-    if (this->IsImported()) {
-      std::ostringstream e;
-      e << "SOURCES property can't be set on imported targets (\""
-        << this->Name << "\")\n";
-      this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
-      return;
-    }
-
     this->Internal->SourceEntries.clear();
     this->Internal->SourceBacktraces.clear();
     if (value) {
@@ -932,6 +932,18 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
     e << "NAME property is read-only\n";
     this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
     return;
+  } else if (prop == "EXPORT_NAME" && this->IsImported()) {
+    std::ostringstream e;
+    e << "EXPORT_NAME property can't be set on imported targets (\""
+      << this->Name << "\")\n";
+    this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+    return;
+  } else if (prop == "SOURCES" && this->IsImported()) {
+    std::ostringstream e;
+    e << "SOURCES property can't be set on imported targets (\"" << this->Name
+      << "\")\n";
+    this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+    return;
   }
   if (prop == "INCLUDE_DIRECTORIES") {
     if (value && *value) {
@@ -957,11 +969,6 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
       cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
       this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
     }
-  } else if (prop == "EXPORT_NAME" && this->IsImported()) {
-    std::ostringstream e;
-    e << "EXPORT_NAME property can't be set on imported targets (\""
-      << this->Name << "\")\n";
-    this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
   } else if (prop == "LINK_LIBRARIES") {
     if (value && *value) {
       cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
@@ -969,13 +976,6 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
       this->Internal->LinkImplementationPropertyBacktraces.push_back(lfbt);
     }
   } else if (prop == "SOURCES") {
-    if (this->IsImported()) {
-      std::ostringstream e;
-      e << "SOURCES property can't be set on imported targets (\""
-        << this->Name << "\")\n";
-      this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
-      return;
-    }
     cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
     this->Internal->SourceEntries.push_back(value);
     this->Internal->SourceBacktraces.push_back(lfbt);

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a89dc5374b8798e6dbe699b7a074ec7cd9be36e8
commit a89dc5374b8798e6dbe699b7a074ec7cd9be36e8
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Oct 13 00:18:26 2016 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Oct 16 12:09:42 2016 +0200

    cmTarget: Move sanity checks and computed property access to callers
    
    The GetProperty method is now just accessing contained data, meaning it
    can be implemented in cmState.
    
    Remove the cmMakefile context from the signature as a result and remove
    the overload with the same signature.
    
    As a side-effect, the CMP0026 warning now gives a backtrace to the
    target when issued from a generator expression.

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 050fcb8..b0ff13e 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -397,6 +397,18 @@ std::string cmGeneratorTarget::GetExportName() const
 
 const char* cmGeneratorTarget::GetProperty(const std::string& prop) const
 {
+  if (!cmTargetPropertyComputer::PassesWhitelist(
+        this->GetType(), prop, this->Makefile->GetMessenger(),
+        this->GetBacktrace())) {
+    return 0;
+  }
+  if (const char* result = cmTargetPropertyComputer::GetProperty(
+        this, prop, this->Makefile->GetMessenger(), this->GetBacktrace())) {
+    return result;
+  }
+  if (cmSystemTools::GetFatalErrorOccured()) {
+    return CM_NULLPTR;
+  }
   return this->Target->GetProperty(prop);
 }
 
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index ba03568..0a59933 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -6,9 +6,20 @@
 #include "cmPropertyDefinition.h"
 #include "cmSourceFile.h"
 #include "cmState.h"
+#include "cmTargetPropertyComputer.h"
 #include "cmTest.h"
 #include "cmake.h"
 
+#ifdef __clang__
+extern template const char* cmTargetPropertyComputer::ComputeLocationForBuild(
+  cmTarget const* tgt);
+extern template const char* cmTargetPropertyComputer::ComputeLocation(
+  cmTarget const* tgt, std::string const& config);
+extern template const char* cmTargetPropertyComputer::GetSources(
+  cmTarget const* tgt, cmMessenger* messenger,
+  cmListFileBacktrace const& context);
+#endif
+
 cmGetPropertyCommand::cmGetPropertyCommand()
 {
   this->InfoType = OutValue;
@@ -246,8 +257,18 @@ bool cmGetPropertyCommand::HandleTargetMode()
       }
       return this->StoreResult(CM_NULLPTR);
     }
-    return this->StoreResult(
-      target->GetProperty(this->PropertyName, this->Makefile));
+    const char* prop_cstr = 0;
+    cmListFileBacktrace bt = this->Makefile->GetBacktrace();
+    cmMessenger* messenger = this->Makefile->GetMessenger();
+    if (cmTargetPropertyComputer::PassesWhitelist(
+          target->GetType(), this->PropertyName, messenger, bt)) {
+      prop_cstr = cmTargetPropertyComputer::GetProperty(
+        target, this->PropertyName, messenger, bt);
+      if (!prop_cstr) {
+        prop_cstr = target->GetProperty(this->PropertyName);
+      }
+    }
+    return this->StoreResult(prop_cstr);
   }
   std::ostringstream e;
   e << "could not find TARGET " << this->Name
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index fe09442..d009bc3 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -2,6 +2,18 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmGetTargetPropertyCommand.h"
 
+#include "cmTargetPropertyComputer.h"
+
+#ifdef __clang__
+extern template const char* cmTargetPropertyComputer::ComputeLocationForBuild(
+  cmTarget const* tgt);
+extern template const char* cmTargetPropertyComputer::ComputeLocation(
+  cmTarget const* tgt, std::string const& config);
+extern template const char* cmTargetPropertyComputer::GetSources(
+  cmTarget const* tgt, cmMessenger* messenger,
+  cmListFileBacktrace const& context);
+#endif
+
 // cmSetTargetPropertyCommand
 bool cmGetTargetPropertyCommand::InitialPass(
   std::vector<std::string> const& args, cmExecutionStatus&)
@@ -22,7 +34,17 @@ bool cmGetTargetPropertyCommand::InitialPass(
         prop_exists = true;
       }
     } else if (!args[2].empty()) {
-      const char* prop_cstr = tgt->GetProperty(args[2], this->Makefile);
+      const char* prop_cstr = 0;
+      cmListFileBacktrace bt = this->Makefile->GetBacktrace();
+      cmMessenger* messenger = this->Makefile->GetMessenger();
+      if (cmTargetPropertyComputer::PassesWhitelist(tgt->GetType(), args[2],
+                                                    messenger, bt)) {
+        prop_cstr =
+          cmTargetPropertyComputer::GetProperty(tgt, args[2], messenger, bt);
+        if (!prop_cstr) {
+          prop_cstr = tgt->GetProperty(args[2]);
+        }
+      }
       if (prop_cstr) {
         prop = prop_cstr;
         prop_exists = true;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 9b2043c..ef13b26 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1131,26 +1131,6 @@ void cmTarget::CheckProperty(const std::string& prop,
 
 const char* cmTarget::GetProperty(const std::string& prop) const
 {
-  return this->GetProperty(prop, this->Makefile);
-}
-
-const char* cmTarget::GetProperty(const std::string& prop,
-                                  cmMakefile* context) const
-{
-  if (!cmTargetPropertyComputer::PassesWhitelist(this->GetType(), prop,
-                                                 context->GetMessenger(),
-                                                 context->GetBacktrace())) {
-    return CM_NULLPTR;
-  }
-
-  if (const char* result = cmTargetPropertyComputer::GetProperty(
-        this, prop, context->GetMessenger(), context->GetBacktrace())) {
-    return result;
-  }
-  if (cmSystemTools::GetFatalErrorOccured()) {
-    return CM_NULLPTR;
-  }
-
   static UNORDERED_SET<std::string> specialProps;
 #define MAKE_STATIC_PROP(PROP) static const std::string prop##PROP = #PROP
   MAKE_STATIC_PROP(LINK_LIBRARIES);
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 2d259ed..d48e7e2 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -200,7 +200,6 @@ public:
   void AppendProperty(const std::string& prop, const char* value,
                       bool asString = false);
   const char* GetProperty(const std::string& prop) const;
-  const char* GetProperty(const std::string& prop, cmMakefile* context) const;
   bool GetPropertyAsBool(const std::string& prop) const;
   void CheckProperty(const std::string& prop, cmMakefile* context) const;
 
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt
index e4dbb71..d4e5b29 100644
--- a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt
@@ -1,4 +1,4 @@
-CMake Warning \(dev\) in CMakeLists.txt:
+CMake Warning \(dev\) at TARGET_PROPERTY-LOCATION.cmake:2 \(add_library\):
   Policy CMP0026 is not set: Disallow use of the LOCATION target property.
   Run "cmake --help-policy CMP0026" for policy details.  Use the cmake_policy
   command to set the policy and suppress this warning.
@@ -7,4 +7,6 @@ CMake Warning \(dev\) in CMakeLists.txt:
   name directly with add_custom_command, or use the generator expression
   \$<TARGET_FILE>, as appropriate.
 
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
 This warning is for project developers.  Use -Wno-dev to suppress it.

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list