CMakeASMInformation.cmake 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. #=============================================================================
  2. # Copyright 2007-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. if(UNIX)
  14. set(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .o)
  15. else()
  16. set(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .obj)
  17. endif()
  18. set(CMAKE_INCLUDE_FLAG_ASM${ASM_DIALECT} "-I") # -I
  19. set(CMAKE_BASE_NAME)
  20. get_filename_component(CMAKE_BASE_NAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME_WE)
  21. if("${CMAKE_BASE_NAME}" STREQUAL "as")
  22. set(CMAKE_BASE_NAME gas)
  23. endif()
  24. # Load compiler-specific information.
  25. set(_INCLUDED_FILE "")
  26. if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
  27. include(Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
  28. endif()
  29. if(NOT _INCLUDED_FILE)
  30. if("ASM${ASM_DIALECT}" STREQUAL "ASM")
  31. message(STATUS "Warning: Did not find file Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}")
  32. endif()
  33. include(Platform/${CMAKE_BASE_NAME} OPTIONAL)
  34. endif()
  35. if(CMAKE_SYSTEM_PROCESSOR)
  36. include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
  37. if(NOT _INCLUDED_FILE)
  38. include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
  39. endif()
  40. endif()
  41. include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
  42. if(NOT _INCLUDED_FILE)
  43. include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
  44. endif()
  45. # This should be included before the _INIT variables are
  46. # used to initialize the cache. Since the rule variables
  47. # have if blocks on them, users can still define them here.
  48. # But, it should still be after the platform file so changes can
  49. # be made to those values.
  50. if(CMAKE_USER_MAKE_RULES_OVERRIDE)
  51. # Save the full path of the file so try_compile can use it.
  52. include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override)
  53. set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}")
  54. endif()
  55. if(CMAKE_USER_MAKE_RULES_OVERRIDE_ASM)
  56. # Save the full path of the file so try_compile can use it.
  57. include(${CMAKE_USER_MAKE_RULES_OVERRIDE_ASM} RESULT_VARIABLE _override)
  58. set(CMAKE_USER_MAKE_RULES_OVERRIDE_ASM "${_override}")
  59. endif()
  60. # Set default assembler file extensions:
  61. if(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS)
  62. set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm)
  63. endif()
  64. # Support for CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT and friends:
  65. set(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT "$ENV{ASM${ASM_DIALECT}FLAGS} ${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}")
  66. # avoid just having a space as the initial value for the cache
  67. if(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT STREQUAL " ")
  68. set(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT)
  69. endif()
  70. set (CMAKE_ASM${ASM_DIALECT}_FLAGS "${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}" CACHE STRING
  71. "Flags used by the assembler during all build types.")
  72. if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
  73. # default build type is none
  74. if(NOT CMAKE_NO_BUILD_TYPE)
  75. set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
  76. "Choose the type of build, options are: None, Debug Release RelWithDebInfo MinSizeRel.")
  77. endif()
  78. set (CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG "${CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG_INIT}" CACHE STRING
  79. "Flags used by the assembler during debug builds.")
  80. set (CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL "${CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL_INIT}" CACHE STRING
  81. "Flags used by the assembler during release minsize builds.")
  82. set (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE_INIT}" CACHE STRING
  83. "Flags used by the assembler during release builds.")
  84. set (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
  85. "Flags used by the assembler during Release with Debug Info builds.")
  86. endif()
  87. mark_as_advanced(CMAKE_ASM${ASM_DIALECT}_FLAGS
  88. CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG
  89. CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL
  90. CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE
  91. CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO
  92. )
  93. if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
  94. set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
  95. endif()
  96. if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY)
  97. set(CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY
  98. "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
  99. "<CMAKE_RANLIB> <TARGET> ")
  100. endif()
  101. if(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE)
  102. set(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE
  103. "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
  104. endif()
  105. if(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG)
  106. set(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG})
  107. endif()
  108. if(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP)
  109. set(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP})
  110. endif()
  111. if(NOT CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG)
  112. set(CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_ASM${ASM_DIALECT}_FLAG})
  113. endif()
  114. # to be done
  115. if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
  116. set(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
  117. endif()
  118. if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE)
  119. set(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE)
  120. endif()
  121. set(CMAKE_ASM${ASM_DIALECT}_INFOMATION_LOADED 1)