web-dev-qa-db-fra.com

Passer `-std = c ++ 11` à CMakeLists?

Je viens d'installer Qt Creator et j'utilise la syntaxe C++ 11.

Malheureusement, lorsque j'essaie de construire mon projet, j'obtiens:

/usr/include/c++/4.8/bits/c++0x_warning.h:32: error:
      #error This file requires compiler and library support for the ISO C++ 2011
             standard. This support is currently experimental, and must be
             enabled with the -std=c++11 or -std=gnu++11 compiler options.
      #error This file requires compiler and library support for the \
       ^

Ensuite, un tas d'erreurs comme "Tuple pas membre de std".

Mon CMakeLists.txt contient:

project(routing_tests)
set(QMAKE_CXXFLAGS "-std=c++11")
cmake_minimum_required(VERSION 2.8)
aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})

EDIT: petit test élémentaire montrant le problème https://Gist.github.com/anonymous/817107

16
A T

main.cpp

#include <iostream>
#include <Tuple>

int main() {
    auto foo = std::make_Tuple("bar", "foo", "can");
    std::cout << std::get<0>(foo) << std::get<1>(foo) << std::get<2>(foo);
} 

CMakeLists.txt

project(Tuple_tests)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# C++14: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
cmake_minimum_required(VERSION 2.8)
aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})
37
lpapp