Skip to content
Snippets Groups Projects
Commit 362093c4 authored by adrien-matta's avatar adrien-matta
Browse files

* Fixing project compilation issue on clang4.2

parent eb411c96
No related branches found
No related tags found
No related merge requests found
...@@ -25,20 +25,24 @@ link_directories( ${ROOT_LIBRARY_DIR}) ...@@ -25,20 +25,24 @@ link_directories( ${ROOT_LIBRARY_DIR})
include_directories( ${NPTOOL_INCLUDE_DIR}) include_directories( ${NPTOOL_INCLUDE_DIR})
link_directories( ${NPTOOL_LIB_DIR}) link_directories( ${NPTOOL_LIB_DIR})
# If the compiler is Clang, silence the unrecognised flags # Check for user disabling of c++11 support
if(${CMAKE_CXX_COMPILER_ID} MATCHES ".*Clang.*") string(COMPARE EQUAL "${CPP11}" "no" nocpp11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -undefined dynamic_lookup") if(nocpp11)
message(" -> C++11 support disable")
endif() endif()
# If the compiler is Clang, silence the unrecognised flags # If the compiler is Clang, silence the unrecognised flags
if(${CMAKE_CXX_COMPILER_ID} MATCHES ".*Clang.*") if(${CMAKE_CXX_COMPILER_ID} MATCHES ".*Clang.*")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics -undefined dynamic_lookup")
if( UNIX AND NOT APPLE ) if( UNIX AND NOT APPLE )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif() endif()
if( APPLE AND CLANG_VERSION_MAJOR VERSION_LESS 5 AND NOT nocpp11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
endif() endif()
# Adjust the compiler language flag # Adjust the compiler language flag
set(NOCPPFLAGS true) set(NOCPPFLAGS true)
if(${CMAKE_CXX_FLAGS} MATCHES ".*std=.*11") if(${CMAKE_CXX_FLAGS} MATCHES ".*std=.*11")
...@@ -49,13 +53,13 @@ endif() ...@@ -49,13 +53,13 @@ endif()
if(NOCPPFLAGS) if(NOCPPFLAGS)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX11) if(COMPILER_SUPPORTS_CXX11 AND NOT nocpp11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else() else()
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
endif() endif()
if(COMPILER_SUPPORTS_CXX0X) if(COMPILER_SUPPORTS_CXX0X AND NOT nocpp11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
endif() endif()
endif() endif()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment