1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-04-30 20:53:52 +00:00

tests: add atomic flag if needed (#1000)

Fix https://github.com/CLIUtils/CLI11/issues/999.

This looks like about what we have to do. This test seems to be missing
from Meson, so don't have a workaround there yet.

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
Henry Schreiner 2024-02-06 10:49:45 -05:00 committed by GitHub
parent 30ead5da4d
commit fd483ea006
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -188,6 +188,18 @@ if(CMAKE_CXX_STANDARD GREATER 16)
target_compile_definitions(FuzzFailTest_Single PUBLIC -DTEST_FILE_FOLDER="${TEST_FILE_FOLDER}")
target_sources(FuzzFailTest_Single PUBLIC ${PROJECT_SOURCE_DIR}/fuzz/fuzzApp.cpp)
endif()
# Some platforms need to link to atomic
file(WRITE "${CMAKE_BINARY_DIR}/test_atomic.cpp"
"#include <atomic>\n" "int main() { std::atomic<int64_t> i(0); i++; return 0; }\n")
try_compile(ATOMIC_BUILD_SUCCEEDED "${CMAKE_BINARY_DIR}" "${CMAKE_BINARY_DIR}/test_atomic.cpp")
if(NOT ATOMIC_BUILD_SUCCEEDED)
target_link_libraries(FuzzFailTest PRIVATE atomic)
if(CLI11_SINGLE_FILE AND CLI11_SINGLE_FILE_TESTS)
target_link_libraries(FuzzFailTestSingle PRIVATE atomic)
endif()
endif()
file(REMOVE ${CMAKE_BINARY_DIR}/test_atomic.cpp)
endif()
# Add -Wno-deprecated-declarations to DeprecatedTest