mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
chore(cmake): Fix CheckAtomic.cmake to check sub-word atomics
Platforms like riscv64 does have 32-bit or 64-bit atomics, but not 8-bit or 16-bit. Modified `check_working_cxx_atomics` to check sub-word atomics as well.
This commit is contained in:
parent
a6d15140b1
commit
8ab8b2fef9
|
@ -27,9 +27,12 @@ function(check_working_cxx_atomics varname)
|
||||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11")
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11")
|
||||||
CHECK_CXX_SOURCE_COMPILES("
|
CHECK_CXX_SOURCE_COMPILES("
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
std::atomic<int> x;
|
#include <cstdint>
|
||||||
|
std::atomic<uint8_t> x1;
|
||||||
|
std::atomic<uint16_t> x2;
|
||||||
|
std::atomic<uint32_t> x3;
|
||||||
int main() {
|
int main() {
|
||||||
return x;
|
return ++x1 + ++x2 + ++x3;
|
||||||
}
|
}
|
||||||
" ${varname})
|
" ${varname})
|
||||||
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
|
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user