I'm trying to introduce using CMake to build my C++ project. When I run make I get an error :
[ 11%] Building CXX object CMakeFiles/http://ift.tt/2s7Isof
In file included from /usr/include/c++/5/unordered_map:35:0,
...
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support...
I realise this is because CMake is not invoking C++11 when it needs to in order to enable the use of the unordered_map. After googling I know I need to use target_compile_features() in my CMakeLists.txt. But I can't find anywhere which gives me the syntax/arguments I need to use, there's just examples e.g. on the CMake page it gives :
add_library(mylib requires_constexpr.cpp)
target_compile_features(mylib PRIVATE cxx_constexpr)
But I don't need cxx_constexpr, I don't even know what that is. I need unordered_map.
Can anyone tell me the syntax I need to use please, preferably giving me some sort of reference to valid values to pass into that function.
Aucun commentaire:
Enregistrer un commentaire