Merge topic 'target-transitive-sources'

9407174b target_sources: New command to add sources to target.
81ad69e0 Make the SOURCES target property writable.
6e636f2e cmTarget: Make the SOURCES origin tracable.
3676fb49 cmTarget: Allow transitive evaluation of SOURCES property.
e6971df6 cmTarget: Make the source files depend on the config.
df753df9 cmGeneratorTarget: Don't add computed sources to the target.
869328aa cmComputeTargetDepends: Use valid config to compute target depends.
This commit is contained in:
Brad King
2014-04-03 12:51:53 -04:00
committed by CMake Topic Stage
74 changed files with 1101 additions and 186 deletions

View File

@@ -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.

View File

@@ -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

View File

@@ -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

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -0,0 +1,5 @@
target_sources-command
----------------------
* The :command:`target_sources` command was added to add to the
:prop_tgt:`SOURCES` target property.

View File

@@ -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.