CMakeCommonLanguageInclude.cmake 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #=============================================================================
  2. # Copyright 2004-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. # this file has flags that are shared across languages and sets
  14. # cache values that can be initialized in the platform-compiler.cmake file
  15. # it may be included by more than one language.
  16. set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
  17. CACHE STRING "Flags used by the linker.")
  18. if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
  19. # default build type is none
  20. if(NOT CMAKE_NO_BUILD_TYPE)
  21. set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
  22. "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
  23. endif()
  24. set (CMAKE_EXE_LINKER_FLAGS_DEBUG ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT} CACHE STRING
  25. "Flags used by the linker during debug builds.")
  26. set (CMAKE_EXE_LINKER_FLAGS_MINSIZEREL ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT} CACHE STRING
  27. "Flags used by the linker during release minsize builds.")
  28. set (CMAKE_EXE_LINKER_FLAGS_RELEASE ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT} CACHE STRING
  29. "Flags used by the linker during release builds.")
  30. set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
  31. ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
  32. "Flags used by the linker during Release with Debug Info builds.")
  33. set (CMAKE_SHARED_LINKER_FLAGS_DEBUG ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT} CACHE STRING
  34. "Flags used by the linker during debug builds.")
  35. set (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL ${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT}
  36. CACHE STRING
  37. "Flags used by the linker during release minsize builds.")
  38. set (CMAKE_SHARED_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT} CACHE STRING
  39. "Flags used by the linker during release builds.")
  40. set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
  41. ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
  42. "Flags used by the linker during Release with Debug Info builds.")
  43. set (CMAKE_MODULE_LINKER_FLAGS_DEBUG ${CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT} CACHE STRING
  44. "Flags used by the linker during debug builds.")
  45. set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL ${CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT}
  46. CACHE STRING
  47. "Flags used by the linker during release minsize builds.")
  48. set (CMAKE_MODULE_LINKER_FLAGS_RELEASE ${CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT} CACHE STRING
  49. "Flags used by the linker during release builds.")
  50. set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
  51. ${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
  52. "Flags used by the linker during Release with Debug Info builds.")
  53. set (CMAKE_STATIC_LINKER_FLAGS_DEBUG ${CMAKE_STATIC_LINKER_FLAGS_DEBUG_INIT} CACHE STRING
  54. "Flags used by the linker during debug builds.")
  55. set (CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL ${CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL_INIT}
  56. CACHE STRING
  57. "Flags used by the linker during release minsize builds.")
  58. set (CMAKE_STATIC_LINKER_FLAGS_RELEASE ${CMAKE_STATIC_LINKER_FLAGS_RELEASE_INIT} CACHE STRING
  59. "Flags used by the linker during release builds.")
  60. set (CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
  61. ${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
  62. "Flags used by the linker during Release with Debug Info builds.")
  63. endif()
  64. # shared linker flags
  65. set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
  66. CACHE STRING "Flags used by the linker during the creation of dll's.")
  67. # module linker flags
  68. set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
  69. CACHE STRING "Flags used by the linker during the creation of modules.")
  70. # static linker flags
  71. set (CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS_INIT}"
  72. CACHE STRING "Flags used by the linker during the creation of static libraries.")
  73. # Alias the build tool variable for backward compatibility.
  74. set(CMAKE_BUILD_TOOL ${CMAKE_MAKE_PROGRAM})
  75. mark_as_advanced(
  76. CMAKE_VERBOSE_MAKEFILE
  77. CMAKE_EXE_LINKER_FLAGS
  78. CMAKE_EXE_LINKER_FLAGS_DEBUG
  79. CMAKE_EXE_LINKER_FLAGS_MINSIZEREL
  80. CMAKE_EXE_LINKER_FLAGS_RELEASE
  81. CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
  82. CMAKE_SHARED_LINKER_FLAGS
  83. CMAKE_SHARED_LINKER_FLAGS_DEBUG
  84. CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
  85. CMAKE_SHARED_LINKER_FLAGS_RELEASE
  86. CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
  87. CMAKE_MODULE_LINKER_FLAGS
  88. CMAKE_MODULE_LINKER_FLAGS_DEBUG
  89. CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
  90. CMAKE_MODULE_LINKER_FLAGS_RELEASE
  91. CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
  92. CMAKE_STATIC_LINKER_FLAGS
  93. CMAKE_STATIC_LINKER_FLAGS_DEBUG
  94. CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
  95. CMAKE_STATIC_LINKER_FLAGS_RELEASE
  96. CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
  97. )