Skip to content

Commit

Permalink
Add check for latomic
Browse files Browse the repository at this point in the history
  • Loading branch information
pghysels committed Jan 20, 2023
1 parent 1a6831e commit be6d1f6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,23 @@ endif()
# with clang
set_property(TARGET strumpack PROPERTY POSITION_INDEPENDENT_CODE ON)


# see https://github.com/pghysels/STRUMPACK/issues/82
# TODO check if 32bit, check compiler??
set(ATOMIC_TEST_SOURCE "#include <atomic>
int main() { std::atomic<int64_t> i(0); i++; return 0; }")
check_cxx_source_compiles("${ATOMIC_TEST_SOURCE}" ATOMIC_INT64_IS_BUILTIN)
if(NOT ATOMIC_INT64_IS_BUILTIN)
set(CMAKE_REQUIRED_LIBRARIES atomic)
check_cxx_source_compiles(
"${ATOMIC_TEST_SOURCE}" ATOMIC_INT64_REQUIRES_LIBATOMIC)
if (ATOMIC_INT64_REQUIRES_LIBATOMIC)
target_link_libraries(strumpack PRIVATE atomic)
endif()
unset(CMAKE_REQUIRED_LIBRARIES)
endif()


add_subdirectory(src)

target_sources(strumpack
Expand Down

0 comments on commit be6d1f6

Please sign in to comment.