1set(files
2  __bit_reference
3  __bsd_locale_defaults.h
4  __bsd_locale_fallbacks.h
5  __errc
6  __debug
7  __functional_03
8  __functional_base
9  __functional_base_03
10  __hash_table
11  __libcpp_version
12  __locale
13  __mutex_base
14  __node_handle
15  __nullptr
16  __split_buffer
17  __sso_allocator
18  __std_stream
19  __string
20  __threading_support
21  __tree
22  __tuple
23  __undef_macros
24  algorithm
25  any
26  array
27  atomic
28  barrier
29  bit
30  bitset
31  cassert
32  ccomplex
33  cctype
34  cerrno
35  cfenv
36  cfloat
37  charconv
38  chrono
39  cinttypes
40  ciso646
41  climits
42  clocale
43  cmath
44  codecvt
45  compare
46  complex
47  complex.h
48  concepts
49  condition_variable
50  csetjmp
51  csignal
52  cstdarg
53  cstdbool
54  cstddef
55  cstdint
56  cstdio
57  cstdlib
58  cstring
59  ctgmath
60  ctime
61  ctype.h
62  cwchar
63  cwctype
64  deque
65  errno.h
66  exception
67  execution
68  experimental/__config
69  experimental/__memory
70  experimental/algorithm
71  experimental/coroutine
72  experimental/deque
73  experimental/filesystem
74  experimental/forward_list
75  experimental/functional
76  experimental/iterator
77  experimental/list
78  experimental/map
79  experimental/memory_resource
80  experimental/propagate_const
81  experimental/regex
82  experimental/set
83  experimental/simd
84  experimental/string
85  experimental/type_traits
86  experimental/unordered_map
87  experimental/unordered_set
88  experimental/utility
89  experimental/vector
90  ext/__hash
91  ext/hash_map
92  ext/hash_set
93  fenv.h
94  filesystem
95  float.h
96  forward_list
97  fstream
98  functional
99  future
100  initializer_list
101  inttypes.h
102  iomanip
103  ios
104  iosfwd
105  iostream
106  istream
107  iterator
108  latch
109  limits
110  limits.h
111  list
112  locale
113  locale.h
114  map
115  math.h
116  memory
117  module.modulemap
118  mutex
119  new
120  numeric
121  optional
122  ostream
123  queue
124  random
125  ratio
126  regex
127  scoped_allocator
128  semaphore
129  set
130  setjmp.h
131  shared_mutex
132  span
133  sstream
134  stack
135  stdbool.h
136  stddef.h
137  stdexcept
138  stdint.h
139  stdio.h
140  stdlib.h
141  streambuf
142  string
143  string.h
144  string_view
145  strstream
146  system_error
147  tgmath.h
148  thread
149  tuple
150  type_traits
151  typeindex
152  typeinfo
153  unordered_map
154  unordered_set
155  utility
156  valarray
157  variant
158  vector
159  version
160  wchar.h
161  wctype.h
162  )
163
164if(LIBCXX_INSTALL_SUPPORT_HEADERS)
165  set(files
166    ${files}
167    support/android/locale_bionic.h
168    support/fuchsia/xlocale.h
169    support/ibm/limits.h
170    support/ibm/locale_mgmt_aix.h
171    support/ibm/support.h
172    support/ibm/xlocale.h
173    support/musl/xlocale.h
174    support/newlib/xlocale.h
175    support/solaris/floatingpoint.h
176    support/solaris/wchar.h
177    support/solaris/xlocale.h
178    support/win32/limits_msvc_win32.h
179    support/win32/locale_win32.h
180    support/xlocale/__nop_locale_mgmt.h
181    support/xlocale/__posix_l_fallback.h
182    support/xlocale/__strtonum_fallback.h
183    )
184endif()
185
186if (LIBCXX_NEEDS_SITE_CONFIG)
187  # Generate a custom __config header. The new header is created
188  # by prepending __config_site to the current __config header.
189  add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config
190    COMMAND ${Python3_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/cat_files.py
191      ${LIBCXX_BINARY_DIR}/__config_site
192      ${LIBCXX_SOURCE_DIR}/include/__config
193      -o ${LIBCXX_BINARY_DIR}/__generated_config
194    DEPENDS ${LIBCXX_SOURCE_DIR}/include/__config
195            ${LIBCXX_BINARY_DIR}/__config_site
196  )
197  # Add a target that executes the generation commands.
198  add_custom_target(cxx-generated-config ALL
199    DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
200  set(generated_config_deps cxx-generated-config)
201else()
202  set(files
203    ${files}
204    __config
205    )
206endif()
207
208# In some build configurations (like bootstrapping clang), we need to be able to
209# install the libcxx headers before the CMake configuration for libcxx runs. Making
210# the name of this target configurable allows LLVM/runtimes/CMakeLists.txt to
211# add this subdirectory to the LLVM build to put libcxx's headers in place
212# before libcxx's build configuration is run.
213if (NOT CXX_HEADER_TARGET)
214  set(CXX_HEADER_TARGET cxx-headers)
215endif()
216if(NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
217  set(output_dir ${LIBCXX_HEADER_DIR}/include/c++/v1)
218
219  set(out_files)
220  foreach(f ${files})
221    set(src ${CMAKE_CURRENT_SOURCE_DIR}/${f})
222    set(dst ${output_dir}/${f})
223    add_custom_command(OUTPUT ${dst}
224      DEPENDS ${src}
225      COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
226      COMMENT "Copying CXX header ${f}")
227    list(APPEND out_files ${dst})
228  endforeach()
229
230  if (LIBCXX_NEEDS_SITE_CONFIG)
231    # Copy the generated header as __config into build directory.
232    set(src ${LIBCXX_BINARY_DIR}/__generated_config)
233    set(dst ${output_dir}/__config)
234    add_custom_command(OUTPUT ${dst}
235        DEPENDS ${src} ${generated_config_deps}
236        COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
237        COMMENT "Copying CXX __config")
238    list(APPEND out_files ${dst})
239  endif()
240
241  add_custom_target(${CXX_HEADER_TARGET} ALL DEPENDS ${out_files} ${LIBCXX_CXX_ABI_HEADER_TARGET})
242else()
243  add_custom_target(${CXX_HEADER_TARGET})
244endif()
245set_target_properties(${CXX_HEADER_TARGET} PROPERTIES FOLDER "Misc")
246
247if (LIBCXX_INSTALL_HEADERS)
248  foreach(file ${files})
249    get_filename_component(dir ${file} DIRECTORY)
250    install(FILES ${file}
251      DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir}
252      COMPONENT ${CXX_HEADER_TARGET}
253      PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
254    )
255  endforeach()
256
257  if (LIBCXX_NEEDS_SITE_CONFIG)
258    # Install the generated header as __config.
259    install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
260      DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1
261      PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
262      RENAME __config
263      COMPONENT ${CXX_HEADER_TARGET})
264  endif()
265
266  if (NOT CMAKE_CONFIGURATION_TYPES)
267    add_custom_target(install-${CXX_HEADER_TARGET}
268                      DEPENDS ${CXX_HEADER_TARGET} ${generated_config_deps}
269                      COMMAND "${CMAKE_COMMAND}"
270                              -DCMAKE_INSTALL_COMPONENT=${CXX_HEADER_TARGET}
271                              -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
272    # Stripping is a no-op for headers
273    add_custom_target(install-${CXX_HEADER_TARGET}-stripped DEPENDS install-${CXX_HEADER_TARGET})
274  endif()
275endif()
276