build: check if atomic routines are implicitly provided
It is possible for the atomic routines to be provided by the compiler without requiring any additional libraries. Check if that is the case before checking for a library. Patch by Matt Glazar! llvm-svn: 230452
This commit is contained in:
parent
671a29d30d
commit
5285c12008
|
@ -2,9 +2,13 @@
|
||||||
|
|
||||||
INCLUDE(CheckCXXSourceCompiles)
|
INCLUDE(CheckCXXSourceCompiles)
|
||||||
|
|
||||||
check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC)
|
check_function_exists(__atomic_fetch_add_4 HAVE___ATOMIC_FETCH_ADD_4)
|
||||||
if (HAVE_LIBATOMIC)
|
if( NOT HAVE___ATOMIC_FETCH_ADD_4 )
|
||||||
list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
|
check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC)
|
||||||
|
set(HAVE_LIBATOMIC False)
|
||||||
|
if( HAVE_LIBATOMIC )
|
||||||
|
list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
CHECK_CXX_SOURCE_COMPILES("
|
CHECK_CXX_SOURCE_COMPILES("
|
||||||
|
|
Loading…
Reference in New Issue