From 9dc702fb9f861cd323604fec4ec23edbf82a1b35 Mon Sep 17 00:00:00 2001
From: adrien-matta <a.matta@surrey.ac.uk>
Date: Wed, 3 Feb 2016 11:08:48 +0000
Subject: [PATCH] * Trying to fix error when disabling C++11 support

---
 NPLib/CMakeLists.txt | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/NPLib/CMakeLists.txt b/NPLib/CMakeLists.txt
index 35bd75464..5b621f67f 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)
-- 
GitLab