mirror of
https://github.com/minetest/minetest.git
synced 2024-09-21 20:10:17 +02:00
Only link -atomic on Clang and GCC
MSVC does not recognize /latomic.
This commit is contained in:
parent
3bd5169aee
commit
fb423071c6
|
@ -321,11 +321,13 @@ endif()
|
||||||
# Note that find_library does not reliably find it so we have to resort to this.
|
# Note that find_library does not reliably find it so we have to resort to this.
|
||||||
# Also, passing -latomic is not always the same as adding atomic to the library list.
|
# Also, passing -latomic is not always the same as adding atomic to the library list.
|
||||||
include(CheckCSourceCompiles)
|
include(CheckCSourceCompiles)
|
||||||
set(CMAKE_REQUIRED_LIBRARIES "-latomic")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GCC")
|
||||||
check_c_source_compiles("int main(){}" HAVE_LINK_ATOMIC)
|
set(CMAKE_REQUIRED_LIBRARIES "-latomic")
|
||||||
set(CMAKE_REQUIRED_LIBRARIES "")
|
check_c_source_compiles("int main(){}" HAVE_LINK_ATOMIC)
|
||||||
if(HAVE_LINK_ATOMIC)
|
set(CMAKE_REQUIRED_LIBRARIES "")
|
||||||
set(PLATFORM_LIBS ${PLATFORM_LIBS} "-latomic")
|
if(HAVE_LINK_ATOMIC)
|
||||||
|
set(PLATFORM_LIBS ${PLATFORM_LIBS} "-latomic")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(CheckSymbolExists)
|
include(CheckSymbolExists)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user