From: Shuanglei Tao Date: Mon, 2 Jan 2017 16:14:57 +0000 (+0800) Subject: cmake: fix c99 mode for old versions of cmake X-Git-Url: http://git.prime8.dev/?a=commitdiff_plain;h=22e8b110339b0c50dbd38f6e97652c7f2254ab64;p=ttyd.git cmake: fix c99 mode for old versions of cmake --- 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)