From b155608bffd4e599d26fb648327705946458e012 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Fri, 24 Mar 2023 16:22:15 +0700 Subject: [PATCH] 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. --- cmake.deps/CMakeLists.txt | 1 + cmake.deps/cmake/LibvtermCMakeLists.txt | 2 -- cmake.deps/cmake/TreesitterCMakeLists.txt | 2 +- cmake.deps/cmake/TreesitterParserCMakeLists.txt | 1 - cmake.deps/cmake/libtermkeyCMakeLists.txt | 3 --- 5 files changed, 2 insertions(+), 7 deletions(-) diff --git a/cmake.deps/CMakeLists.txt b/cmake.deps/CMakeLists.txt index 48a96b1bd8..665503aded 100644 --- a/cmake.deps/CMakeLists.txt +++ b/cmake.deps/CMakeLists.txt @@ -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) diff --git a/cmake.deps/cmake/LibvtermCMakeLists.txt b/cmake.deps/cmake/LibvtermCMakeLists.txt index 0fb3227117..7b1d95f531 100644 --- a/cmake.deps/cmake/LibvtermCMakeLists.txt +++ b/cmake.deps/cmake/LibvtermCMakeLists.txt @@ -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) diff --git a/cmake.deps/cmake/TreesitterCMakeLists.txt b/cmake.deps/cmake/TreesitterCMakeLists.txt index 759fa93bb0..9017436ef5 100644 --- a/cmake.deps/cmake/TreesitterCMakeLists.txt +++ b/cmake.deps/cmake/TreesitterCMakeLists.txt @@ -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) diff --git a/cmake.deps/cmake/TreesitterParserCMakeLists.txt b/cmake.deps/cmake/TreesitterParserCMakeLists.txt index 9bdf500aa7..42386185e7 100644 --- a/cmake.deps/cmake/TreesitterParserCMakeLists.txt +++ b/cmake.deps/cmake/TreesitterParserCMakeLists.txt @@ -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 diff --git a/cmake.deps/cmake/libtermkeyCMakeLists.txt b/cmake.deps/cmake/libtermkeyCMakeLists.txt index 95d4a54549..cefe14e515 100644 --- a/cmake.deps/cmake/libtermkeyCMakeLists.txt +++ b/cmake.deps/cmake/libtermkeyCMakeLists.txt @@ -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})