llvm-project

Форк
0
/
HandleLibunwindFlags.cmake 
116 строк · 3.3 Кб
1
# HandleLibcxxFlags - A set of macros used to setup the flags used to compile
2
# and link libc++abi. These macros add flags to the following CMake variables.
3
# - LIBUNWIND_COMPILE_FLAGS: flags used to compile libunwind
4
# - LIBUNWIND_LINK_FLAGS: flags used to link libunwind
5
# - LIBUNWIND_LIBRARIES: libraries to link libunwind to.
6

7
include(CheckCCompilerFlag)
8
include(CheckCXXCompilerFlag)
9
include(HandleFlags)
10

11
unset(add_flag_if_supported)
12

13
# Add a list of flags to 'LIBUNWIND_COMPILE_FLAGS'.
14
macro(add_compile_flags)
15
  foreach(f ${ARGN})
16
    list(APPEND LIBUNWIND_COMPILE_FLAGS ${f})
17
  endforeach()
18
endmacro()
19

20
# If 'condition' is true then add the specified list of flags to
21
# 'LIBUNWIND_COMPILE_FLAGS'
22
macro(add_compile_flags_if condition)
23
  if (${condition})
24
    add_compile_flags(${ARGN})
25
  endif()
26
endmacro()
27

28
# For each specified flag, add that flag to 'LIBUNWIND_COMPILE_FLAGS' if the
29
# flag is supported by the C++ compiler.
30
macro(add_compile_flags_if_supported)
31
  foreach(flag ${ARGN})
32
      mangle_name("${flag}" flagname)
33
      check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
34
      add_compile_flags_if(CXX_SUPPORTS_${flagname}_FLAG ${flag})
35
  endforeach()
36
endmacro()
37

38
# Add a list of flags to 'LIBUNWIND_C_FLAGS'.
39
macro(add_c_flags)
40
  foreach(f ${ARGN})
41
    list(APPEND LIBUNWIND_C_FLAGS ${f})
42
  endforeach()
43
endmacro()
44

45
# If 'condition' is true then add the specified list of flags to
46
# 'LIBUNWIND_C_FLAGS'
47
macro(add_c_flags_if condition)
48
  if (${condition})
49
    add_c_flags(${ARGN})
50
  endif()
51
endmacro()
52

53
# Add a list of flags to 'LIBUNWIND_CXX_FLAGS'.
54
macro(add_cxx_flags)
55
  foreach(f ${ARGN})
56
    list(APPEND LIBUNWIND_CXX_FLAGS ${f})
57
  endforeach()
58
endmacro()
59

60
# If 'condition' is true then add the specified list of flags to
61
# 'LIBUNWIND_CXX_FLAGS'
62
macro(add_cxx_flags_if condition)
63
  if (${condition})
64
    add_cxx_flags(${ARGN})
65
  endif()
66
endmacro()
67

68
# For each specified flag, add that flag to 'LIBUNWIND_CXX_FLAGS' if the
69
# flag is supported by the C compiler.
70
macro(add_cxx_compile_flags_if_supported)
71
  foreach(flag ${ARGN})
72
      mangle_name("${flag}" flagname)
73
      check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
74
      add_cxx_flags_if(CXX_SUPPORTS_${flagname}_FLAG ${flag})
75
  endforeach()
76
endmacro()
77

78
# Add a list of flags to 'LIBUNWIND_LINK_FLAGS'.
79
macro(add_link_flags)
80
  foreach(f ${ARGN})
81
    list(APPEND LIBUNWIND_LINK_FLAGS ${f})
82
  endforeach()
83
endmacro()
84

85
# If 'condition' is true then add the specified list of flags to
86
# 'LIBUNWIND_LINK_FLAGS'
87
macro(add_link_flags_if condition)
88
  if (${condition})
89
    add_link_flags(${ARGN})
90
  endif()
91
endmacro()
92

93
# For each specified flag, add that flag to 'LIBUNWIND_LINK_FLAGS' if the
94
# flag is supported by the C++ compiler.
95
macro(add_link_flags_if_supported)
96
  foreach(flag ${ARGN})
97
    mangle_name("${flag}" flagname)
98
    check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
99
    add_link_flags_if(CXX_SUPPORTS_${flagname}_FLAG ${flag})
100
  endforeach()
101
endmacro()
102

103
# Add a list of libraries or link flags to 'LIBUNWIND_LIBRARIES'.
104
macro(add_library_flags)
105
  foreach(lib ${ARGN})
106
    list(APPEND LIBUNWIND_LIBRARIES ${lib})
107
  endforeach()
108
endmacro()
109

110
# if 'condition' is true then add the specified list of libraries and flags
111
# to 'LIBUNWIND_LIBRARIES'.
112
macro(add_library_flags_if condition)
113
  if(${condition})
114
    add_library_flags(${ARGN})
115
  endif()
116
endmacro()
117

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.