mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-01 04:08:46 -06:00
Merge topic 'target-transitive-sources'
9407174btarget_sources: New command to add sources to target.81ad69e0Make the SOURCES target property writable.6e636f2ecmTarget: Make the SOURCES origin tracable.3676fb49cmTarget: Allow transitive evaluation of SOURCES property.e6971df6cmTarget: Make the source files depend on the config.df753df9cmGeneratorTarget: Don't add computed sources to the target.869328aacmComputeTargetDepends: Use valid config to compute target depends.
This commit is contained in:
28
Help/command/target_sources.rst
Normal file
28
Help/command/target_sources.rst
Normal 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.
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
15
Help/prop_tgt/INTERFACE_SOURCES.rst
Normal file
15
Help/prop_tgt/INTERFACE_SOURCES.rst
Normal 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.
|
||||
@@ -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.
|
||||
|
||||
5
Help/release/dev/target-INTERFACE_SOURCES.rst
Normal file
5
Help/release/dev/target-INTERFACE_SOURCES.rst
Normal 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.
|
||||
6
Help/release/dev/target-SOURCES-write.rst
Normal file
6
Help/release/dev/target-SOURCES-write.rst
Normal 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.
|
||||
5
Help/release/dev/target_sources-command.rst
Normal file
5
Help/release/dev/target_sources-command.rst
Normal file
@@ -0,0 +1,5 @@
|
||||
target_sources-command
|
||||
----------------------
|
||||
|
||||
* The :command:`target_sources` command was added to add to the
|
||||
:prop_tgt:`SOURCES` target property.
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user