CMAKECXXFLAGS
CMAKE_CXX_FLAGS is a CMake cache variable that stores extra command-line options to pass to the C++ compiler for all targets built by a project. It serves as the CMake analogue to CMAKE_C_FLAGS for C, and is commonly used to apply uniform warnings, standards, or other global compiler options across targets. In modern CMake, it is considered a legacy mechanism, and per-target options are preferred, but CMAKE_CXX_FLAGS remains widely seen in older projects.
Usage and behavior: CMAKE_CXX_FLAGS is a single string. You can append flags by modifying the variable, for
Per-configuration and generator considerations: CMake also defines per-configuration variants such as CMAKE_CXX_FLAGS_DEBUG, CMAKE_CXX_FLAGS_RELEASE, CMAKE_CXX_FLAGS_RELWITHDEBINFO, and CMAKE_CXX_FLAGS_MINSIZEREL.
Examples and best practices: A typical practice in older projects is to append common flags via CMAKE_CXX_FLAGS,
See also: CMAKE_C_FLAGS, CMAKE_CXX_STANDARD, target_compile_options, add_compile_options.