I am trying to get ctags to be automatically run when I do a scons. I have a custom builder based on this answer that allows me to run ctags from within my SConscript file. This works in as far as I get a tags file in the appropriate directory. However, since the builder runs within the root directory and not the subdirectory, I get the wrong paths (aka from the root, not the subdirectory) for all the files contains within the tags file. Apart from using sed to strip paths in the tags file, anyone can offer a suggestion as to how to make scons generate the right paths?
In effects, I would like to run the builder in a specific directory (aka the one where the SConscript is located, maybe passed as an option?) and not from the project root.
This is the builder code I ended up using. Notice that the ctags command has a
--tag-relative=yesoption to it.In my
Sconscriptfile(s), I can now do:The
tagsfile now contains tags with path relative to the location of the tags file and not from the scons root directory.