Home | History | Annotate | Download | only in include
      1 if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
      2   set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
      3 endif()
      4 
      5 set(LIBCXX_HEADER_PATTERN
      6   PATTERN "*"
      7   PATTERN "CMakeLists.txt" EXCLUDE
      8   PATTERN ".svn" EXCLUDE
      9   PATTERN "__config_site.in" EXCLUDE
     10   ${LIBCXX_SUPPORT_HEADER_PATTERN}
     11   )
     12 
     13 if(NOT LIBCXX_USING_INSTALLED_LLVM AND LLVM_BINARY_DIR)
     14   file(COPY .
     15     DESTINATION "${LLVM_BINARY_DIR}/include/c++/v1"
     16     FILES_MATCHING
     17     ${LIBCXX_HEADER_PATTERN}
     18     )
     19 endif()
     20 
     21 if (LIBCXX_INSTALL_HEADERS)
     22   install(DIRECTORY .
     23     DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1
     24     COMPONENT cxx-headers
     25     FILES_MATCHING
     26     ${LIBCXX_HEADER_PATTERN}
     27     PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
     28   )
     29 
     30   if (LIBCXX_NEEDS_SITE_CONFIG)
     31     # Generate and install a custom __config header. The new header is created
     32     # by  prepending __config_site to the current __config header.
     33     add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config
     34       COMMAND ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/cat_files.py
     35         ${LIBCXX_BINARY_DIR}/__config_site
     36         ${LIBCXX_SOURCE_DIR}/include/__config
     37         -o ${LIBCXX_BINARY_DIR}/__generated_config
     38       DEPENDS ${LIBCXX_SOURCE_DIR}/include/__config
     39               ${LIBCXX_BINARY_DIR}/__config_site
     40     )
     41     # Add a target that executes the generation commands.
     42     add_custom_target(generate_config_header ALL
     43       DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
     44     set(generated_config_deps generate_config_header)
     45     # Install the generated header as __config.
     46     install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
     47       DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1
     48       PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
     49       RENAME __config
     50       COMPONENT cxx-headers)
     51   endif()
     52 
     53   if (NOT CMAKE_CONFIGURATION_TYPES)
     54     # this target is just needed as a placeholder for the distribution target
     55     add_custom_target(cxx-headers)
     56     add_custom_target(install-cxx-headers
     57                       DEPENDS cxx-headers ${generated_config_deps}
     58                       COMMAND "${CMAKE_COMMAND}"
     59                               -DCMAKE_INSTALL_COMPONENT=cxx-headers
     60                               -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
     61     # Stripping is a no-op for headers
     62     add_custom_target(install-cxx-headers-stripped DEPENDS install-cxx-headers)
     63 
     64     add_custom_target(libcxx-headers)
     65     add_custom_target(install-libcxx-headers DEPENDS install-cxx-headers)
     66     add_custom_target(install-libcxx-headers-stripped DEPENDS install-cxx-headers-stripped)
     67   endif()
     68 
     69 endif()
     70