Search code examples
eclipse-cdt

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?


Solution

  • 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.