CYGWIN.cmake 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. if("${CMAKE_MINIMUM_REQUIRED_VERSION}" VERSION_LESS "2.8.3.20101214")
  2. set(__USE_CMAKE_LEGACY_CYGWIN_WIN32 1)
  3. endif()
  4. if(NOT DEFINED WIN32)
  5. set(WIN32 0)
  6. if(DEFINED __USE_CMAKE_LEGACY_CYGWIN_WIN32)
  7. if(NOT DEFINED CMAKE_LEGACY_CYGWIN_WIN32
  8. AND DEFINED ENV{CMAKE_LEGACY_CYGWIN_WIN32})
  9. set(CMAKE_LEGACY_CYGWIN_WIN32 $ENV{CMAKE_LEGACY_CYGWIN_WIN32})
  10. endif()
  11. if(CMAKE_LEGACY_CYGWIN_WIN32)
  12. message(STATUS "Defining WIN32 under Cygwin due to CMAKE_LEGACY_CYGWIN_WIN32")
  13. set(WIN32 1)
  14. elseif("x${CMAKE_LEGACY_CYGWIN_WIN32}" STREQUAL "x")
  15. message(WARNING "CMake no longer defines WIN32 on Cygwin!"
  16. "\n"
  17. "(1) If you are just trying to build this project, ignore this warning "
  18. "or quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32=0 in your environment or "
  19. "in the CMake cache. "
  20. "If later configuration or build errors occur then this project may "
  21. "have been written under the assumption that Cygwin is WIN32. "
  22. "In that case, set CMAKE_LEGACY_CYGWIN_WIN32=1 instead."
  23. "\n"
  24. "(2) If you are developing this project, add the line\n"
  25. " set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required\n"
  26. "at the top of your top-level CMakeLists.txt file or set the minimum "
  27. "required version of CMake to 2.8.4 or higher. "
  28. "Then teach your project to build on Cygwin without WIN32.")
  29. endif()
  30. elseif(DEFINED CMAKE_LEGACY_CYGWIN_WIN32)
  31. message(AUTHOR_WARNING "CMAKE_LEGACY_CYGWIN_WIN32 ignored because\n"
  32. " cmake_minimum_required(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})\n"
  33. "is at least 2.8.4.")
  34. endif()
  35. endif()
  36. if(DEFINED __USE_CMAKE_LEGACY_CYGWIN_WIN32)
  37. # Pass WIN32 legacy setting to scripts.
  38. if(WIN32)
  39. set(ENV{CMAKE_LEGACY_CYGWIN_WIN32} 1)
  40. else()
  41. set(ENV{CMAKE_LEGACY_CYGWIN_WIN32} 0)
  42. endif()
  43. unset(__USE_CMAKE_LEGACY_CYGWIN_WIN32)
  44. endif()
  45. set(CYGWIN 1)
  46. set(CMAKE_SHARED_LIBRARY_PREFIX "cyg")
  47. set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")
  48. set(CMAKE_SHARED_MODULE_PREFIX "cyg")
  49. set(CMAKE_SHARED_MODULE_SUFFIX ".dll")
  50. set(CMAKE_IMPORT_LIBRARY_PREFIX "lib")
  51. set(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a")
  52. set(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe
  53. # Modules have a different default prefix that shared libs.
  54. set(CMAKE_MODULE_EXISTS 1)
  55. set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
  56. set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a")
  57. # Shared libraries on cygwin can be named with their version number.
  58. set(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 1)
  59. include(Platform/UnixPaths)
  60. # Windows API on Cygwin
  61. list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
  62. /usr/include/w32api
  63. )
  64. # Windows API on Cygwin
  65. list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
  66. /usr/lib/w32api
  67. )