From cf421243be61a318492f125601625ec55c83e606 Mon Sep 17 00:00:00 2001 From: Davis King Date: Tue, 5 Jul 2016 07:03:38 -0400 Subject: [PATCH] Made this cmake script always enable whatever partial C++11 support your compiler has. --- dlib/cmake_utils/use_cpp_11.cmake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dlib/cmake_utils/use_cpp_11.cmake b/dlib/cmake_utils/use_cpp_11.cmake index 9e48c6b7b..047dc1250 100644 --- a/dlib/cmake_utils/use_cpp_11.cmake +++ b/dlib/cmake_utils/use_cpp_11.cmake @@ -72,3 +72,17 @@ else() endif() endif() +# Always enable whatever partial C++11 support we have, even if it isn't full support. +if (NOT COMPILER_CAN_DO_CPP_11) + include(CheckCXXCompilerFlag) + CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) + CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) + if(COMPILER_SUPPORTS_CXX11) + message(STATUS "C++11 activated (compiler doesn't have full C++11 support).") + add_global_compiler_switch("-std=c++11") + elseif(COMPILER_SUPPORTS_CXX0X) + message(STATUS "C++0x activated (compiler doesn't have full C++11 support).") + add_global_compiler_switch("-std=c++0x") + endif() +endif() +