forked from libspatialindex/libspatialindex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
170 lines (135 loc) · 4.79 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
#
# top-level CMake configuration file for libspatialindex
#
# (based originally on the PDAL and libLAS files copyright Mateusz Loskot)
cmake_minimum_required(VERSION 3.13)
#------------------------------------------------------------------------------
# libspatialindex general settings
#------------------------------------------------------------------------------
project(spatialindex
LANGUAGES CXX
VERSION "2.0.0"
HOMEPAGE_URL "https://github.com/libspatialindex/libspatialindex"
)
set(SIDX_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(SIDX_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(SIDX_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
set(SIDX_VERSION_STRING "${PROJECT_VERSION}")
set(SIDX_LIB_VERSION "7.0.0")
set(SIDX_LIB_SOVERSION "7")
include(GNUInstallDirs)
message(STATUS
"Configuring CMake ${CMAKE_VERSION} to build spatialindex ${PROJECT_VERSION}")
include(CTest)
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
option(BUILD_TESTING "Enables integrated test suites" OFF)
if(DEFINED SIDX_BUILD_TESTS)
message(DEPRECATION "SIDX_BUILD_TESTS has been replaced with BUILD_TESTING")
set(BUILD_TESTING ${SIDX_BUILD_TESTS})
endif()
include(CTest)
# C++11 required, overridable by user
set(CMAKE_CXX_STANDARD 11
CACHE STRING "C++ standard version to use (default is 11)")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Name of C++ library
set(SIDX_LIB_NAME spatialindex)
set(SIDX_C_LIB_NAME spatialindex_c)
if(WIN32 AND MSVC)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(SIDX_LIB_NAME "${SIDX_LIB_NAME}-64")
set(SIDX_C_LIB_NAME "${SIDX_C_LIB_NAME}-64")
else()
set(SIDX_LIB_NAME "${SIDX_LIB_NAME}-32")
set(SIDX_C_LIB_NAME "${SIDX_C_LIB_NAME}-32")
endif()
endif()
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
include(CheckFunctionExists)
check_function_exists(srand48 HAVE_SRAND48)
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
check_function_exists(memset HAVE_MEMSET)
check_function_exists(memcpy HAVE_MEMCPY)
check_function_exists(bcopy HAVE_BCOPY)
include(CheckIncludeFiles)
add_subdirectory(src)
if(BUILD_TESTING)
add_subdirectory(test)
endif()
#------------------------------------------------------------------------------
# CMake package configuration for find_package(libspatialindex)
#------------------------------------------------------------------------------
include(CMakePackageConfigHelpers)
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "include directory")
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "lib directory")
configure_package_config_file(
libspatialindexConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/libspatialindexConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libspatialindex
PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/libspatialindexConfigVersion.cmake
VERSION ${SIDX_VERSION_STRING}
COMPATIBILITY AnyNewerVersion)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/libspatialindexConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/libspatialindexConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libspatialindex)
#------------------------------------------------------------------------------
# pkg-config support
#------------------------------------------------------------------------------
if(NOT WIN32)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/libspatialindex.pc.in
${CMAKE_CURRENT_BINARY_DIR}/libspatialindex.pc
@ONLY)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/libspatialindex.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
#------------------------------------------------------------------------------
# CPack controls
#------------------------------------------------------------------------------
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_TWEAK ${PROJECT_VERSION_TWEAK})
set(CPACK_PACKAGE_NAME "libspatialindex")
set(CPACK_SOURCE_GENERATOR "TBZ2;TGZ")
set(CPACK_PACKAGE_VENDOR "libspatialindex Development Team")
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING")
set(CPACK_SOURCE_PACKAGE_FILE_NAME
"${CMAKE_PROJECT_NAME}-src-${PROJECT_VERSION}")
set(CPACK_SOURCE_IGNORE_FILES
"/\\\\.gitattributes"
"/\\\\.vagrant"
"/\\\\.DS_Store"
"/CVS/"
"/\\\\.git/"
"\\\\.swp$"
"~$"
"\\\\.\\\\#"
"/\\\\#"
"CMakeScripts/"
"_CPack_Packages"
"cmake_install.cmake"
"/bin/"
"/scripts/"
"/azure-pipelines.yml"
".gitignore"
".ninja*"
"HOWTORELEASE.txt"
"README"
"build/"
"CMakeFiles"
"CTestTestfile.cmake"
"/docs/build/"
"/doc/presentations/"
"package-release.sh"
"docker-package.sh"
".gz"
".bz2"
)
include(CPack)
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)