From 6710cfd65a816671833c8193add6a77c758fb5df Mon Sep 17 00:00:00 2001 From: Jose-Luis Blanco-Claraco Date: Thu, 5 Feb 2015 21:18:07 +0100 Subject: [PATCH] Clean 7zip deps: cmake always provide tar, right? --- README.md | 3 +-- checkGetSuiteSparse.cmake | 55 ++++++++++----------------------------- 2 files changed, 15 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 9ccf7df5a..d1b4c9974 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,7 @@ The goal is using one single CMake code to build against *SuiteSparse* in standa * (1) Install [CMake](http://www.cmake.org/). * (2) Only for Linux/Mac: Install LAPACK & BLAS. In Debian/Ubuntu: `sudo apt-get install liblapack-dev libblas-dev` * (3) Clone or download this project ([latest release](https://github.com/jlblancoc/suitesparse-metis-for-windows/releases)) and extract it somewhere in your disk, say `SP_ROOT`. - * In Windows, install [7-Zip](http://www.7-zip.org/) if you want CMake to download SuiteSparse sources automatically for you. - * (OPTIONAL) Otherwise, manually install SuiteSparse as follows: + * (OPTIONAL) CMake will download SuiteSparse sources automatically for you (skip to step 4), but you may do it manually if preferred: * Populate the directories within `SP_ROOT` with the original sources from each project: * *`SuiteSparse`:* * Download [SuiteSparse-X.Y.Z.tar.gz](http://www.cise.ufl.edu/research/sparse/SuiteSparse/) from Tim Davis' webpage. diff --git a/checkGetSuiteSparse.cmake b/checkGetSuiteSparse.cmake index 3314ee52b..f4ec36710 100644 --- a/checkGetSuiteSparse.cmake +++ b/checkGetSuiteSparse.cmake @@ -12,47 +12,21 @@ ## Created by jesnault (jerome.esnault@inria.fr) 2014-01-21 ## Updated by jesnault (jerome.esnault@inria.fr) 2014-01-21 -if(POLICY CMP0053) - cmake_policy(SET CMP0053 OLD) # To correctly interpret the 7-zip strings below -endif() - -## try first with 7-Zip, and with standard cmake tar command otherwise +## use standard cmake tar command macro(SuiteSparse_unzip whichZipFile) - find_program(7ZIP_CMD NAMES 7z DOC "7-zip executable" - PATHS "$ENV{PROGRAMFILES}/7-Zip" "$ENV{PROGRAMFILES(x86)}/7-Zip" - /usr/bin /usr/local/bin - ) - if(OFF) - message(STATUS "unzip: please, wait until ${7ZIP_CMD} finished...") - execute_process( COMMAND ${7ZIP_CMD} x ${whichZipFile} -y - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} TIMEOUT 120 - RESULT_VARIABLE resVar OUTPUT_VARIABLE outVar ERROR_VARIABLE errVar - ) - if(${resVar} MATCHES "0") - message(STATUS "SuiteSparse just unziped in the source dir") ## OK - set(SUITESPARSE_DL_LAST OFF CACHE BOOL "get the last version of suiteSparse" FORCE) - else() - message(WARNING "something wrong with ${7ZIP_CMD} command, redo or try to unzip by yourself...") - message("unzip: outVar=${outVar}") - message("unzip: errVar=${errVar}") - endif() + get_filename_component(zipFile ${whichZipFile} NAME) + message(STATUS "unzip: please, wait until tar xzf ${whichZipFile} finished...") + execute_process( COMMAND ${CMAKE_COMMAND} -E tar xzf ${zipFile} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} TIMEOUT 120 + RESULT_VARIABLE resVar OUTPUT_VARIABLE outVar ERROR_VARIABLE errVar + ) + if(${resVar} MATCHES "0") + message(STATUS "SuiteSparse just unziped in the source dir") ## OK + set(SUITESPARSE_DL_LAST OFF CACHE BOOL "get the last version of suiteSparse" FORCE) else() - get_filename_component(zipFile ${whichZipFile} NAME) - message(STATUS "unzip: please, wait until tar xzf ${whichZipFile} finished...") - execute_process( COMMAND ${CMAKE_COMMAND} -E tar xzf ${zipFile} - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} TIMEOUT 120 - RESULT_VARIABLE resVar OUTPUT_VARIABLE outVar ERROR_VARIABLE errVar - ) - if(${resVar} MATCHES "0") - message(STATUS "SuiteSparse just unziped in the source dir") ## OK - set(SUITESPARSE_DL_LAST OFF CACHE BOOL "get the last version of suiteSparse" FORCE) - else() - message(WARNING "something wrong with cmake tar command, redo or try to unzip by yourself...") - message("unzip: outVar=${outVar}") - message("unzip: errVar=${errVar}") - message("Or try to get 7zip (http://www.7-zip.org/download.html) to unzip the downloaded dir.") - set(7ZIP_CMD "" CACHE FILEPATH "7-zip executable") - endif() + message(WARNING "something wrong with cmake tar command, redo or try to unzip by yourself...") + message("unzip: outVar=${outVar}") + message("unzip: errVar=${errVar}") endif() endmacro() @@ -84,6 +58,5 @@ if(SUITESPARSE_DL_LAST) endif() if(EXISTS "${SUITESPARSE_ZIP}") execute_process(COMMAND "${CMAKE_COMMAND}" -E remove "${SUITESPARSE_ZIP}") - endif() - + endif() endif()