CMakeASMInformation.cmake 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. if(UNIX)
  4. set(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .o)
  5. else()
  6. set(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .obj)
  7. endif()
  8. set(CMAKE_INCLUDE_FLAG_ASM${ASM_DIALECT} "-I") # -I
  9. set(CMAKE_BASE_NAME)
  10. get_filename_component(CMAKE_BASE_NAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME_WE)
  11. if("${CMAKE_BASE_NAME}" STREQUAL "as")
  12. set(CMAKE_BASE_NAME gas)
  13. endif()
  14. # Load compiler-specific information.
  15. set(_INCLUDED_FILE "")
  16. if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
  17. include(Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
  18. endif()
  19. if(NOT _INCLUDED_FILE)
  20. if("ASM${ASM_DIALECT}" STREQUAL "ASM")
  21. message(STATUS "Warning: Did not find file Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}")
  22. endif()
  23. include(Platform/${CMAKE_BASE_NAME} OPTIONAL)
  24. endif()
  25. if(CMAKE_SYSTEM_PROCESSOR)
  26. include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
  27. if(NOT _INCLUDED_FILE)
  28. include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
  29. endif()
  30. endif()
  31. include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
  32. if(NOT _INCLUDED_FILE)
  33. include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
  34. endif()
  35. # This should be included before the _INIT variables are
  36. # used to initialize the cache. Since the rule variables
  37. # have if blocks on them, users can still define them here.
  38. # But, it should still be after the platform file so changes can
  39. # be made to those values.
  40. if(CMAKE_USER_MAKE_RULES_OVERRIDE)
  41. # Save the full path of the file so try_compile can use it.
  42. include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override)
  43. set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}")
  44. endif()
  45. if(CMAKE_USER_MAKE_RULES_OVERRIDE_ASM)
  46. # Save the full path of the file so try_compile can use it.
  47. include(${CMAKE_USER_MAKE_RULES_OVERRIDE_ASM} RESULT_VARIABLE _override)
  48. set(CMAKE_USER_MAKE_RULES_OVERRIDE_ASM "${_override}")
  49. endif()
  50. # Set default assembler file extensions:
  51. if(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS)
  52. set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm)
  53. endif()
  54. # Support for CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT and friends:
  55. set(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT "$ENV{ASM${ASM_DIALECT}FLAGS} ${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}")
  56. cmake_initialize_per_config_variable(CMAKE_ASM${ASM_DIALECT}_FLAGS "Flags used by the ASM${ASM_DIALECT} compiler")
  57. if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
  58. set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
  59. endif()
  60. if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY)
  61. set(CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY
  62. "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
  63. "<CMAKE_RANLIB> <TARGET> ")
  64. endif()
  65. if(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE)
  66. set(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE
  67. "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
  68. endif()
  69. if(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG)
  70. set(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG})
  71. endif()
  72. if(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP)
  73. set(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP})
  74. endif()
  75. if(NOT CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG)
  76. set(CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_ASM${ASM_DIALECT}_FLAG})
  77. endif()
  78. # to be done
  79. if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
  80. set(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
  81. endif()
  82. if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE)
  83. set(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE)
  84. endif()
  85. set(CMAKE_ASM${ASM_DIALECT}_INFOMATION_LOADED 1)