Author Topic: CFLAGS vs CPPFLAGS  (Read 6035 times)

steveth45

  • Guest
CFLAGS vs CPPFLAGS
« on: February 12, 2007, 11:02:28 am »
I've successfully converted Irrlicht (an open source 3D rendering engine) to a standard C::B project, not using the Makefile.  I did this so I could easily set up a debug build of the library.  It works, but there is one catch, I can't seem to configure separate options for the compilation of .c vs .cpp files.  This is done easily in the Makefile with these lines:

CXXFLAGS = -Wno-reorder // this is only used when compiling .cpp files
CFLAGS = -fexpensive-optimizations -O3 // this is only used when compiling .c files

Is there any way in a normal Code::Blocks project to differentiate compiler options for .c and .cpp files in the same project?  Right now it builds fine, but there are a bunch of warnings compiling the .c files since -Wno-reorder is not a valid option for gcc.  Also, the .cpp files shouldn't be compiled with the -O3 option in this particular project.  It seems to be introducing some subtle bugs.

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: CFLAGS vs CPPFLAGS
« Reply #1 on: February 12, 2007, 02:13:33 pm »
If you can find a way of separating the C and C++ sources into separate targets, you can then set the Build Options for each target individually. Beyond that, C::B doesn't yet support this functionality.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)