forked from libgeos/geos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
559 lines (477 loc) · 21.5 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
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
##############################################################################
# Part of CMake configuration for GEOS
#
# Copyright (C) 2018-2019 Mateusz Loskot <mateusz@loskot.net>
#
# This is free software; you can redistribute and/or modify it under
# the terms of the GNU Lesser General Public Licence as published
# by the Free Software Foundation.
# See the COPYING file for more information.
##############################################################################
# Require CMake 3.13+ with support for meta-features that request compiler
# modes for specific C/C++ language standard levels, and object libraries.
cmake_minimum_required(VERSION 3.13)
#-----------------------------------------------------------------------------
# Version
#-----------------------------------------------------------------------------
file(READ Version.txt _version_txt)
string(REGEX MATCH "GEOS_VERSION_MAJOR=([0-9]+)" _ ${_version_txt})
set(_version_major ${CMAKE_MATCH_1})
string(REGEX MATCH "GEOS_VERSION_MINOR=([0-9]+)" _ ${_version_txt})
set(_version_minor ${CMAKE_MATCH_1})
string(REGEX MATCH "GEOS_VERSION_PATCH=([0-9]+)" _ ${_version_txt})
set(_version_patch ${CMAKE_MATCH_1})
# OPTIONS: "", "dev", "rc1" etc.
string(REGEX MATCH "GEOS_PATCH_WORD=([a-zA-Z0-9]+)" _ ${_version_txt})
set(_version_patch_word ${CMAKE_MATCH_1})
# Version of JTS this release is bound to
string(REGEX MATCH "JTS_PORT=([0-9a-zA-Z\.]+)" _ ${_version_txt})
set(JTS_PORT ${CMAKE_MATCH_1})
# Version of public C API
string(REGEX MATCH "CAPI_INTERFACE_CURRENT=([0-9]+)" _ ${_version_txt})
set(_version_capi_current ${CMAKE_MATCH_1})
string(REGEX MATCH "CAPI_INTERFACE_REVISION=([0-9]+)" _ ${_version_txt})
set(_version_capi_revision ${CMAKE_MATCH_1})
string(REGEX MATCH "CAPI_INTERFACE_AGE=([0-9]+)" _ ${_version_txt})
set(_version_capi_age ${CMAKE_MATCH_1})
unset(_version_txt)
math(EXPR _version_capi_major "${_version_capi_current} - ${_version_capi_age}")
set(CAPI_VERSION_MAJOR ${_version_capi_major})
set(CAPI_VERSION_MINOR ${_version_capi_age})
set(CAPI_VERSION_PATCH ${_version_capi_revision})
set(CAPI_VERSION "${_version_capi_major}.${_version_capi_age}.${_version_capi_revision}")
unset(_version_capi_current)
unset(_version_capi_major)
unset(_version_capi_age)
unset(_version_capi_revision)
#-----------------------------------------------------------------------------
# Project
#-----------------------------------------------------------------------------
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.9)
list(APPEND _project_info DESCRIPTION "GEOS - C++ port of the Java Topology Suite (JTS)")
endif()
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
list(APPEND _project_info HOMEPAGE_URL "https://libgeos.org/")
endif()
project(GEOS VERSION "${_version_major}.${_version_minor}.${_version_patch}"
LANGUAGES C CXX
${_project_info})
if(NOT "${_version_patch_word}" STREQUAL "")
# Re-write VERSION variables after project()
set(GEOS_VERSION "${GEOS_VERSION}${_version_patch_word}")
set(GEOS_VERSION_PATCH "${_version_patch}${_version_patch_word}")
endif()
set(GEOS_VERSION_NOPATCH "${_version_major}.${_version_minor}.${_version_patch}")
unset(_version_major)
unset(_version_minor)
unset(_version_patch)
unset(_version_patch_word)
message(STATUS "GEOS: Version ${GEOS_VERSION}")
message(STATUS "GEOS: C API Version ${CAPI_VERSION}")
message(STATUS "GEOS: JTS port ${JTS_PORT}")
if(CMAKE_VERSION VERSION_LESS 3.21)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(PROJECT_IS_TOP_LEVEL ON)
else()
set(PROJECT_IS_TOP_LEVEL OFF)
endif()
endif()
#-----------------------------------------------------------------------------
# Setup
#-----------------------------------------------------------------------------
# Default to release build so packagers don't release debug builds
set(DEFAULT_BUILD_TYPE Release)
# Require CMake 3.13+ with VS generator for complete support of VS versions
# and support by AppVeyor.
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# TODO: Follow CMake detection of git and version tagging
# https://gitlab.kitware.com/cmake/cmake/blob/master/Source/CMakeVersionSource.cmake
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
set(GEOS_BUILD_FROM_GIT ON)
endif()
# Make sure we know our build type
if(NOT CMAKE_BUILD_TYPE)
get_property(_is_multi_config_generator GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (NOT _is_multi_config_generator)
set(CMAKE_BUILD_TYPE ${DEFAULT_BUILD_TYPE})
message(STATUS "GEOS: Using default build type: ${CMAKE_BUILD_TYPE}")
endif()
unset(_is_multi_config_generator)
else()
message(STATUS "GEOS: Build type: ${CMAKE_BUILD_TYPE}")
endif()
#-----------------------------------------------------------------------------
# Options
#-----------------------------------------------------------------------------
include(Ccache)
include(CMakeDependentOption)
## CMake global variables
option(BUILD_SHARED_LIBS "Build GEOS with shared libraries" ON)
set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard version to use (default is 14)")
## GEOS custom variables
option(BUILD_BENCHMARKS "Build GEOS benchmarks" OFF)
cmake_dependent_option(GEOS_BUILD_DEVELOPER
"Build with compilation flags useful for development" ON
"GEOS_BUILD_FROM_GIT;PROJECT_IS_TOP_LEVEL" OFF)
mark_as_advanced(GEOS_BUILD_DEVELOPER)
if (POLICY CMP0092)
# dont set /W3 warning flags by default, we already
# set /W4 anyway
cmake_policy(SET CMP0092 NEW)
endif()
#-----------------------------------------------------------------------------
# Setup build directories
#-----------------------------------------------------------------------------
# Place executables and shared libraries in the same location for
# convenience of direct execution from common spot and for
# convenience in environments without RPATH support.
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
message(STATUS "GEOS: Run-time output: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
message(STATUS "GEOS: Archives output: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
#-----------------------------------------------------------------------------
# Add ASAN build option
#-----------------------------------------------------------------------------
#
# To use ASAN with MacOSX you will need to install clang++ from MacPorts
# or HomeBrew, the default XCode one won't work. Then get cmake to use your
# new compiler, with something like.
#
# cmake \
# -D CMAKE_C_COMPILER=/opt/local/bin/clang-mp-15 \
# -D CMAKE_CXX_COMPILER=/opt/local/bin/clang-mp-15++ \
# -D CMAKE_BUILD_TYPE=ASAN
#
# To suppress reporting on leaks in MacOS itself (yes, really),
# add a suppression file to your build directory.
#
# echo leak:realizeClassWithoutSwift >> lsan.supp
#
# Now run the program with env vars set to turn on leak checking and suppression.
#
# MallocNanoZone=0 \
# ASAN_OPTIONS=detect_leaks=1 \
# LSAN_OPTIONS=suppressions=lsan.supp \
# ./bin/test_geos_unit
#
set(CMAKE_C_FLAGS_ASAN "${CMAKE_C_FLAGS_DEBUG} -g -O0 -fsanitize=address -fno-omit-frame-pointer -fno-common")
set(CMAKE_CXX_FLAGS_ASAN "${CMAKE_CXX_FLAGS_DEBUG} -g -O0 -fsanitize=address -fno-omit-frame-pointer -fno-common")
set(CMAKE_EXE_LINKER_FLAGS_ASAN "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fsanitize=address")
set(CMAKE_SHARED_LINKER_FLAGS_ASAN "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=address")
get_property(_cmake_build_type_is_cache CACHE CMAKE_BUILD_TYPE PROPERTY TYPE)
if (_cmake_build_type_is_cache)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "ASAN")
endif()
unset(_cmake_build_type_is_cache)
#-----------------------------------------------------------------------------
# Install directories
#-----------------------------------------------------------------------------
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
#-----------------------------------------------------------------------------
# C++ language version and compilation flags
#-----------------------------------------------------------------------------
message(STATUS "GEOS: Require C++${CMAKE_CXX_STANDARD}")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
#-----------------------------------------------------------------------------
# Target geos_cxx_flags: common compilation flags
#-----------------------------------------------------------------------------
add_library(geos_cxx_flags INTERFACE)
target_compile_features(geos_cxx_flags INTERFACE cxx_std_11)
#-----------------------------------------------------------------------------
# Add flags to prevent 'fused multiply-add' operations on targets (ARM64)
# that allow it, as it breaks calculations in DD.cpp.
# TODO: Replace DD calculations with 'long float' where target supports
# true long float, and remove other cases where FMA causes regression
# failures.
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98207
#-----------------------------------------------------------------------------
target_compile_options(geos_cxx_flags INTERFACE
"$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-ffp-contract=off>"
"$<$<CXX_COMPILER_ID:GNU>:-ffp-contract=off>"
"$<$<BOOL:${MSVC}>:/fp:precise>"
)
# Use -ffloat-store for 32-bit builds (needed to make some tests pass)
target_compile_options(geos_cxx_flags INTERFACE
$<$<AND:$<CXX_COMPILER_ID:GNU>,$<EQUAL:4,${CMAKE_SIZEOF_VOID_P}>>:-ffloat-store>
)
# Make sure NDEBUG is defined so that assert() is disabled for
# any non-debug build. Use a generator expression so that this
# works with multi-configuration generators.
target_compile_definitions(geos_cxx_flags INTERFACE $<$<NOT:$<CONFIG:Debug>>:NDEBUG>)
#-----------------------------------------------------------------------------
# Target geos_developer_cxx_flags: developer mode compilation flags
#-----------------------------------------------------------------------------
# Do NOT install this target for end-users!
add_library(geos_developer_cxx_flags INTERFACE)
if(GEOS_BUILD_DEVELOPER)
message(STATUS "GEOS: Developer mode ENABLED")
endif()
# geos_cxx_flags inherits properties from geos_developer_cxx_flags when
# building as part of the GEOS repository or on explicit request for
# developer compilation mode, as GEOS contributor.
# The flags are intended only for GEOS itself and are not part of
# usage requirements needed by GEOS consumers.
if(GEOS_BUILD_DEVELOPER)
target_link_libraries(geos_cxx_flags
INTERFACE
$<BUILD_INTERFACE:geos_developer_cxx_flags>)
endif()
target_compile_definitions(geos_cxx_flags
INTERFACE
USE_UNSTABLE_GEOS_CPP_API)
# Deal with Intel Compiler
if (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-fno-fast-math HAVE_FLAG_NO_FAST_MATH)
if (HAVE_FLAG_NO_FAST_MATH)
# Intel CXX compiler, based on clang, defaults to -ffast-math, which breaks a lot of things
target_compile_options(geos_cxx_flags INTERFACE "-fno-fast-math")
endif ()
set(TEST_LINK_STDCPP_SOURCE_CODE
"#include <string>
int main(){
std::string s;
s += \"x\";
return 0;
}")
check_cxx_source_compiles("${TEST_LINK_STDCPP_SOURCE_CODE}" _TEST_LINK_STDCPP)
if( NOT _TEST_LINK_STDCPP )
message(WARNING "Cannot link code using standard C++ library. Automatically adding -lstdc++ to CMAKE_EXE_LINKER_FLAGS, CMAKE_SHARED_LINKER_FLAGS and CMAKE_MODULE_LINKER_FLAGS")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lstdc++")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lstdc++")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -lstdc++")
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("${TEST_LINK_STDCPP_SOURCE_CODE}" _TEST_LINK_STDCPP_AGAIN)
if( NOT _TEST_LINK_STDCPP_AGAIN )
message(FATAL_ERROR "Cannot link C++ program")
endif()
endif()
endif ()
target_compile_definitions(geos_developer_cxx_flags
INTERFACE
$<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>
$<$<BOOL:${MSVC}>:_SCL_SECURE_NO_DEPRECATE>
$<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
$<$<BOOL:${WIN32}>:NOMINMAX>)
target_compile_options(geos_developer_cxx_flags
INTERFACE
$<$<CXX_COMPILER_ID:MSVC>:-W4> # consider -analyze
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Werror -pedantic -Wall -Wextra -Wno-long-long -Wcast-align -Wconversion -Wsign-conversion -Wchar-subscripts -Wdouble-promotion -Wpointer-arith -Wformat -Wformat-security -Wshadow -Wuninitialized -Wunused-parameter -fno-common>
$<$<CXX_COMPILER_ID:GNU>:-fno-implicit-inline-templates -Wno-psabi -Wsuggest-attribute=format>
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wno-unknown-warning-option>
)
#-----------------------------------------------------------------------------
# Define a coverage build
#-----------------------------------------------------------------------------
set(CMAKE_CXX_FLAGS_COVERAGE "-fprofile-arcs -ftest-coverage")
#-----------------------------------------------------------------------------
# Extra libraries
#-----------------------------------------------------------------------------
include(CheckLibraryExists)
check_library_exists(m pow "" HAVE_LIBM)
#-----------------------------------------------------------------------------
# Target geos: C++ API library
#-----------------------------------------------------------------------------
add_library(geos "")
add_library(GEOS::geos ALIAS geos)
target_link_libraries(geos PUBLIC geos_cxx_flags PRIVATE $<BUILD_INTERFACE:ryu>)
# ryu is an object library, nothing is actually being linked here. The BUILD_INTERFACE
# switch was necessary to build on AppVeyor (CMake 3.16.2) but not locally (CMake 3.16.3)
# Leave install with an RPATH approach to linking
#if(APPLE AND BUILD_SHARED_LIBS)
# set_target_properties(geos PROPERTIES
# INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}")
#endif()
add_subdirectory(include)
add_subdirectory(src)
# Some packagers would like the DLL files generated by MinGW to
# include version numbers in the file name. Others would rather
# they not (which is the cmake default).
option(VERSION_MINGW_SHARED_LIBS "Add version suffix to MinGW shared libraries" OFF)
if(BUILD_SHARED_LIBS)
target_compile_definitions(geos
PRIVATE $<$<BOOL:${WIN32}>:GEOS_DLL_EXPORT>)
set_target_properties(geos PROPERTIES VERSION ${GEOS_VERSION_NOPATCH})
set_target_properties(geos PROPERTIES SOVERSION ${GEOS_VERSION_NOPATCH})
if(MINGW AND VERSION_MINGW_SHARED_LIBS)
set_target_properties(geos PROPERTIES SUFFIX "-${GEOS_VERSION_NOPATCH}${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif()
endif()
#-----------------------------------------------------------------------------
# Target geos_c: C API library
#-----------------------------------------------------------------------------
add_library(geos_c "")
add_library(GEOS::geos_c ALIAS geos_c)
target_link_libraries(geos_c PRIVATE geos)
# Leave install with an RPATH approach to linking
#if(APPLE AND BUILD_SHARED_LIBS)
# set_target_properties(geos_c PROPERTIES
# INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}")
#endif()
if(BUILD_SHARED_LIBS)
target_compile_definitions(geos_c
PRIVATE $<$<BOOL:${WIN32}>:GEOS_DLL_EXPORT>)
set_target_properties(geos_c PROPERTIES VERSION ${CAPI_VERSION})
if(NOT WIN32 OR MINGW)
set_target_properties(geos_c PROPERTIES SOVERSION ${CAPI_VERSION_MAJOR})
endif()
if(MINGW AND VERSION_MINGW_SHARED_LIBS)
set_target_properties(geos_c PROPERTIES SUFFIX "-${CAPI_VERSION_MAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif()
endif()
add_subdirectory(capi)
#-----------------------------------------------------------------------------
# Tests
#-----------------------------------------------------------------------------
if(PROJECT_IS_TOP_LEVEL)
include(CTest)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
endif()
#-----------------------------------------------------------------------------
# Benchmarks
#-----------------------------------------------------------------------------
if(PROJECT_IS_TOP_LEVEL AND BUILD_BENCHMARKS)
add_subdirectory(benchmarks)
endif()
#-----------------------------------------------------------------------------
# Utils
#-----------------------------------------------------------------------------
if(PROJECT_IS_TOP_LEVEL)
add_subdirectory(util)
endif()
#-----------------------------------------------------------------------------
# Documentation/Examples
#-----------------------------------------------------------------------------
if(PROJECT_IS_TOP_LEVEL)
add_subdirectory(doxygen)
endif()
#-----------------------------------------------------------------------------
# Web Site
#-----------------------------------------------------------------------------
option(BUILD_WEBSITE "Build website" OFF)
if(PROJECT_IS_TOP_LEVEL AND BUILD_WEBSITE)
add_subdirectory(web)
endif()
#-----------------------------------------------------------------------------
# Install and export targets - support 'make install' or equivalent
#-----------------------------------------------------------------------------
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/geos-config-version.cmake"
VERSION ${GEOS_VERSION}
COMPATIBILITY AnyNewerVersion)
configure_file(cmake/geos-config.cmake
"${CMAKE_CURRENT_BINARY_DIR}/geos-config.cmake"
COPYONLY)
install(TARGETS geos geos_cxx_flags
EXPORT geos-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(TARGETS geos_c
EXPORT geos-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(EXPORT geos-targets
FILE geos-targets.cmake
NAMESPACE GEOS::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GEOS)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/geos-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/geos-config-version.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GEOS)
install(DIRECTORY
"${CMAKE_CURRENT_LIST_DIR}/include/geos"
"${CMAKE_CURRENT_BINARY_DIR}/include/geos"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h")
install(DIRECTORY
"${CMAKE_CURRENT_LIST_DIR}/include/geos"
"${CMAKE_CURRENT_BINARY_DIR}/include/geos"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.hpp")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/capi/geos_c.h"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES "${CMAKE_CURRENT_LIST_DIR}/include/geos.h"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
add_subdirectory(tools)
#-----------------------------------------------------------------------------
# Uninstall
#-----------------------------------------------------------------------------
if(PROJECT_IS_TOP_LEVEL)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake")
endif() # PROJECT_IS_TOP_LEVEL
#-----------------------------------------------------------------------------
# "make dist" workalike
#-----------------------------------------------------------------------------
if(PROJECT_IS_TOP_LEVEL)
get_property(_is_multi_config_generator GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(NOT _is_multi_config_generator)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GEOS Computational Geometry Library")
set(CPACK_PACKAGE_VENDOR "OSGeo")
set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README.md)
set(CPACK_SOURCE_GENERATOR "TBZ2")
set(CPACK_PACKAGE_VERSION_MAJOR ${GEOS_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${GEOS_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${GEOS_VERSION_PATCH})
set(CPACK_SOURCE_PACKAGE_FILE_NAME "geos-${GEOS_VERSION}")
set(CPACK_VERBATIM_VARIABLES TRUE)
set(CPACK_SOURCE_IGNORE_FILES
/\\..* # any file/directory starting with .
/.*build-.*/
#/.*build.*/ #taken out because breaks gitlab make distcheck
/autogen\\.sh
/autom4te\\.cache
/bin/
/debian/
/HOWTO_RELEASE
/include/geos/version\\.h\$
/php/
/tools/ci
/tools/geos-config\$
/tools/geos\\.pc\$
/web/
cmake_install\\.cmake\$
${CMAKE_CURRENT_BINARY_DIR}
)
# message(STATUS "GEOS: CPACK_SOURCE_PACKAGE_FILE_NAME: ${CPACK_SOURCE_PACKAGE_FILE_NAME}")
# message(STATUS "GEOS: CPACK_SOURCE_IGNORE_FILES: ${CPACK_SOURCE_IGNORE_FILES}")
# message(STATUS "GEOS: CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}")
include(CPack)
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
message(STATUS "GEOS: Configured 'dist' target")
endif()
endif() # PROJECT_IS_TOP_LEVEL
#-----------------------------------------------------------------------------
# "make check" workalike
#-----------------------------------------------------------------------------
if(PROJECT_IS_TOP_LEVEL)
add_custom_target(check COMMAND ${CMAKE_BUILD_TOOL} test)
endif()
#-----------------------------------------------------------------------------
# "make distcheck" workalike
#-----------------------------------------------------------------------------
if(PROJECT_IS_TOP_LEVEL)
if(NOT _is_multi_config_generator)
find_package(MakeDistCheck)
AddMakeDistCheck()
message(STATUS "GEOS: Configured 'distcheck' target")
endif()
unset(_is_multi_config_generator)
endif() # PROJECT_IS_TOP_LEVEL