CMake disable -std=c++11 flag for C files
build, c++, c++11, cmake
Solution
Use `CMAKE_CXX_FLAGS` to set c++ specific flags:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
Problem
I'm trying to build bkchaind. One build option is to use cmake, so I installed it with Homebrew (OSX 10.9.1). When I do `cmake`, though, I get: ``` [ 2%] Building C object json-rpc-cpp/src/jsonrpc/CMakeFiles/jsonrpcStatic.dir/connectors/mongoose.c.o error: invalid argument '-std=c++11' not allowed with 'C/ObjC' ``` I am none too sure why `cmake` would try to pass a C++-specific compiler option to a C/ObjC file. If I comment out this line in the main `CMakeLists.txt` file: ``` ADD_DEFINITIONS(-std=c++11) ``` then it no longer passes the flag to any file. However, the C++ files do need it. How do I get `cmake` to include the flag for C++ files, but not for C files?