File: Proj4SystemInfo.cmake

package info (click to toggle)
proj 4.9.3-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 58,684 kB
  • ctags: 3,263
  • sloc: sh: 885,752; ansic: 26,077; makefile: 235; java: 60; xml: 46
file content (83 lines) | stat: -rw-r--r-- 2,801 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
################################################################################
# SociSystemInfo.cmake - part of CMake configuration of Proj.4 library
#
# Based on idea taken from http://code.google.com/p/softart/ project
################################################################################
# Copyright (C) 2010 Mateusz Loskot <mateusz@loskot.net>
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
################################################################################
# The following variables are defined:
#   PROJ_COMPILER_NAME - name of compiler toolset, follows Boost toolset naming.
#   PROJ_PLATFORM_NAME - target platform name: x64, x86 or win32
################################################################################

set(PROJ_COMPILER_NAME)
set(PROJ_PLATFORM_NAME)

if(MINGW OR UNIX)
  exec_program(gcc ARGS -dumpversion OUTPUT_VARIABLE GCC_VERSION)
  string(REPLACE "." "" GCC_VERSION_STR_FULL ${GCC_VERSION})
  string(REGEX MATCH "[0-9]+\\.[0-9]+" GCC_VERSION_MAJOR_MINOR ${GCC_VERSION})
endif()

if(WIN32)
  # Compilers, taken from http://predef.sourceforge.net/precomp.html#sec34
  if(MSVC)
    if(MSVC_VERSION EQUAL 1200)
      set(PROJ_COMPILER_NAME "msvc-6.0")
    endif()
    if(MSVC_VERSION EQUAL 1300)
      set(PROJ_COMPILER_NAME "msvc-7.0")
    endif()
    if(MSVC_VERSION EQUAL 1310)
      set(PROJ_COMPILER_NAME "msvc-7.1") #Visual Studio 2003
    endif()
    if(MSVC_VERSION EQUAL 1400)
      set(PROJ_COMPILER_NAME "msvc-8.0") #Visual Studio 2005
    endif()
    if(MSVC_VERSION EQUAL 1500)
      set(PROJ_COMPILER_NAME "msvc-9.0") #Visual Studio 2008
    endif()
    if(MSVC_VERSION EQUAL 1600)
      set(PROJ_COMPILER_NAME "msvc-10.0") #Visual Studio 2010
    endif()
    if(MSVC_VERSION EQUAL 1700)
      set(PROJ_COMPILER_NAME "msvc-11.0") #Visual Studio 2012
    endif()
    if(MSVC_VERSION EQUAL 1800)
      set(PROJ_COMPILER_NAME "msvc-12.0") #Visual Studio 2013
    endif()
  endif(MSVC)
  
  if(MINGW)
    set(PROJ_COMPILER_NAME "mingw-${GCC_VERSION}")
  endif( MINGW )
  
  if(CMAKE_GENERATOR MATCHES "Win64")
    set(PROJ_PLATFORM_NAME "x64")
  else()
    set(PROJ_PLATFORM_NAME "win32")
  endif()
endif(WIN32)

if(UNIX)
  set(PROJ_COMPILER_NAME "gcc-${GCC_VERSION}")
  if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
    set(PROJ_PLATFORM_NAME "x64")
  else()
    set(PROJ_PLATFORM_NAME "x86")
  endif()
endif(UNIX)

if(NOT PROJ_COMPILER_NAME)
  colormsg(_RED_ "WARNING:")
  colormsg(RED "Could not determine compiler toolset name to set PROJ_COMPILER_NAME variable.")
endif()

if(NOT PROJ_COMPILER_NAME)
  colormsg(_RED_ "WARNING:")
  colormsg(RED "Could not determine platform name to set PROJ_COMPILER_NAME variable.")
endif()