Setting custom cflags in linux project?

Hi y’all,

I couldn’t quite figure out how to pass -DCMAKE_EXPORT_COMPILE_COMMANDS=ON to my openFrameworks in Linux in order to generate compile_commands.json automatically. Should be a no-brainer, but I just can’t get it to work. I tried setting it in config.make like so:

PROJECT_CFLAGS = -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

but this didn’t work…

Any pointers are most welcome!

K

1 Like

Hey @kflak1 ,

I’m really awful with make, cmake, etc. But in config.make, how about += instead of =:

PROJECT_CFLAGS += -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

The config.make file has some comments for PROJECT_CFLAGS and how they realate to PLATFORM_CFLAGS in the core configuration file(s). I wish I could be more help.

Thanks a lot! That actually helps me further. The compile_commands.json is not generated, but the flag is picked up by the compiler, so now I know where to keep looking.

K