summaryrefslogtreecommitdiffstats
path: root/Modules/ExternalProject.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-06-07 18:22:02 (GMT)
committerBrad King <brad.king@kitware.com>2010-06-07 18:22:02 (GMT)
commit33b59ee8ddedefab6156ef1468ec8e31647af9c3 (patch)
tree85bc627276cea1fcc3442a967b19897ed83b3c6a /Modules/ExternalProject.cmake
parent2bc82e07bdf6ebd9aad5ebcad170637519cea990 (diff)
parentf5e8ce522e5b37f29d5ef89aa79e1b82e192466f (diff)
downloadCMake-33b59ee8ddedefab6156ef1468ec8e31647af9c3.zip
CMake-33b59ee8ddedefab6156ef1468ec8e31647af9c3.tar.gz
CMake-33b59ee8ddedefab6156ef1468ec8e31647af9c3.tar.bz2
Merge branch 'use-rename-not-copy-ExternalProject'
Diffstat (limited to 'Modules/ExternalProject.cmake')
-rw-r--r--Modules/ExternalProject.cmake19
1 files changed, 10 insertions, 9 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 2fbab17..ddb4ece 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -246,7 +246,7 @@ message(STATUS \"downloading... done\")
endfunction(_ep_write_downloadfile_script)
-function(_ep_write_extractfile_script script_filename filename tmp directory)
+function(_ep_write_extractfile_script script_filename filename directory)
set(args "")
if(filename MATCHES ".tar$")
@@ -270,7 +270,6 @@ function(_ep_write_extractfile_script script_filename filename tmp directory)
"# Make file names absolute:
#
get_filename_component(filename \"${filename}\" ABSOLUTE)
-get_filename_component(tmp \"${tmp}\" ABSOLUTE)
get_filename_component(directory \"${directory}\" ABSOLUTE)
message(STATUS \"extracting...
@@ -279,11 +278,11 @@ message(STATUS \"extracting...
# Prepare a space for extracting:
#
-set(i 1)
-while(EXISTS \"\${tmp}/extract\${i}\")
+set(i 1234)
+while(EXISTS \"\${directory}/../ex\${i}\")
math(EXPR i \"\${i} + 1\")
endwhile()
-set(ut_dir \"\${tmp}/extract\${i}\")
+set(ut_dir \"\${directory}/../ex\${i}\")
file(MAKE_DIRECTORY \"\${ut_dir}\")
# Extract it:
@@ -308,10 +307,12 @@ if(NOT n EQUAL 1 OR NOT IS_DIRECTORY \"\${contents}\")
set(contents \"\${ut_dir}\")
endif()
-# Copy \"the one\" directory to the final directory:
+# Move \"the one\" directory to the final directory:
#
-message(STATUS \"extracting... [copy]\")
-file(COPY \"\${contents}/\" DESTINATION \${directory})
+message(STATUS \"extracting... [rename]\")
+file(REMOVE_RECURSE \${directory})
+get_filename_component(contents \${contents} ABSOLUTE)
+file(RENAME \${contents} \${directory})
# Clean up:
#
@@ -716,7 +717,7 @@ function(_ep_add_download_command name)
set(comment "Performing download step (extract) for '${name}'")
endif()
# TODO: Support other archive formats.
- _ep_write_extractfile_script("${stamp_dir}/extract-${name}.cmake" "${file}" "${tmp_dir}" "${source_dir}")
+ _ep_write_extractfile_script("${stamp_dir}/extract-${name}.cmake" "${file}" "${source_dir}")
list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/extract-${name}.cmake)
endif()
else()