llvm.org GIT mirror llvm / 93051ef
[cmake] Add custom command to touch archives on Darwin so ninja won't rebuild them. Summary: 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 the archive after it's been built so that ninja won't rebuild it unnecessarily the next time it's run. Reviewed By: beanz Tags: #llvm Differential Revision: https://reviews.llvm.org/D62172 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361280 91177308-0d34-0410-b5e6-96231b3b80d8 Don Hinton 3 months ago
2 changed file(s) with 28 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
553553 set(LLVM_BINUTILS_INCDIR "" CACHE PATH
554554 "PATH to binutils/include containing plugin-api.h for gold plugin.")
555555
556 if(CMAKE_GENERATOR STREQUAL "Ninja")
557 include(CMakeNInjaFindMake)
558 if(CMAKE_MAKE_PROGRAM)
559 execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} --version
560 OUTPUT_VARIABLE NINJA_VERSION
561 OUTPUT_STRIP_TRAILING_WHITESPACE)
562 set(NINJA_VERSION ${NINJA_VERSION} CACHE STRING "Ninja version number" FORCE)
563 endif()
564 endif()
565
566 if(CMAKE_GENERATOR STREQUAL "Ninja" AND
567 NINJA_VERSION VERSION_GREATER_EQUAL "1.9.0" AND
568 CMAKE_HOST_APPLE AND CMAKE_HOST_SYSTEM_VERSION VERSION_GREATER "15.6.0")
569 set(LLVM_TOUCH_STATIC_LIBRARIES ON)
570 endif()
571
556572 if(CMAKE_HOST_APPLE AND APPLE)
557573 if(NOT CMAKE_XCRUN)
558574 find_program(CMAKE_XCRUN NAMES xcrun)
594594 if(ARG_SHARED OR ARG_MODULE)
595595 llvm_externalize_debuginfo(${name})
596596 llvm_codesign(${name} ENTITLEMENTS ${ARG_ENTITLEMENTS})
597 endif()
598 # clang and newer versions of ninja use high-resolutions timestamps,
599 # but older versions of libtool on Darwin don't, so the archive will
600 # often get an older timestamp than the last object that was added
601 # or updated. To fix this, we add a custom command to touch archive
602 # after it's been built so that ninja won't rebuild it unnecessarily
603 # the next time it's run.
604 if(ARG_STATIC AND LLVM_TOUCH_STATIC_LIBRARIES)
605 add_custom_command(TARGET ${name}
606 POST_BUILD
607 COMMAND touch ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${name}${CMAKE_STATIC_LIBRARY_SUFFIX}
608 )
597609 endif()
598610 endfunction()
599611