Skip to content

Commit 4f6359e

Browse files
nwellnhofjgm
authored andcommitted
Compile with latest supported C standard
Use latest C standard known to CMake. Remove CMAKE_C_STANDARD_REQUIRED to fall back to earlier versions. AFAIK, there's no way to set the minimum required version. But since we support C99 and it's unlikely that CMake supports C89-only compilers, this shouldn't be a problem.
1 parent 93e4801 commit 4f6359e

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ project(cmark
44
LANGUAGES C CXX
55
VERSION 0.31.2)
66

7-
set(CMAKE_C_STANDARD 99)
8-
set(CMAKE_C_STANDARD_REQUIRED YES)
7+
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.21)
8+
set(CMAKE_C_STANDARD 23)
9+
else()
10+
set(CMAKE_C_STANDARD 11)
11+
endif()
912
set(CMAKE_C_EXTENSIONS NO)
1013

1114
if(CMAKE_BUILD_TYPE STREQUAL Asan)

0 commit comments

Comments
 (0)