CMakeSystemSpecificInformation.cmake 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. # This file is included by cmGlobalGenerator::EnableLanguage.
  4. # It is included after the compiler has been determined, so
  5. # we know things like the compiler name and if the compiler is gnu.
  6. # before cmake 2.6 these variables were set in cmMakefile.cxx. This is still
  7. # done to keep scripts and custom language and compiler modules working.
  8. # But they are reset here and set again in the platform files for the target
  9. # platform, so they can be used for testing the target platform instead
  10. # of testing the host platform.
  11. set(APPLE )
  12. set(UNIX )
  13. set(CYGWIN )
  14. set(MSYS )
  15. set(WIN32 )
  16. set(BSD )
  17. function(_cmake_record_install_prefix )
  18. set(_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_VALUE "${CMAKE_INSTALL_PREFIX}" PARENT_SCOPE)
  19. set(_CMAKE_SYSTEM_PREFIX_PATH_STAGING_PREFIX_VALUE "${CMAKE_STAGING_PREFIX}" PARENT_SCOPE)
  20. set(icount 0)
  21. set(scount 0)
  22. foreach(value IN LISTS CMAKE_SYSTEM_PREFIX_PATH)
  23. if(value STREQUAL CMAKE_INSTALL_PREFIX)
  24. math(EXPR icount "${icount}+1")
  25. endif()
  26. if(value STREQUAL CMAKE_STAGING_PREFIX)
  27. math(EXPR scount "${scount}+1")
  28. endif()
  29. endforeach()
  30. set(_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_COUNT "${icount}" PARENT_SCOPE)
  31. set(_CMAKE_SYSTEM_PREFIX_PATH_STAGING_PREFIX_COUNT "${scount}" PARENT_SCOPE)
  32. endfunction()
  33. # include Generic system information
  34. include(CMakeGenericSystem)
  35. # 2. now include SystemName.cmake file to set the system specific information
  36. set(CMAKE_SYSTEM_INFO_FILE Platform/${CMAKE_SYSTEM_NAME})
  37. include(${CMAKE_SYSTEM_INFO_FILE} OPTIONAL RESULT_VARIABLE _INCLUDED_SYSTEM_INFO_FILE)
  38. if(NOT _INCLUDED_SYSTEM_INFO_FILE)
  39. message("System is unknown to cmake, create:\n${CMAKE_SYSTEM_INFO_FILE}"
  40. " to use this system, please post your config file on "
  41. "discourse.cmake.org so it can be added to cmake")
  42. if(EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
  43. configure_file(${CMAKE_BINARY_DIR}/CMakeCache.txt
  44. ${CMAKE_BINARY_DIR}/CopyOfCMakeCache.txt COPYONLY)
  45. message("Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. "
  46. "Please post that file on discourse.cmake.org.")
  47. endif()
  48. endif()
  49. # optionally include a file which can do extra-generator specific things, e.g.
  50. # CMakeFindEclipseCDT4.cmake asks gcc for the system include dirs for the Eclipse CDT4 generator
  51. if(CMAKE_EXTRA_GENERATOR)
  52. string(REPLACE " " "" _CMAKE_EXTRA_GENERATOR_NO_SPACES ${CMAKE_EXTRA_GENERATOR} )
  53. include("CMakeFind${_CMAKE_EXTRA_GENERATOR_NO_SPACES}" OPTIONAL)
  54. endif()
  55. # for most systems a module is the same as a shared library
  56. # so unless the variable CMAKE_MODULE_EXISTS is set just
  57. # copy the values from the LIBRARY variables
  58. # this has to be done after the system information has been loaded
  59. if(NOT CMAKE_MODULE_EXISTS)
  60. set(CMAKE_SHARED_MODULE_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}")
  61. set(CMAKE_SHARED_MODULE_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}")
  62. endif()
  63. set(CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED 1)