build: set CMAKE_C_STANDARD to 99 for all dependencies

Older gcc versions (4.x) require passing --std=c99 compiler flag to
prevent warnings from being emitted. Instead of setting it for each
dependency, it's easier to just pass the CMAKE_C_STANDARD flag to all
dependencies. This also prevents the scenario of us forgetting to set it
if we add new dependencies.
This commit is contained in:
dundargoc 2023-03-24 16:22:15 +07:00 committed by GitHub
parent a478fd4175
commit b155608bff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 2 additions and 7 deletions

View File

@ -14,6 +14,7 @@ include(Util)
set(DEPS_CMAKE_ARGS
-D CMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-D CMAKE_C_STANDARD=99
-D CMAKE_GENERATOR=${CMAKE_GENERATOR}
-D CMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
-D CMAKE_POSITION_INDEPENDENT_CODE=ON)

View File

@ -5,8 +5,6 @@ include(GNUInstallDirs)
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
else()
add_compile_options(-std=c99)
endif()
include_directories(${CMAKE_SOURCE_DIR}/include)

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.10)
project(tree-sitter C)
set(CMAKE_C_STANDARD 99)
add_library(tree-sitter lib/src/lib.c)
target_include_directories(tree-sitter
PRIVATE lib/src lib/include)

View File

@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 3.10)
project(parser C)
set(CMAKE_C_STANDARD 99)
file(GLOB source_files src/*.c)
add_library(parser

View File

@ -3,9 +3,6 @@ project(libtermkey C)
add_definitions(-D _CRT_SECURE_NO_WARNINGS)
add_definitions(-DHAVE_UNIBILIUM)
if(NOT MSVC)
add_compile_options(-std=c99)
endif()
include_directories(${PROJECT_BINARY_DIR}/t)
include_directories(SYSTEM ${UNIBILIUM_INCLUDE_DIRS})