diff options
author | Brad King <brad.king@kitware.com> | 2009-04-29 19:07:09 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-04-29 19:07:09 (GMT) |
commit | 0d40703f49604d498788d6f757bfdcaf76930a21 (patch) | |
tree | b8448c661174667240e773918c896649f3ee6bd8 /Modules/UntarFile.cmake | |
parent | 01c669e643738fa7159176ee052d878a94438776 (diff) | |
download | CMake-0d40703f49604d498788d6f757bfdcaf76930a21.zip CMake-0d40703f49604d498788d6f757bfdcaf76930a21.tar.gz CMake-0d40703f49604d498788d6f757bfdcaf76930a21.tar.bz2 |
ENH: Teach UntarFile to preserve file timestamps
After extracting the tarball in a temporary directory we copy the tree
to the destination directory. The 'cmake -E copy_directory' command
does not preserve file timestamps, so we use file(COPY) instead.
Diffstat (limited to 'Modules/UntarFile.cmake')
-rw-r--r-- | Modules/UntarFile.cmake | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/Modules/UntarFile.cmake b/Modules/UntarFile.cmake index 0b0e403..9f8e4df 100644 --- a/Modules/UntarFile.cmake +++ b/Modules/UntarFile.cmake @@ -66,31 +66,15 @@ endif() # Analyze what came out of the tar file: # file(GLOB contents "${ut_dir}/*") - -set(is_one_directory 0) list(LENGTH contents n) -if(n EQUAL 1) - if(IS_DIRECTORY "${contents}") - set(is_one_directory 1) - endif() +if(NOT n EQUAL 1 OR NOT IS_DIRECTORY "${contents}") + set(contents "${ut_dir}") endif() # Copy "the one" directory to the final directory: # -if(is_one_directory EQUAL 1) - #message(STATUS "info: (1) copying '${contents}' to '${directory}'...") - execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${contents}" "${directory}" - RESULT_VARIABLE rv) -else() - #message(STATUS "info: (more) copying '${ut_dir}' to '${directory}'...") - execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${ut_dir}" "${directory}" - RESULT_VARIABLE rv) -endif() - -if(NOT rv EQUAL 0) - message(FATAL_ERROR "error: copy_directory failed after untar in '${ut_dir}'") -endif() +file(COPY "${contents}/" DESTINATION ${directory}) # Clean up: |