v0.15.0
Loading...
Searching...
No Matches
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
14option(WITH_METAIO "Build MetaIO" ON)
15
16if(NOT METAIO_DIR)
17 set(METAIO_DIR $ENV{METAIO_DIR})
18endif(NOT METAIO_DIR)
19
20if(METAIO_DIR)
21 find_library(ITKMetaIO NAMES ITKMetaIO PATHS ${METAIO_DIR}/lib)
22 find_library(itkzlib NAMES itkzlib PATHS ${METAIO_DIR}/lib/iktMetaIO)
23 if(ITKMetaIO)
24 include_directories(${METAIO_DIR}/include)
25 include_directories(${METAIO_DIR}/include/iktMetaIO)
26 include_directories(${METAIO_DIR}/include/iktMetaIO/Utilities)
27 add_definitions(-DWITH_METAIO)
28 endif(ITKMetaIO)
29endif(METAIO_DIR)
30
31if(WITH_METAIO)
32 ExternalProject_Add(
33 MetaIO
34 PREFIX ${PROJECT_BINARY_DIR}/external/
35 GIT_REPOSITORY https://github.com/likask/MetaIO.git
36 GIT_TAG ForMoFEMv0.2
37 CMAKE_ARGS
38 -DBUILD_SHARED_LIBS:BOOL=OFF
39 -DCMAKE_INSTALL_PREFIX:PATH=${PROJECT_BINARY_DIR}/external/
40 UPDATE_COMMAND ""
41 )
42endif(WITH_METAIO)
43
44if(WITH_METAIO)
45 if(NOT ITKMetaIO)
46 include_directories(${PROJECT_BINARY_DIR}/external/include)
47 include_directories(${PROJECT_BINARY_DIR}/external/include/iktMetaIO)
48 include_directories(${PROJECT_BINARY_DIR}/external/include/iktMetaIO/Utilities)
49 add_library(ITKMetaIO STATIC IMPORTED)
50 set_property(TARGET ITKMetaIO PROPERTY IMPORTED_LOCATION ${PROJECT_BINARY_DIR}/external/lib/libITKMetaIO.a)
51 add_dependencies(ITKMetaIO MetaIO)
52 add_library(itkzlib STATIC IMPORTED)
53 set_property(TARGET itkzlib PROPERTY IMPORTED_LOCATION ${PROJECT_BINARY_DIR}/external/lib/iktMetaIO/libitkzlib.a)
54 add_dependencies(itkzlib MetaIO)
55 add_definitions(-DWITH_METAIO)
56 endif(NOT ITKMetaIO)
57endif(WITH_METAIO)