Append compile flags to CFLAGS and CXXFLAGS while configuration/make

后端 未结 1 1408
花落未央
花落未央 2020-12-08 04:35

The project that I am trying to build has default flags

CFLAGS = -Wall -g -O2

CXXFLAGS = -g -O2

I need to append a flag -w t

相关标签:
1条回答
  • 2020-12-08 05:25

    You almost have it right; why did you add the semicolon?

    To do it on the configure line:

     ./configure CFLAGS='-g -O2 -w' CXXFLAGS='-g -O2 -w'
    

    To do it on the make line:

     make CFLAGS='-g -O2 -w' CXXFLAGS='-g -O2 -w'
    

    However, that doesn't really remove consider all warnings as errors; that removes all warnings. So specifying both -Wall and -w doesn't make sense. If you want to keep the warnings but not have them considered errors, use the -Wall -Wno-error flags.

    Alternatively, most configure scripts which enable -Werror by default also have a flag such as --disable-werror or similar. Run ./configure --help and see if there's something like that.

    0 讨论(0)
提交回复
热议问题