Scripts/Compiler.cmake

Thu, 20 Mar 2014 08:31:57 +0200

author
cemkalyoncu
date
Thu, 20 Mar 2014 08:31:57 +0200
branch
4.x-dev
changeset 415
001cd0eb15db
child 416
7c04a3e33dcc
permissions
-rw-r--r--

* CMake scripts does not need to specify paths anymore
* CMake utilities to check compilers and adjust accordingly

415
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
1 cmake_minimum_required(VERSION 2.8)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
2
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
3 #compiler check
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
4 IF(CMAKE_COMPILER_IS_GNUCXX)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
5 IF(GCC_VERSION VERSION_LESS 4.8)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
6 IF(IGNORE_COMPILER_VERSION)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
7 MESSAGE(STATUS "Gorgon Library requires GCC 4.8+")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
8 ELSE()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
9 MESSAGE(STATUS "use cmake -DIGNORE_COMPILER_VERSION=1 to continue anyway")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
10 MESSAGE(FATAL_ERROR "Gorgon Library requires GCC 4.8+")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
11 ENDIF()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
12 ENDIF()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
13 ELSEIF(MSVC)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
14 IF(MSVC_VERSION VERSION_LESS 11)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
15 IF(IGNORE_COMPILER_VERSION)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
16 MESSAGE(STATUS "Gorgon Library requires Visual Studio 2012+")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
17 ELSE()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
18 MESSAGE(STATUS "use cmake -DIGNORE_COMPILER_VERSION=1 to continue anyway")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
19 MESSAGE(FATAL_ERROR "Gorgon Library requires Visual Studio 2012+")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
20 ENDIF()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
21 ENDIF()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
22 ELSE()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
23 IF(IGNORE_COMPILER_VENDOR)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
24 MESSAGE(STATUS "Unsupported compiler! Gorgon Library requires GCC 4.8+ OR Visual Studio 2012+")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
25 MESSAGE(STATUS "You may need to manually activate C++11 features")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
26 ELSE()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
27 MESSAGE(STATUS "use cmake -DIGNORE_COMPILER_VENDOR=1 to continue anyway")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
28 MESSAGE(FATAL_ERROR "Unsupported compiler! Gorgon Library requires GCC 4.8+ OR Visual Studio 2012+")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
29 ENDIF()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
30 ENDIF()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
31
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
32 #enable C++11
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
33 INCLUDE(CheckCXXCompilerFlag)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
34 IF(CMAKE_COMPILER_IS_GNUCXX)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
35 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
36 ENDIF()

mercurial