Commit 14281fa4 authored by Lynn Garren's avatar Lynn Garren
Browse files

CLHEP requires c++11 compliance

parent 8af9c18f
......@@ -87,6 +87,7 @@ macro( clhep_autoconf_variables )
endmacro( clhep_autoconf_variables )
macro( _clhep_verify_cxx0x )
message( FATAL_ERROR "The c++0x extension is no longer supported. Please use gcc 4.7.1 or later and c++11 or later.")
if( ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" )
if( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2.9 )
message( FATAL_ERROR "c++0x extension is not available for ${CMAKE_CXX_COMPILER_ID}${CMAKE_CXX_COMPILER_VERSION}")
......@@ -159,14 +160,16 @@ macro( _clhep_verify_cxx14 )
endmacro( _clhep_verify_cxx14 )
macro( _clhep_check_cxxstd )
##message(STATUS "_clhep_check_cxxstd debug: CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
##message(STATUS "_clhep_check_cxxstd debug: CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")
##message(STATUS "_clhep_check_cxxstd debug: CMAKE_CXX_COMPILER_VERSION: ${CMAKE_CXX_COMPILER_VERSION}")
##message(STATUS "_clhep_check_cxxstd debug: CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
##message(STATUS "_clhep_check_cxxstd debug: CLHEP_BUILD_CXXSTD: ${CLHEP_BUILD_CXXSTD}")
if( CLHEP_DEBUG_MESSAGES )
message(STATUS "_clhep_check_cxxstd debug: CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
message(STATUS "_clhep_check_cxxstd debug: CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "_clhep_check_cxxstd debug: CMAKE_CXX_COMPILER_VERSION: ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "_clhep_check_cxxstd debug: CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
message(STATUS "_clhep_check_cxxstd debug: CLHEP_BUILD_CXXSTD: ${CLHEP_BUILD_CXXSTD}")
endif( CLHEP_DEBUG_MESSAGES )
set( HAVE_STDCXX )
if( "${CLHEP_BUILD_CXXSTD}" STREQUAL "-std=c++0x" )
_clhep_verify_cxx0x( )
message( FATAL_ERROR "The c++0x extension is no longer supported. Please use gcc 4.7.1 or later and c++11 or later.")
elseif( "${CLHEP_BUILD_CXXSTD}" STREQUAL "-std=c++11" )
_clhep_verify_cxx11()
elseif( "${CLHEP_BUILD_CXXSTD}" STREQUAL "-std=c++1y" )
......@@ -183,14 +186,15 @@ macro( _clhep_check_cxxstd )
if( ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CLHEP_BUILD_CXXSTD} -pthread" )
elseif(CMAKE_COMPILER_IS_GNUCXX)
set( CMAKE_CXX_FLAGS "${CLHEP_BUILD_CXXSTD} -pthread ${CMAKE_CXX_FLAGS}" )
set( CMAKE_CXX_FLAGS "${CLHEP_BUILD_CXXSTD} -pthread ${CMAKE_CXX_FLAGS} -D_GNU_SOURCE" )
else()
message(STATUS "clhep_set_compiler_flags: Do not know how to set c++11 extensions for ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "clhep_set_compiler_flags: Do not know how to set ${CLHEP_BUILD_CXXSTD} extensions for ${CMAKE_CXX_COMPILER_ID}")
endif()
endif()
endmacro( _clhep_check_cxxstd )
macro( _clhep_check_for_pthread )
message( FATAL_ERROR "_clhep_check_for_pthread should no longer be used. CLHEP now requires gcc 4.7.1 or later with c++11 or later.")
##message(STATUS "_clhep_check_for_pthread debug: CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
set( HAVE_STDCXX )
if( NOT "${CMAKE_CXX_FLAGS}" STREQUAL "" )
......@@ -223,12 +227,12 @@ macro( clhep_set_compiler_flags )
endif()
##message(STATUS "clhep_set_compiler_flags debug: CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
message(STATUS "cmake build type is ${CMAKE_BUILD_TYPE}")
if( CLHEP_BUILD_CXXSTD )
#if( CLHEP_BUILD_CXXSTD )
_clhep_check_cxxstd()
message(STATUS "enable c++11 extensions: ${CMAKE_CXX_FLAGS}")
else()
_clhep_check_for_pthread()
endif()
#else()
# _clhep_check_for_pthread()
#endif()
#message(STATUS "clhep_set_compiler_flags debug: CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
#message(STATUS "cmake compilers ${CMAKE_CXX_COMPILER} ${CMAKE_C_COMPILER}")
get_filename_component(clhep_cxx_compiler ${CMAKE_CXX_COMPILER} NAME)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment