v0.14.0
FindMetaIO.cmake
Go to the documentation of this file.
1 # MoFEM is free software: you can redistribute it and/or modify it under
2 # the terms of the GNU Lesser General Public License as published by the
3 # Free Software Foundation, either version 3 of the License, or (at your
4 # option) any later version.
5 #
6 # MoFEM is distributed in the hope that it will be useful, but WITHOUT
7 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
9 # License for more details.
10 #
11 # You should have received a copy of the GNU Lesser General Public
12 # License along with MoFEM. If not, see <http://www.gnu.org/licenses/>
13 
14 if(NOT METAIO_DIR)
15  set(METAIO_DIR $ENV{METAIO_DIR})
16 endif(NOT METAIO_DIR)
17 
18 if(METAIO_DIR)
19  find_library(ITKMetaIO NAMES ITKMetaIO PATHS ${METAIO_DIR}/lib)
20  find_library(itkzlib NAMES itkzlib PATHS ${METAIO_DIR}/lib/iktMetaIO)
21  if(ITKMetaIO)
22  include_directories(${METAIO_DIR}/include)
23  include_directories(${METAIO_DIR}/include/iktMetaIO)
24  include_directories(${METAIO_DIR}/include/iktMetaIO/Utilities)
25  add_definitions(-DWITH_METAIO)
26  endif(ITKMetaIO)
27 endif(METAIO_DIR)
28 
29 if(WITH_METAIO)
30  ExternalProject_Add(
31  MetaIO
32  PREFIX ${PROJECT_BINARY_DIR}/external/
33  GIT_REPOSITORY https://github.com/likask/MetaIO.git
34  GIT_TAG ForMoFEMv0.2
35  CMAKE_ARGS
36  -DBUILD_SHARED_LIBS:BOOL=OFF
37  -DCMAKE_INSTALL_PREFIX:PATH=${PROJECT_BINARY_DIR}/external/
38  UPDATE_COMMAND ""
39  )
40 endif(WITH_METAIO)
41 
42 if(WITH_METAIO)
43  if(NOT ITKMetaIO)
44  include_directories(${PROJECT_BINARY_DIR}/external/include)
45  include_directories(${PROJECT_BINARY_DIR}/external/include/iktMetaIO)
46  include_directories(${PROJECT_BINARY_DIR}/external/include/iktMetaIO/Utilities)
47  add_library(ITKMetaIO STATIC IMPORTED)
48  set_property(TARGET ITKMetaIO PROPERTY IMPORTED_LOCATION ${PROJECT_BINARY_DIR}/external/lib/libITKMetaIO.a)
49  add_dependencies(ITKMetaIO MetaIO)
50  add_library(itkzlib STATIC IMPORTED)
51  set_property(TARGET itkzlib PROPERTY IMPORTED_LOCATION ${PROJECT_BINARY_DIR}/external/lib/iktMetaIO/libitkzlib.a)
52  add_dependencies(itkzlib MetaIO)
53  add_definitions(-DWITH_METAIO)
54  endif(NOT ITKMetaIO)
55 endif(WITH_METAIO)