

You can easily introduce your own build type like ALL_WARNINGS. Later, CMake would expect that the user modifies the CMAKE_CXX_FLAGS cached variable directly to append things, e.g., by using an editor like ccmake commit with CMake. So you can initially call: cmake -E env CXXFLAGS="-Wall" cmake.

The initial content from the cached CMAKE_CXX_FLAGS variable is a combination of CMAKE_CXX_FLAGS_INIT set by CMake itself during OS/toolchain detection and whatever is set in the CXXFLAGS environment variable. Here are some of the possibilities (excluding the more complex toolchain variants): Append Compiler Flags But there are two things you have to differentiate in CMake: the first call to generate the build environment and all consecutive calls for regenerating that build environment after changes to your CMakeLists.txt files or dependencies.

Yes, you can append compiler and linker options.
