2

I would like to add an External Tool to my Eclipse CDT Project.

This external tool, which is a program that I have written myself, requires different arguments (the map file and a list of all *.c *.cpp and *.h files). I already managed to hand over the map file but is there any way of getting a list of all *.c and *.h files (maybe with an Eclipse Variable) so that I can directly add this to the argument field?

Cœur
  • 37,241
  • 25
  • 195
  • 267
mattes84
  • 19
  • 2

1 Answers1

-1

I found one solution which can be used on a linux system. Just use a a pipe with the following command and put it in a shell script.

First of all, how to find all source code files:

find <rootfolder> -name '*.c' -o -name '*.cpp' -o -name '*.h'

Complete command:

find <rootfolder> -name '*.c' -o -name '*.cpp' -o -name '*.h' | xargs <myTool>

The first command will find out all absolute paths to the all .c .cpp and .h files listed in the rootfolder and the second one will convert its input into a set on arguments. The result will be the same as if every found file path would have been handed over as a single argument to mytool.

mattes84
  • 19
  • 2
  • This only works on the condition that all files under root is actually part of the current project. And if that is the case why bother putting the find stuff in the eclipse config, the myTool can just take what efter is under . – Otzen May 14 '20 at 10:52