tstellar created this revision.
tstellar added reviewers: smeenai, vzakhari, phosek.
Herald added a subscriber: mgorny.
Herald added a project: clang.

This is a follow up to r355253 and a better fix than the first attempt
which was r359257.

We can't install anything from ${CMAKE_CFG_INTDIR}, because this value
is only defined at build time, but we still must make sure to copy the
headers into ${CMAKE_CFG_INTDIR}/lib/clang/$VERSION/include, because the lit
tests look for headers there.  So for this fix we revert to the
old behavior of copying the headers to 
${CMAKE_CFG_INTDIR}/lib/clang/$VERSION/include
during the build and then installing them from the source tree.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D61220

Files:
  clang/lib/Headers/CMakeLists.txt


Index: clang/lib/Headers/CMakeLists.txt
===================================================================
--- clang/lib/Headers/CMakeLists.txt
+++ clang/lib/Headers/CMakeLists.txt
@@ -128,6 +128,7 @@
 
 set(output_dir ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/include)
 set(out_files)
+set(install_files)
 
 function(copy_header_to_output_dir src_dir file)
   set(src ${src_dir}/${file})
@@ -138,6 +139,8 @@
     COMMENT "Copying clang's ${file}...")
   list(APPEND out_files ${dst})
   set(out_files ${out_files} PARENT_SCOPE)
+  list(APPEND install_files ${src})
+  set(install_files ${install_files} PARENT_SCOPE)
 endfunction(copy_header_to_output_dir)
 
 function(clang_generate_header td_option td_file out_file)
@@ -147,6 +150,7 @@
 
   copy_header_to_output_dir(${CMAKE_CURRENT_BINARY_DIR} ${out_file})
   set(out_files ${out_files} PARENT_SCOPE)
+  set(install_files ${install_files} PARENT_SCOPE)
 endfunction(clang_generate_header)
 
 
@@ -169,7 +173,7 @@
 set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION})
 
 install(
-  DIRECTORY ${output_dir}
+  FILES ${install_files}
   DESTINATION ${header_install_dir}
   COMPONENT clang-resource-headers)
 


Index: clang/lib/Headers/CMakeLists.txt
===================================================================
--- clang/lib/Headers/CMakeLists.txt
+++ clang/lib/Headers/CMakeLists.txt
@@ -128,6 +128,7 @@
 
 set(output_dir ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/include)
 set(out_files)
+set(install_files)
 
 function(copy_header_to_output_dir src_dir file)
   set(src ${src_dir}/${file})
@@ -138,6 +139,8 @@
     COMMENT "Copying clang's ${file}...")
   list(APPEND out_files ${dst})
   set(out_files ${out_files} PARENT_SCOPE)
+  list(APPEND install_files ${src})
+  set(install_files ${install_files} PARENT_SCOPE)
 endfunction(copy_header_to_output_dir)
 
 function(clang_generate_header td_option td_file out_file)
@@ -147,6 +150,7 @@
 
   copy_header_to_output_dir(${CMAKE_CURRENT_BINARY_DIR} ${out_file})
   set(out_files ${out_files} PARENT_SCOPE)
+  set(install_files ${install_files} PARENT_SCOPE)
 endfunction(clang_generate_header)
 
 
@@ -169,7 +173,7 @@
 set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION})
 
 install(
-  DIRECTORY ${output_dir}
+  FILES ${install_files}
   DESTINATION ${header_install_dir}
   COMPONENT clang-resource-headers)
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to