CMakeBackwardCompatibilityC.cmake 3.2 KB

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