From 24dd2366148a97313c905cb87dc1a9c07e57506f Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Mon, 17 Nov 2014 22:53:42 +0800 Subject: [PATCH] check more c++11 features --- CMakeLists.txt | 16 +++++++++++++--- test/.gitattributes | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 test/.gitattributes diff --git a/CMakeLists.txt b/CMakeLists.txt index f17578b..b1f5413 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,10 +84,20 @@ else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") endif() -include(CheckCXXCompilerFlag) -check_cxx_compiler_flag("${CMAKE_CXX_FLAGS}" CXX0X_SUPPORT) +# check the C++11 features we need +include(CheckCXXSourceCompiles) +check_cxx_source_compiles(" +#include +int main() +{ + char * ptr = nullptr; + std::vector v; + auto f = [&](){ for(auto & i : v) ++i; }; + f(); +} +" CXX0X_SUPPORT) if(NOT CXX0X_SUPPORT) - message(FATAL_ERROR "Error: your compiler does not support C++0x, please update it.") + message(FATAL_ERROR "Error: your compiler does not support C++0x/C++11, please update it.") endif() diff --git a/test/.gitattributes b/test/.gitattributes new file mode 100644 index 0000000..d72fd52 --- /dev/null +++ b/test/.gitattributes @@ -0,0 +1 @@ +*.pdf binary