-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
81 lines (61 loc) · 2.24 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
PROJECT(lis)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# Find necessary packages
find_package(GDAL REQUIRED)
if(NOT GDAL_FOUND)
message(FATAL_ERROR "Cannot find GDAL. Set GDAL_INCLUDE_DIR and GDAL_LIBRARY")
endif()
if (GDAL_CONFIG)
# extract gdal version
exec_program(${GDAL_CONFIG}
ARGS --version
OUTPUT_VARIABLE GDAL_VERSION )
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" GDAL_VERSION_MAJOR "${GDAL_VERSION}")
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" GDAL_VERSION_MINOR "${GDAL_VERSION}")
# check for gdal version
if (GDAL_VERSION_MAJOR LESS 2)
message (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 2.1 or higher.")
endif ()
endif()
#Set python home (needed on the cnes hpc)
# FIXME Is it still needed on hal?
set(PYTHON_INCLUDE_DIRS $ENV{PYTHONHOME}/include)
find_package(PythonInterp REQUIRED)
find_package( PythonLibs 2.7 REQUIRED)
include_directories( ${PYTHON_INCLUDE_DIRS} )
# Link to the Orfeo ToolBox
# LIS required OTB 6.0
SET(OTB_MIN_VERSION "6.0.0")
find_package(OTB ${OTB_MIN_VERSION} REQUIRED)
if(OTB_FOUND)
include(${OTB_USE_FILE})
else(OTB_FOUND)
message(FATAL_ERROR
"OTB not found. Please set OTB_DIR")
endif(OTB_FOUND)
# Output directories
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${lis_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for all ARCHIVE products (static libs, import libs)")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lis_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for all LIBRARY products (so, modules)")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${lis_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for all RUNTIME products (executables, dlls)")
# Install dirs
if(NOT lis_INSTALL_BIN_DIR)
set(lis_INSTALL_BIN_DIR "bin")
endif(NOT lis_INSTALL_BIN_DIR)
if(NOT lis_INSTALL_LIB_DIR)
set(lis_INSTALL_LIB_DIR "lib")
endif(NOT lis_INSTALL_LIB_DIR)
if(NOT lis_INSTALL_INCLUDE_DIR)
set(lis_INSTALL_INCLUDE_DIR "include")
endif(NOT lis_INSTALL_INCLUDE_DIR)
set(BUILD_SHARED_LIBS ON)
include_directories(src)
add_subdirectory(src)
add_subdirectory(python)
add_subdirectory(app)
# Add Testing subdirectory
option(BUILD_TESTING "Build testing." OFF)
if(BUILD_TESTING)
ENABLE_TESTING()
INCLUDE(Dart)
add_subdirectory(test)
endif()