[Cmake-commits] CMake branch, next, updated. v3.0.0-rc3-1700-gf25cf48
Stephen Kelly
steveire at gmail.com
Tue Apr 1 07:48:07 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 f25cf48160f7db3c42e672483e90ae5f0f19f1ba (commit)
via 345e48e9e796814449c727b4f1a3eff5d19c18fc (commit)
via e80b9fbf2a2bf8906c5e7d4798599632961cc0ea (commit)
via 62ded28bc426d142032146a455c55c6785a882ec (commit)
from d22f5db5ce34558addc2325abb4f26125d4163fe (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=f25cf48160f7db3c42e672483e90ae5f0f19f1ba
commit f25cf48160f7db3c42e672483e90ae5f0f19f1ba
Merge: d22f5db 345e48e
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Apr 1 07:48:06 2014 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Apr 1 07:48:06 2014 -0400
Merge topic 'target-transitive-sources' into next
345e48e9 target_sources: New command to add sources to target.
e80b9fbf Make the SOURCES target property writable.
62ded28b cmTarget: Make the SOURCES origin tracable.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=345e48e9e796814449c727b4f1a3eff5d19c18fc
commit 345e48e9e796814449c727b4f1a3eff5d19c18fc
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Jul 8 20:18:42 2013 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Apr 1 13:47:52 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 6b7453f..0200dcb 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:
+
+ \* .*Tests/RunCMake/TargetSources/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 683c2e9..fad7073 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:
+
+ \* .*Tests/RunCMake/TargetSources/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=e80b9fbf2a2bf8906c5e7d4798599632961cc0ea
commit e80b9fbf2a2bf8906c5e7d4798599632961cc0ea
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Jul 8 20:18:42 2013 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Apr 1 13:47:14 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 10ecbfa..475bcdb 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1697,6 +1697,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);
}
@@ -1764,6 +1783,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 dad9fee..6b7453f 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:
+
+ \* .*Tests/RunCMake/TargetSources/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 9797870..683c2e9 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:
+
+ \* .*Tests/RunCMake/TargetSources/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=62ded28bc426d142032146a455c55c6785a882ec
commit 62ded28bc426d142032146a455c55c6785a882ec
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Mar 27 13:16:59 2014 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Apr 1 13:46:55 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 0b5734d..10ecbfa 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();
@@ -601,6 +602,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)
{
@@ -609,8 +611,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());
+ }
}
}
@@ -621,6 +634,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;
@@ -635,7 +666,8 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
uniqueSrcs,
&dagChecker,
head,
- config);
+ config,
+ debugSources);
if (!this->Internal->CacheLinkInterfaceSourcesDone[config])
{
@@ -686,7 +718,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..dad9fee
--- /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:
+
+ \* .*Tests/RunCMake/TargetSources/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:
+
+ \* .*Tests/RunCMake/TargetSources/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..9797870
--- /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:
+
+ \* .*Tests/RunCMake/TargetSources/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:
+
+ \* .*Tests/RunCMake/TargetSources/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()
-----------------------------------------------------------------------
Summary of changes:
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list