CMakeBackwardCompatibilityC.cmake 2.79 KB
Newer Older
1
2
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
3

4

5
# Nothing here yet
6
7
8
if(CMAKE_GENERATOR MATCHES "Visual Studio 7")
  include(CMakeVS7BackwardCompatibility)
  set(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
9
endif()
10
11

if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
12
13
  # Old CMake versions did not support OS X universal binaries anyway,
  # so just get through this with at least some size for the types.
14
15
16
17
18
19
20
21
22
23
  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)
24
25
26
27
28
29
30
31
  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)

32
  include (CheckIncludeFile)
33
34
35
36
  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)

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

40
  include (TestBigEndian)
41
  TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)
42
  include (FindX11)
43

44
  if("${X11_X11_INCLUDE_PATH}" STREQUAL "/usr/include")
45
    set (CMAKE_X_CFLAGS "" CACHE STRING "X11 extra flags.")
46
  else()
47
    set (CMAKE_X_CFLAGS "-I${X11_X11_INCLUDE_PATH}" CACHE STRING
48
         "X11 extra flags.")
49
  endif()
50
  set (CMAKE_X_LIBS "${X11_LIBRARIES}" CACHE STRING
51
       "Libraries and options used in X11 programs.")
52
  set (CMAKE_HAS_X "${X11_FOUND}" CACHE INTERNAL "Is X11 around.")
53

54
  include (FindThreads)
55

56
  set (CMAKE_THREAD_LIBS        "${CMAKE_THREAD_LIBS_INIT}" CACHE STRING
Bill Hoffman's avatar
Bill Hoffman committed
57
58
    "Thread library used.")

59
  set (CMAKE_USE_PTHREADS       "${CMAKE_USE_PTHREADS_INIT}" CACHE BOOL
Bill Hoffman's avatar
Bill Hoffman committed
60
61
     "Use the pthreads library.")

62
  set (CMAKE_USE_WIN32_THREADS  "${CMAKE_USE_WIN32_THREADS_INIT}" CACHE BOOL
Bill Hoffman's avatar
Bill Hoffman committed
63
64
       "Use the win32 thread library.")

65
  set (CMAKE_HP_PTHREADS        ${CMAKE_HP_PTHREADS_INIT} CACHE BOOL
Bill Hoffman's avatar
Bill Hoffman committed
66
67
     "Use HP pthreads.")

68
  set (CMAKE_USE_SPROC          ${CMAKE_USE_SPROC_INIT} CACHE BOOL
Bill Hoffman's avatar
Bill Hoffman committed
69
     "Use sproc libs.")
70

71
72
73
74
  if(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
    set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
    set(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
  endif()
75
endif()
Bill Hoffman's avatar
Bill Hoffman committed
76

77
mark_as_advanced(
78
CMAKE_HP_PTHREADS
Bill Hoffman's avatar
Bill Hoffman committed
79
80
81
CMAKE_THREAD_LIBS
CMAKE_USE_PTHREADS
CMAKE_USE_SPROC
82
83
84
85
CMAKE_USE_WIN32_THREADS
CMAKE_X_CFLAGS
CMAKE_X_LIBS
)
Bill Hoffman's avatar
Bill Hoffman committed
86