[PATCH] D62455: [cmake] Move LLVM_TOUCH_STATIC_LIBRARIES logic to llvm_update_compile_flags
Don Hinton via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat May 25 12:17:43 PDT 2019
hintonda created this revision.
hintonda added a reviewer: beanz.
Herald added a subscriber: mgorny.
Herald added a project: LLVM.
This is a refinement of D62172 <https://reviews.llvm.org/D62172>, r361280, and moves the
LLVM_TOUCH_STATIC_LIBRARIES logic to llvm_update_compile_flags so it
can be used by static libraries created with add_library and not just
those created with llvm_add_library.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D62455
Files:
llvm/cmake/modules/AddLLVM.cmake
Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -3,6 +3,22 @@
include(DetermineGCCCompatible)
function(llvm_update_compile_flags name)
+ # clang and newer versions of ninja use high-resolutions timestamps,
+ # but older versions of libtool on Darwin don't, so the archive will
+ # often get an older timestamp than the last object that was added
+ # or updated. To fix this, we add a custom command to touch archive
+ # after it's been built so that ninja won't rebuild it unnecessarily
+ # the next time it's run.
+ if(LLVM_TOUCH_STATIC_LIBRARIES)
+ get_target_property(target_type ${name} TYPE)
+ if (target_type STREQUAL "STATIC_LIBRARY")
+ add_custom_command(TARGET ${name}
+ POST_BUILD
+ COMMAND touch ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${name}${CMAKE_STATIC_LIBRARY_SUFFIX}
+ )
+ endif ()
+ endif()
+
get_property(sources TARGET ${name} PROPERTY SOURCES)
if("${sources}" MATCHES "\\.c(;|$)")
set(update_src_props ON)
@@ -596,18 +612,6 @@
llvm_externalize_debuginfo(${name})
llvm_codesign(${name} ENTITLEMENTS ${ARG_ENTITLEMENTS})
endif()
- # clang and newer versions of ninja use high-resolutions timestamps,
- # but older versions of libtool on Darwin don't, so the archive will
- # often get an older timestamp than the last object that was added
- # or updated. To fix this, we add a custom command to touch archive
- # after it's been built so that ninja won't rebuild it unnecessarily
- # the next time it's run.
- if(ARG_STATIC AND LLVM_TOUCH_STATIC_LIBRARIES)
- add_custom_command(TARGET ${name}
- POST_BUILD
- COMMAND touch ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${name}${CMAKE_STATIC_LIBRARY_SUFFIX}
- )
- endif()
endfunction()
function(add_llvm_install_targets target)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62455.201421.patch
Type: text/x-patch
Size: 1951 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190525/61806f32/attachment.bin>
More information about the llvm-commits
mailing list