summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-09 13:11:25 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-09 13:11:25 +0200
commit7831e0165ae752c15474d4baa897c41958750f77 (patch)
tree6b12988bba8d01c5778c769db23bfaabd5eb04eb
parentfc0c8ab6205304052a1ecdc65586b36b7a1c706d (diff)
Check compiler version to ensure a minimal version.
Change-Id: I619ba2c41e9e5f46b1d10d31510794b6577fce85 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--reference/etc/config.cmake5
-rw-r--r--reference/etc/macros.cmake8
2 files changed, 10 insertions, 3 deletions
diff --git a/reference/etc/config.cmake b/reference/etc/config.cmake
index a88fcf0..596cfbb 100644
--- a/reference/etc/config.cmake
+++ b/reference/etc/config.cmake
@@ -44,10 +44,9 @@ set(PROJECT_LANGUAGES,"C")
# ----------------------------------
set(CMAKE_BUILD_TYPE "DEBUG")
-# Compiler selection if needed. Overload the detected compiler.
+# Compiler selection if needed. Impose a minimal version.
# -----------------------------------------------
-#set(CMAKE_C_COMPILER "gcc")
-#set(CMAKE_CXX_COMPILER "g++")
+set (gcc_minimal_version 4.9)
# PKG_CONFIG required packages
# -----------------------------
diff --git a/reference/etc/macros.cmake b/reference/etc/macros.cmake
index 184f8ba..b8c4e06 100644
--- a/reference/etc/macros.cmake
+++ b/reference/etc/macros.cmake
@@ -40,6 +40,14 @@ macro(PROJECT_TARGET_ADD TARGET_NAME)
endif()
endmacro(PROJECT_TARGET_ADD)
+# Check GCC minimal version version
+if (gcc_minimal_version)
+ message ("-- Check gcc_minimal_version (found gcc version ${CMAKE_C_COMPILER_VERSION}) (found g++ version ${CMAKE_CXX_COMPILER_VERSION})")
+if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${gcc_minimal_version} OR CMAKE_C_COMPILER_VERSION VERSION_LESS ${gcc_minimal_version})
+ message(FATAL_ERROR "**** FATAL: Require at least gcc-${gcc_minimal_version} please set CMAKE_C[XX]_COMPILER")
+endif()
+endif(gcc_minimal_version)
+
macro(defstr name value)
add_definitions(-D${name}=${value})
endmacro(defstr)