I have a remote, cross build and I would like to manually take the gcc command line from the makefile build, and use it to setup the Eclipse CDT project file with include paths and preprocessor definitions. How can I do this?
1
votes
1 Answers
2
votes
The usual way to do this is using the Build Output Parser.
- Create a Makefile project
Enable the Build Output Parser in
Project Properties | C/C++ General | Preprocessor Include Paths, Macros etc. | Providers tab
(in might already be enabled).- Configure it if necessary (e.g. the "Compiler command pattern" may need to be adjusted to match your cross-compiler's name.)
Make sure you can build the project from within Eclipse. If necessary, configure the make target name and invocation directory in
Project Properties | C/C++ Build
.Invoke the build from within Eclipse.
- The Build Output Parser will run automatically at the end of the build, parse the compiler commands in the build output, and configure the project's include paths and preprocessor defines based on the commands.
Note: for this to work, the build output needs to actually contain the raw compiler commands. Sometimes, e.g. with CMake-generated makefiles, it doesn't by default but there is an option to enable it - if so, be sure that the "Build command" specified in Project Properties | C/C++Build
contains that option.