waterlooalex
waterlooalex

Reputation: 13922

Eclipse-CDT: Whats the best way to add a custom build step?

I have a file in my project which I need to compile using an external tool, and the output of that is a pair of .c and .h files.

Whats the best way to integrate this into my Eclipse-CDT build?

I've tried out adding something to the 'Builders' section under Project Properties with mixed results.

thx

Upvotes: 5

Views: 6522

Answers (3)

waterlooalex
waterlooalex

Reputation: 13922

I got this working well by adding a 'Builder' of type 'Program'.

  1. Right click on the project
  2. Click "Properties", "Builders"
  3. Click "New", "Program", ...
  4. Add the location of the file you want to execute, as well as any command line arguments.

Upvotes: 4

Christoph
Christoph

Reputation: 794

I'm using cmake with eclipse cdt
it provides an generator to generate the whole eclipse cdt project

you just have to setup your CMakeLists.txt file and then run the following command in your project directory:
cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug .
after that eclipse uses the cmake generated make file and regenerates it when you change the CMakeLists.txt

there exists tutorial for cmake and cdt

you have to check whether cmake suits your needs

Upvotes: 2

Josh Kelley
Josh Kelley

Reputation: 58422

Relatively early in our projects' lifetime, I felt like I was running into too many limitations of Eclipse CDT's managed builds, so I switched to Make.

This isn't as bad as it might sound; Eclipse CDT integrates well with make (running it with the configuration you chose and parsing its results), and you can use Eclipse CDT's generated makefiles as a starting point.

Once you're using make, you can easily add a custom build step.

Upvotes: 1

Related Questions