CFLAGS vs CPPFLAGS

The implicit make rule for compiling a C program is %.o:%.c $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< where the $() syntax expands the variables. As both CPPFLAGS and CFLAGS are used in the compiler call, which you use to define include paths is a matter of personal taste. For instance if foo.c is a … Read more

Set CFLAGS and CXXFLAGS options using CMake

You need to set the flags after the project command in your CMakeLists.txt. Also, if you’re calling include(${QT_USE_FILE}) or add_definitions(${QT_DEFINITIONS}), you should include these set commands after the Qt ones since these would append further flags. If that is the case, you maybe just want to append your flags to the Qt ones, so change … Read more