summaryrefslogtreecommitdiffstats
path: root/Help/command/target_sources.rst
diff options
context:
space:
mode:
authorPatrick Stotko <stotko@cs.uni-bonn.de>2018-06-02 15:20:51 (GMT)
committerPatrick Stotko <stotko@cs.uni-bonn.de>2018-06-18 19:01:57 (GMT)
commit316815e1f4beb66b679f27f96800facef572889e (patch)
tree99c44018136c1fe6ead03b4c00359af72be1dc82 /Help/command/target_sources.rst
parentf31d4ac7d68a1939d22ab7246b51e0ac10842bec (diff)
downloadCMake-316815e1f4beb66b679f27f96800facef572889e.zip
CMake-316815e1f4beb66b679f27f96800facef572889e.tar.gz
CMake-316815e1f4beb66b679f27f96800facef572889e.tar.bz2
target_sources: Interpret relative paths as relative to the calling directory
Previously the command considered non-absolute source file paths relative to the associated target on the LHS. This causes problems in incremental builds where files are added from subdirectories and forces users to workaround by manually converting to absolute paths. Change this to enable more intuitive usage by projects. Fixes #17981
Diffstat (limited to 'Help/command/target_sources.rst')
-rw-r--r--Help/command/target_sources.rst7
1 files changed, 6 insertions, 1 deletions
diff --git a/Help/command/target_sources.rst b/Help/command/target_sources.rst
index a4f5196..5dd8d86 100644
--- a/Help/command/target_sources.rst
+++ b/Help/command/target_sources.rst
@@ -9,7 +9,9 @@ Add sources to a target.
<INTERFACE|PUBLIC|PRIVATE> [items1...]
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
-Specify sources to use when compiling a given target. The
+Specify sources to use when compiling a given target. Relative
+source file paths are interpreted as being relative to the current
+source directory (i.e. :variable:`CMAKE_CURRENT_SOURCE_DIR`). The
named ``<target>`` must have been created by a command such as
:command:`add_executable` or :command:`add_library` and must not be an
:ref:`ALIAS target <Alias Targets>`.
@@ -27,3 +29,6 @@ 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.
+
+See also the :policy:`CMP0076` policy for older behavior related to the
+handling of relative source file paths.