Commit 1fc92605 authored by Lynn Garren's avatar Lynn Garren
Browse files

check apple clang version for thread support

parent 4349c559
......@@ -224,16 +224,7 @@ macro( _clhep_check_cxxstd )
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()
_clhep_check_cxxstd()
# find pthread
if(CLHEP_SINGLE_THREAD)
set(CLHEP_THREAD_DEFINITION "#define CLHEP_THREAD_LOCAL")
else()
macro( _clhep_use_pthread )
set(CLHEP_THREAD_DEFINITION "#define CLHEP_THREAD_LOCAL thread_local")
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)
......@@ -245,6 +236,27 @@ macro( clhep_set_compiler_flags )
# needed when building with gcc on OSX
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread" )
endif()
endmacro( _clhep_use_pthread )
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()
_clhep_check_cxxstd()
# find pthread
if(CLHEP_SINGLE_THREAD)
set(CLHEP_THREAD_DEFINITION "#define CLHEP_THREAD_LOCAL")
elseif(CMAKE_COMPILER_IS_GNUCXX)
_clhep_use_pthread()
elseif( ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang" )
if( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0 )
set(CLHEP_THREAD_DEFINITION "#define CLHEP_THREAD_LOCAL")
else()
_clhep_use_pthread()
endif()
else()
set(CLHEP_THREAD_DEFINITION "#define CLHEP_THREAD_LOCAL")
endif()
if( CLHEP_DEBUG_MESSAGES )
message(STATUS "enable c++11 extensions: ${CMAKE_CXX_FLAGS}")
......
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