Skip to content

Commit

Permalink
build: clean up after failed -fconcepts detection
Browse files Browse the repository at this point in the history
The cmake code sets CMAKE_REQUIRED_FLAGS to "-fconcepts" in order
to see if that flag is available. But if not (as is expected with
clang), it leaves CMAKE_REQUIRED_FLAGS, and so every following test
becomes poisoned, since it will fail on the unsupported flag.

This break the membarrier test which follows. As a result membarrier()
will not be used even if it is available. This is more or less okay
on x86 which has a fallback (even there, the fallback is pretty bad
on large machines), but on aarch64 there is no fallback, so Seastar
programs spin even when they have nothing to do.

Fix this by clearing the flag after the test. In order to change
as little as possible, if the test succeeded, we set it again.
Message-Id: <[email protected]>
  • Loading branch information
avikivity authored and penberg committed Nov 20, 2020
1 parent 27e8207 commit 010fb0d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmake/FindConcepts.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ include (CheckCXXSourceCompiles)
file (READ ${CMAKE_CURRENT_LIST_DIR}/code_tests/Concepts_test.cc _concepts_test_code)
set (CMAKE_REQUIRED_FLAGS -fconcepts)
check_cxx_source_compiles ("${_concepts_test_code}" Concepts_FOUND)
set (CMAKE_REQUIRED_FLAGS "")

if (Concepts_FOUND AND NOT (TARGET Concepts::concepts))
set (CMAKE_REQUIRED_FLAGS -fconcepts)
add_library (Concepts::concepts INTERFACE IMPORTED)

set_target_properties (Concepts::concepts
Expand Down

0 comments on commit 010fb0d

Please sign in to comment.