mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 10:05:10 +00:00
Enable C99 explicitly with CMake where available
This enables compilation as C99 where supported by the compiler. A workaround with per-compiler hardcoded flags is used for CMake 3.0, which does not support the C_STANDARD target property. Fixes #1560. Closes #1576.
This commit is contained in:
parent
f71b55f83d
commit
8f852e0833
@ -100,6 +100,16 @@ set_target_properties(glfw PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
FOLDER "GLFW3")
|
||||
|
||||
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.1.0")
|
||||
set_target_properties(glfw PROPERTIES C_STANDARD 99)
|
||||
else()
|
||||
# Remove this fallback when removing support for CMake version less than 3.1
|
||||
target_compile_options(glfw PRIVATE
|
||||
"$<$<C_COMPILER_ID:AppleClang>:-std=c99>"
|
||||
"$<$<C_COMPILER_ID:Clang>:-std=c99>>"
|
||||
"$<$<C_COMPILER_ID:GNU>:-std=c99>>")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(glfw PRIVATE _GLFW_USE_CONFIG_H)
|
||||
target_include_directories(glfw PUBLIC
|
||||
"$<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>"
|
||||
|
Loading…
Reference in New Issue
Block a user