summaryrefslogtreecommitdiffstats
path: root/libcxx/cmake/Modules
diff options
context:
space:
mode:
authorPetr Hosek <phosek@chromium.org>2018-06-12 03:10:02 +0000
committerPetr Hosek <phosek@chromium.org>2018-06-12 03:10:02 +0000
commitc20c182df362f40e4c4d286c8b6039d5f6973338 (patch)
treef8dc5fee3a3f2a20417d1ac3466da5336542e6bd /libcxx/cmake/Modules
parente044d1e5042946e380f41b080b63f22f3e10f5cf (diff)
downloadbcm5719-llvm-c20c182df362f40e4c4d286c8b6039d5f6973338.tar.gz
bcm5719-llvm-c20c182df362f40e4c4d286c8b6039d5f6973338.zip
Reland "Use custom command and target to install libc++ headers"
Using file(COPY FILE...) has several downsides. Since the file command is only executed at configuration time, any changes to headers made after the initial CMake execution are ignored. This can lead to subtle errors since the just built Clang will be using stale libc++ headers. Furthermore, since the headers are copied prior to executing the build system, this may hide missing dependencies on libc++ from other LLVM components. This changes replaces the use of file(COPY FILE...) command with a custom command and target which addresses all aforementioned issues and matches the implementation already used by other LLVM components that also install headers like Clang builtin headers. Differential Revision: https://reviews.llvm.org/D44773 llvm-svn: 334468
Diffstat (limited to 'libcxx/cmake/Modules')
-rw-r--r--libcxx/cmake/Modules/HandleLibCXXABI.cmake24
1 files changed, 17 insertions, 7 deletions
diff --git a/libcxx/cmake/Modules/HandleLibCXXABI.cmake b/libcxx/cmake/Modules/HandleLibCXXABI.cmake
index 558e11ba2cc..851ff9ec19a 100644
--- a/libcxx/cmake/Modules/HandleLibCXXABI.cmake
+++ b/libcxx/cmake/Modules/HandleLibCXXABI.cmake
@@ -47,12 +47,22 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
set(found TRUE)
get_filename_component(dstdir ${fpath} PATH)
get_filename_component(ifile ${fpath} NAME)
- file(COPY "${incpath}/${fpath}"
- DESTINATION "${LIBCXX_BINARY_INCLUDE_DIR}/${dstdir}"
- )
- file(COPY "${incpath}/${fpath}"
- DESTINATION "${CMAKE_BINARY_DIR}/include/c++/v1/${dstdir}"
- )
+ set(src ${incpath}/${fpath})
+
+ set(dst ${LIBCXX_BINARY_INCLUDE_DIR}/${dstdir}/${fpath})
+ add_custom_command(OUTPUT ${dst}
+ DEPENDS ${src}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
+ COMMENT "Copying C++ ABI header ${fpath}...")
+ list(APPEND abilib_headers "${dst}")
+
+ set(dst "${CMAKE_BINARY_DIR}/include/c++/v1/${dstdir}/${fpath}")
+ add_custom_command(OUTPUT ${dst}
+ DEPENDS ${src}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
+ COMMENT "Copying C++ ABI header ${fpath}...")
+ list(APPEND abilib_headers "${dst}")
+
if (LIBCXX_INSTALL_HEADERS)
install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1/${dstdir}
@@ -60,7 +70,6 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endif()
- list(APPEND abilib_headers "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}")
endif()
endforeach()
if (NOT found)
@@ -69,6 +78,7 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
endforeach()
include_directories("${LIBCXX_BINARY_INCLUDE_DIR}")
+ add_custom_target(cxx-abi-headers ALL DEPENDS ${abilib_headers})
endmacro()
OpenPOWER on IntegriCloud