Imported Upstream version 2.8.10.2
[platform/upstream/cmake.git] / Modules / CMakeBackwardCompatibilityC.cmake
1
2 #=============================================================================
3 # Copyright 2002-2009 Kitware, Inc.
4 #
5 # Distributed under the OSI-approved BSD License (the "License");
6 # see accompanying file Copyright.txt for details.
7 #
8 # This software is distributed WITHOUT ANY WARRANTY; without even the
9 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # See the License for more information.
11 #=============================================================================
12 # (To distribute this file outside of CMake, substitute the full
13 #  License text for the above reference.)
14
15 # Nothing here yet
16 if(CMAKE_GENERATOR MATCHES "Visual Studio 7")
17   include(CMakeVS7BackwardCompatibility)
18   set(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
19 endif()
20 if(CMAKE_GENERATOR MATCHES "Visual Studio 6")
21   include(CMakeVS6BackwardCompatibility)
22   set(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
23 endif()
24
25 if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
26   # Old CMake versions did not support OS X universal binaries anyway,
27   # so just get through this with at least some size for the types.
28   list(LENGTH CMAKE_OSX_ARCHITECTURES NUM_ARCHS)
29   if(${NUM_ARCHS} GREATER 1)
30     if(NOT DEFINED CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
31       message(WARNING "This module does not work with OS X universal binaries.")
32       set(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES 1)
33       list(GET CMAKE_OSX_ARCHITECTURES 0 CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
34     endif()
35   endif()
36
37   include (CheckTypeSize)
38   CHECK_TYPE_SIZE(int      CMAKE_SIZEOF_INT)
39   CHECK_TYPE_SIZE(long     CMAKE_SIZEOF_LONG)
40   CHECK_TYPE_SIZE("void*"  CMAKE_SIZEOF_VOID_P)
41   CHECK_TYPE_SIZE(char     CMAKE_SIZEOF_CHAR)
42   CHECK_TYPE_SIZE(short    CMAKE_SIZEOF_SHORT)
43   CHECK_TYPE_SIZE(float    CMAKE_SIZEOF_FLOAT)
44   CHECK_TYPE_SIZE(double   CMAKE_SIZEOF_DOUBLE)
45
46   include (CheckIncludeFile)
47   CHECK_INCLUDE_FILE("limits.h"       CMAKE_HAVE_LIMITS_H)
48   CHECK_INCLUDE_FILE("unistd.h"       CMAKE_HAVE_UNISTD_H)
49   CHECK_INCLUDE_FILE("pthread.h"      CMAKE_HAVE_PTHREAD_H)
50
51   include (CheckIncludeFiles)
52   CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h"    CMAKE_HAVE_SYS_PRCTL_H)
53
54   include (TestBigEndian)
55   TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)
56   include (FindX11)
57
58   if("${X11_X11_INCLUDE_PATH}" MATCHES "^/usr/include$")
59     set (CMAKE_X_CFLAGS "" CACHE STRING "X11 extra flags.")
60   else()
61     set (CMAKE_X_CFLAGS "-I${X11_X11_INCLUDE_PATH}" CACHE STRING
62          "X11 extra flags.")
63   endif()
64   set (CMAKE_X_LIBS "${X11_LIBRARIES}" CACHE STRING
65        "Libraries and options used in X11 programs.")
66   set (CMAKE_HAS_X "${X11_FOUND}" CACHE INTERNAL "Is X11 around.")
67
68   include (FindThreads)
69
70   set (CMAKE_THREAD_LIBS        "${CMAKE_THREAD_LIBS_INIT}" CACHE STRING
71     "Thread library used.")
72
73   set (CMAKE_USE_PTHREADS       "${CMAKE_USE_PTHREADS_INIT}" CACHE BOOL
74      "Use the pthreads library.")
75
76   set (CMAKE_USE_WIN32_THREADS  "${CMAKE_USE_WIN32_THREADS_INIT}" CACHE BOOL
77        "Use the win32 thread library.")
78
79   set (CMAKE_HP_PTHREADS        ${CMAKE_HP_PTHREADS_INIT} CACHE BOOL
80      "Use HP pthreads.")
81
82   set (CMAKE_USE_SPROC          ${CMAKE_USE_SPROC_INIT} CACHE BOOL
83      "Use sproc libs.")
84
85   if(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
86     set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
87     set(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
88   endif()
89 endif()
90
91 mark_as_advanced(
92 CMAKE_HP_PTHREADS
93 CMAKE_THREAD_LIBS
94 CMAKE_USE_PTHREADS
95 CMAKE_USE_SPROC
96 CMAKE_USE_WIN32_THREADS
97 CMAKE_X_CFLAGS
98 CMAKE_X_LIBS
99 )
100