From 22e8b110339b0c50dbd38f6e97652c7f2254ab64 Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Tue, 3 Jan 2017 00:14:57 +0800 Subject: [PATCH] cmake: fix c99 mode for old versions of cmake --- CMakeLists.txt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f15337..71714fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,17 @@ cmake_minimum_required(VERSION 2.8) -# enable C99 mode +project(ttyd) + if(CMAKE_VERSION VERSION_LESS "3.1") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") + if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") + endif() else() - set (CMAKE_C_STANDARD 99) + set(CMAKE_C_STANDARD 99) endif() -project(ttyd) - set(LIBWEBSOCKETS_MIN_VERSION 1.7.0) set(SOURCE_FILES src/server.c src/http.c src/protocol.c src/utils.c) -- 2.43.4