From 4f82120c8f5d1905dd1491bdabe52f171d039827 Mon Sep 17 00:00:00 2001 From: Gustavo Jose de Sousa Date: Thu, 25 Feb 2016 12:34:37 +0000 Subject: [PATCH] waf: cmake: improve documentation regarding target option That feature can also be used within wscripts with no problem. The code added in the example shows that. --- Tools/ardupilotwaf/cmake.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Tools/ardupilotwaf/cmake.py b/Tools/ardupilotwaf/cmake.py index a10ea1d2c3..a9c879cfb1 100644 --- a/Tools/ardupilotwaf/cmake.py +++ b/Tools/ardupilotwaf/cmake.py @@ -64,11 +64,10 @@ OrderedDict. Example:: ... ) -There may be cases when you want to stablish dependency between other tasks and +There may be cases when you want to establish dependency between other tasks and the external build system's products (headers and libraries, for example). In that case, you can specify the specific files in the option 'target' of your -cmake_build task generator. In general, that feature is supposed to be used by -other tools rather than by wscripts. Example:: +cmake_build task generator. Example:: def build(bld): ... @@ -76,6 +75,22 @@ other tools rather than by wscripts. Example:: # declaring on target only what I'm interested in foo.cmake_build('baz', target='path/to/foobld/include/baz.h') + # myprogram.c includes baz.h, so the dependency is (implicitly) + # established + bld.program(target='myprogram', source='myprogram.c') + + # another example + foo.cmake_build('another', target='another.txt') + + bld( + rule='${CP} ${SRC} ${TGT}', + source=bld.bldnode.find_or_declare('another.txt'), + target='another_copied.txt', + ) + + +You can also establish the dependency directly on a task object:: + @feature('myfeature') def process_myfeature(self): baz_taskgen = self.bld.get_tgen_by_name('baz')