1
1
include (AddLLVM)
2
2
include (ExternalProject)
3
- include (LLVMParseArguments)
4
3
include (CompilerRTUtils)
5
4
6
5
# Tries to add an "object library" target for a given list of OSs and/or
7
6
# architectures with name "<name>.<arch>" for non-Darwin platforms if
8
7
# architecture can be targeted, and "<name>.<os>" for Darwin platforms.
9
8
# add_compiler_rt_object_libraries(<name>
10
- # OS <os>
11
- # ARCH <arch >
9
+ # OS <os names >
10
+ # ARCHS <architectures >
12
11
# SOURCES <source files>
13
12
# CFLAGS <compile flags>
14
13
# DEFS <compile definitions>)
15
14
function (add_compiler_rt_object_libraries name )
16
- parse_arguments (LIB "OS;ARCH ;SOURCES;CFLAGS;DEFS" " " ${ARGN} )
15
+ cmake_parse_arguments (LIB "" "" " OS;ARCHS ;SOURCES;CFLAGS;DEFS" ${ARGN} )
17
16
set (libnames)
18
17
if (APPLE )
19
18
foreach (os ${LIB_OS} )
@@ -22,7 +21,7 @@ function(add_compiler_rt_object_libraries name)
22
21
set (extra_cflags_${libname} ${DARWIN_${os} _CFLAGS})
23
22
endforeach ()
24
23
else ()
25
- foreach (arch ${LIB_ARCH } )
24
+ foreach (arch ${LIB_ARCHS } )
26
25
set (libname "${name} .${arch} " )
27
26
set (libnames ${libnames} ${libname} )
28
27
set (extra_cflags_${libname} ${TARGET_${arch} _CFLAGS})
@@ -40,7 +39,7 @@ function(add_compiler_rt_object_libraries name)
40
39
set_property (TARGET ${libname} APPEND PROPERTY
41
40
COMPILE_DEFINITIONS ${LIB_DEFS} )
42
41
if (APPLE )
43
- set_target_properties (${libname} PROPERTIES OSX_ARCHITECTURES "${LIB_ARCH } " )
42
+ set_target_properties (${libname} PROPERTIES OSX_ARCHITECTURES "${LIB_ARCHS } " )
44
43
endif ()
45
44
endforeach ()
46
45
endfunction ()
@@ -54,7 +53,7 @@ endfunction()
54
53
# OUTPUT_NAME <output library name>)
55
54
macro (add_compiler_rt_runtime name arch type )
56
55
if (CAN_TARGET_${arch} )
57
- parse_arguments (LIB "SOURCES;CFLAGS;LINKFLAGS;DEFS;OUTPUT_NAME" " " ${ARGN} )
56
+ cmake_parse_arguments (LIB "" "OUTPUT_NAME" " SOURCES;CFLAGS;LINKFLAGS;DEFS" ${ARGN} )
58
57
add_library (${name} ${type} ${LIB_SOURCES} )
59
58
# Setup compile flags and definitions.
60
59
set_target_compile_flags(${name}
@@ -87,18 +86,18 @@ endmacro()
87
86
88
87
# Same as add_compiler_rt_runtime(... STATIC), but creates a universal library
89
88
# for several architectures.
90
- # add_compiler_rt_osx_static_runtime(<name> ARCH <architectures>
89
+ # add_compiler_rt_osx_static_runtime(<name> ARCHS <architectures>
91
90
# SOURCES <source files>
92
91
# CFLAGS <compile flags>
93
92
# DEFS <compile definitions>)
94
93
macro (add_compiler_rt_osx_static_runtime name )
95
- parse_arguments (LIB "ARCH ;SOURCES;CFLAGS;DEFS" " " ${ARGN} )
94
+ cmake_parse_arguments (LIB "" "" "ARCHS ;SOURCES;CFLAGS;DEFS" ${ARGN} )
96
95
add_library (${name} STATIC ${LIB_SOURCES} )
97
96
set_target_compile_flags(${name} ${LIB_CFLAGS} )
98
97
set_property (TARGET ${name} APPEND PROPERTY
99
98
COMPILE_DEFINITIONS ${LIB_DEFS} )
100
99
set_target_properties (${name} PROPERTIES
101
- OSX_ARCHITECTURES "${LIB_ARCH } "
100
+ OSX_ARCHITECTURES "${LIB_ARCHS } "
102
101
ARCHIVE_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR} )
103
102
install (TARGETS ${name}
104
103
ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR} )
@@ -107,20 +106,20 @@ endmacro()
107
106
# Adds dynamic runtime library on osx/iossim, which supports multiple
108
107
# architectures.
109
108
# add_compiler_rt_darwin_dynamic_runtime(<name> <os>
110
- # ARCH <architectures>
109
+ # ARCHS <architectures>
111
110
# SOURCES <source files>
112
111
# CFLAGS <compile flags>
113
112
# DEFS <compile definitions>
114
113
# LINKFLAGS <link flags>)
115
114
macro (add_compiler_rt_darwin_dynamic_runtime name os)
116
- parse_arguments (LIB "ARCH ;SOURCES;CFLAGS;DEFS;LINKFLAGS" " " ${ARGN} )
115
+ cmake_parse_arguments (LIB "" "" "ARCHS ;SOURCES;CFLAGS;DEFS;LINKFLAGS" ${ARGN} )
117
116
add_library (${name} SHARED ${LIB_SOURCES} )
118
117
set_target_compile_flags(${name} ${LIB_CFLAGS} ${DARWIN_${os} _CFLAGS})
119
118
set_target_link_flags(${name} ${LIB_LINKFLAGS} ${DARWIN_${os} _LINKFLAGS})
120
119
set_property (TARGET ${name} APPEND PROPERTY
121
120
COMPILE_DEFINITIONS ${LIB_DEFS} )
122
121
set_target_properties (${name} PROPERTIES
123
- OSX_ARCHITECTURES "${LIB_ARCH } "
122
+ OSX_ARCHITECTURES "${LIB_ARCHS } "
124
123
LIBRARY_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR} )
125
124
install (TARGETS ${name}
126
125
LIBRARY DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR} )
@@ -169,7 +168,7 @@ endif()
169
168
# DEPS <deps (e.g. runtime libs)>
170
169
# LINK_FLAGS <link flags>)
171
170
macro (add_compiler_rt_test test_suite test_name)
172
- parse_arguments (TEST "SUBDIR; OBJECTS;DEPS;LINK_FLAGS" "" ${ARGN} )
171
+ cmake_parse_arguments (TEST "" " SUBDIR" " OBJECTS;DEPS;LINK_FLAGS" "" ${ARGN} )
173
172
if (TEST_SUBDIR)
174
173
set (output_bin "${CMAKE_CURRENT_BINARY_DIR} /${TEST_SUBDIR} /${test_name} " )
175
174
else ()
@@ -236,7 +235,7 @@ macro(add_custom_libcxx name prefix)
236
235
message (FATAL_ERROR "libcxx not found!" )
237
236
endif ()
238
237
239
- parse_arguments (LIBCXX "DEPS;CFLAGS " "" ${ARGN} )
238
+ cmake_parse_arguments (LIBCXX "" "" "DEPS;CFLAGS " ${ARGN} )
240
239
foreach (flag ${LIBCXX_CFLAGS} )
241
240
set (flagstr "${flagstr} ${flag} " )
242
241
endforeach ()
0 commit comments