aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-10-08 15:07:00 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-10-08 15:07:00 +0000
commit5a0169f0a1434014e727b22240a45a1f329cc0be (patch)
treec2722c909f3774878d1923e7690f3d44f2fa2070 /tools
parent320296a4cfe414ce59f406b8a5ce15272f563103 (diff)
downloadexternal_llvm-5a0169f0a1434014e727b22240a45a1f329cc0be.zip
external_llvm-5a0169f0a1434014e727b22240a45a1f329cc0be.tar.gz
external_llvm-5a0169f0a1434014e727b22240a45a1f329cc0be.tar.bz2
Only modify lto.exports.def when contents have changed.
Patch by Greg Bedwell. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192182 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/lto/CMakeLists.txt12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt
index 89160ee..957a9f0 100644
--- a/tools/lto/CMakeLists.txt
+++ b/tools/lto/CMakeLists.txt
@@ -15,10 +15,16 @@ if( NOT CYGWIN AND LLVM_ENABLE_PIC )
# 'EXPORTS'. The file "lto.exports" already contains the list, so we
# massage it into the correct format here to create "lto.exports.def".
set(LTO_EXPORTS_DEF ${CMAKE_CURRENT_BINARY_DIR}/lto.exports.def)
+ set(LTO_EXPORTS_DEF_TEMP ${LTO_EXPORTS_DEF}.txt)
file(READ "lto.exports" exports_list)
- file(WRITE ${LTO_EXPORTS_DEF} "LIBRARY LTO\n")
- file(APPEND ${LTO_EXPORTS_DEF} "EXPORTS\n")
- file(APPEND ${LTO_EXPORTS_DEF} ${exports_list})
+ file(WRITE ${LTO_EXPORTS_DEF_TEMP} "LIBRARY LTO\n")
+ file(APPEND ${LTO_EXPORTS_DEF_TEMP} "EXPORTS\n")
+ file(APPEND ${LTO_EXPORTS_DEF_TEMP} ${exports_list})
+
+ # Copy the file only if it has changed.
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ ${LTO_EXPORTS_DEF_TEMP} ${LTO_EXPORTS_DEF})
+
set(SHARED_LIB_SOURCES ${SOURCES} ${LTO_EXPORTS_DEF})
else()
set(SHARED_LIB_SOURCES ${SOURCES})