From ed0891328d6eb4a0f0455eeb3289df75136c8ea5 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Tue, 17 Dec 2024 10:19:35 -0800 Subject: [PATCH] build: enable C11 globally and C11 atomics on MSVC This accounts for local changes to the repository that are unguarded and undocumented. --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 85b9557fbc..9dcb4ddea6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,12 @@ cmake_minimum_required(VERSION 3.24) project(LMDB LANGUAGES C) +set(CMAKE_C_STANDARD 11) + +if("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_C_COMPILER_SIMULATE_ID}" STREQUAL "MSVC") + add_compile_options(/experimental:c11atomics) +endif() + # Set the build artifact directories to ensure that the generated products are # colocated and findable for wiring up into the test suites across repositories. # This pattern is applied to all Swift and LLVM repositories.