Lorenzo Pistone
Lorenzo Pistone

Reputation: 5188

Eclipse CDT default makefile: read CXXFLAGS variable?

Is there an option to force the generated makefile read the CXXFLAGS and CFLAGS variables and use them as most of makefiles do?

Upvotes: 3

Views: 2486

Answers (2)

Diego Dude
Diego Dude

Reputation: 9

I solved this problem by not selecting the "Use default build command" radio box in the C/C++ Build Setting.

Specify custom Build command: make -f Makefile. You can add additional compiler options in the $CCFLAGS defined in the targeted Makefile.

enter image description here

Upvotes: 0

Alexandru C.
Alexandru C.

Reputation: 3395

Eclipse CDT generated makefiles have the following lines included:

-include ../makefile.init

-include ../makefile.defs

You can create the file makefile.defs in which you define CFLAGS or CXXFLAGS and then go to project Properties -> C++ Build Properties -> Settings -> GCC or G++ compiler -> Miscellaneous. Here you can add your $(CFLAGS) or $(CXXFLAGS) option in the Other flags field.

This should add your additional options to the compiler command line.

Upvotes: 4

Related Questions