diff --git a/NPLib/CMakeLists.txt b/NPLib/CMakeLists.txt index 35bd754647669bc9202985e5c8ec4498f89dbb66..5b621f67fbdca843424898cc33a87f604759f269 100644 --- a/NPLib/CMakeLists.txt +++ b/NPLib/CMakeLists.txt @@ -29,18 +29,24 @@ set(CMAKE_INSTALL_MESSAGE LAZY) # look for Root include("ressources/CMake/Root.cmake") +# Check for user disabling of c++11 support +string(COMPARE EQUAL "${CPP11}" "no" nocpp11) +if(nocpp11) + message(" -> C++11 support disable") +endif() + + # If the compiler is Clang, silence the unrecognised flags if(${CMAKE_CXX_COMPILER_ID} MATCHES ".*Clang.*") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics") if( UNIX AND NOT APPLE ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") endif() - if( APPLE AND CLANG_VERSION_MAJOR VERSION_LESS 5) + if( APPLE AND CLANG_VERSION_MAJOR VERSION_LESS 5 AND NOT nocpp11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") endif() endif() - # Adjust the compiler language flag set(NOCPPFLAGS true) if(${CMAKE_CXX_FLAGS} MATCHES ".*std=.*11") @@ -49,11 +55,6 @@ elseif(${CMAKE_CXX_FLAGS} MATCHES ".*std=.*0x") set(NOCPPFLAGS false) endif() -string(COMPARE EQUAL "${CPP11}" "no" nocpp11) -if(nocpp11) - message(" -> C++11 support disable") -endif() - if(NOCPPFLAGS) CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) if(COMPILER_SUPPORTS_CXX11 AND NOT nocpp11)