2 #=============================================================================
3 # Copyright 2007-2009 Kitware, Inc.
5 # Distributed under the OSI-approved BSD License (the "License");
6 # see accompanying file Copyright.txt for details.
8 # This software is distributed WITHOUT ANY WARRANTY; without even the
9 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # See the License for more information.
11 #=============================================================================
12 # (To distribute this file outside of CMake, substitute the full
13 # License text for the above reference.)
16 set(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .o)
18 set(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .obj)
21 set(CMAKE_INCLUDE_FLAG_ASM${ASM_DIALECT} "-I") # -I
23 get_filename_component(CMAKE_BASE_NAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME_WE)
25 if("${CMAKE_BASE_NAME}" STREQUAL "as")
26 set(CMAKE_BASE_NAME gas)
29 # Load compiler-specific information.
30 set(_INCLUDED_FILE "")
31 if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
32 include(Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
34 if(NOT _INCLUDED_FILE)
35 if("ASM${ASM_DIALECT}" STREQUAL "ASM")
36 message(STATUS "Warning: Did not find file Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}")
38 include(Platform/${CMAKE_BASE_NAME} OPTIONAL)
41 if(CMAKE_SYSTEM_PROCESSOR)
42 include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
43 if(NOT _INCLUDED_FILE)
44 include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
48 include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
49 if(NOT _INCLUDED_FILE)
50 include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
53 # Set default assembler file extensions:
54 if(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS)
55 set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm)
59 # Support for CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT and friends:
60 set(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT "$ENV{ASM${ASM_DIALECT}FLAGS} ${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}")
61 # avoid just having a space as the initial value for the cache
62 if(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT STREQUAL " ")
63 set(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT)
65 set (CMAKE_ASM${ASM_DIALECT}_FLAGS "${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}" CACHE STRING
66 "Flags used by the assembler during all build types.")
68 if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
69 # default build type is none
70 if(NOT CMAKE_NO_BUILD_TYPE)
71 set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
72 "Choose the type of build, options are: None, Debug Release RelWithDebInfo MinSizeRel.")
74 set (CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG "${CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG_INIT}" CACHE STRING
75 "Flags used by the assembler during debug builds.")
76 set (CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL "${CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL_INIT}" CACHE STRING
77 "Flags used by the assembler during release minsize builds.")
78 set (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE_INIT}" CACHE STRING
79 "Flags used by the assembler during release builds.")
80 set (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
81 "Flags used by the assembler during Release with Debug Info builds.")
84 mark_as_advanced(CMAKE_ASM${ASM_DIALECT}_FLAGS
85 CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG
86 CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL
87 CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE
88 CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO
92 if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
93 set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
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> ")
102 if(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE)
103 set(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE
104 "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
107 if(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG)
108 set(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG})
111 if(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP)
112 set(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP})
115 if(NOT CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG)
116 set(CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_ASM${ASM_DIALECT}_FLAG})
120 if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
121 set(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
124 if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE)
125 set(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE)
129 set(CMAKE_ASM${ASM_DIALECT}_INFOMATION_LOADED 1)