Mercurial > hg > orthanc
comparison Resources/CMake/DownloadPackage.cmake @ 364:37b066ee2988
trying to support more platforms
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 31 Jan 2013 16:51:42 +0100 |
parents | b00a6c68d529 |
children | 5f6d75cd4b46 |
comparison
equal
deleted
inserted
replaced
363:b9bc31c6b639 | 364:37b066ee2988 |
---|---|
28 | 28 |
29 GetUrlExtension(TMP_EXTENSION "${Url}") | 29 GetUrlExtension(TMP_EXTENSION "${Url}") |
30 #message(${TMP_EXTENSION}) | 30 #message(${TMP_EXTENSION}) |
31 message("Uncompressing ${TMP_FILENAME}") | 31 message("Uncompressing ${TMP_FILENAME}") |
32 | 32 |
33 if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux") | 33 if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") |
34 if ("${TMP_EXTENSION}" STREQUAL "zip") | |
35 execute_process( | |
36 COMMAND sh -c "unzip -q ${TMP_PATH} ${UncompressArguments}" | |
37 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | |
38 RESULT_VARIABLE Failure | |
39 ) | |
40 elseif (("${TMP_EXTENSION}" STREQUAL "gz") OR ("${TMP_EXTENSION}" STREQUAL "tgz")) | |
41 #message("tar xvfz ${TMP_PATH} ${UncompressArguments}") | |
42 execute_process( | |
43 COMMAND sh -c "tar xfz ${TMP_PATH} ${UncompressArguments}" | |
44 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | |
45 RESULT_VARIABLE Failure | |
46 ) | |
47 elseif ("${TMP_EXTENSION}" STREQUAL "bz2") | |
48 execute_process( | |
49 COMMAND sh -c "tar xfj ${TMP_PATH} ${UncompressArguments}" | |
50 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | |
51 RESULT_VARIABLE Failure | |
52 ) | |
53 else() | |
54 message(FATAL_ERROR "Unknown package format.") | |
55 endif() | |
56 | |
57 elseif ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") | |
58 # How to silently extract files using 7-zip | 34 # How to silently extract files using 7-zip |
59 # http://superuser.com/questions/331148/7zip-command-line-extract-silently-quietly | 35 # http://superuser.com/questions/331148/7zip-command-line-extract-silently-quietly |
60 | 36 |
61 FIND_PROGRAM(ZIP_EXECUTABLE 7z PATHS "$ENV{ProgramFiles}/7-Zip") | 37 FIND_PROGRAM(ZIP_EXECUTABLE 7z PATHS "$ENV{ProgramFiles}/7-Zip") |
62 | 38 |
111 OUTPUT_QUIET | 87 OUTPUT_QUIET |
112 ) | 88 ) |
113 else() | 89 else() |
114 message(FATAL_ERROR "Support your platform here") | 90 message(FATAL_ERROR "Support your platform here") |
115 endif() | 91 endif() |
92 | |
116 else() | 93 else() |
117 message(FATAL_ERROR "Support your platform here") | 94 if ("${TMP_EXTENSION}" STREQUAL "zip") |
95 execute_process( | |
96 COMMAND sh -c "unzip -q ${TMP_PATH} ${UncompressArguments}" | |
97 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | |
98 RESULT_VARIABLE Failure | |
99 ) | |
100 elseif (("${TMP_EXTENSION}" STREQUAL "gz") OR ("${TMP_EXTENSION}" STREQUAL "tgz")) | |
101 #message("tar xvfz ${TMP_PATH} ${UncompressArguments}") | |
102 execute_process( | |
103 COMMAND sh -c "tar xfz ${TMP_PATH} ${UncompressArguments}" | |
104 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | |
105 RESULT_VARIABLE Failure | |
106 ) | |
107 elseif ("${TMP_EXTENSION}" STREQUAL "bz2") | |
108 execute_process( | |
109 COMMAND sh -c "tar xfj ${TMP_PATH} ${UncompressArguments}" | |
110 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | |
111 RESULT_VARIABLE Failure | |
112 ) | |
113 else() | |
114 message(FATAL_ERROR "Unknown package format.") | |
115 endif() | |
118 endif() | 116 endif() |
119 | 117 |
120 if (Failure) | 118 if (Failure) |
121 message(FATAL_ERROR "Error while running the uncompression tool") | 119 message(FATAL_ERROR "Error while running the uncompression tool") |
122 endif() | 120 endif() |