Commit b4690256 authored by Lynn Garren's avatar Lynn Garren
Browse files

CLHEP_BUILD_CXXSTD

parent 00050fce
......@@ -3,6 +3,7 @@
# cmake [-DCMAKE_INSTALL_PREFIX=/install/path]
# [-DCMAKE_BUILD_TYPE=Debug|Release|RelWithDebInfo|MinSizeRel]
# [-DCMAKE_C_COMPILER=...] [-DCMAKE_CXX_COMPILER=...]
# [-DCLHEP_BUILD_CXXSTD=ON] (c++11 extensions and thread support)
# [-DCLHEP_BUILD_DOCS=ON]
# [-DLIB_SUFFIX=64]
# /path/to/source
......@@ -10,8 +11,6 @@
# make test
# make install
#
# to enable thread support: -DCMAKE_CXX_FLAGS="-pthread -std=c++11 -Wno-deprecated-declarations"
#
# mac i386: -DCMAKE_CXX_FLAGS="-m32" -DCMAKE_OSX_ARCHITECTURES="i386"
# mac x86_64: -DCMAKE_CXX_FLAGS="-m64" -DCMAKE_OSX_ARCHITECTURES="x86_64"
#
......
......@@ -85,12 +85,38 @@ macro( clhep_autoconf_variables )
endmacro( clhep_autoconf_variables )
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}")
get_filename_component(clhep_cxx_compiler ${CMAKE_CXX_COMPILER} NAME)
if( ${clhep_cxx_compiler} STREQUAL "clang++" )
if( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2.9 )
message( FATAL_ERROR "c++11 extensions are not available for ${CMAKE_CXX_COMPILER_ID}${CMAKE_CXX_COMPILER_VERSION}")
else()
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -ftls-model=initial-exec -pthread -Wno-deprecated-declarations" )
endif()
elseif(CMAKE_COMPILER_IS_GNUCXX)
if( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.3 )
message( FATAL_ERROR "c++11 extensions are not available for ${CMAKE_CXX_COMPILER_ID}${CMAKE_CXX_COMPILER_VERSION}")
elseif( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7 )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -ftls-model=initial-exec -pthread -Wno-deprecated-declarations" )
else()
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -ftls-model=initial-exec -pthread -Wno-deprecated-declarations" )
endif()
endif()
endmacro( _clhep_check_cxxstd )
macro( clhep_set_compiler_flags )
##message(STATUS "incoming cmake build type is ${CMAKE_BUILD_TYPE}")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "" FORCE)
endif()
message(STATUS "cmake build type is ${CMAKE_BUILD_TYPE}")
if( CLHEP_BUILD_CXXSTD )
_clhep_check_cxxstd()
message(STATUS "enable c++11 extensions: ${CMAKE_CXX_FLAGS}")
endif()
#message(STATUS "cmake compilers ${CMAKE_CXX_COMPILER} ${CMAKE_C_COMPILER}")
get_filename_component(clhep_cxx_compiler ${CMAKE_CXX_COMPILER} NAME)
get_filename_component(clhep_c_compiler ${CMAKE_C_COMPILER} NAME)
......
Markdown is supported
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