[libcxx-commits] [libcxx] r361513 - [CMake] Copy C++ headers before configuring runtimes build

Chris Bieneman via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 23 10:06:46 PDT 2019


Author: cbieneman
Date: Thu May 23 10:06:46 2019
New Revision: 361513

URL: http://llvm.org/viewvc/llvm-project?rev=361513&view=rev
Log:
[CMake] Copy C++ headers before configuring runtimes build

Summary: On some platforms C++ headers are packaged with the compiler not the sysroot. If you don't copy C++ headers into the build include directory during configuraiton of the outer build the C++ check during the runtime configuration may get inaccurate results.

Reviewers: phosek, compnerd, smeenai, EricWF

Reviewed By: compnerd

Subscribers: EricWF, christof, libcxx-commits, mgorny, llvm-commits

Tags: #llvm, #libc

Differential Revision: https://reviews.llvm.org/D62155

Modified:
    libcxx/trunk/include/CMakeLists.txt

Modified: libcxx/trunk/include/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/CMakeLists.txt?rev=361513&r1=361512&r2=361513&view=diff
==============================================================================
--- libcxx/trunk/include/CMakeLists.txt (original)
+++ libcxx/trunk/include/CMakeLists.txt Thu May 23 10:06:46 2019
@@ -208,6 +208,14 @@ else()
     )
 endif()
 
+# In some build configuraitons (like boostrapping clang), we need to be able to
+# install the libcxx headers before CMake configuraiton for libcxx runs. Making
+# the name of this target configurable allows LLVM/runtimes/CMakeLists.txt to
+# add this subdirectory to the LLVM build to put libcxx's headers in place
+# before libcxx's build configuration is run.
+if (NOT CXX_HEADER_TARGET)
+  set(CXX_HEADER_TARGET cxx-headers)
+endif()
 if(NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
   set(output_dir ${LIBCXX_HEADER_DIR}/include/c++/v1)
 
@@ -233,18 +241,18 @@ if(NOT LIBCXX_USING_INSTALLED_LLVM AND L
     list(APPEND out_files ${dst})
   endif()
 
-  add_custom_target(cxx-headers ALL DEPENDS ${out_files} ${LIBCXX_CXX_ABI_HEADER_TARGET})
+  add_custom_target(${CXX_HEADER_TARGET} ALL DEPENDS ${out_files} ${LIBCXX_CXX_ABI_HEADER_TARGET})
 else()
-  add_custom_target(cxx-headers)
+  add_custom_target(${CXX_HEADER_TARGET})
 endif()
-set_target_properties(cxx-headers PROPERTIES FOLDER "Misc")
+set_target_properties(${CXX_HEADER_TARGET} PROPERTIES FOLDER "Misc")
 
 if (LIBCXX_INSTALL_HEADERS)
   foreach(file ${files})
     get_filename_component(dir ${file} DIRECTORY)
     install(FILES ${file}
       DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir}
-      COMPONENT cxx-headers
+      COMPONENT ${CXX_HEADER_TARGET}
       PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
     )
   endforeach()
@@ -255,19 +263,19 @@ if (LIBCXX_INSTALL_HEADERS)
       DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1
       PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
       RENAME __config
-      COMPONENT cxx-headers)
+      COMPONENT ${CXX_HEADER_TARGET})
   endif()
 
   if (NOT CMAKE_CONFIGURATION_TYPES)
-    add_custom_target(install-cxx-headers
-                      DEPENDS cxx-headers ${generated_config_deps}
+    add_custom_target(install-${CXX_HEADER_TARGET}
+                      DEPENDS ${CXX_HEADER_TARGET} ${generated_config_deps}
                       COMMAND "${CMAKE_COMMAND}"
-                              -DCMAKE_INSTALL_COMPONENT=cxx-headers
+                              -DCMAKE_INSTALL_COMPONENT=${CXX_HEADER_TARGET}
                               -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
     # Stripping is a no-op for headers
-    add_custom_target(install-cxx-headers-stripped DEPENDS install-cxx-headers)
+    add_custom_target(install-${CXX_HEADER_TARGET}-stripped DEPENDS install-${CXX_HEADER_TARGET})
 
-    add_custom_target(install-libcxx-headers DEPENDS install-cxx-headers)
-    add_custom_target(install-libcxx-headers-stripped DEPENDS install-cxx-headers-stripped)
+    add_custom_target(install-libcxx-headers DEPENDS install-${CXX_HEADER_TARGET})
+    add_custom_target(install-libcxx-headers-stripped DEPENDS install-${CXX_HEADER_TARGET}-stripped)
   endif()
 endif()




More information about the libcxx-commits mailing list