Skip to content

Commit

Permalink
Select C standard based on Python version
Browse files Browse the repository at this point in the history
  • Loading branch information
jesper-friis committed Dec 15, 2024
1 parent 74c0f5b commit 8417948
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,13 @@ option(WITH_STATIC_PYTHON "Whether to compile with static python libraries" NO)
# Append our cmake-modules to CMAKE_MODULE_PATH
list(APPEND CMAKE_MODULE_PATH ${dlite_SOURCE_DIR}/cmake)

# Enable C11
# DLite was developed with C99, but since Python 3.12 started to require
# C11, DLite has switched to C11 too
if(WIN32)
# Select C standard to be consistent with Python. Default to c11
if(PYTHON_VERSION AND PYTHON_VERSION VERSION_LESS "3.11")
set(CMAKE_C_STANDARD 99)
else()
set(CMAKE_C_STANDARD 11)
endif()
message(STATUS "CMAKE_C_STANDARD=${CMAKE_C_STANDARD}")

# Set default cmake configurations
include(SetDefaults)
Expand Down

0 comments on commit 8417948

Please sign in to comment.