[Cmake-commits] [cmake-commits] david.cole committed ExternalProject.cmake 1.4 1.5 DownloadFile.cmake 1.1 NONE UntarFile.cmake 1.4 NONE
cmake-commits at cmake.org
cmake-commits at cmake.org
Wed Aug 19 12:19:17 EDT 2009
Update of /cvsroot/CMake/CMake/Modules
In directory public:/mounts/ram/cvs-serv31006
Modified Files:
ExternalProject.cmake
Removed Files:
DownloadFile.cmake UntarFile.cmake
Log Message:
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.
--- UntarFile.cmake DELETED ---
Index: ExternalProject.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/ExternalProject.cmake,v
retrieving revision 1.4
retrieving revision 1.5
diff -C 2 -d -r1.4 -r1.5
*** ExternalProject.cmake 13 Jul 2009 14:46:32 -0000 1.4
--- ExternalProject.cmake 19 Aug 2009 16:19:12 -0000 1.5
***************
*** 55,59 ****
# INSTALL_DIR = <base>/Install/<name>
# If no PREFIX, EP_PREFIX, or EP_BASE is specified then the default
! # is to set PREIFX to "<name>-prefix".
# Relative paths are interpreted with respect to the build directory
# corresponding to the source directory in which ep_add is invoked.
--- 55,59 ----
# INSTALL_DIR = <base>/Install/<name>
# If no PREFIX, EP_PREFIX, or EP_BASE is specified then the default
! # is to set PREFIX to "<name>-prefix".
# Relative paths are interpreted with respect to the build directory
# corresponding to the source directory in which ep_add is invoked.
***************
*** 89,92 ****
--- 89,93 ----
# Property names correspond to the keyword argument names of 'ep_add'.
+
# Pre-compute a regex to match documented keywords for each command.
file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines LIMIT_COUNT 100
***************
*** 113,116 ****
--- 114,118 ----
endif()
+
function(_ep_parse_arguments f name ns args)
# Transfer the arguments to this function into target properties for the
***************
*** 165,168 ****
--- 167,171 ----
endfunction(_ep_parse_arguments)
+
define_property(DIRECTORY PROPERTY "EP_BASE" INHERITED
BRIEF_DOCS "Base directory for External Project storage."
***************
*** 179,182 ****
--- 182,300 ----
)
+
+ function(_ep_write_downloadfile_script script_filename remote local timeout)
+ if(NOT timeout)
+ set(timeout 30)
+ endif()
+
+ file(WRITE ${script_filename}
+ "message(STATUS \"downloading...
+ src='${remote}'
+ dst='${local}'\")
+
+ file(DOWNLOAD
+ \"${remote}\"
+ \"${local}\"
+ TIMEOUT ${timeout}
+ STATUS status
+ LOG log)
+
+ list(GET status 0 status_code)
+ list(GET status 1 status_string)
+
+ if(NOT status_code EQUAL 0)
+ message(FATAL_ERROR \"error: downloading '${remote}' failed
+ status_code: \${status_code}
+ status_string: \${status_string}
+ log: \${log}
+ \")
+ endif()
+
+ message(STATUS \"downloading... done\")
+ "
+ )
+
+ endfunction(_ep_write_downloadfile_script)
+
+
+ function(_ep_write_extractfile_script script_filename filename tmp directory)
+ set(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()
+
+ if(args STREQUAL "")
+ message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .tar, .tgz and .tar.gz")
+ return()
+ endif()
+
+ file(WRITE ${script_filename}
+ "# 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...
+ src='\${filename}'
+ dst='\${directory}'\")
+
+ # Prepare a space for extracting:
+ #
+ set(i 1)
+ while(EXISTS \"\${tmp}/extract\${i}\")
+ math(EXPR i \"\${i} + 1\")
+ endwhile()
+ set(ut_dir \"\${tmp}/extract\${i}\")
+ file(MAKE_DIRECTORY \"\${ut_dir}\")
+
+ # Extract it:
+ #
+ message(STATUS \"extracting... [tar ${args}]\")
+ execute_process(COMMAND \${CMAKE_COMMAND} -E tar ${args} \${filename}
+ WORKING_DIRECTORY \${ut_dir}
+ RESULT_VARIABLE rv)
+
+ if(NOT rv EQUAL 0)
+ message(STATUS \"extracting... [error clean up]\")
+ file(REMOVE_RECURSE \"\${ut_dir}\")
+ message(FATAL_ERROR \"error: extract of '\${filename}' failed\")
+ endif()
+
+ # Analyze what came out of the tar file:
+ #
+ message(STATUS \"extracting... [analysis]\")
+ 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:
+ #
+ message(STATUS \"extracting... [copy]\")
+ file(COPY \"\${contents}/\" DESTINATION \${directory})
+
+ # Clean up:
+ #
+ message(STATUS \"extracting... [clean up]\")
+ file(REMOVE_RECURSE \"\${ut_dir}\")
+
+ message(STATUS \"extracting... done\")
+ "
+ )
+
+ endfunction(_ep_write_extractfile_script)
+
+
function(_ep_set_directories name)
get_property(prefix TARGET ${name} PROPERTY _EP_PREFIX)
***************
*** 249,252 ****
--- 367,371 ----
endfunction(_ep_set_directories)
+
function(ep_get name)
foreach(var ${ARGN})
***************
*** 260,263 ****
--- 379,383 ----
endfunction(ep_get)
+
function(_ep_get_configure_command_id name cfg_cmd_id_var)
get_target_property(cmd ${name} _EP_CONFIGURE_COMMAND)
***************
*** 285,288 ****
--- 405,409 ----
endfunction(_ep_get_configure_command_id)
+
function(_ep_get_build_command name step cmd_var)
set(cmd "${${cmd_var}}")
***************
*** 333,336 ****
--- 454,458 ----
endfunction(_ep_get_build_command)
+
function(ep_add_step name step)
set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles)
***************
*** 413,416 ****
--- 535,539 ----
endfunction(ep_add_step)
+
function(_ep_add_mkdir_command name)
ep_get(${name}
***************
*** 427,430 ****
--- 550,554 ----
endfunction(_ep_add_mkdir_command)
+
function(_ep_add_download_command name)
ep_get(${name} source_dir stamp_dir download_dir tmp_dir)
***************
*** 518,522 ****
endif()
set(file ${download_dir}/${fname})
! set(cmd ${CMAKE_COMMAND} -Dremote=${url} -Dlocal=${file} -P ${CMAKE_ROOT}/Modules/DownloadFile.cmake
COMMAND)
set(comment "Performing download step (download and extract) for '${name}'")
--- 642,647 ----
endif()
set(file ${download_dir}/${fname})
! _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" "${url}" "${file}")
! set(cmd ${CMAKE_COMMAND} -P ${stamp_dir}/download-${name}.cmake
COMMAND)
set(comment "Performing download step (download and extract) for '${name}'")
***************
*** 526,530 ****
endif()
# TODO: Support other archive formats.
! list(APPEND cmd ${CMAKE_COMMAND} -Dfilename=${file} -Dtmp=${tmp_dir} -Ddirectory=${source_dir} -P ${CMAKE_ROOT}/Modules/UntarFile.cmake)
endif()
else()
--- 651,656 ----
endif()
# TODO: Support other archive formats.
! _ep_write_extractfile_script("${stamp_dir}/extract-${name}.cmake" "${file}" "${tmp_dir}" "${source_dir}")
! list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/extract-${name}.cmake)
endif()
else()
***************
*** 680,683 ****
--- 806,810 ----
endfunction(_ep_add_install_command)
+
function(ep_add name)
# Add a custom target for the external project.
--- DownloadFile.cmake DELETED ---
More information about the Cmake-commits
mailing list