I do not think add_definitions() adds its arguments to CMAKE_CXX_FLAGS . In fact, as far as I can tell, they are not saved anywhere (except for arguments starting with -D or /D , which are added to COMPILE_DEFINITIONS ).
The easiest way to solve this would be, by calling add_definitions() , also manually add these flags to CMAKE_CXX_FLAGS .
To find out what is in CMAKE_CXX_FLAGS anywhere, you can do
message(STATUS ${CMAKE_CXX_FLAGS})
or check CMakeCache.txt in the build directory (either via ccmake or cmake-gui ).
source share