diff --git a/CMakeLists.txt b/CMakeLists.txt index 590fd8d49..b4f3c43f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,4 @@ +message(STATUS "cmake verison: ${CMAKE_VERSION}") cmake_minimum_required(VERSION 2.8.7) project(libiio C) @@ -77,6 +78,13 @@ if (CMAKE_COMPILER_IS_GNUCC) if (HAS_WPEDANTIC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpedantic") endif() + # cmake 2.8 doesn't support C_STANDARD defined in set_target_properties + if (${CMAKE_VERSION} VERSION_LESS "3.2") + check_c_compiler_flag(-std=c99 HAS_C99) + if (HAS_C99) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") + endif() + endif() endif() if(APPLE)