Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CMakeLists.txt to fix MacOS build #14160

Merged
merged 13 commits into from
Dec 27, 2023
3 changes: 2 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,13 @@ endif()
# On clang and gcc, some functionalities of std::atomic require -latomic.
# See <https://en.cppreference.com/w/cpp/atomic/atomic#Notes>.
# 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.
Desour marked this conversation as resolved.
Show resolved Hide resolved
include(CheckCSourceCompiles)
set(CMAKE_REQUIRED_LIBRARIES "-latomic")
check_c_source_compiles("int main(){}" HAVE_LINK_ATOMIC)
set(CMAKE_REQUIRED_LIBRARIES "")
if(HAVE_LINK_ATOMIC)
set(PLATFORM_LIBS ${PLATFORM_LIBS} atomic)
set(PLATFORM_LIBS ${PLATFORM_LIBS} "-latomic")
endif()

check_include_files(endian.h HAVE_ENDIAN_H)
Expand Down