CMakeLists.txt 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
  2. set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
  3. endif()
  4. set(LIBCXX_HEADER_PATTERN
  5. PATTERN "*"
  6. PATTERN "CMakeLists.txt" EXCLUDE
  7. PATTERN ".svn" EXCLUDE
  8. PATTERN "__config_site.in" EXCLUDE
  9. ${LIBCXX_SUPPORT_HEADER_PATTERN}
  10. )
  11. file(COPY .
  12. DESTINATION "${CMAKE_BINARY_DIR}/include/c++/v1"
  13. FILES_MATCHING
  14. ${LIBCXX_HEADER_PATTERN}
  15. )
  16. if (LIBCXX_INSTALL_HEADERS)
  17. install(DIRECTORY .
  18. DESTINATION include/c++/v1
  19. COMPONENT libcxx-headers
  20. FILES_MATCHING
  21. ${LIBCXX_HEADER_PATTERN}
  22. PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
  23. )
  24. if (LIBCXX_NEEDS_SITE_CONFIG)
  25. set(UNIX_CAT cat)
  26. if (WIN32)
  27. set(UNIX_CAT type)
  28. endif()
  29. # Generate and install a custom __config header. The new header is created
  30. # by prepending __config_site to the current __config header.
  31. add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config
  32. COMMAND ${CMAKE_COMMAND} -E copy ${LIBCXX_BINARY_DIR}/__config_site ${LIBCXX_BINARY_DIR}/__generated_config
  33. COMMAND ${UNIX_CAT} ${LIBCXX_SOURCE_DIR}/include/__config >> ${LIBCXX_BINARY_DIR}/__generated_config
  34. DEPENDS ${LIBCXX_SOURCE_DIR}/include/__config
  35. ${LIBCXX_BINARY_DIR}/__config_site
  36. )
  37. # Add a target that executes the generation commands.
  38. add_custom_target(generate_config_header ALL
  39. DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
  40. set(generated_config_deps generate_config_header)
  41. # Install the generated header as __config.
  42. install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
  43. DESTINATION include/c++/v1
  44. PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
  45. RENAME __config
  46. COMPONENT libcxx-headers)
  47. endif()
  48. if (NOT CMAKE_CONFIGURATION_TYPES)
  49. # this target is just needed as a placeholder for the distribution target
  50. add_custom_target(libcxx-headers)
  51. add_custom_target(install-libcxx-headers
  52. DEPENDS libcxx-headers ${generated_config_deps}
  53. COMMAND "${CMAKE_COMMAND}"
  54. -DCMAKE_INSTALL_COMPONENT=libcxx-headers
  55. -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
  56. endif()
  57. endif()