Scripts/Compiler.cmake

Fri, 21 Mar 2014 09:53:19 +0200

author
cemkalyoncu
date
Fri, 21 Mar 2014 09:53:19 +0200
branch
4.x-dev
changeset 418
dcdaafd460d7
parent 416
7c04a3e33dcc
child 421
058a467651b3
permissions
-rw-r--r--

* Testing framework finished

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
418
dcdaafd460d7 * Testing framework finished
cemkalyoncu
parents: 416
diff changeset
3 OPTION(IGNORE_COMPILER_VERSION "Ignore compiler version check" OFF)
dcdaafd460d7 * Testing framework finished
cemkalyoncu
parents: 416
diff changeset
4 OPTION(IGNORE_COMPILER_VENDOR "Ignore compiler vendor check" OFF)
dcdaafd460d7 * Testing framework finished
cemkalyoncu
parents: 416
diff changeset
5
415
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
6 #compiler check
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
7 IF(CMAKE_COMPILER_IS_GNUCXX)
416
7c04a3e33dcc * Partial testing system
cemkalyoncu
parents: 415
diff changeset
8 EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
7c04a3e33dcc * Partial testing system
cemkalyoncu
parents: 415
diff changeset
9
415
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
10 IF(GCC_VERSION VERSION_LESS 4.8)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
11 IF(IGNORE_COMPILER_VERSION)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
12 MESSAGE(STATUS "Gorgon Library requires GCC 4.8+")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
13 ELSE()
418
dcdaafd460d7 * Testing framework finished
cemkalyoncu
parents: 416
diff changeset
14 MESSAGE(STATUS "use cmake -DIGNORE_COMPILER_VERSION=ON to continue anyway")
415
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
15 MESSAGE(FATAL_ERROR "Gorgon Library requires GCC 4.8+")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
16 ENDIF()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
17 ENDIF()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
18 ELSEIF(MSVC)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
19 IF(MSVC_VERSION VERSION_LESS 11)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
20 IF(IGNORE_COMPILER_VERSION)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
21 MESSAGE(STATUS "Gorgon Library requires Visual Studio 2012+")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
22 ELSE()
418
dcdaafd460d7 * Testing framework finished
cemkalyoncu
parents: 416
diff changeset
23 MESSAGE(STATUS "use cmake -DIGNORE_COMPILER_VERSION=ON to continue anyway")
415
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
24 MESSAGE(FATAL_ERROR "Gorgon Library requires Visual Studio 2012+")
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
25 ENDIF()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
26 ENDIF()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
27 ELSE()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
28 IF(IGNORE_COMPILER_VENDOR)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
29 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
30 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
31 ELSE()
418
dcdaafd460d7 * Testing framework finished
cemkalyoncu
parents: 416
diff changeset
32 MESSAGE(STATUS "use cmake -DIGNORE_COMPILER_VENDOR=ON to continue anyway")
415
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
33 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
34 ENDIF()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
35 ENDIF()
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
36
416
7c04a3e33dcc * Partial testing system
cemkalyoncu
parents: 415
diff changeset
37 #enable C++11 and 32-bit compilation
415
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
38 INCLUDE(CheckCXXCompilerFlag)
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
39 IF(CMAKE_COMPILER_IS_GNUCXX)
416
7c04a3e33dcc * Partial testing system
cemkalyoncu
parents: 415
diff changeset
40 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -m32")
7c04a3e33dcc * Partial testing system
cemkalyoncu
parents: 415
diff changeset
41 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
415
001cd0eb15db * CMake scripts does not need to specify paths anymore
cemkalyoncu
parents:
diff changeset
42 ENDIF()
416
7c04a3e33dcc * Partial testing system
cemkalyoncu
parents: 415
diff changeset
43
7c04a3e33dcc * Partial testing system
cemkalyoncu
parents: 415
diff changeset
44 #make sure 64bits cannot be activated
7c04a3e33dcc * Partial testing system
cemkalyoncu
parents: 415
diff changeset
45 IF(MSVC)
7c04a3e33dcc * Partial testing system
cemkalyoncu
parents: 415
diff changeset
46 IF(${CMAKE_CL_64})
7c04a3e33dcc * Partial testing system
cemkalyoncu
parents: 415
diff changeset
47 MESSAGE(FATAL_ERROR "Gorgon Library works only 32bits")
7c04a3e33dcc * Partial testing system
cemkalyoncu
parents: 415
diff changeset
48 ENDIF()
418
dcdaafd460d7 * Testing framework finished
cemkalyoncu
parents: 416
diff changeset
49 ENDIF()

mercurial