File: CMakeLists.txt

package info (click to toggle)
gmt 5.4.5+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 149,768 kB
  • sloc: ansic: 202,638; sh: 7,742; xml: 149; makefile: 73; fortran: 49; lisp: 41; csh: 5
file content (213 lines) | stat: -rw-r--r-- 7,977 bytes parent folder | download | duplicates (2)
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#
#	$Id$
#
#	Copyright (c) 1991-2019 by P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
#	See LICENSE.TXT file for copying and redistribution conditions.
#
#	This program is free software; you can redistribute it and/or modify
#	it under the terms of the GNU Lesser General Public License as published by
#	the Free Software Foundation; version 3 or 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 Lesser General Public License for more details.
#
#	Contact info: gmt.soest.hawaii.edu
#-------------------------------------------------------------------------------
#
# To modify the cmake process: Edit your cmake/ConfigUser.cmake file
#
# To build out-of-source do (example):
#
#	mkdir build
#	cd build
#	cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
#
# CMAKE_BUILD_TYPE can be: empty, Debug, Release, RelWithDebInfo or MinSizeRel
#
# cmake creates a new file cmake/ConfigUser.cmake if it does not already
# exist. You can configure additional options there.
#

# Make sure the user doesn't play dirty with symlinks
get_filename_component (srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
get_filename_component (bindir "${CMAKE_BINARY_DIR}" REALPATH)

# Disallow in-source builds
if (${srcdir} STREQUAL ${bindir})
	message(FATAL_ERROR "In-source builds are not allowed. "
	"Please create a directory and run cmake from there, passing the path "
	"to this source directory as the last argument. This process created "
	"the file `CMakeCache.txt' and the directory `CMakeFiles' in ${srcdir}. "
	"Please remove them.")
endif (${srcdir} STREQUAL ${bindir})

# Define minimum CMake version required
cmake_minimum_required (VERSION 2.8.5)

# Use NEW behavior with newer CMake releases
foreach(p
		CMP0025 # CMake 3.0: Compiler id for Apple Clang is now AppleClang
		)
	if(POLICY ${p})
		cmake_policy(SET ${p} NEW)
	endif()
endforeach()

# Use OLD behavior with newer CMake releases
foreach(p
		CMP0026 # CMake 3.0: Disallow use of the LOCATION target property
		)
	if(POLICY ${p})
		cmake_policy(SET ${p} OLD)
	endif()
endforeach()

# Define project name and language
project (GMT C)

# Where to find our CMake modules (this variable is visible in subdirectories).
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/"
	CACHE INTERNAL "Location of our custom CMake modules." FORCE)

# Include configuration options (default options and options overridden by user).
include (ConfigCMake)

# Find UNIX commands
include (FindUnixCommands)
find_program (GIT git)
find_program (GS gs gswin64)
find_program (XZ NAMES xz)

# Global test target
add_custom_target (check
	COMMAND ${CMAKE_CTEST_COMMAND}
	--force-new-ctest-process -j${N_TEST_JOBS})

# Find test dependencies
find_program (GRAPHICSMAGICK gm)
if (DO_EXAMPLES OR DO_TESTS AND NOT GRAPHICSMAGICK)
	message (FATAL_ERROR "Cannot proceed without GraphicsMagick. "
		"Need to either install GraphicsMagick or disable tests.")
endif (DO_EXAMPLES OR DO_TESTS AND NOT GRAPHICSMAGICK)

# Add subdirectories
#set(_manfiles_ps "" CACHE INTERNAL "Global list of PS manpages")
add_subdirectory (src)
add_subdirectory (share)      # share must be processed *after* src (GSHHG_PATH)
add_subdirectory (doc)        # share must be processed *after* src (PDF manpages)
if (EXISTS ${GMT_SOURCE_DIR}/test/)
	add_subdirectory (test)
endif (EXISTS ${GMT_SOURCE_DIR}/test/)
add_subdirectory (cmake/dist) # make distribution bundles (always last)

# Source release target
if (GIT AND HAVE_SVN_VERSION)
	# Export svn working tree
	#add_custom_target (git_export_release_tar
	#	COMMAND ${GIT} archive --prefix=gmt-${GMT_PACKAGE_VERSION}/ -o ${GMT_RELEASE_PREFIX}.tar 5.4
	#	WORKING_DIRECTORY ..)
	if (GZIP AND XZ)
		# Targets for creating tarballs
		string (REGEX REPLACE ".*/" "" _release_dirname "${GMT_RELEASE_PREFIX}")
		add_custom_command (OUTPUT ${_release_dirname}-src.tar
			COMMAND ${GIT} archive --prefix=gmt-${GMT_PACKAGE_VERSION}/ -o ${GMT_RELEASE_PREFIX}-src.tar 5.4
			WORKING_DIRECTORY ..
			VERBATIM)
		add_custom_command (OUTPUT ${_release_dirname}-src.tar.gz
			COMMAND ${GZIP} -9 --keep --force ${GMT_BINARY_DIR}/${_release_dirname}-src.tar
			DEPENDS ${_release_dirname}-src.tar
			WORKING_DIRECTORY ${GMT_RELEASE_PREFIX}/..
			VERBATIM)
		add_custom_command (OUTPUT ${_release_dirname}-src.tar.xz
			COMMAND ${XZ} -9 --keep --force ${GMT_BINARY_DIR}/${_release_dirname}-src.tar
			DEPENDS ${_release_dirname}-src.tar
			WORKING_DIRECTORY ${GMT_RELEASE_PREFIX}/..
			VERBATIM)
		add_custom_target (gmt_release_tar
			DEPENDS ${_release_dirname}-src.tar
			${_release_dirname}-src.tar.gz ${_release_dirname}-src.tar.xz)
		add_depend_to_target (gmt_release gmt_release_tar)
	endif (GZIP AND XZ)
endif (GIT AND HAVE_SVN_VERSION)

get_target_property (_location gmtlib LOCATION)
get_filename_component (GMT_CORE_LIB_NAME ${_location} NAME)

get_target_property (_location pslib LOCATION)
get_filename_component (PSL_LIB_NAME ${_location} NAME)

if (BUILD_SUPPLEMENTS)
	# Get name of shared supplemental library
	get_target_property (_location supplib LOCATION)
	get_filename_component (GMT_SUPPL_LIB_NAME ${_location} NAME)
	set (SUPPL "yes [${GMT_SUPPL_LIB_NAME}]")
else (BUILD_SUPPLEMENTS)
	set (SUPPL "no")
endif (BUILD_SUPPLEMENTS)

if (BUILD_DEVELOPER)
	set (DEVEL "yes")
else (BUILD_DEVELOPER)
	set (DEVEL "no")
endif (BUILD_DEVELOPER)

if (BUILD_SHARED_LIBS)
	set (BUILD_MODE "shared")
else (BUILD_SHARED_LIBS)
	set (BUILD_MODE "static")
endif (BUILD_SHARED_LIBS)

if (EXTRA_BUILD_DIRS)
	set (PROTO ${EXTRA_BUILD_DIRS})
else (EXTRA_BUILD_DIRS)
	set (PROTO "none")
endif (EXTRA_BUILD_DIRS)

# Configure header file to pass some of the CMake settings to the source code
configure_file (src/config.h.in src/config.h)

# Configuration done
message(
	"*  Options:\n"
	"*  Found GSHHG database       : ${GSHHG_PATH} (${GSHHG_VERSION})\n"
	"*  Found DCW-GMT database     : ${DCW_PATH}\n"
	"*  NetCDF library             : ${NETCDF_LIBRARY}\n"
	"*  NetCDF include dir         : ${NETCDF_INCLUDE_DIR}\n"
	"*  Curl library               : ${CURL_LIBRARY}\n"
	"*  Curl include dir           : ${CURL_INCLUDE_DIR}\n"
	"*  GDAL library               : ${GDAL_LIBRARY}\n"
	"*  GDAL include dir           : ${GDAL_INCLUDE_DIR}\n"
	"*  FFTW library               : ${FFTW3F_LIBRARY}\n"
	"*  FFTW include dir           : ${FFTW3_INCLUDE_DIR}\n"
	"*  Accelerate Framework       : ${ACCELERATE_FRAMEWORK}\n"
	"*  Regex support              : ${GMT_CONFIG_REGEX_MESSAGE}\n"
	"*  ZLIB library               : ${ZLIB_LIBRARY}\n"
	"*  ZLIB include dir           : ${ZLIB_INCLUDE_DIR}\n"
	"*  LAPACK library             : ${GMT_CONFIG_LAPACK_MESSAGE}\n"
	"*  License restriction        : ${LICENSE_RESTRICTED}\n"
	"*  Triangulation method       : ${GMT_TRIANGULATE}\n"
	"*  OpenMP support             : ${GMT_CONFIG_OPENMP_MESSAGE}\n"
	"*  GLIB GTHREAD support       : ${GMT_CONFIG_GTHREAD_MESSAGE}\n"
	"*  PTHREAD support            : ${GMT_CONFIG_PTHREAD_MESSAGE}\n"
	"*  Build mode                 : ${BUILD_MODE}\n"
	"*  Build GMT core             : always [${GMT_CORE_LIB_NAME}]\n"
	"*  Build PSL library          : always [${PSL_LIB_NAME}]\n"
	"*  Build GMT supplements      : ${SUPPL}\n"
	"*  Build GMT for developers   : ${DEVEL}\n"
	"*  Build proto supplements    : ${PROTO}\n"
	"*\n"
	"*  Locations:\n"
	"*  Installing GMT in          : ${CMAKE_INSTALL_PREFIX}\n"
	"*  GMT_DATADIR                : ${CMAKE_INSTALL_PREFIX}/${GMT_DATADIR}\n"
	"*  GMT_DOCDIR                 : ${CMAKE_INSTALL_PREFIX}/${GMT_DOCDIR}\n"
	"*  GMT_MANDIR                 : ${CMAKE_INSTALL_PREFIX}/${GMT_MANDIR}")

# For debugging: print all set variables
#get_cmake_property(_variableNames VARIABLES)
#foreach (_variableName ${_variableNames})
#	message(STATUS "${_variableName}=${${_variableName}}")
#endforeach()

# vim: textwidth=78 noexpandtab tabstop=2 softtabstop=2 shiftwidth=2