[CMake] C++11 flag not being added

Matthew S Wallace mwallace at ccmtrading.com
Tue Oct 13 11:22:36 EDT 2015


I have the following two lines in my CMakeLists.txt

set_property(GLOBAL PROPERTY CXX_STANDARD 11)
set_property(GLOBAL PROPERTY CXX_STANDARD_REQUIRED)

However when compiling some of my source files, the -std=c++11 flag is not added.

Just for good measure I added:
target_compile_features(my_target PRIVATE cxx_strong_enums) to the target that was having the problem.

Not sure if it matters, but in this case the compile error I’m getting is complaining because I’m referencing a fully scoped enum.  If I explicitly include -std=c++11 in my compile flags, everything works.

I’m thinking I’m probably just misunderstanding how CXX_STANDARD works, but any help would be appreciated.

-Matt


More information about the CMake mailing list