-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
133 lines (115 loc) · 4.11 KB
/
CMakeLists.txt
File metadata and controls
133 lines (115 loc) · 4.11 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# This file is part of the ESO METIS Pipeline
# Copyright (C) 2023-2024 European Southern Observatory
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.12)
project(METIS VERSION 0.0.1 LANGUAGES C CXX)
# Add local cmake module search path
list(INSERT CMAKE_MODULE_PATH 0 "${PROJECT_SOURCE_DIR}/cmake")
# Set policies
cmake_policy(VERSION 3.12)
# Safer library linking
cmake_policy(SET CMP0003 NEW)
# Automatically escape preprocessor definitions
cmake_policy(SET CMP0005 NEW)
# Make syntax problems errors
cmake_policy(SET CMP0010 NEW)
# Input directories must have CMakeLists.txt
cmake_policy(SET CMP0014 NEW)
# Do not interpret quoted or bracketed variables in if statments
cmake_policy(SET CMP0054 NEW)
# Usage of <PackageName>_ROOT variables
cmake_policy(SET CMP0074 NEW)
# Escape RPATH entries in intermediate scripts
cmake_policy(SET CMP0095 NEW)
# Deprecated FindPythonInterp and FindPythonLibs
cmake_policy(SET CMP0148 NEW)
# exec_program() command should not be called.
cmake_policy(SET CMP0153 NEW)
# Setup basic pipeline package information
include(EsoPipelinePackage)
# Immediately before every release do:
#-------------------------------------
# if (the interface is totally unchanged from previous release)
# REVISION++;
# else {
# /* interfaces have been added, removed or changed */
# REVISION = 0;
# CURRENT++;
# if (any interfaces have been _added_ since last release)
# AGE++;
# if (any interfaces have been _removed_ or incompatibly changed)
# AGE = 0;
# }
eso_set_library_version(0 0 0)
# Require out-of-source build
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
if (NOT DEFINED WITH_IN_SOURCE_BUILD)
message(FATAL_ERROR "CMake generation for this project is not allowed
within the source directory!")
endif()
endif()
# Default build type
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build,
options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif()
set(CMAKE_VERBOSE_MAKEFILE ON)
# Set install directories
if (UNIX AND NOT WIN32)
include(GNUInstallDirs)
set(PACKAGE_RECIPE_DIR "${CMAKE_INSTALL_LIBDIR}/esopipes-plugins")
endif()
# Find external packages
find_package(PkgConfig)
find_package(CPL "7.2" REQUIRED COMPONENTS cplcore cplui cpldfs cpldrs)
#find_package(HDRL "1.5" REQUIRED COMPONENTS hdrl)
find_package(Python3 REQUIRED COMPONENTS Interpreter)
# Package creation
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
set(CPACK_GENERATOR "TGZ")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES
.git
.svn
.vscode
.clang-format
README.DEV
${PROJECT_BINARY_DIR})
include(CPack)
# Create config.h
configure_file(
"${PROJECT_SOURCE_DIR}/cmake/config.h.cmake"
"${PROJECT_BINARY_DIR}/config.h")
add_definitions(-DHAVE_CONFIG_H)
set_source_files_properties(${PROJECT_BINARY_DIR}/config.h
PROPERTIES GENERATED TRUE
HEADER_FILE_ONLY TRUE)
# uninstall target
if(NOT TARGET uninstall)
configure_file(
"${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake"
"${PROJECT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
# Add subdirectories
add_subdirectory(metis)
add_subdirectory(recipes)
add_subdirectory(pymetis)
add_subdirectory(pyrecipes)