Require c11 atomics

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)

apparently is not enough, and gcc 4.8.5 e.g. passes whatever checks are
done for the above but doesn't support c11 atomics. Let's just check for
them explicitly.
This commit is contained in:
Andrew Noyes 2020-05-18 16:22:38 +00:00
parent 747243e9cb
commit 55f0b13fe9
1 changed files with 6 additions and 0 deletions

View File

@ -89,6 +89,12 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
include(CheckIncludeFile)
CHECK_INCLUDE_FILE("stdatomic.h" HAS_C11_ATOMICS)
if (NOT HAS_C11_ATOMICS)
message(FATAL_ERROR "C compiler does not support c11 atomics")
endif()
if(WIN32)
# see: https://docs.microsoft.com/en-us/windows/desktop/WinProg/using-the-windows-headers
# this sets the windows target version to Windows Server 2003