annotate Resources/DownloadOrthancFramework.cmake @ 3337:9c8e119d0c5b

fix detection of uuid on freebsd
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 04 Apr 2019 15:51:37 +0200
parents b770435a93d3
children b7728227a852
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 # Orthanc - A Lightweight, RESTful DICOM Store
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 # Department, University Hospital of Liege, Belgium
3060
4e43e67f8ecf preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3044
diff changeset
4 # Copyright (C) 2017-2019 Osimis S.A., Belgium
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 #
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 # This program is free software: you can redistribute it and/or
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 # modify it under the terms of the GNU General Public License as
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 # published by the Free Software Foundation, either version 3 of the
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 # License, or (at your option) any later version.
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 #
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 # In addition, as a special exception, the copyright holders of this
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 # program give permission to link the code of its release with the
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 # OpenSSL project's "OpenSSL" library (or with modified versions of it
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 # that use the same license as the "OpenSSL" library), and distribute
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 # the linked executables. You must obey the GNU General Public License
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 # in all respects for all of the code used other than "OpenSSL". If you
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 # modify file(s) with this exception, you may extend this exception to
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 # your version of the file(s), but you are not obligated to do so. If
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 # you do not wish to do so, delete this exception statement from your
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 # version. If you delete this exception statement from all source files
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 # in the program, then also delete it here.
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 # This program is distributed in the hope that it will be useful, but
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 # WITHOUT ANY WARRANTY; without even the implied warranty of
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 # General Public License for more details.
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 # You should have received a copy of the GNU General Public License
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 # along with this program. If not, see <http://www.gnu.org/licenses/>.
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 ##
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 ## Check whether the parent script sets the mandatory variables
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 ##
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 if (NOT DEFINED ORTHANC_FRAMEWORK_SOURCE OR
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 (NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg" AND
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "web" AND
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" AND
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "path"))
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_SOURCE must be set to \"hg\", \"web\", \"archive\" or \"path\"")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 ##
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 ## Detection of the requested version
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 ##
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg" OR
2533
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
51 ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" OR
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 ORTHANC_FRAMEWORK_SOURCE STREQUAL "web")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 if (NOT DEFINED ORTHANC_FRAMEWORK_VERSION)
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_VERSION must be set")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 if (DEFINED ORTHANC_FRAMEWORK_MAJOR OR
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 DEFINED ORTHANC_FRAMEWORK_MINOR OR
2533
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
59 DEFINED ORTHANC_FRAMEWORK_REVISION OR
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
60 DEFINED ORTHANC_FRAMEWORK_MD5)
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 message(FATAL_ERROR "Some internal variable has been set")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
2533
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
64 set(ORTHANC_FRAMEWORK_MD5 "")
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
65
2688
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2553
diff changeset
66 if (NOT DEFINED ORTHANC_FRAMEWORK_BRANCH)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2553
diff changeset
67 if (ORTHANC_FRAMEWORK_VERSION STREQUAL "mainline")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2553
diff changeset
68 set(ORTHANC_FRAMEWORK_BRANCH "default")
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69
2688
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2553
diff changeset
70 else()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2553
diff changeset
71 set(ORTHANC_FRAMEWORK_BRANCH "Orthanc-${ORTHANC_FRAMEWORK_VERSION}")
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
2688
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2553
diff changeset
73 set(RE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2553
diff changeset
74 string(REGEX REPLACE ${RE} "\\1" ORTHANC_FRAMEWORK_MAJOR ${ORTHANC_FRAMEWORK_VERSION})
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2553
diff changeset
75 string(REGEX REPLACE ${RE} "\\2" ORTHANC_FRAMEWORK_MINOR ${ORTHANC_FRAMEWORK_VERSION})
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2553
diff changeset
76 string(REGEX REPLACE ${RE} "\\3" ORTHANC_FRAMEWORK_REVISION ${ORTHANC_FRAMEWORK_VERSION})
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77
2688
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2553
diff changeset
78 if (NOT ORTHANC_FRAMEWORK_MAJOR MATCHES "^[0-9]+$" OR
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2553
diff changeset
79 NOT ORTHANC_FRAMEWORK_MINOR MATCHES "^[0-9]+$" OR
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2553
diff changeset
80 NOT ORTHANC_FRAMEWORK_REVISION MATCHES "^[0-9]+$")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2553
diff changeset
81 message("Bad version of the Orthanc framework: ${ORTHANC_FRAMEWORK_VERSION}")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2553
diff changeset
82 endif()
2533
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
83
2688
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2553
diff changeset
84 if (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.3.1")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2553
diff changeset
85 set(ORTHANC_FRAMEWORK_MD5 "dac95bd6cf86fb19deaf4e612961f378")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2553
diff changeset
86 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.3.2")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2553
diff changeset
87 set(ORTHANC_FRAMEWORK_MD5 "d0ccdf68e855d8224331f13774992750")
2740
e226f3a23f2f framework 1.4.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2688
diff changeset
88 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.4.0")
e226f3a23f2f framework 1.4.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2688
diff changeset
89 set(ORTHANC_FRAMEWORK_MD5 "81e15f34d97ac32bbd7d26e85698835a")
2915
9abcfd97a76b Orthanc framework 1.4.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2838
diff changeset
90 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.4.1")
9abcfd97a76b Orthanc framework 1.4.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2838
diff changeset
91 set(ORTHANC_FRAMEWORK_MD5 "9b6f6114264b17ed421b574cd6476127")
2838
f3a2d109e361 new orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2740
diff changeset
92 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.4.2")
f3a2d109e361 new orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2740
diff changeset
93 set(ORTHANC_FRAMEWORK_MD5 "d1ee84927dcf668e60eb5868d24b9394")
2993
01dc71f9b9e3 back to mainline
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2915
diff changeset
94 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.0")
01dc71f9b9e3 back to mainline
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2915
diff changeset
95 set(ORTHANC_FRAMEWORK_MD5 "4429d8d9dea4ff6648df80ec3c64d79e")
3044
1000178f94e4 back to mainline
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2993
diff changeset
96 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.1")
1000178f94e4 back to mainline
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2993
diff changeset
97 set(ORTHANC_FRAMEWORK_MD5 "099671538865e5da96208b37494d6718")
3152
6150748578f6 back to mainline
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3135
diff changeset
98 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.2")
6150748578f6 back to mainline
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3135
diff changeset
99 set(ORTHANC_FRAMEWORK_MD5 "8867050f3e9a1ce6157c1ea7a9433b1b")
3170
04336d6da2c6 back to mainline
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3152
diff changeset
100 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.3")
04336d6da2c6 back to mainline
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3152
diff changeset
101 set(ORTHANC_FRAMEWORK_MD5 "bf2f5ed1adb8b0fc5f10d278e68e1dfe")
3213
abb204aed6bf back to mainline
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3170
diff changeset
102 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.4")
abb204aed6bf back to mainline
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3170
diff changeset
103 set(ORTHANC_FRAMEWORK_MD5 "404baef5d4c43e7c5d9410edda8ef5a5")
3307
66745b9039aa back to mainline
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3213
diff changeset
104 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.5")
66745b9039aa back to mainline
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3213
diff changeset
105 set(ORTHANC_FRAMEWORK_MD5 "cfc437e0687ae4bd725fd93dc1f08bc4")
3318
b770435a93d3 back to mainline
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3307
diff changeset
106 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.6")
b770435a93d3 back to mainline
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3307
diff changeset
107 set(ORTHANC_FRAMEWORK_MD5 "3c29de1e289b5472342947168f0105c0")
2688
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2553
diff changeset
108 endif()
2533
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
109 endif()
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 ##
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 ## Detection of the third-party software
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 ##
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 find_program(ORTHANC_FRAMEWORK_HG hg)
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 if (${ORTHANC_FRAMEWORK_HG} MATCHES "ORTHANC_FRAMEWORK_HG-NOTFOUND")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 message(FATAL_ERROR "Please install Mercurial")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" OR
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 ORTHANC_FRAMEWORK_SOURCE STREQUAL "web")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 find_program(ORTHANC_FRAMEWORK_7ZIP 7z
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 PATHS
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 "$ENV{ProgramFiles}/7-Zip"
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 "$ENV{ProgramW6432}/7-Zip"
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 )
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 if (${ORTHANC_FRAMEWORK_7ZIP} MATCHES "ORTHANC_FRAMEWORK_7ZIP-NOTFOUND")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 message(FATAL_ERROR "Please install the '7-zip' software (http://www.7-zip.org/)")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 else()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 find_program(ORTHANC_FRAMEWORK_TAR tar)
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 if (${ORTHANC_FRAMEWORK_TAR} MATCHES "ORTHANC_FRAMEWORK_TAR-NOTFOUND")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 message(FATAL_ERROR "Please install the 'tar' package")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 ##
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 ## Case of the Orthanc framework specified as a path on the filesystem
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 ##
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "path")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 if (NOT DEFINED ORTHANC_FRAMEWORK_ROOT)
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_ROOT must provide the path to the sources of Orthanc")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT})
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 message(FATAL_ERROR "Non-existing directory: ${ORTHANC_FRAMEWORK_ROOT}")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
2533
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
165 message(FATAL_ERROR "Directory not containing the source code of Orthanc: ${ORTHANC_FRAMEWORK_ROOT}")
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 set(ORTHANC_ROOT ${ORTHANC_FRAMEWORK_ROOT})
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 ##
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 ## Case of the Orthanc framework cloned using Mercurial
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 ##
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg")
2534
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2533
diff changeset
178 if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2533
diff changeset
179 message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2533
diff changeset
180 endif()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2533
diff changeset
181
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 set(ORTHANC_ROOT ${CMAKE_BINARY_DIR}/orthanc)
2534
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2533
diff changeset
183
2537
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2534
diff changeset
184 if (EXISTS ${ORTHANC_ROOT})
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2534
diff changeset
185 message("Updating the Orthanc source repository using Mercurial")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2534
diff changeset
186 execute_process(
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2534
diff changeset
187 COMMAND ${ORTHANC_FRAMEWORK_HG} pull
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2534
diff changeset
188 WORKING_DIRECTORY ${ORTHANC_ROOT}
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2534
diff changeset
189 RESULT_VARIABLE Failure
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2534
diff changeset
190 )
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2534
diff changeset
191 else()
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 message("Forking the Orthanc source repository using Mercurial")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 execute_process(
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 COMMAND ${ORTHANC_FRAMEWORK_HG} clone "https://bitbucket.org/sjodogne/orthanc"
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 RESULT_VARIABLE Failure
2537
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2534
diff changeset
197 )
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2534
diff changeset
198 endif()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2534
diff changeset
199
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2534
diff changeset
200 if (Failure OR NOT EXISTS ${ORTHANC_ROOT})
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2534
diff changeset
201 message(FATAL_ERROR "Cannot fork the Orthanc repository")
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 message("Setting branch of the Orthanc repository to: ${ORTHANC_FRAMEWORK_BRANCH}")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 execute_process(
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 COMMAND ${ORTHANC_FRAMEWORK_HG} update -c ${ORTHANC_FRAMEWORK_BRANCH}
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 WORKING_DIRECTORY ${ORTHANC_ROOT}
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 RESULT_VARIABLE Failure
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 )
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 if (Failure)
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 message(FATAL_ERROR "Error while running Mercurial")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 ##
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 ## Case of the Orthanc framework provided as a source archive on the
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 ## filesystem
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 ##
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 if (NOT DEFINED ORTHANC_FRAMEWORK_ARCHIVE)
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_ARCHIVE must provide the path to the sources of Orthanc")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 ##
2547
8b6b0b6ece6b MinGW, ORTHANC_FRAMEWORK_URL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2537
diff changeset
233 ## Case of the Orthanc framework downloaded from the Web
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 ##
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "web")
2547
8b6b0b6ece6b MinGW, ORTHANC_FRAMEWORK_URL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2537
diff changeset
237 if (DEFINED ORTHANC_FRAMEWORK_URL)
8b6b0b6ece6b MinGW, ORTHANC_FRAMEWORK_URL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2537
diff changeset
238 string(REGEX REPLACE "^.*/" "" ORTHANC_FRAMEMORK_FILENAME "${ORTHANC_FRAMEWORK_URL}")
8b6b0b6ece6b MinGW, ORTHANC_FRAMEWORK_URL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2537
diff changeset
239 else()
8b6b0b6ece6b MinGW, ORTHANC_FRAMEWORK_URL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2537
diff changeset
240 # Default case: Download from the official Web site
8b6b0b6ece6b MinGW, ORTHANC_FRAMEWORK_URL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2537
diff changeset
241 set(ORTHANC_FRAMEMORK_FILENAME Orthanc-${ORTHANC_FRAMEWORK_VERSION}.tar.gz)
3135
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
242 set(ORTHANC_FRAMEWORK_URL "http://orthanc.osimis.io/ThirdPartyDownloads/orthanc-framework/${ORTHANC_FRAMEMORK_FILENAME}")
2547
8b6b0b6ece6b MinGW, ORTHANC_FRAMEWORK_URL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2537
diff changeset
243 endif()
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 set(ORTHANC_FRAMEWORK_ARCHIVE "${CMAKE_SOURCE_DIR}/ThirdPartyDownloads/${ORTHANC_FRAMEMORK_FILENAME}")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 if (NOT EXISTS "${ORTHANC_FRAMEWORK_ARCHIVE}")
2534
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2533
diff changeset
248 if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2533
diff changeset
249 message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2533
diff changeset
250 endif()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2533
diff changeset
251
2547
8b6b0b6ece6b MinGW, ORTHANC_FRAMEWORK_URL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2537
diff changeset
252 message("Downloading: ${ORTHANC_FRAMEWORK_URL}")
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 file(DOWNLOAD
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 "${ORTHANC_FRAMEWORK_URL}" "${ORTHANC_FRAMEWORK_ARCHIVE}"
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 SHOW_PROGRESS EXPECTED_MD5 "${ORTHANC_FRAMEWORK_MD5}"
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 TIMEOUT 60
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 INACTIVITY_TIMEOUT 60
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 )
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 else()
2533
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
261 message("Using local copy of: ${ORTHANC_FRAMEWORK_URL}")
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 ##
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 ## Uncompressing the Orthanc framework, if it was retrieved from a
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 ## source archive on the filesystem, or from the official Web site
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 ##
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" OR
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 ORTHANC_FRAMEWORK_SOURCE STREQUAL "web")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 if (NOT DEFINED ORTHANC_FRAMEWORK_ARCHIVE OR
2533
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
277 NOT DEFINED ORTHANC_FRAMEWORK_VERSION OR
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
278 NOT DEFINED ORTHANC_FRAMEWORK_MD5)
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279 message(FATAL_ERROR "Internal error")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281
2533
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
282 if (ORTHANC_FRAMEWORK_MD5 STREQUAL "")
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
283 message(FATAL_ERROR "Unknown release of Orthanc: ${ORTHANC_FRAMEWORK_VERSION}")
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
284 endif()
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
285
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
286 file(MD5 ${ORTHANC_FRAMEWORK_ARCHIVE} ActualMD5)
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
287
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
288 if (NOT "${ActualMD5}" STREQUAL "${ORTHANC_FRAMEWORK_MD5}")
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
289 message(FATAL_ERROR "The MD5 hash of the Orthanc archive is invalid: ${ORTHANC_FRAMEWORK_ARCHIVE}")
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
290 endif()
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
291
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 set(ORTHANC_ROOT "${CMAKE_BINARY_DIR}/Orthanc-${ORTHANC_FRAMEWORK_VERSION}")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 if (NOT IS_DIRECTORY "${ORTHANC_ROOT}")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 if (NOT ORTHANC_FRAMEWORK_ARCHIVE MATCHES ".tar.gz$")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 message(FATAL_ERROR "Archive should have the \".tar.gz\" extension: ${ORTHANC_FRAMEWORK_ARCHIVE}")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298
2533
e7f86a9f0f79 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2532
diff changeset
299 message("Uncompressing: ${ORTHANC_FRAMEWORK_ARCHIVE}")
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302 # How to silently extract files using 7-zip
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303 # http://superuser.com/questions/331148/7zip-command-line-extract-silently-quietly
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305 execute_process(
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306 COMMAND ${ORTHANC_FRAMEWORK_7ZIP} e -y ${ORTHANC_FRAMEWORK_ARCHIVE}
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308 RESULT_VARIABLE Failure
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309 OUTPUT_QUIET
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310 )
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312 if (Failure)
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 message(FATAL_ERROR "Error while running the uncompression tool")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315
2553
7853c9a67605 fix for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2552
diff changeset
316 get_filename_component(TMP_FILENAME "${ORTHANC_FRAMEWORK_ARCHIVE}" NAME)
7853c9a67605 fix for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2552
diff changeset
317 string(REGEX REPLACE ".gz$" "" TMP_FILENAME2 "${TMP_FILENAME}")
2531
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 execute_process(
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320 COMMAND ${ORTHANC_FRAMEWORK_7ZIP} x -y ${TMP_FILENAME2}
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322 RESULT_VARIABLE Failure
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323 OUTPUT_QUIET
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324 )
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 else()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327 execute_process(
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 COMMAND sh -c "${ORTHANC_FRAMEWORK_TAR} xfz ${ORTHANC_FRAMEWORK_ARCHIVE}"
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 RESULT_VARIABLE Failure
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331 )
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334 if (Failure)
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335 message(FATAL_ERROR "Error while running the uncompression tool")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 if (NOT IS_DIRECTORY "${ORTHANC_ROOT}")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339 message(FATAL_ERROR "The Orthanc framework was not uncompressed at the proper location. Check the CMake instructions.")
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
340 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
341 endif()
b7ed112ce56e DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
342 endif()