CXXFLAGS
also: CXXFLAGS environment variable
An environment variable that specifies compiler flags passed to the C++ compiler during the build process. Common flags control optimization levels, include paths, and warning settings.
CXXFLAGS is used by build systems (like Make or Autoconf) to pass options to C++ compilers such as g++ or clang++. When you run make or ./configure && make, the build system reads this variable and applies the flags to every C++ compilation command.
Common flags include -O2 (optimization level 2), -Wall (enable warnings), -I/path/to/include (add include directories), and -DDEFINE (define preprocessor macros). For example: CXXFLAGS="-O2 -Wall -std=c++17" tells the compiler to optimize code, show warnings, and use the C++17 standard.
You can set CXXFLAGS before building a project: export CXXFLAGS="-O3 -march=native"; ./configure; make. This is useful for tuning compilation without modifying source files or build scripts.