CMakeASMInformation.cmake 5.57 KB
Newer Older
1
2
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
3
4


5
6
if(UNIX)
  set(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .o)
7
else()
8
  set(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .obj)
9
endif()
Alexander Neundorf's avatar
 
Alexander Neundorf committed
10

11
12
13
set(CMAKE_INCLUDE_FLAG_ASM${ASM_DIALECT} "-I")       # -I
set(CMAKE_BASE_NAME)
get_filename_component(CMAKE_BASE_NAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME_WE)
Alexander Neundorf's avatar
 
Alexander Neundorf committed
14

15
16
if("${CMAKE_BASE_NAME}" STREQUAL "as")
  set(CMAKE_BASE_NAME gas)
17
endif()
Alexander Neundorf's avatar
 
Alexander Neundorf committed
18

19
# Load compiler-specific information.
20
21
22
set(_INCLUDED_FILE "")
if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
  include(Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL  RESULT_VARIABLE _INCLUDED_FILE)
23
endif()
24
25
26
if(NOT _INCLUDED_FILE)
  if("ASM${ASM_DIALECT}" STREQUAL "ASM")
    message(STATUS "Warning: Did not find file Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}")
27
  endif()
28
  include(Platform/${CMAKE_BASE_NAME} OPTIONAL)
29
endif()
30
31
32
33
34

if(CMAKE_SYSTEM_PROCESSOR)
  include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL  RESULT_VARIABLE _INCLUDED_FILE)
  if(NOT _INCLUDED_FILE)
    include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
35
36
  endif()
endif()
37
38
39
40

include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL  RESULT_VARIABLE _INCLUDED_FILE)
if(NOT _INCLUDED_FILE)
  include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
41
endif()
Alexander Neundorf's avatar
 
Alexander Neundorf committed
42

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# This should be included before the _INIT variables are
# used to initialize the cache.  Since the rule variables
# have if blocks on them, users can still define them here.
# But, it should still be after the platform file so changes can
# be made to those values.

if(CMAKE_USER_MAKE_RULES_OVERRIDE)
  # Save the full path of the file so try_compile can use it.
  include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override)
  set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}")
endif()

if(CMAKE_USER_MAKE_RULES_OVERRIDE_ASM)
  # Save the full path of the file so try_compile can use it.
  include(${CMAKE_USER_MAKE_RULES_OVERRIDE_ASM} RESULT_VARIABLE _override)
  set(CMAKE_USER_MAKE_RULES_OVERRIDE_ASM "${_override}")
endif()

61
# Set default assembler file extensions:
62
63
if(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS)
  set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm)
64
endif()
Alexander Neundorf's avatar
 
Alexander Neundorf committed
65

66
67

# Support for CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT and friends:
68
set(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT "$ENV{ASM${ASM_DIALECT}FLAGS} ${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}")
69
70
71
72
73

foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
  string(STRIP "${CMAKE_ASM${ASM_DIALECT}_FLAGS${c}_INIT}" CMAKE_ASM${ASM_DIALECT}_FLAGS${c}_INIT)
endforeach()

74
set (CMAKE_ASM${ASM_DIALECT}_FLAGS "${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}" CACHE STRING
75
76
     "Flags used by the assembler during all build types.")

77
if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
78
# default build type is none
79
80
  if(NOT CMAKE_NO_BUILD_TYPE)
    set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
81
      "Choose the type of build, options are: None, Debug Release RelWithDebInfo MinSizeRel.")
82
  endif()
83
  set (CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG "${CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG_INIT}" CACHE STRING
84
    "Flags used by the assembler during debug builds.")
85
  set (CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL "${CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL_INIT}" CACHE STRING
86
    "Flags used by the assembler during release minsize builds.")
87
  set (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE_INIT}" CACHE STRING
88
    "Flags used by the assembler during release builds.")
89
  set (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
90
    "Flags used by the assembler during Release with Debug Info builds.")
91
endif()
92

93
mark_as_advanced(CMAKE_ASM${ASM_DIALECT}_FLAGS
94
95
96
97
98
99
100
                 CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG
                 CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL
                 CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE
                 CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO
                )


101
if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
102
  set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
103
endif()
Alexander Neundorf's avatar
 
Alexander Neundorf committed
104

105
106
if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY)
  set(CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY
Alexander Neundorf's avatar
 
Alexander Neundorf committed
107
108
      "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
      "<CMAKE_RANLIB> <TARGET> ")
109
endif()
Alexander Neundorf's avatar
 
Alexander Neundorf committed
110

111
112
if(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE)
  set(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE
113
    "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS>  -o <TARGET> <LINK_LIBRARIES>")
114
endif()
Alexander Neundorf's avatar
 
Alexander Neundorf committed
115

116
117
118
if(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG)
  set(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG})
endif()
119

120
121
122
if(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP)
  set(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP})
endif()
123

124
125
126
if(NOT CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG)
  set(CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_ASM${ASM_DIALECT}_FLAG})
endif()
127

Alexander Neundorf's avatar
 
Alexander Neundorf committed
128
# to be done
129
130
if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
  set(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
131
endif()
Alexander Neundorf's avatar
 
Alexander Neundorf committed
132

133
134
if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE)
  set(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE)
135
endif()
Alexander Neundorf's avatar
 
Alexander Neundorf committed
136
137


138
set(CMAKE_ASM${ASM_DIALECT}_INFOMATION_LOADED 1)
Alexander Neundorf's avatar
 
Alexander Neundorf committed
139