1 #-------------------------------------------------------------------------------
2 # ______ ______ ____ __ __
3 # | ____| | ____/ __ \ /\ | \/ |
4 # | |__ _ __ ___ ___| |__ | | | | / \ | \ / |
5 # | __| '__/ _ \/ _ \ __|| | | |/ /\ \ | |\/| |
6 # | | | | | __/ __/ | | |__| / ____ \| | | |
7 # |_| |_| \___|\___|_| \____/_/ \_\_| |_|
9 # FreeFOAM: The Cross-Platform CFD Toolkit
11 # Copyright (C) 2008 Michael Wild <themiwi@users.sf.net>
12 # Gerber van der Graaf <gerber_graaf@users.sf.net>
13 #-------------------------------------------------------------------------------
15 # This file is part of FreeFOAM.
17 # FreeFOAM is free software; you can redistribute it and/or modify it
18 # under the terms of the GNU General Public License as published by the
19 # Free Software Foundation; either version 2 of the License, or (at your
20 # option) any later version.
22 # FreeFOAM is distributed in the hope that it will be useful, but WITHOUT
23 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
24 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 # You should have received a copy of the GNU General Public License
28 # along with FreeFOAM; if not, write to the Free Software Foundation,
29 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 #-------------------------------------------------------------------------------
33 # macro to download a dist file if necessary
34 macro( __download_distfile __URL __FILE __MD5 )
35 # find out whether we need to download the dist file
36 set( __MUST_DOWNLOAD FALSE )
37 if( NOT EXISTS ${__FILE} )
38 message( STATUS "Could not find the ${__FILE} tarball. Will download it now." )
39 set( __MUST_DOWNLOAD TRUE )
40 else( NOT EXISTS ${__FILE} )
42 COMMAND ${CMAKE_COMMAND} -E md5sum ${__FILE}
43 OUTPUT_VARIABLE __MD5_computed
44 OUTPUT_STRIP_TRAILING_WHITESPACE
46 separate_arguments( __MD5_computed )
47 list( GET __MD5_computed 0 __MD5_computed )
48 if( NOT __MD5_computed STREQUAL ${__MD5} )
49 message( STATUS "MD5SUM mismatch of ${__FILE}. Expected ${__MD5}, actual ${__MD5_computed}. Will redownload it." )
50 set( __MUST_DOWNLOAD TRUE )
51 endif( NOT __MD5_computed STREQUAL ${__MD5} )
52 endif( NOT EXISTS ${__FILE} )
54 # if necessary download distfile
56 message( STATUS "Downloading ${__FILE}" )
57 file( DOWNLOAD ${__URL} ${__FILE} STATUS __DL_STAT )
58 list( GET __DL_STAT 1 __DL_ERR )
59 list( GET __DL_STAT 0 __DL_STAT )
62 "\nFailed to download ${__FILE} from ${__URL}.\nThe error message was: ${__DL_ERR}
63 One obvious reason might be that you are not connected to the internet, so you might want to first check that. Another possible reason for the failure might be that in its default configuration CMake does not support all common communication protocols (in particular not https). Also, if it has been enabled to use a download library which actually supports SSL encryption, the download might still fail if the security certificate is self-signed.
64 Please try to download
66 manually and put the file into this place:
68 You can either achieve this with your web browser or on a Unix like system (such as Linux or Mac OS X) you can try to use curl or wget. If your system has wget installed, type
69 wget --no-check-certificate ${__URL} -O ${__FILE}
70 on a single line. If, instead you have curl installed, you can use
71 curl --insecure ${__URL} -o ${__FILE}
72 Then restart the CMake configuration process. It should pick up where it left off.\n"
75 endif( __MUST_DOWNLOAD )
76 endmacro( __download_distfile )
78 # ------------------------- vim: set sw=2 sts=2 et: --------------- end-of-file