Package: mapserver / 6.4.1-5+deb8u3

cmake-mapserver-export.patch Patch series | download
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
Description: Install headers and export cmake package for outside projects.
Author: Bas Couwenberg <sebastic@xs4all.nl>
Last-Update: 2013-10-21
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,6 +37,24 @@ if (APPLE)
   set(CMAKE_FIND_FRAMEWORK "LAST")
 endif (APPLE)
 
+# Offer the user the choice of overriding the installation directories
+set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
+set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
+set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
+if(WIN32 AND NOT CYGWIN)
+  set(DEF_INSTALL_CMAKE_DIR CMake)
+else()
+  set(DEF_INSTALL_CMAKE_DIR share/mapserver/cmake)
+endif()
+set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files")
+
+# Make relative paths absolute (needed later on)
+foreach(p LIB BIN INCLUDE CMAKE)
+  set(var INSTALL_${p}_DIR)
+  if(NOT IS_ABSOLUTE "${${var}}")
+    set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
+  endif()
+endforeach()
 
 macro (ms_link_libraries)
   target_link_libraries(mapserver ${ARGV})
@@ -230,11 +248,20 @@ mapgeomtransform.c mapogroutput.c mapsde
 mapgeomutil.cpp mapkmlrenderer.cpp
 mapogr.cpp mapcontour.c mapsmoothing.c ${REGEX_SOURCES})
 
+set(mapserver_HEADERS
+cgiutil.h dxfcolor.h hittest.h mapaxisorder.h mapcopy.h mapentities.h
+maperror.h mapfile.h mapgml.h maphash.h maphttp.h mapio.h mapkmlrenderer.h
+maplibxml2.h mapogcfilter.h mapogcsld.h mapoglcontext.h mapoglrenderer.h
+mapowscommon.h mapows.h mapparser.h mappostgis.h mapprimitive.h mapproject.h
+mapraster.h mapregex.h mapresample.h mapserver-api.h mapserver.h mapserv.h
+mapshape.h mapsymbol.h maptemplate.h mapthread.h maptile.h maptime.h maptree.h
+mapwcs.h)
+
 add_library(mapserver SHARED ${mapserver_SOURCES} ${agg_SOURCES})
 set_target_properties( mapserver  PROPERTIES
   VERSION ${MapServer_VERSION_STRING}
   SOVERSION 1
-) 
+)
 if(BUILD_STATIC)
   add_library(mapserver_static STATIC ${mapserver_SOURCES} ${agg_SOURCES})
   set_target_properties( mapserver_static PROPERTIES
@@ -276,6 +303,7 @@ find_package(PNG)
 if(PNG_FOUND)
   include_directories(${PNG_INCLUDE_DIR})
   ms_link_libraries( ${PNG_LIBRARIES})
+  list(APPEND ALL_INCLUDE_DIRS ${PNG_INCLUDE_DIR})
   set(USE_PNG 1)
 else(PNG_FOUND)
   report_mandatory_not_found(PNG)
@@ -285,6 +313,7 @@ find_package(JPEG)
 if(JPEG_FOUND)
   include_directories(${JPEG_INCLUDE_DIR})
   ms_link_libraries( ${JPEG_LIBRARY})
+  list(APPEND ALL_INCLUDE_DIRS ${JPEG_INCLUDE_DIR})
   set(USE_JPEG 1)
 else(JPEG_FOUND)
   report_mandatory_not_found(JPEG)
@@ -296,6 +325,7 @@ if(NOT FREETYPE_FOUND)
 endif(NOT FREETYPE_FOUND)
 include_directories(${FREETYPE_INCLUDE_DIR})
 ms_link_libraries( ${FREETYPE_LIBRARY})
+list(APPEND ALL_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIR})
 
 
 if(WITH_PROJ)
@@ -305,6 +335,7 @@ if(WITH_PROJ)
  else(NOT PROJ_FOUND)
     include_directories(${PROJ_INCLUDE_DIR})
     ms_link_libraries( ${PROJ_LIBRARY})
+    list(APPEND ALL_INCLUDE_DIRS ${PROJ_INCLUDE_DIR})
     set (USE_PROJ 1)
  endif(NOT PROJ_FOUND)
 endif (WITH_PROJ)
@@ -325,6 +356,7 @@ if(WITH_GD)
  else(NOT GD_FOUND)
     include_directories(${GD_INCLUDE_DIR})
     ms_link_libraries( ${GD_LIBRARY})
+    list(APPEND ALL_INCLUDE_DIRS ${GD_INCLUDE_DIR})
     set (USE_GD 1)
     if(GD_SUPPORTS_PNG)
       set(USE_GD_PNG 1)
@@ -348,6 +380,7 @@ if(WITH_FRIBIDI)
  else(NOT FRIBIDI_FOUND)
     include_directories(${FRIBIDI_INCLUDE_DIR})
     ms_link_libraries( ${FRIBIDI_LIBRARY})
+    list(APPEND ALL_INCLUDE_DIRS ${FRIBIDI_INCLUDE_DIR})
     set (USE_FRIBIDI 1)
     if(FRIBIDI_LEGACY)
       message(WARNING "Old Fribidi found, upgrade recommended")
@@ -360,6 +393,7 @@ if(WITH_ICONV)
   if(ICONV_FOUND)
     include_directories(${ICONV_INCLUDE_DIR})
     ms_link_libraries( ${ICONV_LIBRARY})
+    list(APPEND ALL_INCLUDE_DIRS ${ICONV_INCLUDE_DIR})
     set (USE_ICONV 1)
   else(ICONV_FOUND)
     report_optional_not_found(ICONV)
@@ -376,6 +410,7 @@ if(WITH_CAIRO)
   if(CAIRO_FOUND)
     include_directories(${CAIRO_INCLUDE_DIRS})
     ms_link_libraries( ${CAIRO_LIBRARY})
+    list(APPEND ALL_INCLUDE_DIRS ${CAIRO_INCLUDE_DIR})
     set (USE_CAIRO 1)
   else(CAIRO_FOUND)
     report_optional_not_found(CAIRO)
@@ -387,6 +422,7 @@ if(WITH_MYSQL)
   if(MYSQL_FOUND)
     include_directories(${MYSQL_INCLUDE_DIR})
     ms_link_libraries( ${MYSQL_LIBRARY})
+    list(APPEND ALL_INCLUDE_DIRS ${MYSQL_INCLUDE_DIR})
     set (USE_MYSQL 1)
   else(MYSQL_FOUND)
     report_optional_not_found(MYSQL)
@@ -404,6 +440,7 @@ if(WITH_ORACLESPATIAL OR WITH_ORACLE_PLU
   find_package(Oracle)
   if(ORACLE_FOUND)
     include_directories(${ORACLE_INCLUDE_DIR})
+    list(APPEND ALL_INCLUDE_DIRS ${ORACLE_INCLUDE_DIR})
   else(ORACLE_FOUND)
     report_optional_not_found(ORACLESPATIAL)
     #FIXME: error message here could be misleading, only states ORACLESPATIAL whereas
@@ -430,6 +467,7 @@ if(WITH_MSSQL2008)
 	add_library(msplugin_mssql2008 MODULE mapmssql2008.c)
 	target_link_libraries(msplugin_mssql2008 ${ODBC_LIBRARY} ${MAPSERVER_LIBMAPSERVER})
     set_target_properties(msplugin_mssql2008 PROPERTIES COMPILE_FLAGS "-DUSE_MSSQL2008_PLUGIN -DUSE_MSSQL2008")
+    list(APPEND ALL_INCLUDE_DIRS ${ODBC_INCLUDE_DIR})
 	set (USE_MSSQL2008 1)
   else(ODBC_FOUND)
     report_optional_not_found(ODBC)
@@ -451,6 +489,7 @@ if(WITH_SDE_PLUGIN)
       target_link_libraries(msplugin_sde92 ${SDE_LIBRARY_DIR}/pe.lib ${SDE_LIBRARY_DIR}/sg.lib ${SDE_LIBRARY_DIR}/sde.lib ${MAPSERVER_LIBMAPSERVER})
       set_target_properties(msplugin_sde92 PROPERTIES COMPILE_FLAGS "-DUSE_SDE")
     endif(SDE_VERSION STREQUAL "91")
+    list(APPEND ALL_INCLUDE_DIRS ${SDE_INCLUDE_DIR})
     set(USE_SDE_PLUGIN 1)
   else(SDE_INCLUDE_DIR AND SDE_LIBRARY_DIR)
      MESSAGE( SEND_ERROR "Must specify SDE_INCLUDE_DIR and SDE_LIBRARY_DIR for WITH_SDE_PLUGIN")
@@ -462,6 +501,7 @@ if(WITH_SDE)
   if(SDE_FOUND)
     include_directories(${SDE_INCLUDE_DIRS})
     ms_link_libraries(${SDE_LIBRARIES})
+    list(APPEND ALL_INCLUDE_DIRS ${SDE_INCLUDE_DIRS})
     set (USE_SDE 1)
     if(CMAKE_SIZEOF_VOID_P EQUAL 8)
       set(SDE64 1)
@@ -477,6 +517,7 @@ if(WITH_FCGI)
   if(FCGI_FOUND)
     include_directories(${FCGI_INCLUDE_DIR})
     target_link_libraries(mapserv ${FCGI_LIBRARY})
+    list(APPEND ALL_INCLUDE_DIRS ${FCGI_INCLUDE_DIR})
     set (USE_FASTCGI 1)
   else(FCGI_FOUND)
     report_optional_not_found(FCGI)
@@ -488,6 +529,7 @@ if(WITH_GEOS)
   if(GEOS_FOUND)
     include_directories(${GEOS_INCLUDE_DIR})
     ms_link_libraries( ${GEOS_LIBRARY})
+    list(APPEND ALL_INCLUDE_DIRS ${GEOS_INCLUDE_DIR})
     set (USE_GEOS 1)
   else(GEOS_FOUND)
     report_optional_not_found(GEOS)
@@ -507,6 +549,7 @@ if(WITH_POSTGIS)
     include_directories(${POSTGRESQL_INCLUDE_DIR})
     ms_link_libraries( ${POSTGRESQL_LIBRARY})
     CHECK_LIBRARY_EXISTS(pq "PQserverVersion" POSTGRESQL_LIBRARY POSTGIS_HAS_SERVER_VERSION)
+    list(APPEND ALL_INCLUDE_DIRS ${POSTGRESQL_INCLUDE_DIR})
     set (USE_POSTGIS 1)
   else(POSTGRESQL_FOUND)
     report_optional_not_found(POSTGIS)
@@ -518,6 +561,7 @@ if(WITH_GDAL)
   if(GDAL_FOUND)
     include_directories(${GDAL_INCLUDE_DIR})
     ms_link_libraries( ${GDAL_LIBRARY})
+    list(APPEND ALL_INCLUDE_DIRS ${GDAL_INCLUDE_DIR})
     set (USE_GDAL 1)
   else(GDAL_FOUND)
     report_optional_not_found(GDAL)
@@ -532,6 +576,7 @@ if(WITH_SVGCAIRO)
   if(SVGCAIRO_FOUND)
     include_directories(${SVGCAIRO_INCLUDE_DIR})
     ms_link_libraries( ${SVG_LIBRARY} ${SVGCAIRO_LIBRARY})
+    list(APPEND ALL_INCLUDE_DIRS ${SVGCAIRO_INCLUDE_DIR})
     set (USE_SVG_CAIRO 1)
   else(SVGCAIRO_FOUND)
     report_optional_not_found(SVGCAIRO)
@@ -546,8 +591,10 @@ if(WITH_RSVG)
   if(RSVG_FOUND AND GOBJECT_FOUND)
     include_directories(${RSVG_INCLUDE_DIRS})
     ms_link_libraries( ${RSVG_LIBRARY} )
+    list(APPEND ALL_INCLUDE_DIRS ${RSVG_INCLUDE_DIRS})
     include_directories(${GOBJECT_INCLUDE_DIRS})
     ms_link_libraries( ${GOBJECT_LIBRARY} )
+    list(APPEND ALL_INCLUDE_DIRS ${GOBJECT_INCLUDE_DIRS})
     set (USE_RSVG 1)
   else(RSVG_FOUND AND GOBJECT_FOUND)
     report_optional_not_found(RSVG)
@@ -562,6 +609,7 @@ if(WITH_OGR)
     if(GDAL_FOUND)
       include_directories(${GDAL_INCLUDE_DIR})
       ms_link_libraries( ${GDAL_LIBRARY})
+      list(APPEND ALL_INCLUDE_DIRS ${GDAL_INCLUDE_DIR})
       set (USE_OGR 1)
     else(GDAL_FOUND)
       message(SEND_ERROR "GDAL library could not be found and is needed for OGR support.
@@ -581,6 +629,7 @@ if(WITH_CURL)
    if(CURL_FOUND)
      include_directories(${CURL_INCLUDE_DIR})
      ms_link_libraries( ${CURL_LIBRARY})
+    list(APPEND ALL_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
      set(USE_CURL 1)
    else(CURL_FOUND)
      report_optional_not_found(CURL)
@@ -719,6 +768,7 @@ if(WITH_XMLMAPFILE)
     endif()
     include_directories(${LIBXSLT_INCLUDE_DIR})
     ms_link_libraries( ${LIBXSLT_LIBRARY} ${LIBXSLT_EXSLT_LIBRARY})
+    list(APPEND ALL_INCLUDE_DIRS ${LIBXSLT_INCLUDE_DIR})
     set(USE_XMLMAPFILE 1)
   else(LIBXSLT_FOUND)
     message(SEND_ERROR "Xml Mapfile support requires XSLT support which was not found.
@@ -734,6 +784,7 @@ if(WITH_GIF)
   if(GIF_FOUND)
     include_directories(${GIF_INCLUDE_DIR})
     ms_link_libraries( ${GIF_LIBRARY})
+    list(APPEND ALL_INCLUDE_DIRS ${GIF_INCLUDE_DIR})
     set(USE_GIF 1)
   else(GIF_FOUND)
     report_optional_not_found(GIF)
@@ -745,6 +796,7 @@ if(WITH_EXEMPI)
   if(LIBEXEMPI_FOUND)
     include_directories(${LIBEXEMPI_INCLUDE_DIR})
     ms_link_libraries( ${LIBEXEMPI_LIBRARY})
+    list(APPEND ALL_INCLUDE_DIRS ${LIBEXEMPI_INCLUDE_DIR})
     set(USE_EXEMPI 1)
   else(LIBEXEMPI_FOUND)
     report_optional_not_found(EXEMPI)
@@ -805,7 +857,9 @@ configure_file (
   "${PROJECT_BINARY_DIR}/mapserver-version.h"
   )
 
-
+set_target_properties(mapserver PROPERTIES
+  PUBLIC_HEADER "${mapserver_HEADERS};${PROJECT_BINARY_DIR}/mapserver-config.h;${PROJECT_BINARY_DIR}/mapserver-version.h"
+)
 
 macro(status_optional_component component enabled libpath)
   if("${enabled}" EQUAL "1")
@@ -903,23 +957,68 @@ endif(WIN32)
 
 #INSTALL(FILES mapserver-api.h ${PROJECT_BINARY_DIR}/mapserver-version.h DESTINATION include)
 if(USE_ORACLE_PLUGIN)
-   INSTALL(TARGETS msplugin_oracle DESTINATION ${CMAKE_INSTALL_LIBDIR})
+   INSTALL(TARGETS msplugin_oracle DESTINATION ${INSTALL_LIB_DIR})
 endif(USE_ORACLE_PLUGIN)
 
 if(USE_MSSQL2008)
-   INSTALL(TARGETS msplugin_mssql2008 DESTINATION ${CMAKE_INSTALL_LIBDIR})
+   INSTALL(TARGETS msplugin_mssql2008 DESTINATION ${INSTALL_LIB_DIR})
 endif(USE_MSSQL2008)
 
 if(USE_SDE91)
-   INSTALL(TARGETS msplugin_sde91 DESTINATION ${CMAKE_INSTALL_LIBDIR})
+   INSTALL(TARGETS msplugin_sde91 DESTINATION ${INSTALL_LIB_DIR})
 endif(USE_SDE91)
 
 if(USE_SDE92)
-   INSTALL(TARGETS msplugin_sde92 DESTINATION ${CMAKE_INSTALL_LIBDIR})
+   INSTALL(TARGETS msplugin_sde92 DESTINATION ${INSTALL_LIB_DIR})
 endif(USE_SDE92)
 
-INSTALL(TARGETS sortshp shptree shptreevis msencrypt legend scalebar tile4ms shptreetst shp2img mapserv mapserver RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+INSTALL(TARGETS sortshp shptree shptreevis msencrypt legend scalebar tile4ms shptreetst shp2img mapserv
+        RUNTIME DESTINATION ${INSTALL_BIN_DIR} COMPONENT bin
+)
+INSTALL(TARGETS mapserver
+        EXPORT mapserverTargets
+        LIBRARY DESTINATION ${INSTALL_LIB_DIR} COMPONENT shlib
+        PUBLIC_HEADER DESTINATION ${INSTALL_INCLUDE_DIR}/mapserver COMPONENT dev
+)
 if(BUILD_STATIC)
-   INSTALL(TARGETS mapserver_static DESTINATION ${CMAKE_INSTALL_LIBDIR})
+   INSTALL(TARGETS mapserver_static DESTINATION ${INSTALL_LIB_DIR})
 endif(BUILD_STATIC)
 
+# Add all targets to the build-tree export set
+export(TARGETS mapserver
+       FILE "${PROJECT_BINARY_DIR}/mapserverTargets.cmake"
+)
+
+# Export the package for use from the build-tree
+# (this registers the build-tree with a global CMake-registry)
+export(PACKAGE mapserver)
+
+list(APPEND ALL_INCLUDE_DIRS ${INSTALL_INCLUDE_DIR})
+list(APPEND ALL_INCLUDE_DIRS ${INSTALL_INCLUDE_DIR}/mapserver)
+
+list(REMOVE_DUPLICATES ALL_INCLUDE_DIRS)
+
+# Create the mapserver-config.cmake and mapserver-config-version files
+file(RELATIVE_PATH REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}" "${ALL_INCLUDE_DIRS}")
+
+# ... for the build tree
+set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}")
+configure_file(mapserver-config.cmake.in "${PROJECT_BINARY_DIR}/mapserver-config.cmake" @ONLY)
+
+# ... for the install tree
+set(CONF_INCLUDE_DIRS "\${MAPSERVER_CMAKE_DIR}/${REL_INCLUDE_DIR}")
+configure_file(mapserver-config.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/mapserver-config.cmake" @ONLY)
+
+# ... for both
+configure_file(mapserver-config-version.cmake.in "${PROJECT_BINARY_DIR}/mapserver-config-version.cmake" @ONLY)
+
+# Install the mapserver-config.cmake and mapserver-config-version.cmake
+install(FILES "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/mapserver-config.cmake"
+              "${PROJECT_BINARY_DIR}/mapserver-config-version.cmake"
+        DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev
+)
+
+# Install the export set for use with the install-tree
+install(EXPORT mapserverTargets
+        DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev
+)
--- /dev/null
+++ b/mapserver-config.cmake.in
@@ -0,0 +1,18 @@
+# - Config file for the mapserver package
+# It defines the following variables
+#  MAPSERVER_INCLUDE_DIRS - include directories for mapserver
+#  MAPSERVER_LIBRARIES    - libraries to link against
+#  MAPSERVER_EXECUTABLES  - executables build for mapserver
+
+# Compute paths
+get_filename_component(MAPSERVER_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+set(MAPSERVER_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@")
+
+# Our library dependencies (contains definitions for IMPORTED targets)
+if(NOT TARGET mapserver AND NOT MapServer_BINARY_DIR)
+  include("${MAPSERVER_CMAKE_DIR}/mapserverTargets.cmake")
+endif()
+
+# These are IMPORTED targets created by mapserverTargets.cmake
+set(MAPSERVER_LIBRARIES mapserver)
+set(MAPSERVER_EXECUTABLES sortshp shptree shptreevis msencrypt legend scalebar tile4ms shptreetst shp2img mapserv)
--- /dev/null
+++ b/mapserver-config-version.cmake.in
@@ -0,0 +1,11 @@
+set(PACKAGE_VERSION "@MapServer_VERSION_STRING@")
+
+# Check whether the requested PACKAGE_FIND_VERSION is compatible
+if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
+  set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+  set(PACKAGE_VERSION_COMPATIBLE TRUE)
+  if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
+    set(PACKAGE_VERSION_EXACT TRUE)
+  endif()
+endif()