[Cmake-commits] CMake branch, next, updated. v3.0.0-rc3-1598-g5919286

Stephen Kelly steveire at gmail.com
Mon Mar 31 00:33:39 EDT 2014


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  5919286f676efbbe146c26adb5f1176a212b450b (commit)
       via  2852eb92505aa7f8a860b529941d56f91b177efc (commit)
       via  5106a7f71ea365bc0305bd572a486b6ba2e5937d (commit)
       via  c3e72f1e7b7365cf42282abd480e38b3ce5112c0 (commit)
       via  e74d9ff5ff51fcce5727f116651afd3525c412be (commit)
      from  b2bff78e4441f897209ef12a3558bb4ea61d2938 (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=5919286f676efbbe146c26adb5f1176a212b450b
commit 5919286f676efbbe146c26adb5f1176a212b450b
Merge: b2bff78 2852eb9
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Mar 31 00:33:37 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Mar 31 00:33:37 2014 -0400

    Merge topic 'target-transitive-sources' into next
    
    2852eb92 target_sources: New command to add sources to target.
    5106a7f7 Make the SOURCES target property writable.
    c3e72f1e cmTarget: Make the SOURCES origin tracable.
    e74d9ff5 cmTarget: Allow transitive evaluation of SOURCES property.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2852eb92505aa7f8a860b529941d56f91b177efc
commit 2852eb92505aa7f8a860b529941d56f91b177efc
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Jul 8 20:18:42 2013 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Mar 30 21:06:53 2014 +0200

    target_sources: New command to add sources to target.

diff --git a/Help/command/target_sources.rst b/Help/command/target_sources.rst
new file mode 100644
index 0000000..ff756b4
--- /dev/null
+++ b/Help/command/target_sources.rst
@@ -0,0 +1,28 @@
+target_sources
+--------------
+
+Add sources to a target.
+
+::
+
+  target_sources(<target>
+    <INTERFACE|PUBLIC|PRIVATE> [items1...]
+    [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
+
+Specify sources to use when compiling a given target.  The
+named ``<target>`` must have been created by a command such as
+:command:`add_executable` or :command:`add_library` and must not be an
+:prop_tgt:`IMPORTED Target`.
+
+The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to
+specify the scope of the following arguments.  ``PRIVATE`` and ``PUBLIC``
+items will populate the :prop_tgt:`SOURCES` property of
+``<target>``.  ``PUBLIC`` and ``INTERFACE`` items will populate the
+:prop_tgt:`INTERFACE_SOURCES` property of ``<target>``.  The
+following arguments specify sources.  Repeated calls for the same
+``<target>`` append items in the order called.
+
+Arguments to ``target_sources`` may use "generator expressions"
+with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
+manual for available expressions.  See the :manual:`cmake-buildsystem(7)`
+manual for more on defining buildsystem properties.
diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst
index fb0d2b5..4b1dbed 100644
--- a/Help/manual/cmake-commands.7.rst
+++ b/Help/manual/cmake-commands.7.rst
@@ -94,6 +94,7 @@ These commands may be used freely in CMake projects.
    /command/target_compile_options
    /command/target_include_directories
    /command/target_link_libraries
+   /command/target_sources
    /command/try_compile
    /command/try_run
    /command/unset
diff --git a/Help/release/dev/target_sources-command.rst b/Help/release/dev/target_sources-command.rst
new file mode 100644
index 0000000..abfb303
--- /dev/null
+++ b/Help/release/dev/target_sources-command.rst
@@ -0,0 +1,5 @@
+target_sources-command
+----------------------
+
+* The :command:`target_sources` command was added to add to the
+  :prop_tgt:`SOURCES` target property.
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 27d099d..4c678d8 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -348,6 +348,7 @@ foreach(command_file
     cmTargetCompileDefinitionsCommand
     cmTargetCompileOptionsCommand
     cmTargetIncludeDirectoriesCommand
+    cmTargetSourcesCommand
     cmUseMangledMesaCommand
     cmUtilitySourceCommand
     cmVariableRequiresCommand
diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx
new file mode 100644
index 0000000..e82b36d
--- /dev/null
+++ b/Source/cmTargetSourcesCommand.cxx
@@ -0,0 +1,64 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2014 Stephen Kelly <steveire at gmail.com>
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+#include "cmTargetSourcesCommand.h"
+
+#include "cmGeneratorExpression.h"
+
+//----------------------------------------------------------------------------
+bool cmTargetSourcesCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
+{
+  return this->HandleArguments(args, "SOURCES");
+}
+
+//----------------------------------------------------------------------------
+void cmTargetSourcesCommand
+::HandleImportedTarget(const std::string &tgt)
+{
+  cmOStringStream e;
+  e << "Cannot specify sources for imported target \""
+    << tgt << "\".";
+  this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+}
+
+//----------------------------------------------------------------------------
+void cmTargetSourcesCommand
+::HandleMissingTarget(const std::string &name)
+{
+  cmOStringStream e;
+  e << "Cannot specify sources for target \"" << name << "\" "
+       "which is not built by this project.";
+  this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+}
+
+//----------------------------------------------------------------------------
+std::string cmTargetSourcesCommand
+::Join(const std::vector<std::string> &content)
+{
+  std::string srcs;
+  std::string sep;
+  for(std::vector<std::string>::const_iterator it = content.begin();
+    it != content.end(); ++it)
+    {
+    srcs += sep + *it;
+    sep = ";";
+    }
+  return srcs;
+}
+
+//----------------------------------------------------------------------------
+void cmTargetSourcesCommand
+::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
+                      bool, bool)
+{
+  tgt->AppendProperty("SOURCES", this->Join(content).c_str());
+}
diff --git a/Source/cmTargetSourcesCommand.h b/Source/cmTargetSourcesCommand.h
new file mode 100644
index 0000000..dae78c4
--- /dev/null
+++ b/Source/cmTargetSourcesCommand.h
@@ -0,0 +1,55 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2014 Stephen Kelly <steveire at gmail.com>
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+
+#ifndef cmTargetSourcesCommand_h
+#define cmTargetSourcesCommand_h
+
+#include "cmTargetPropCommandBase.h"
+
+//----------------------------------------------------------------------------
+class cmTargetSourcesCommand : public cmTargetPropCommandBase
+{
+public:
+  /**
+   * This is a virtual constructor for the command.
+   */
+  virtual cmCommand* Clone()
+    {
+    return new cmTargetSourcesCommand;
+    }
+
+  /**
+   * This is called when the command is first encountered in
+   * the CMakeLists.txt file.
+   */
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
+
+  /**
+   * The name of the command as specified in CMakeList.txt.
+   */
+  virtual std::string GetName() const { return "target_sources";}
+
+  cmTypeMacro(cmTargetSourcesCommand, 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
diff --git a/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt b/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt
index d9e29a1..3bb6bf4 100644
--- a/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt
+++ b/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt
@@ -14,6 +14,14 @@ CMake Debug Log at OriginDebug.cmake:16 \(set_property\):
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)
 +
+CMake Debug Log at OriginDebug.cmake:20 \(target_sources\):
+  Used sources for target OriginDebug:
+
+   \* empty_4.cpp
+
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
++
 CMake Debug Log at OriginDebug.cmake:14 \(target_link_libraries\):
   Used sources for target OriginDebug:
 
diff --git a/Tests/RunCMake/TargetSources/OriginDebug.cmake b/Tests/RunCMake/TargetSources/OriginDebug.cmake
index 3fa5858..5fe9ba7 100644
--- a/Tests/RunCMake/TargetSources/OriginDebug.cmake
+++ b/Tests/RunCMake/TargetSources/OriginDebug.cmake
@@ -16,3 +16,5 @@ target_link_libraries(OriginDebug iface)
 set_property(TARGET OriginDebug APPEND PROPERTY SOURCES
   empty_3.cpp
 )
+
+target_sources(OriginDebug PRIVATE empty_4.cpp)
diff --git a/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt b/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt
index f6d029d..358bfb3 100644
--- a/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt
+++ b/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt
@@ -16,6 +16,15 @@ Call Stack \(most recent call first\):
   OriginDebugIDE.cmake:4 \(include\)
   CMakeLists.txt:3 \(include\)
 +
+CMake Debug Log at OriginDebug.cmake:20 \(target_sources\):
+  Used sources for target OriginDebug:
+
+   \* empty_4.cpp
+
+Call Stack \(most recent call first\):
+  OriginDebugIDE.cmake:4 \(include\)
+  CMakeLists.txt:3 \(include\)
++
 CMake Debug Log:
   Used sources for target OriginDebug:
 
diff --git a/Tests/RunCMake/TargetSources/empty_4.cpp b/Tests/RunCMake/TargetSources/empty_4.cpp
new file mode 100644
index 0000000..bfbbdde
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/empty_4.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int empty()
+{
+  return 0;
+}

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5106a7f71ea365bc0305bd572a486b6ba2e5937d
commit 5106a7f71ea365bc0305bd572a486b6ba2e5937d
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Jul 8 20:18:42 2013 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Mar 30 21:06:48 2014 +0200

    Make the SOURCES target property writable.

diff --git a/Help/prop_tgt/SOURCES.rst b/Help/prop_tgt/SOURCES.rst
index 833b65a..493643e 100644
--- a/Help/prop_tgt/SOURCES.rst
+++ b/Help/prop_tgt/SOURCES.rst
@@ -3,5 +3,4 @@ SOURCES
 
 Source names specified for a target.
 
-Read-only list of sources specified for a target.  The names returned
-are suitable for passing to the set_source_files_properties command.
+List of sources specified for a target.
diff --git a/Help/release/dev/target-SOURCES-write.rst b/Help/release/dev/target-SOURCES-write.rst
new file mode 100644
index 0000000..a754a73
--- /dev/null
+++ b/Help/release/dev/target-SOURCES-write.rst
@@ -0,0 +1,6 @@
+target-SOURCES-write.rst
+------------------------
+
+* It is now possible to write and append to the :prop_tgt:`SOURCES` target
+  property.  The :variable:`CMAKE_DEBUG_TARGET_PROPERTIES` variable may be
+  used to trace the origin of sources.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index bbe22eb..dfd5796 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1696,6 +1696,25 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
     this->Internal->LinkImplementationPropertyEntries.push_back(entry);
     return;
     }
+  if (prop == "SOURCES")
+    {
+    if(this->IsImported())
+      {
+      cmOStringStream 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(lfbt);
+    cmGeneratorExpression ge(lfbt);
+    this->Internal->SourceEntries.clear();
+    cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
+    this->Internal->SourceEntries.push_back(
+                          new cmTargetInternals::TargetPropertyEntry(cge));
+    return;
+    }
   this->Properties.SetProperty(prop, value, cmProperty::TARGET);
   this->MaybeInvalidatePropertyCache(prop);
 }
@@ -1763,6 +1782,25 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
     this->Internal->LinkImplementationPropertyEntries.push_back(entry);
     return;
     }
+  if (prop == "SOURCES")
+    {
+    if(this->IsImported())
+      {
+      cmOStringStream 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(lfbt);
+      cmGeneratorExpression ge(lfbt);
+      cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
+      this->Internal->SourceEntries.push_back(
+                            new cmTargetInternals::TargetPropertyEntry(cge));
+    return;
+    }
   this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString);
   this->MaybeInvalidatePropertyCache(prop);
 }
diff --git a/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt b/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt
index d586ada..d9e29a1 100644
--- a/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt
+++ b/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt
@@ -6,6 +6,14 @@ CMake Debug Log at OriginDebug.cmake:13 \(add_library\):
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)
 +
+CMake Debug Log at OriginDebug.cmake:16 \(set_property\):
+  Used sources for target OriginDebug:
+
+   \* empty_3.cpp
+
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
++
 CMake Debug Log at OriginDebug.cmake:14 \(target_link_libraries\):
   Used sources for target OriginDebug:
 
diff --git a/Tests/RunCMake/TargetSources/OriginDebug.cmake b/Tests/RunCMake/TargetSources/OriginDebug.cmake
index 911a7d4..3fa5858 100644
--- a/Tests/RunCMake/TargetSources/OriginDebug.cmake
+++ b/Tests/RunCMake/TargetSources/OriginDebug.cmake
@@ -12,3 +12,7 @@ set_property(TARGET iface PROPERTY INTERFACE_SOURCES
 
 add_library(OriginDebug empty_2.cpp)
 target_link_libraries(OriginDebug iface)
+
+set_property(TARGET OriginDebug APPEND PROPERTY SOURCES
+  empty_3.cpp
+)
diff --git a/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt b/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt
index 48c8cd3..f6d029d 100644
--- a/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt
+++ b/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt
@@ -7,6 +7,15 @@ Call Stack \(most recent call first\):
   OriginDebugIDE.cmake:4 \(include\)
   CMakeLists.txt:3 \(include\)
 +
+CMake Debug Log at OriginDebug.cmake:16 \(set_property\):
+  Used sources for target OriginDebug:
+
+   \* empty_3.cpp
+
+Call Stack \(most recent call first\):
+  OriginDebugIDE.cmake:4 \(include\)
+  CMakeLists.txt:3 \(include\)
++
 CMake Debug Log:
   Used sources for target OriginDebug:
 
diff --git a/Tests/RunCMake/TargetSources/empty_3.cpp b/Tests/RunCMake/TargetSources/empty_3.cpp
new file mode 100644
index 0000000..bfbbdde
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/empty_3.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int empty()
+{
+  return 0;
+}
diff --git a/Tests/SourcesProperty/CMakeLists.txt b/Tests/SourcesProperty/CMakeLists.txt
index 0b3097e..6c99e00 100644
--- a/Tests/SourcesProperty/CMakeLists.txt
+++ b/Tests/SourcesProperty/CMakeLists.txt
@@ -8,3 +8,5 @@ set_property(TARGET iface PROPERTY INTERFACE_SOURCES iface.cpp)
 
 add_executable(SourcesProperty main.cpp)
 target_link_libraries(SourcesProperty iface)
+
+set_property(TARGET SourcesProperty APPEND PROPERTY SOURCES prop.cpp)
diff --git a/Tests/SourcesProperty/iface.h b/Tests/SourcesProperty/iface.h
index 2cac248..6da80a4 100644
--- a/Tests/SourcesProperty/iface.h
+++ b/Tests/SourcesProperty/iface.h
@@ -1,2 +1,4 @@
 
 int iface();
+
+int prop();
diff --git a/Tests/SourcesProperty/main.cpp b/Tests/SourcesProperty/main.cpp
index ae4f305..33a97f4 100644
--- a/Tests/SourcesProperty/main.cpp
+++ b/Tests/SourcesProperty/main.cpp
@@ -3,5 +3,5 @@
 
 int main(int argc, char** argv)
 {
-  return iface();
+  return iface() + prop();
 }
diff --git a/Tests/SourcesProperty/prop.cpp b/Tests/SourcesProperty/prop.cpp
new file mode 100644
index 0000000..e343431
--- /dev/null
+++ b/Tests/SourcesProperty/prop.cpp
@@ -0,0 +1,5 @@
+
+int prop()
+{
+  return 0;
+}

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c3e72f1e7b7365cf42282abd480e38b3ce5112c0
commit c3e72f1e7b7365cf42282abd480e38b3ce5112c0
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Mar 27 13:16:59 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Mar 30 21:06:44 2014 +0200

    cmTarget: Make the SOURCES origin tracable.

diff --git a/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst b/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst
index 11aed0c..edd8fa1 100644
--- a/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst
+++ b/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst
@@ -6,7 +6,8 @@ Enables tracing output for target properties.
 This variable can be populated with a list of properties to generate
 debug output for when evaluating target properties.  Currently it can
 only be used when evaluating the :prop_tgt:`INCLUDE_DIRECTORIES`,
-:prop_tgt:`COMPILE_DEFINITIONS`, :prop_tgt:`COMPILE_OPTIONS`, :prop_tgt:`AUTOUIC_OPTIONS`,
+:prop_tgt:`COMPILE_DEFINITIONS`, :prop_tgt:`COMPILE_OPTIONS`,
+:prop_tgt:`AUTOUIC_OPTIONS`, :prop_tgt:`SOURCES`,
 :prop_tgt:`POSITION_INDEPENDENT_CODE` target properties and any other property
 listed in :prop_tgt:`COMPATIBLE_INTERFACE_STRING` and other ``COMPATIBLE_INTERFACE_``
 properties.  It outputs an origin for each entry in the target property.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index d512044..bbe22eb 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -224,6 +224,7 @@ cmTarget::cmTarget()
   this->DebugIncludesDone = false;
   this->DebugCompileOptionsDone = false;
   this->DebugCompileDefinitionsDone = false;
+  this->DebugSourcesDone = false;
 }
 
 //----------------------------------------------------------------------------
@@ -553,7 +554,7 @@ static void processSources(cmTarget const* tgt,
       std::set<std::string> &uniqueSrcs,
       cmGeneratorExpressionDAGChecker *dagChecker,
       cmTarget const* head,
-      std::string const& config)
+      std::string const& config, bool debugSources)
 {
   cmMakefile *mf = tgt->GetMakefile();
 
@@ -600,6 +601,7 @@ static void processSources(cmTarget const* tgt,
         (*it)->CachedEntries = entrySources;
         }
       }
+    std::string usedSources;
     for(std::vector<std::string>::iterator
           li = entrySources.begin(); li != entrySources.end(); ++li)
       {
@@ -608,8 +610,19 @@ static void processSources(cmTarget const* tgt,
       if(uniqueSrcs.insert(src).second)
         {
         srcs.push_back(src);
+        if (debugSources)
+          {
+          usedSources += " * " + src + "\n";
+          }
         }
       }
+    if (!usedSources.empty())
+      {
+      mf->GetCMakeInstance()->IssueMessage(cmake::LOG,
+                            std::string("Used sources for target ")
+                            + tgt->GetName() + ":\n"
+                            + usedSources, (*it)->ge->GetBacktrace());
+      }
     }
 }
 
@@ -620,6 +633,24 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
 {
   assert(this->GetType() != INTERFACE_LIBRARY);
 
+  std::vector<std::string> debugProperties;
+  const char *debugProp =
+              this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
+  if (debugProp)
+    {
+    cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+    }
+
+  bool debugSources = !this->DebugSourcesDone
+                    && std::find(debugProperties.begin(),
+                                 debugProperties.end(),
+                                 "SOURCES")
+                        != debugProperties.end();
+
+  if (this->Makefile->IsGeneratingBuildSystem())
+    {
+    this->DebugSourcesDone = true;
+    }
 
   cmListFileBacktrace lfbt;
 
@@ -634,7 +665,8 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
                  uniqueSrcs,
                  &dagChecker,
                  head,
-                 config);
+                 config,
+                 debugSources);
 
   if (!this->Internal->CacheLinkInterfaceSourcesDone[config])
     {
@@ -685,7 +717,8 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
                             uniqueSrcs,
                             &dagChecker,
                             head,
-                            config);
+                            config,
+                            debugSources);
 
   if (!this->Makefile->IsGeneratingBuildSystem())
     {
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 15c49ea..055e029 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -710,6 +710,7 @@ private:
   mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
   mutable bool DebugCompileOptionsDone;
   mutable bool DebugCompileDefinitionsDone;
+  mutable bool DebugSourcesDone;
   mutable std::set<std::string> LinkImplicitNullProperties;
   bool BuildInterfaceIncludesAppended;
 
diff --git a/Tests/RunCMake/TargetSources/OriginDebug-result.txt b/Tests/RunCMake/TargetSources/OriginDebug-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/OriginDebug-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt b/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt
new file mode 100644
index 0000000..d586ada
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt
@@ -0,0 +1,15 @@
+CMake Debug Log at OriginDebug.cmake:13 \(add_library\):
+  Used sources for target OriginDebug:
+
+   \* empty_2.cpp
+
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
++
+CMake Debug Log at OriginDebug.cmake:14 \(target_link_libraries\):
+  Used sources for target OriginDebug:
+
+   \* empty_1.cpp
+
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/TargetSources/OriginDebug.cmake b/Tests/RunCMake/TargetSources/OriginDebug.cmake
new file mode 100644
index 0000000..911a7d4
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/OriginDebug.cmake
@@ -0,0 +1,14 @@
+
+cmake_minimum_required(VERSION 3.0)
+
+project(OriginDebug)
+
+set(CMAKE_DEBUG_TARGET_PROPERTIES SOURCES)
+
+add_library(iface INTERFACE)
+set_property(TARGET iface PROPERTY INTERFACE_SOURCES
+  empty_1.cpp
+)
+
+add_library(OriginDebug empty_2.cpp)
+target_link_libraries(OriginDebug iface)
diff --git a/Tests/RunCMake/TargetSources/OriginDebugIDE-result.txt b/Tests/RunCMake/TargetSources/OriginDebugIDE-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/OriginDebugIDE-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt b/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt
new file mode 100644
index 0000000..48c8cd3
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt
@@ -0,0 +1,22 @@
+CMake Debug Log at OriginDebug.cmake:13 \(add_library\):
+  Used sources for target OriginDebug:
+
+   \* empty_2.cpp
+
+Call Stack \(most recent call first\):
+  OriginDebugIDE.cmake:4 \(include\)
+  CMakeLists.txt:3 \(include\)
++
+CMake Debug Log:
+  Used sources for target OriginDebug:
+
+   * .*CMakeLists.txt
++
+CMake Debug Log at OriginDebug.cmake:14 \(target_link_libraries\):
+  Used sources for target OriginDebug:
+
+   \* empty_1.cpp
+
+Call Stack \(most recent call first\):
+  OriginDebugIDE.cmake:4 \(include\)
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/TargetSources/OriginDebugIDE.cmake b/Tests/RunCMake/TargetSources/OriginDebugIDE.cmake
new file mode 100644
index 0000000..a3cc3a8
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/OriginDebugIDE.cmake
@@ -0,0 +1,4 @@
+
+# Separate test for the IDEs, because they show the CMakeLists.txt file
+# as a source file.
+include(${CMAKE_CURRENT_LIST_DIR}/OriginDebug.cmake)
diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
index 1a3a7fa..b9095f9 100644
--- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
+++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
@@ -3,4 +3,7 @@ include(RunCMake)
 if(RunCMake_GENERATOR MATCHES Xcode
     OR RunCMake_GENERATOR MATCHES "Visual Studio")
   run_cmake(ConfigNotAllowed)
+  run_cmake(OriginDebugIDE)
+else()
+  run_cmake(OriginDebug)
 endif()

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e74d9ff5ff51fcce5727f116651afd3525c412be
commit e74d9ff5ff51fcce5727f116651afd3525c412be
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Feb 13 20:52:21 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Mar 30 21:06:40 2014 +0200

    cmTarget: Allow transitive evaluation of SOURCES property.
    
    Extend the cmGeneratorExpressionDAGChecker with an interface
    returning the name of the top target.  Use that to determine
    when there is a DAG violation, as required by the RunCMake.Languages
    tests.

diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 6ea5839..fd16eb9 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -152,6 +152,7 @@ Properties on Targets
    /prop_tgt/INTERFACE_INCLUDE_DIRECTORIES
    /prop_tgt/INTERFACE_LINK_LIBRARIES
    /prop_tgt/INTERFACE_POSITION_INDEPENDENT_CODE
+   /prop_tgt/INTERFACE_SOURCES
    /prop_tgt/INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
    /prop_tgt/INTERPROCEDURAL_OPTIMIZATION_CONFIG
    /prop_tgt/INTERPROCEDURAL_OPTIMIZATION
diff --git a/Help/prop_tgt/INTERFACE_SOURCES.rst b/Help/prop_tgt/INTERFACE_SOURCES.rst
new file mode 100644
index 0000000..fb28231
--- /dev/null
+++ b/Help/prop_tgt/INTERFACE_SOURCES.rst
@@ -0,0 +1,15 @@
+INTERFACE_SOURCES
+-----------------
+
+List of interface sources to pass to the compiler.
+
+Targets may populate this property to publish the sources
+for consuming targets to compile.  Consuming
+targets can add entries to their own :prop_tgt:`SOURCES` property
+such as ``$<TARGET_PROPERTY:foo,INTERFACE_SOURCES>`` to use the
+sources specified in the interface of ``foo``.
+
+Contents of ``INTERFACE_SOURCES`` may use "generator expressions"
+with the syntax ``$<...>``.  See the :manual:`cmake-generator-expressions(7)`
+manual for available expressions.  See the :manual:`cmake-buildsystem(7)`
+manual for more on defining buildsystem properties.
diff --git a/Help/release/dev/target-INTERFACE_SOURCES.rst b/Help/release/dev/target-INTERFACE_SOURCES.rst
new file mode 100644
index 0000000..4e34943
--- /dev/null
+++ b/Help/release/dev/target-INTERFACE_SOURCES.rst
@@ -0,0 +1,5 @@
+target-INTERFACE_SOURCES
+------------------------
+
+* A new :prop_tgt:`INTERFACE_SOURCES` target property was introduced. This is
+  consumed by dependent targets, which compile and link the listed sources.
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index 07efba9..7f8e694 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -179,6 +179,18 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(const char *tgt)
        || strcmp(prop, "INTERFACE_LINK_LIBRARIES") == 0;
 }
 
+std::string cmGeneratorExpressionDAGChecker::TopTarget() const
+{
+  const cmGeneratorExpressionDAGChecker *top = this;
+  const cmGeneratorExpressionDAGChecker *parent = this->Parent;
+  while (parent)
+    {
+    top = parent;
+    parent = parent->Parent;
+    }
+  return top->Target;
+}
+
 enum TransitiveProperty {
 #define DEFINE_ENUM_ENTRY(NAME) NAME,
   CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(DEFINE_ENUM_ENTRY)
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index 6cbbd2a..b3147f7 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -25,7 +25,8 @@
   SELECT(F, EvaluatingSystemIncludeDirectories, SYSTEM_INCLUDE_DIRECTORIES) \
   SELECT(F, EvaluatingCompileDefinitions,       COMPILE_DEFINITIONS) \
   SELECT(F, EvaluatingCompileOptions,           COMPILE_OPTIONS) \
-  SELECT(F, EvaluatingAutoUicOptions,           AUTOUIC_OPTIONS)
+  SELECT(F, EvaluatingAutoUicOptions,           AUTOUIC_OPTIONS) \
+  SELECT(F, EvaluatingSources,                  SOURCES)
 
 #define CM_FOR_EACH_TRANSITIVE_PROPERTY(F) \
   CM_FOR_EACH_TRANSITIVE_PROPERTY_IMPL(F, CM_SELECT_BOTH)
@@ -70,6 +71,8 @@ struct cmGeneratorExpressionDAGChecker
   void SetTransitivePropertiesOnly()
     { this->TransitivePropertiesOnly = true; }
 
+  std::string TopTarget() const;
+
 private:
   Result CheckGraph() const;
 
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index a392675..59e3aec 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -985,7 +985,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
     if (propertyName == "LINKER_LANGUAGE")
       {
       if (target->LinkLanguagePropagatesToDependents() &&
-          dagCheckerParent && dagCheckerParent->EvaluatingLinkLibraries())
+          dagCheckerParent && (dagCheckerParent->EvaluatingLinkLibraries()
+            || dagCheckerParent->EvaluatingSources()))
         {
         reportError(context, content->GetOriginalExpression(),
             "LINKER_LANGUAGE target property can not be used while evaluating "
@@ -1569,7 +1570,9 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
                   "Target \"" + name + "\" is not an executable or library.");
       return std::string();
       }
-    if (dagChecker && dagChecker->EvaluatingLinkLibraries(name.c_str()))
+    if (dagChecker && (dagChecker->EvaluatingLinkLibraries(name.c_str())
+        || (dagChecker->EvaluatingSources()
+          && name == dagChecker->TopTarget())))
       {
       ::reportError(context, content->GetOriginalExpression(),
                     "Expressions which require the linker language may not "
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index fbd7315..d512044 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -159,10 +159,13 @@ public:
                                 CachedLinkInterfaceCompileOptionsEntries;
   mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
                                 CachedLinkInterfaceCompileDefinitionsEntries;
+  mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
+                                CachedLinkInterfaceSourcesEntries;
 
   mutable std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone;
   mutable std::map<std::string, bool> CacheLinkInterfaceCompileDefinitionsDone;
   mutable std::map<std::string, bool> CacheLinkInterfaceCompileOptionsDone;
+  mutable std::map<std::string, bool> CacheLinkInterfaceSourcesDone;
 };
 
 //----------------------------------------------------------------------------
@@ -198,6 +201,7 @@ cmTargetInternals::~cmTargetInternals()
   deleteAndClear(this->CachedLinkInterfaceIncludeDirectoriesEntries);
   deleteAndClear(this->CachedLinkInterfaceCompileOptionsEntries);
   deleteAndClear(this->CachedLinkInterfaceCompileDefinitionsEntries);
+  deleteAndClear(this->CachedLinkInterfaceSourcesEntries);
 }
 
 //----------------------------------------------------------------------------
@@ -543,44 +547,157 @@ bool cmTarget::IsBundleOnApple() const
 }
 
 //----------------------------------------------------------------------------
-void cmTarget::GetSourceFiles(std::vector<std::string> &files,
-                              const std::string& config) const
+static void processSources(cmTarget const* tgt,
+      const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
+      std::vector<std::string> &srcs,
+      std::set<std::string> &uniqueSrcs,
+      cmGeneratorExpressionDAGChecker *dagChecker,
+      cmTarget const* head,
+      std::string const& config)
 {
-  assert(this->GetType() != INTERFACE_LIBRARY);
-  for(std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator
-      si = this->Internal->SourceEntries.begin();
-      si != this->Internal->SourceEntries.end(); ++si)
-    {
-    std::vector<std::string> srcs;
-    cmSystemTools::ExpandListArgument((*si)->ge->Evaluate(this->Makefile,
-                                        config,
-                                        false,
-                                        this),
-                                      srcs);
+  cmMakefile *mf = tgt->GetMakefile();
 
-    for(std::vector<std::string>::const_iterator i = srcs.begin();
-        i != srcs.end(); ++i)
+  for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator
+      it = entries.begin(), end = entries.end(); it != end; ++it)
+    {
+    bool cacheSources = false;
+    std::vector<std::string> entrySources = (*it)->CachedEntries;
+    if(entrySources.empty())
       {
-      std::string src = *i;
-      cmSourceFile* sf = this->Makefile->GetOrCreateSource(src);
-      std::string e;
-      src = sf->GetFullPath(&e);
-      if(src.empty())
+      cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf,
+                                                config,
+                                                false,
+                                                head ? head : tgt,
+                                                tgt,
+                                                dagChecker),
+                                      entrySources);
+      if (mf->IsGeneratingBuildSystem()
+          && !(*it)->ge->GetHadContextSensitiveCondition())
+        {
+        cacheSources = true;
+        }
+
+      for(std::vector<std::string>::const_iterator i = entrySources.begin();
+          i != entrySources.end(); ++i)
         {
-        if(!e.empty())
+        std::string src = *i;
+
+        cmSourceFile* sf = mf->GetOrCreateSource(src);
+        std::string e;
+        if(sf->GetFullPath(&e).empty())
           {
-          cmake* cm = this->Makefile->GetCMakeInstance();
-          cm->IssueMessage(cmake::FATAL_ERROR, e,
-                          this->GetBacktrace());
+          if(!e.empty())
+            {
+            cmake* cm = mf->GetCMakeInstance();
+            cm->IssueMessage(cmake::FATAL_ERROR, e,
+                            tgt->GetBacktrace());
+            }
+          return;
           }
-        return;
         }
-      files.push_back(src);
+      if (cacheSources)
+        {
+        (*it)->CachedEntries = entrySources;
+        }
+      }
+    for(std::vector<std::string>::iterator
+          li = entrySources.begin(); li != entrySources.end(); ++li)
+      {
+      std::string src = *li;
+
+      if(uniqueSrcs.insert(src).second)
+        {
+        srcs.push_back(src);
+        }
       }
     }
 }
 
 //----------------------------------------------------------------------------
+void cmTarget::GetSourceFiles(std::vector<std::string> &files,
+                              const std::string& config,
+                              cmTarget const* head) const
+{
+  assert(this->GetType() != INTERFACE_LIBRARY);
+
+
+  cmListFileBacktrace lfbt;
+
+  cmGeneratorExpressionDAGChecker dagChecker(lfbt,
+                                              this->GetName(),
+                                              "SOURCES", 0, 0);
+
+  std::set<std::string> uniqueSrcs;
+  processSources(this,
+                 this->Internal->SourceEntries,
+                 files,
+                 uniqueSrcs,
+                 &dagChecker,
+                 head,
+                 config);
+
+  if (!this->Internal->CacheLinkInterfaceSourcesDone[config])
+    {
+    for (std::vector<cmValueWithOrigin>::const_iterator
+        it = this->Internal->LinkImplementationPropertyEntries.begin(),
+        end = this->Internal->LinkImplementationPropertyEntries.end();
+        it != end; ++it)
+      {
+      if (!cmGeneratorExpression::IsValidTargetName(it->Value)
+          && cmGeneratorExpression::Find(it->Value) == std::string::npos)
+        {
+        continue;
+        }
+      {
+      cmGeneratorExpression ge(lfbt);
+      cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+                                                        ge.Parse(it->Value);
+      std::string targetResult = cge->Evaluate(this->Makefile, config,
+                                        false, this, 0, &dagChecker);
+      if (!this->Makefile->FindTargetToUse(targetResult))
+        {
+        continue;
+        }
+      }
+      std::string sourceGenex = "$<TARGET_PROPERTY:" +
+                              it->Value + ",INTERFACE_SOURCES>";
+      if (cmGeneratorExpression::Find(it->Value) != std::string::npos)
+        {
+        // Because it->Value is a generator expression, ensure that it
+        // evaluates to the non-empty string before being used in the
+        // TARGET_PROPERTY expression.
+        sourceGenex = "$<$<BOOL:" + it->Value + ">:" + sourceGenex + ">";
+        }
+      cmGeneratorExpression ge(it->Backtrace);
+      cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(
+                                                                sourceGenex);
+
+      this->Internal
+        ->CachedLinkInterfaceSourcesEntries[config].push_back(
+                        new cmTargetInternals::TargetPropertyEntry(cge,
+                                                              it->Value));
+      }
+    }
+
+  processSources(this,
+    this->Internal->CachedLinkInterfaceSourcesEntries[config],
+                            files,
+                            uniqueSrcs,
+                            &dagChecker,
+                            head,
+                            config);
+
+  if (!this->Makefile->IsGeneratingBuildSystem())
+    {
+    deleteAndClear(this->Internal->CachedLinkInterfaceSourcesEntries);
+    }
+  else
+    {
+    this->Internal->CacheLinkInterfaceSourcesDone[config] = true;
+    }
+}
+
+//----------------------------------------------------------------------------
 bool
 cmTarget::GetConfigCommonSourceFiles(std::vector<cmSourceFile*>& files) const
 {
@@ -639,10 +756,11 @@ cmTarget::GetConfigCommonSourceFiles(std::vector<cmSourceFile*>& files) const
 
 //----------------------------------------------------------------------------
 void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
-                              const std::string& config) const
+                              const std::string& config,
+                              cmTarget const* head) const
 {
   std::vector<std::string> srcs;
-  this->GetSourceFiles(srcs, config);
+  this->GetSourceFiles(srcs, config, head);
 
   std::set<cmSourceFile*> emitted;
 
@@ -5053,10 +5171,11 @@ bool cmTarget::IsLinkInterfaceDependentNumberMaxProperty(const std::string &p,
 
 //----------------------------------------------------------------------------
 void cmTarget::GetLanguages(std::set<std::string>& languages,
-                            const std::string& config) const
+                            const std::string& config,
+                            cmTarget const* head) const
 {
   std::vector<cmSourceFile*> sourceFiles;
-  this->GetSourceFiles(sourceFiles, config);
+  this->GetSourceFiles(sourceFiles, config, head);
   for(std::vector<cmSourceFile*>::const_iterator
         i = sourceFiles.begin(); i != sourceFiles.end(); ++i)
     {
@@ -5111,7 +5230,7 @@ void cmTarget::GetLanguages(std::set<std::string>& languages,
   for(std::vector<cmTarget*>::const_iterator
       i = objectLibraries.begin(); i != objectLibraries.end(); ++i)
     {
-    (*i)->GetLanguages(languages, config);
+    (*i)->GetLanguages(languages, config, head);
     }
 }
 
@@ -6050,7 +6169,7 @@ cmTarget::GetLinkImplementation(const std::string& config,
     // Compute the link implementation for this configuration.
     LinkImplementation impl;
     this->ComputeLinkImplementation(config, impl, head);
-    this->ComputeLinkImplementationLanguages(config, impl);
+    this->ComputeLinkImplementationLanguages(config, impl, head);
 
     // Store the information for this configuration.
     cmTargetInternals::LinkImplMapType::value_type entry(key, impl);
@@ -6058,7 +6177,7 @@ cmTarget::GetLinkImplementation(const std::string& config,
     }
   else if (i->second.Languages.empty())
     {
-    this->ComputeLinkImplementationLanguages(config, i->second);
+    this->ComputeLinkImplementationLanguages(config, i->second, head);
     }
 
   return &i->second;
@@ -6172,12 +6291,13 @@ void cmTarget::ComputeLinkImplementation(const std::string& config,
 //----------------------------------------------------------------------------
 void
 cmTarget::ComputeLinkImplementationLanguages(const std::string& config,
-                                             LinkImplementation& impl) const
+                                             LinkImplementation& impl,
+                                             cmTarget const* head) const
 {
   // This target needs runtime libraries for its source languages.
   std::set<std::string> languages;
   // Get languages used in our source files.
-  this->GetLanguages(languages, config);
+  this->GetLanguages(languages, config, head);
   // Copy the set of langauges to the link implementation.
   for(std::set<std::string>::iterator li = languages.begin();
       li != languages.end(); ++li)
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 042b441..15c49ea 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -136,9 +136,11 @@ public:
    * Get the list of the source files used by this target
    */
   void GetSourceFiles(std::vector<std::string> &files,
-                      const std::string& config) const;
+                      const std::string& config,
+                      cmTarget const* head = 0) const;
   void GetSourceFiles(std::vector<cmSourceFile*> &files,
-                      const std::string& config) const;
+                      const std::string& config,
+                      cmTarget const* head = 0) const;
   bool GetConfigCommonSourceFiles(std::vector<cmSourceFile*>& files) const;
 
   /**
@@ -469,7 +471,8 @@ public:
   // information to forward these property changes to the targets
   // until we have per-target object file properties.
   void GetLanguages(std::set<std::string>& languages,
-                    const std::string& config) const;
+                    std::string const& config,
+                    cmTarget const* head = 0) const;
 
   /** Return whether this target is an executable with symbol exports
       enabled.  */
@@ -743,7 +746,8 @@ private:
                                  LinkImplementation& impl,
                                  cmTarget const* head) const;
   void ComputeLinkImplementationLanguages(const std::string& config,
-                                          LinkImplementation& impl) const;
+                                          LinkImplementation& impl,
+                                          cmTarget const* head) const;
   void ComputeLinkClosure(const std::string& config, LinkClosure& lc,
                           cmTarget const* head) const;
 
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index e77133a..1c474ab 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -282,6 +282,7 @@ if(BUILD_TESTING)
     set(ConfigSources_BUILD_OPTIONS -DCMAKE_BUILD_TYPE=Debug)
     ADD_TEST_MACRO(ConfigSources ConfigSources)
   endif()
+  ADD_TEST_MACRO(SourcesProperty SourcesProperty)
   set_tests_properties(EmptyLibrary PROPERTIES
     PASS_REGULAR_EXPRESSION "CMake Error: CMake can not determine linker language for target: test")
   ADD_TEST_MACRO(CrossCompile CrossCompile)
diff --git a/Tests/ConfigSources/CMakeLists.txt b/Tests/ConfigSources/CMakeLists.txt
index 68a4233..c272257 100644
--- a/Tests/ConfigSources/CMakeLists.txt
+++ b/Tests/ConfigSources/CMakeLists.txt
@@ -3,7 +3,15 @@ cmake_minimum_required(VERSION 3.0)
 
 project(ConfigSources)
 
+add_library(iface INTERFACE)
+set_property(TARGET iface PROPERTY INTERFACE_SOURCES
+  iface_src.cpp
+  $<$<CONFIG:Debug>:iface_debug_src.cpp>
+  $<$<CONFIG:Release>:does_not_exist.cpp>
+)
+
 add_executable(ConfigSources
   $<$<CONFIG:Debug>:main.cpp>
   $<$<CONFIG:Release>:does_not_exist.cpp>
 )
+target_link_libraries(ConfigSources iface)
diff --git a/Tests/ConfigSources/iface_debug.h b/Tests/ConfigSources/iface_debug.h
new file mode 100644
index 0000000..a23d737
--- /dev/null
+++ b/Tests/ConfigSources/iface_debug.h
@@ -0,0 +1,4 @@
+
+int iface_src();
+
+int iface_debug();
diff --git a/Tests/ConfigSources/iface_debug_src.cpp b/Tests/ConfigSources/iface_debug_src.cpp
new file mode 100644
index 0000000..63b22fc
--- /dev/null
+++ b/Tests/ConfigSources/iface_debug_src.cpp
@@ -0,0 +1,7 @@
+
+#include "iface_debug.h"
+
+int iface_debug()
+{
+  return 0;
+}
diff --git a/Tests/ConfigSources/iface_src.cpp b/Tests/ConfigSources/iface_src.cpp
new file mode 100644
index 0000000..c3a0c8f
--- /dev/null
+++ b/Tests/ConfigSources/iface_src.cpp
@@ -0,0 +1,5 @@
+
+int iface_src()
+{
+  return 0;
+}
diff --git a/Tests/ConfigSources/main.cpp b/Tests/ConfigSources/main.cpp
index 1c19e8d..71af72f 100644
--- a/Tests/ConfigSources/main.cpp
+++ b/Tests/ConfigSources/main.cpp
@@ -1,5 +1,7 @@
 
+#include "iface_debug.h"
+
 int main(int argc, char** argv)
 {
-  return 0;
+  return iface_src() + iface_debug();
 }
diff --git a/Tests/SourcesProperty/CMakeLists.txt b/Tests/SourcesProperty/CMakeLists.txt
new file mode 100644
index 0000000..0b3097e
--- /dev/null
+++ b/Tests/SourcesProperty/CMakeLists.txt
@@ -0,0 +1,10 @@
+
+cmake_minimum_required(VERSION 3.0)
+
+project(SourcesProperty)
+
+add_library(iface INTERFACE)
+set_property(TARGET iface PROPERTY INTERFACE_SOURCES iface.cpp)
+
+add_executable(SourcesProperty main.cpp)
+target_link_libraries(SourcesProperty iface)
diff --git a/Tests/SourcesProperty/iface.cpp b/Tests/SourcesProperty/iface.cpp
new file mode 100644
index 0000000..e38ac37
--- /dev/null
+++ b/Tests/SourcesProperty/iface.cpp
@@ -0,0 +1,5 @@
+
+int iface()
+{
+  return 0;
+}
diff --git a/Tests/SourcesProperty/iface.h b/Tests/SourcesProperty/iface.h
new file mode 100644
index 0000000..2cac248
--- /dev/null
+++ b/Tests/SourcesProperty/iface.h
@@ -0,0 +1,2 @@
+
+int iface();
diff --git a/Tests/SourcesProperty/main.cpp b/Tests/SourcesProperty/main.cpp
new file mode 100644
index 0000000..ae4f305
--- /dev/null
+++ b/Tests/SourcesProperty/main.cpp
@@ -0,0 +1,7 @@
+
+#include "iface.h"
+
+int main(int argc, char** argv)
+{
+  return iface();
+}

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

Summary of changes:
 Help/command/target_sources.rst                    |   28 +++
 Help/manual/cmake-commands.7.rst                   |    1 +
 Help/manual/cmake-properties.7.rst                 |    1 +
 Help/prop_tgt/INTERFACE_SOURCES.rst                |   15 ++
 Help/prop_tgt/SOURCES.rst                          |    3 +-
 Help/release/dev/target-INTERFACE_SOURCES.rst      |    5 +
 Help/release/dev/target-SOURCES-write.rst          |    6 +
 Help/release/dev/target_sources-command.rst        |    5 +
 Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst    |    3 +-
 Source/CMakeLists.txt                              |    1 +
 Source/cmGeneratorExpressionDAGChecker.cxx         |   12 +
 Source/cmGeneratorExpressionDAGChecker.h           |    5 +-
 Source/cmGeneratorExpressionEvaluator.cxx          |    7 +-
 Source/cmTarget.cxx                                |  259 +++++++++++++++++---
 Source/cmTarget.h                                  |   13 +-
 ...tionsCommand.cxx => cmTargetSourcesCommand.cxx} |   38 +--
 ...leOptionsCommand.h => cmTargetSourcesCommand.h} |   16 +-
 Tests/CMakeLists.txt                               |    1 +
 Tests/ConfigSources/CMakeLists.txt                 |    8 +
 Tests/ConfigSources/iface_debug.h                  |    4 +
 Tests/ConfigSources/iface_debug_src.cpp            |    7 +
 .../simple.cxx => ConfigSources/iface_src.cpp}     |    2 +-
 Tests/ConfigSources/main.cpp                       |    4 +-
 .../OriginDebug-result.txt}                        |    0
 .../RunCMake/TargetSources/OriginDebug-stderr.txt  |   31 +++
 Tests/RunCMake/TargetSources/OriginDebug.cmake     |   20 ++
 .../OriginDebugIDE-result.txt}                     |    0
 .../TargetSources/OriginDebugIDE-stderr.txt        |   40 +++
 Tests/RunCMake/TargetSources/OriginDebugIDE.cmake  |    4 +
 Tests/RunCMake/TargetSources/RunCMakeTest.cmake    |    3 +
 .../empty.cpp => TargetSources/empty_3.cpp}        |    0
 .../empty.cpp => TargetSources/empty_4.cpp}        |    0
 Tests/SourcesProperty/CMakeLists.txt               |   12 +
 .../simple.cxx => SourcesProperty/iface.cpp}       |    2 +-
 Tests/SourcesProperty/iface.h                      |    4 +
 Tests/SourcesProperty/main.cpp                     |    7 +
 .../simple.cxx => SourcesProperty/prop.cpp}        |    2 +-
 37 files changed, 496 insertions(+), 73 deletions(-)
 create mode 100644 Help/command/target_sources.rst
 create mode 100644 Help/prop_tgt/INTERFACE_SOURCES.rst
 create mode 100644 Help/release/dev/target-INTERFACE_SOURCES.rst
 create mode 100644 Help/release/dev/target-SOURCES-write.rst
 create mode 100644 Help/release/dev/target_sources-command.rst
 copy Source/{cmTargetCompileOptionsCommand.cxx => cmTargetSourcesCommand.cxx} (62%)
 copy Source/{cmTargetCompileOptionsCommand.h => cmTargetSourcesCommand.h} (76%)
 create mode 100644 Tests/ConfigSources/iface_debug.h
 create mode 100644 Tests/ConfigSources/iface_debug_src.cpp
 copy Tests/{CTestTestCycle/simple.cxx => ConfigSources/iface_src.cpp} (51%)
 copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => TargetSources/OriginDebug-result.txt} (100%)
 create mode 100644 Tests/RunCMake/TargetSources/OriginDebug-stderr.txt
 create mode 100644 Tests/RunCMake/TargetSources/OriginDebug.cmake
 copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => TargetSources/OriginDebugIDE-result.txt} (100%)
 create mode 100644 Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt
 create mode 100644 Tests/RunCMake/TargetSources/OriginDebugIDE.cmake
 copy Tests/RunCMake/{CMP0022/empty.cpp => TargetSources/empty_3.cpp} (100%)
 copy Tests/RunCMake/{CMP0022/empty.cpp => TargetSources/empty_4.cpp} (100%)
 create mode 100644 Tests/SourcesProperty/CMakeLists.txt
 copy Tests/{CTestTestDepends/simple.cxx => SourcesProperty/iface.cpp} (58%)
 create mode 100644 Tests/SourcesProperty/iface.h
 create mode 100644 Tests/SourcesProperty/main.cpp
 copy Tests/{CTestTestDepends/simple.cxx => SourcesProperty/prop.cpp} (60%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list