Commit 4922095070212d0f49fcc919ce8b4537e83e47e4

Authored by Pierre Lassalle
1 parent 8f495e21
Exists in master

Check version of compiler

Showing 2 changed files with 30 additions and 0 deletions   Show diff stats
code/CMakeLists.txt
... ... @@ -10,6 +10,21 @@ ELSE(OTB_FOUND)
10 10 "Cannot build OTB project without OTB. Please set OTB_DIR.")
11 11 ENDIF(OTB_FOUND)
12 12  
  13 +#Check compiler version
  14 +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
  15 + # require at least gcc 4.8
  16 + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
  17 + message(FATAL_ERROR "GCC version must be at least 4.8!")
  18 + endif()
  19 +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
  20 + # require at least clang 3.2
  21 + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.2)
  22 + message(FATAL_ERROR "Clang version must be at least 3.2!")
  23 + endif()
  24 +else()
  25 + message(WARNING "You are using an unsupported compiler! Compilation has only been tested with Clang and GCC.")
  26 +endif()
  27 +
13 28 include(CheckCXXCompilerFlag)
14 29 CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
15 30 if(COMPILER_SUPPORTS_CXX11)
... ...
code/CMakeLists.txt~
... ... @@ -10,6 +10,21 @@ ELSE(OTB_FOUND)
10 10 "Cannot build OTB project without OTB. Please set OTB_DIR.")
11 11 ENDIF(OTB_FOUND)
12 12  
  13 +#Check compiler version
  14 +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
  15 + # require at least gcc 4.8
  16 + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
  17 + message(FATAL_ERROR "GCC version must be at least 4.8!")
  18 + endif()
  19 +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
  20 + # require at least clang 3.2
  21 + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.2)
  22 + message(FATAL_ERROR "Clang version must be at least 3.2!")
  23 + endif()
  24 +else()
  25 + message(WARNING "You are using an unsupported compiler! Compilation has only been tested with Clang and GCC.")
  26 +endif()
  27 +
13 28 include(CheckCXXCompilerFlag)
14 29 CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
15 30 if(COMPILER_SUPPORTS_CXX11)
... ...