summaryrefslogtreecommitdiffstats
path: root/Modules/UntarFile.cmake
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2009-08-19 16:19:12 (GMT)
committerDavid Cole <david.cole@kitware.com>2009-08-19 16:19:12 (GMT)
commit0470a0c1adf5a779b3e11bbe087e7fbb48e88485 (patch)
treebf06e9bbd57b0e1cedac6f089b3dfeec2a1f1849 /Modules/UntarFile.cmake
parenta2ef34d34459261a13cc3e8ff8375165d4abfceb (diff)
downloadCMake-0470a0c1adf5a779b3e11bbe087e7fbb48e88485.zip
CMake-0470a0c1adf5a779b3e11bbe087e7fbb48e88485.tar.gz
CMake-0470a0c1adf5a779b3e11bbe087e7fbb48e88485.tar.bz2
Remove DownloadFile.cmake and UntarFile.cmake from the Modules directory. Put functionality directly into ExternalProject.cmake itself so that these modules do not end up in the upcoming release of CMake.
Diffstat (limited to 'Modules/UntarFile.cmake')
-rw-r--r--Modules/UntarFile.cmake83
1 files changed, 0 insertions, 83 deletions
diff --git a/Modules/UntarFile.cmake b/Modules/UntarFile.cmake
deleted file mode 100644
index df33db8..0000000
--- a/Modules/UntarFile.cmake
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# Use 'cmake -Dfilename=${tar_or_tgz_file} -Dtmp=${tmp_directory} -Ddirectory=${final_directory}
-# -P UntarFile.cmake' to call this script...
-#
-if(NOT DEFINED filename)
- message(FATAL_ERROR "error: required variable 'filename' not defined...")
-endif()
-
-if(NOT DEFINED tmp)
- message(FATAL_ERROR "error: required variable 'tmp' not defined...")
-endif()
-
-if(NOT DEFINED directory)
- message(FATAL_ERROR "error: required variable 'directory' not defined...")
-endif()
-
-if(NOT DEFINED args)
- if(filename MATCHES ".tar$")
- set(args xf)
- endif()
-
- if(filename MATCHES ".tgz$")
- set(args xfz)
- endif()
-
- if(filename MATCHES ".tar.gz$")
- set(args xfz)
- endif()
-endif()
-
-
-# Make file names absolute:
-#
-get_filename_component(filename "${filename}" ABSOLUTE)
-get_filename_component(tmp "${tmp}" ABSOLUTE)
-get_filename_component(directory "${directory}" ABSOLUTE)
-message(STATUS "filename='${filename}'")
-message(STATUS "tmp='${tmp}'")
-message(STATUS "directory='${directory}'")
-
-
-# Prepare a space for untarring:
-#
-#message(STATUS "info: creating empty subdir of '${tmp}'...")
-set(i 1)
-while(EXISTS "${tmp}/untar${i}")
- math(EXPR i "${i} + 1")
-endwhile()
-set(ut_dir "${tmp}/untar${i}")
-message(STATUS "ut_dir='${ut_dir}'")
-file(MAKE_DIRECTORY "${ut_dir}")
-
-
-# Untar it:
-#
-#message(STATUS "info: untarring '${filename}' in '${ut_dir}' with '${args}'...")
-execute_process(COMMAND ${CMAKE_COMMAND} -E tar ${args} ${filename}
- WORKING_DIRECTORY ${ut_dir}
- RESULT_VARIABLE rv)
-
-if(NOT rv EQUAL 0)
- file(REMOVE_RECURSE "${ut_dir}")
- message(FATAL_ERROR "error: untar of '${filename}' failed")
-endif()
-
-
-# Analyze what came out of the tar file:
-#
-file(GLOB contents "${ut_dir}/*")
-list(LENGTH contents n)
-if(NOT n EQUAL 1 OR NOT IS_DIRECTORY "${contents}")
- set(contents "${ut_dir}")
-endif()
-
-
-# Copy "the one" directory to the final directory:
-#
-file(COPY "${contents}/" DESTINATION ${directory})
-
-
-# Clean up:
-#
-file(REMOVE_RECURSE "${ut_dir}")