1include(CMakePushCheckState)
2include(CheckSymbolExists)
3
4# Because compiler-rt spends a lot of time setting up custom compile flags,
5# define a handy helper function for it. The compile flags setting in CMake
6# has serious issues that make its syntax challenging at best.
7function(set_target_compile_flags target)
8  set(argstring "")
9  foreach(arg ${ARGN})
10    set(argstring "${argstring} ${arg}")
11  endforeach()
12  set_property(TARGET ${target} PROPERTY COMPILE_FLAGS "${argstring}")
13endfunction()
14
15function(set_target_link_flags target)
16  set(argstring "")
17  foreach(arg ${ARGN})
18    set(argstring "${argstring} ${arg}")
19  endforeach()
20  set_property(TARGET ${target} PROPERTY LINK_FLAGS "${argstring}")
21endfunction()
22
23# Set the variable var_PYBOOL to True if var holds a true-ish string,
24# otherwise set it to False.
25macro(pythonize_bool var)
26  if (${var})
27    set(${var}_PYBOOL True)
28  else()
29    set(${var}_PYBOOL False)
30  endif()
31endmacro()
32
33# Appends value to all lists in ARGN, if the condition is true.
34macro(append_list_if condition value)
35  if(${condition})
36    foreach(list ${ARGN})
37      list(APPEND ${list} ${value})
38    endforeach()
39  endif()
40endmacro()
41
42# Appends value to all strings in ARGN, if the condition is true.
43macro(append_string_if condition value)
44  if(${condition})
45    foreach(str ${ARGN})
46      set(${str} "${${str}} ${value}")
47    endforeach()
48  endif()
49endmacro()
50
51macro(append_rtti_flag polarity list)
52  if(${polarity})
53    append_list_if(COMPILER_RT_HAS_FRTTI_FLAG -frtti ${list})
54    append_list_if(COMPILER_RT_HAS_GR_FLAG /GR ${list})
55  else()
56    append_list_if(COMPILER_RT_HAS_FNO_RTTI_FLAG -fno-rtti ${list})
57    append_list_if(COMPILER_RT_HAS_GR_FLAG /GR- ${list})
58  endif()
59endmacro()
60
61macro(list_intersect output input1 input2)
62  set(${output})
63  foreach(it ${${input1}})
64    list(FIND ${input2} ${it} index)
65    if( NOT (index EQUAL -1))
66      list(APPEND ${output} ${it})
67    endif()
68  endforeach()
69endmacro()
70
71function(list_replace input_list old new)
72  set(replaced_list)
73  foreach(item ${${input_list}})
74    if(${item} STREQUAL ${old})
75      list(APPEND replaced_list ${new})
76    else()
77      list(APPEND replaced_list ${item})
78    endif()
79  endforeach()
80  set(${input_list} "${replaced_list}" PARENT_SCOPE)
81endfunction()
82
83# Takes ${ARGN} and puts only supported architectures in @out_var list.
84function(filter_available_targets out_var)
85  set(archs ${${out_var}})
86  foreach(arch ${ARGN})
87    list(FIND COMPILER_RT_SUPPORTED_ARCH ${arch} ARCH_INDEX)
88    if(NOT (ARCH_INDEX EQUAL -1) AND CAN_TARGET_${arch})
89      list(APPEND archs ${arch})
90    endif()
91  endforeach()
92  set(${out_var} ${archs} PARENT_SCOPE)
93endfunction()
94
95# Add $arch as supported with no additional flags.
96macro(add_default_target_arch arch)
97  set(TARGET_${arch}_CFLAGS "")
98  set(CAN_TARGET_${arch} 1)
99  list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
100endmacro()
101
102function(check_compile_definition def argstring out_var)
103  if("${def}" STREQUAL "")
104    set(${out_var} TRUE PARENT_SCOPE)
105    return()
106  endif()
107  cmake_push_check_state()
108  set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${argstring}")
109  check_symbol_exists(${def} "" ${out_var})
110  cmake_pop_check_state()
111endfunction()
112
113# test_target_arch(<arch> <def> <target flags...>)
114# Checks if architecture is supported: runs host compiler with provided
115# flags to verify that:
116#   1) <def> is defined (if non-empty)
117#   2) simple file can be successfully built.
118# If successful, saves target flags for this architecture.
119macro(test_target_arch arch def)
120  set(TARGET_${arch}_CFLAGS ${ARGN})
121  set(TARGET_${arch}_LINK_FLAGS ${ARGN})
122  set(argstring "")
123  foreach(arg ${ARGN})
124    set(argstring "${argstring} ${arg}")
125  endforeach()
126  check_compile_definition("${def}" "${argstring}" HAS_${arch}_DEF)
127  if(NOT DEFINED CAN_TARGET_${arch})
128    if(NOT HAS_${arch}_DEF)
129      set(CAN_TARGET_${arch} FALSE)
130    elseif(TEST_COMPILE_ONLY)
131      try_compile_only(CAN_TARGET_${arch} FLAGS ${TARGET_${arch}_CFLAGS})
132    else()
133      set(FLAG_NO_EXCEPTIONS "")
134      if(COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG)
135        set(FLAG_NO_EXCEPTIONS " -fno-exceptions ")
136      endif()
137      set(SAVED_CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
138      set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${argstring}")
139      try_compile(CAN_TARGET_${arch} ${CMAKE_BINARY_DIR} ${SIMPLE_SOURCE}
140                  COMPILE_DEFINITIONS "${TARGET_${arch}_CFLAGS} ${FLAG_NO_EXCEPTIONS}"
141                  OUTPUT_VARIABLE TARGET_${arch}_OUTPUT)
142      set(CMAKE_EXE_LINKER_FLAGS ${SAVED_CMAKE_EXE_LINKER_FLAGS})
143    endif()
144  endif()
145  if(${CAN_TARGET_${arch}})
146    list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
147  elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" STREQUAL "${arch}" AND
148         COMPILER_RT_HAS_EXPLICIT_DEFAULT_TARGET_TRIPLE)
149    # Bail out if we cannot target the architecture we plan to test.
150    message(FATAL_ERROR "Cannot compile for ${arch}:\n${TARGET_${arch}_OUTPUT}")
151  endif()
152endmacro()
153
154macro(detect_target_arch)
155  check_symbol_exists(__arm__ "" __ARM)
156  check_symbol_exists(__aarch64__ "" __AARCH64)
157  check_symbol_exists(__x86_64__ "" __X86_64)
158  check_symbol_exists(__i386__ "" __I386)
159  check_symbol_exists(__mips__ "" __MIPS)
160  check_symbol_exists(__mips64__ "" __MIPS64)
161  check_symbol_exists(__powerpc__ "" __PPC)
162  check_symbol_exists(__powerpc64__ "" __PPC64)
163  check_symbol_exists(__powerpc64le__ "" __PPC64LE)
164  check_symbol_exists(__riscv "" __RISCV)
165  check_symbol_exists(__s390x__ "" __S390X)
166  check_symbol_exists(__sparc "" __SPARC)
167  check_symbol_exists(__sparcv9 "" __SPARCV9)
168  check_symbol_exists(__wasm32__ "" __WEBASSEMBLY32)
169  check_symbol_exists(__wasm64__ "" __WEBASSEMBLY64)
170  check_symbol_exists(__ve__ "" __VE)
171  if(__ARM)
172    add_default_target_arch(arm)
173  elseif(__AARCH64)
174    add_default_target_arch(aarch64)
175  elseif(__X86_64)
176    add_default_target_arch(x86_64)
177  elseif(__I386)
178    add_default_target_arch(i386)
179  elseif(__MIPS64) # must be checked before __MIPS
180    add_default_target_arch(mips64)
181  elseif(__MIPS)
182    add_default_target_arch(mips)
183  elseif(__PPC64) # must be checked before __PPC
184    add_default_target_arch(powerpc64)
185  elseif(__PPC64LE)
186    add_default_target_arch(powerpc64le)
187  elseif(__PPC)
188    add_default_target_arch(powerpc)
189  elseif(__RISCV)
190    if(CMAKE_SIZEOF_VOID_P EQUAL "4")
191      add_default_target_arch(riscv32)
192    elseif(CMAKE_SIZEOF_VOID_P EQUAL "8")
193      add_default_target_arch(riscv64)
194    else()
195      message(FATAL_ERROR "Unsupport XLEN for RISC-V")
196    endif()
197  elseif(__S390X)
198    add_default_target_arch(s390x)
199  elseif(__SPARCV9)
200    add_default_target_arch(sparcv9)
201  elseif(__SPARC)
202    add_default_target_arch(sparc)
203  elseif(__WEBASSEMBLY32)
204    add_default_target_arch(wasm32)
205  elseif(__WEBASSEMBLY64)
206    add_default_target_arch(wasm64)
207  elseif(__VE)
208    add_default_target_arch(ve)
209  endif()
210endmacro()
211
212macro(load_llvm_config)
213  if (NOT LLVM_CONFIG_PATH)
214    find_program(LLVM_CONFIG_PATH "llvm-config"
215                 DOC "Path to llvm-config binary")
216    if (NOT LLVM_CONFIG_PATH)
217      message(WARNING "UNSUPPORTED COMPILER-RT CONFIGURATION DETECTED: "
218                      "llvm-config not found.\n"
219                      "Reconfigure with -DLLVM_CONFIG_PATH=path/to/llvm-config.")
220    endif()
221  endif()
222  if (LLVM_CONFIG_PATH)
223    execute_process(
224      COMMAND ${LLVM_CONFIG_PATH} "--obj-root" "--bindir" "--libdir" "--src-root" "--includedir"
225      RESULT_VARIABLE HAD_ERROR
226      OUTPUT_VARIABLE CONFIG_OUTPUT)
227    if (HAD_ERROR)
228      message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
229    endif()
230    string(REGEX REPLACE "[ \t]*[\r\n]+[ \t]*" ";" CONFIG_OUTPUT ${CONFIG_OUTPUT})
231    list(GET CONFIG_OUTPUT 0 BINARY_DIR)
232    list(GET CONFIG_OUTPUT 1 TOOLS_BINARY_DIR)
233    list(GET CONFIG_OUTPUT 2 LIBRARY_DIR)
234    list(GET CONFIG_OUTPUT 3 MAIN_SRC_DIR)
235    list(GET CONFIG_OUTPUT 4 INCLUDE_DIR)
236
237    set(LLVM_BINARY_DIR ${BINARY_DIR} CACHE PATH "Path to LLVM build tree")
238    set(LLVM_LIBRARY_DIR ${LIBRARY_DIR} CACHE PATH "Path to llvm/lib")
239    set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
240    set(LLVM_TOOLS_BINARY_DIR ${TOOLS_BINARY_DIR} CACHE PATH "Path to llvm/bin")
241    set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Paths to LLVM headers")
242
243    # Detect if we have the LLVMXRay and TestingSupport library installed and
244    # available from llvm-config.
245    execute_process(
246      COMMAND ${LLVM_CONFIG_PATH} "--ldflags" "--libs" "xray"
247      RESULT_VARIABLE HAD_ERROR
248      OUTPUT_VARIABLE CONFIG_OUTPUT
249      ERROR_QUIET)
250    if (HAD_ERROR)
251      message(WARNING "llvm-config finding xray failed with status ${HAD_ERROR}")
252      set(COMPILER_RT_HAS_LLVMXRAY FALSE)
253    else()
254      string(REGEX REPLACE "[ \t]*[\r\n]+[ \t]*" ";" CONFIG_OUTPUT ${CONFIG_OUTPUT})
255      list(GET CONFIG_OUTPUT 0 LDFLAGS)
256      list(GET CONFIG_OUTPUT 1 LIBLIST)
257      file(TO_CMAKE_PATH "${LDFLAGS}" LDFLAGS)
258      file(TO_CMAKE_PATH "${LIBLIST}" LIBLIST)
259      set(LLVM_XRAY_LDFLAGS ${LDFLAGS} CACHE STRING "Linker flags for LLVMXRay library")
260      set(LLVM_XRAY_LIBLIST ${LIBLIST} CACHE STRING "Library list for LLVMXRay")
261      set(COMPILER_RT_HAS_LLVMXRAY TRUE)
262    endif()
263
264    set(COMPILER_RT_HAS_LLVMTESTINGSUPPORT FALSE)
265    execute_process(
266      COMMAND ${LLVM_CONFIG_PATH} "--ldflags" "--libs" "testingsupport"
267      RESULT_VARIABLE HAD_ERROR
268      OUTPUT_VARIABLE CONFIG_OUTPUT
269      ERROR_QUIET)
270    if (HAD_ERROR)
271      message(WARNING "llvm-config finding testingsupport failed with status ${HAD_ERROR}")
272    elseif(COMPILER_RT_INCLUDE_TESTS)
273      string(REGEX REPLACE "[ \t]*[\r\n]+[ \t]*" ";" CONFIG_OUTPUT ${CONFIG_OUTPUT})
274      list(GET CONFIG_OUTPUT 0 LDFLAGS)
275      list(GET CONFIG_OUTPUT 1 LIBLIST)
276      if (LIBLIST STREQUAL "")
277        message(WARNING "testingsupport library not installed, some tests will be skipped")
278      else()
279        file(TO_CMAKE_PATH "${LDFLAGS}" LDFLAGS)
280        file(TO_CMAKE_PATH "${LIBLIST}" LIBLIST)
281        set(LLVM_TESTINGSUPPORT_LDFLAGS ${LDFLAGS} CACHE STRING "Linker flags for LLVMTestingSupport library")
282        set(LLVM_TESTINGSUPPORT_LIBLIST ${LIBLIST} CACHE STRING "Library list for LLVMTestingSupport")
283        set(COMPILER_RT_HAS_LLVMTESTINGSUPPORT TRUE)
284      endif()
285    endif()
286
287    # Make use of LLVM CMake modules.
288    # --cmakedir is supported since llvm r291218 (4.0 release)
289    execute_process(
290      COMMAND ${LLVM_CONFIG_PATH} --cmakedir
291      RESULT_VARIABLE HAD_ERROR
292      OUTPUT_VARIABLE CONFIG_OUTPUT)
293    if(NOT HAD_ERROR)
294      string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG)
295      file(TO_CMAKE_PATH ${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG} LLVM_CMAKE_PATH)
296    else()
297      file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE)
298      set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
299    endif()
300
301    list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
302    # Get some LLVM variables from LLVMConfig.
303    include("${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
304
305    set(LLVM_LIBRARY_OUTPUT_INTDIR
306      ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
307  endif()
308endmacro()
309
310macro(construct_compiler_rt_default_triple)
311  if(COMPILER_RT_DEFAULT_TARGET_ONLY)
312    if(DEFINED COMPILER_RT_DEFAULT_TARGET_TRIPLE)
313      message(FATAL_ERROR "COMPILER_RT_DEFAULT_TARGET_TRIPLE isn't supported when building for default target only")
314    endif()
315    set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${CMAKE_C_COMPILER_TARGET})
316  else()
317    set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${TARGET_TRIPLE} CACHE STRING
318          "Default triple for which compiler-rt runtimes will be built.")
319  endif()
320
321  if(DEFINED COMPILER_RT_TEST_TARGET_TRIPLE)
322    # Backwards compatibility: this variable used to be called
323    # COMPILER_RT_TEST_TARGET_TRIPLE.
324    set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${COMPILER_RT_TEST_TARGET_TRIPLE})
325  endif()
326
327  string(REPLACE "-" ";" TARGET_TRIPLE_LIST ${COMPILER_RT_DEFAULT_TARGET_TRIPLE})
328  list(GET TARGET_TRIPLE_LIST 0 COMPILER_RT_DEFAULT_TARGET_ARCH)
329  # Determine if test target triple is specified explicitly, and doesn't match the
330  # default.
331  if(NOT COMPILER_RT_DEFAULT_TARGET_TRIPLE STREQUAL TARGET_TRIPLE)
332    set(COMPILER_RT_HAS_EXPLICIT_DEFAULT_TARGET_TRIPLE TRUE)
333  else()
334    set(COMPILER_RT_HAS_EXPLICIT_DEFAULT_TARGET_TRIPLE FALSE)
335  endif()
336endmacro()
337
338# Filter out generic versions of routines that are re-implemented in an
339# architecture specific manner. This prevents multiple definitions of the same
340# symbols, making the symbol selection non-deterministic.
341#
342# We follow the convention that a source file that exists in a sub-directory
343# (e.g. `ppc/divtc3.c`) is architecture-specific and that if a generic
344# implementation exists it will be a top-level source file with the same name
345# modulo the file extension (e.g. `divtc3.c`).
346function(filter_builtin_sources inout_var name)
347  set(intermediate ${${inout_var}})
348  foreach(_file ${intermediate})
349    get_filename_component(_file_dir ${_file} DIRECTORY)
350    if (NOT "${_file_dir}" STREQUAL "")
351      # Architecture specific file. If a generic version exists, print a notice
352      # and ensure that it is removed from the file list.
353      get_filename_component(_name ${_file} NAME)
354      string(REGEX REPLACE "\\.S$" ".c" _cname "${_name}")
355      if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_cname}")
356        message(STATUS "For ${name} builtins preferring ${_file} to ${_cname}")
357        list(REMOVE_ITEM intermediate ${_cname})
358      endif()
359    endif()
360  endforeach()
361  set(${inout_var} ${intermediate} PARENT_SCOPE)
362endfunction()
363
364function(get_compiler_rt_target arch variable)
365  string(FIND ${COMPILER_RT_DEFAULT_TARGET_TRIPLE} "-" dash_index)
366  string(SUBSTRING ${COMPILER_RT_DEFAULT_TARGET_TRIPLE} ${dash_index} -1 triple_suffix)
367  if(COMPILER_RT_DEFAULT_TARGET_ONLY)
368    # Use exact spelling when building only for the target specified to CMake.
369    set(target "${COMPILER_RT_DEFAULT_TARGET_TRIPLE}")
370  elseif(ANDROID AND ${arch} STREQUAL "i386")
371    set(target "i686${triple_suffix}")
372  else()
373    set(target "${arch}${triple_suffix}")
374  endif()
375  set(${variable} ${target} PARENT_SCOPE)
376endfunction()
377
378function(get_compiler_rt_install_dir arch install_dir)
379  if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
380    get_compiler_rt_target(${arch} target)
381    set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/lib/${target} PARENT_SCOPE)
382  else()
383    set(${install_dir} ${COMPILER_RT_LIBRARY_INSTALL_DIR} PARENT_SCOPE)
384  endif()
385endfunction()
386
387function(get_compiler_rt_output_dir arch output_dir)
388  if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
389    get_compiler_rt_target(${arch} target)
390    set(${output_dir} ${COMPILER_RT_OUTPUT_DIR}/lib/${target} PARENT_SCOPE)
391  else()
392    set(${output_dir} ${COMPILER_RT_LIBRARY_OUTPUT_DIR} PARENT_SCOPE)
393  endif()
394endfunction()
395
396# compiler_rt_process_sources(
397#   <OUTPUT_VAR>
398#   <SOURCE_FILE> ...
399#  [ADDITIONAL_HEADERS <header> ...]
400# )
401#
402# Process the provided sources and write the list of new sources
403# into `<OUTPUT_VAR>`.
404#
405# ADDITIONAL_HEADERS     - Adds the supplied header to list of sources for IDEs.
406#
407# This function is very similar to `llvm_process_sources()` but exists here
408# because we need to support standalone builds of compiler-rt.
409function(compiler_rt_process_sources OUTPUT_VAR)
410  cmake_parse_arguments(
411    ARG
412    ""
413    ""
414    "ADDITIONAL_HEADERS"
415    ${ARGN}
416  )
417  set(sources ${ARG_UNPARSED_ARGUMENTS})
418  set(headers "")
419  if (XCODE OR MSVC_IDE OR CMAKE_EXTRA_GENERATOR)
420    # For IDEs we need to tell CMake about header files.
421    # Otherwise they won't show up in UI.
422    set(headers ${ARG_ADDITIONAL_HEADERS})
423    list(LENGTH headers headers_length)
424    if (${headers_length} GREATER 0)
425      set_source_files_properties(${headers}
426        PROPERTIES HEADER_FILE_ONLY ON)
427    endif()
428  endif()
429  set("${OUTPUT_VAR}" ${sources} ${headers} PARENT_SCOPE)
430endfunction()
431
432# Create install targets for a library and its parent component (if specified).
433function(add_compiler_rt_install_targets name)
434  cmake_parse_arguments(ARG "" "PARENT_TARGET" "" ${ARGN})
435
436  if(ARG_PARENT_TARGET AND NOT TARGET install-${ARG_PARENT_TARGET})
437    # The parent install target specifies the parent component to scrape up
438    # anything not installed by the individual install targets, and to handle
439    # installation when running the multi-configuration generators.
440    add_custom_target(install-${ARG_PARENT_TARGET}
441                      DEPENDS ${ARG_PARENT_TARGET}
442                      COMMAND "${CMAKE_COMMAND}"
443                              -DCMAKE_INSTALL_COMPONENT=${ARG_PARENT_TARGET}
444                              -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
445    add_custom_target(install-${ARG_PARENT_TARGET}-stripped
446                      DEPENDS ${ARG_PARENT_TARGET}
447                      COMMAND "${CMAKE_COMMAND}"
448                              -DCMAKE_INSTALL_COMPONENT=${ARG_PARENT_TARGET}
449                              -DCMAKE_INSTALL_DO_STRIP=1
450                              -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
451    set_target_properties(install-${ARG_PARENT_TARGET} PROPERTIES
452                          FOLDER "Compiler-RT Misc")
453    set_target_properties(install-${ARG_PARENT_TARGET}-stripped PROPERTIES
454                          FOLDER "Compiler-RT Misc")
455    add_dependencies(install-compiler-rt install-${ARG_PARENT_TARGET})
456    add_dependencies(install-compiler-rt-stripped install-${ARG_PARENT_TARGET}-stripped)
457  endif()
458
459  # We only want to generate per-library install targets if you aren't using
460  # an IDE because the extra targets get cluttered in IDEs.
461  if(NOT CMAKE_CONFIGURATION_TYPES)
462    add_custom_target(install-${name}
463                      DEPENDS ${name}
464                      COMMAND "${CMAKE_COMMAND}"
465                              -DCMAKE_INSTALL_COMPONENT=${name}
466                              -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
467    add_custom_target(install-${name}-stripped
468                      DEPENDS ${name}
469                      COMMAND "${CMAKE_COMMAND}"
470                              -DCMAKE_INSTALL_COMPONENT=${name}
471                              -DCMAKE_INSTALL_DO_STRIP=1
472                              -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
473    # If you have a parent target specified, we bind the new install target
474    # to the parent install target.
475    if(LIB_PARENT_TARGET)
476      add_dependencies(install-${LIB_PARENT_TARGET} install-${name})
477      add_dependencies(install-${LIB_PARENT_TARGET}-stripped install-${name}-stripped)
478    endif()
479  endif()
480endfunction()
481