comparison Resources/CMake/GdcmConfiguration.cmake @ 0:02f7a0400a91

initial commit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 25 Feb 2015 13:45:35 +0100
parents
children 09421764214b
comparison
equal deleted inserted replaced
-1:000000000000 0:02f7a0400a91
1 # Orthanc - A Lightweight, RESTful DICOM Store
2 # Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
3 # Department, University Hospital of Liege, Belgium
4 #
5 # This program is free software: you can redistribute it and/or
6 # modify it under the terms of the GNU Affero General Public License
7 # as published by the Free Software Foundation, either version 3 of
8 # the License, or (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Affero General Public License for more details.
14 #
15 # You should have received a copy of the GNU Affero General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18
19 if (STATIC_BUILD OR NOT USE_SYSTEM_GDCM)
20 # If using gcc, build GDCM with the "-fPIC" argument to allow its
21 # embedding into the shared library containing the Orthanc plugin
22 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
23 set(Flags -DCMAKE_CXX_FLAGS:STRING=-fPIC -DCMAKE_C_FLAGS:STRING=-fPIC)
24 else()
25 endif()
26
27 if (CMAKE_TOOLCHAIN_FILE)
28 list(APPEND Flags -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
29 endif()
30
31 include(ExternalProject)
32 externalproject_add(GDCM
33 URL "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/gdcm-2.4.4.tar.gz"
34 URL_MD5 "5dca87a061c536b6fa377263b7839dcb"
35 CMAKE_ARGS -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} ${Flags}
36 #-DLIBRARY_OUTPUT_PATH=${CMAKE_CURRENT_BINARY_DIR}
37 INSTALL_COMMAND "" # Skip the install step
38 )
39
40 if(MSVC)
41 set(Suffix ".lib")
42 else()
43 set(Suffix ".a")
44 endif()
45
46 list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix)
47 set(GDCM_LIBRARIES
48 ${Prefix}gdcmMSFF${Suffix}
49 ${Prefix}gdcmcharls${Suffix}
50 ${Prefix}gdcmDICT${Suffix}
51 ${Prefix}gdcmDSED${Suffix}
52 ${Prefix}gdcmIOD${Suffix}
53 ${Prefix}gdcmjpeg8${Suffix}
54 ${Prefix}gdcmjpeg12${Suffix}
55 ${Prefix}gdcmjpeg16${Suffix}
56 ${Prefix}gdcmMEXD${Suffix}
57 ${Prefix}gdcmopenjpeg${Suffix}
58 ${Prefix}gdcmzlib${Suffix}
59 ${Prefix}socketxx${Suffix}
60 ${Prefix}gdcmCommon${Suffix}
61 ${Prefix}gdcmexpat${Suffix}
62
63 #${Prefix}gdcmgetopt${Suffix}
64 #${Prefix}gdcmuuid${Suffix}
65 )
66
67 ExternalProject_Get_Property(GDCM binary_dir)
68 include_directories(${binary_dir}/Source/Common)
69 link_directories(${binary_dir}/bin)
70
71 ExternalProject_Get_Property(GDCM source_dir)
72 include_directories(
73 ${source_dir}/Source/Common
74 ${source_dir}/Source/MediaStorageAndFileFormat
75 ${source_dir}/Source/DataStructureAndEncodingDefinition
76 )
77
78 else()
79 find_package(GDCM REQUIRED)
80 if (GDCM_FOUND)
81 include(${GDCM_USE_FILE})
82 set(GDCM_LIBRARIES gdcmCommon gdcmMSFF)
83 else(GDCM_FOUND)
84 message(FATAL_ERROR "Cannot find GDCM, did you set GDCM_DIR?")
85 endif(GDCM_FOUND)
86 endif()