summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeBackwardCompatibilityC.cmake
blob: 4783d68cdca3181b54950e5a5e1940d0b266d599 (plain)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100

#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
#  License text for the above reference.)

# Nothing here yet
if(CMAKE_GENERATOR MATCHES "Visual Studio 7")
  include(CMakeVS7BackwardCompatibility)
  set(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
endif()
if(CMAKE_GENERATOR MATCHES "Visual Studio 6")
  include(CMakeVS6BackwardCompatibility)
  set(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
endif()

if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
  # Old CMake versions did not support OS X universal binaries anyway,
  # so just get through this with at least some size for the types.
  list(LENGTH CMAKE_OSX_ARCHITECTURES NUM_ARCHS)
  if(${NUM_ARCHS} GREATER 1)
    if(NOT DEFINED CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
      message(WARNING "This module does not work with OS X universal binaries.")
      set(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES 1)
      list(GET CMAKE_OSX_ARCHITECTURES 0 CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
    endif()
  endif()

  include (CheckTypeSize)
  CHECK_TYPE_SIZE(int      CMAKE_SIZEOF_INT)
  CHECK_TYPE_SIZE(long     CMAKE_SIZEOF_LONG)
  CHECK_TYPE_SIZE("void*"  CMAKE_SIZEOF_VOID_P)
  CHECK_TYPE_SIZE(char     CMAKE_SIZEOF_CHAR)
  CHECK_TYPE_SIZE(short    CMAKE_SIZEOF_SHORT)
  CHECK_TYPE_SIZE(float    CMAKE_SIZEOF_FLOAT)
  CHECK_TYPE_SIZE(double   CMAKE_SIZEOF_DOUBLE)

  include (CheckIncludeFile)
  CHECK_INCLUDE_FILE("limits.h"       CMAKE_HAVE_LIMITS_H)
  CHECK_INCLUDE_FILE("unistd.h"       CMAKE_HAVE_UNISTD_H)
  CHECK_INCLUDE_FILE("pthread.h"      CMAKE_HAVE_PTHREAD_H)

  include (CheckIncludeFiles)
  CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h"    CMAKE_HAVE_SYS_PRCTL_H)

  include (TestBigEndian)
  TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)
  include (FindX11)

  if("${X11_X11_INCLUDE_PATH}" STREQUAL "/usr/include")
    set (CMAKE_X_CFLAGS "" CACHE STRING "X11 extra flags.")
  else()
    set (CMAKE_X_CFLAGS "-I${X11_X11_INCLUDE_PATH}" CACHE STRING
         "X11 extra flags.")
  endif()
  set (CMAKE_X_LIBS "${X11_LIBRARIES}" CACHE STRING
       "Libraries and options used in X11 programs.")
  set (CMAKE_HAS_X "${X11_FOUND}" CACHE INTERNAL "Is X11 around.")

  include (FindThreads)

  set (CMAKE_THREAD_LIBS        "${CMAKE_THREAD_LIBS_INIT}" CACHE STRING
    "Thread library used.")

  set (CMAKE_USE_PTHREADS       "${CMAKE_USE_PTHREADS_INIT}" CACHE BOOL
     "Use the pthreads library.")

  set (CMAKE_USE_WIN32_THREADS  "${CMAKE_USE_WIN32_THREADS_INIT}" CACHE BOOL
       "Use the win32 thread library.")

  set (CMAKE_HP_PTHREADS        ${CMAKE_HP_PTHREADS_INIT} CACHE BOOL
     "Use HP pthreads.")

  set (CMAKE_USE_SPROC          ${CMAKE_USE_SPROC_INIT} CACHE BOOL
     "Use sproc libs.")

  if(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
    set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
    set(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
  endif()
endif()

mark_as_advanced(
CMAKE_HP_PTHREADS
CMAKE_THREAD_LIBS
CMAKE_USE_PTHREADS
CMAKE_USE_SPROC
CMAKE_USE_WIN32_THREADS
CMAKE_X_CFLAGS
CMAKE_X_LIBS
)