Skip to content

Commit 08a8265

Browse files
sebastictbonfort
authored andcommitted
Add (optional) support for mapserver with CMake.
1 parent fd657d6 commit 08a8265

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ option(WITH_TIFF "Use TIFFs as a cache backend" OFF)
7676
option(WITH_TIFF_WRITE_SUPPORT "Enable (experimental) support for writable TIFF cache backends" OFF)
7777
option(WITH_GEOTIFF "Allow GeoTIFF metadata creation for TIFF cache backends" OFF)
7878
option(WITH_PCRE "Use PCRE for regex tests" OFF)
79+
option(WITH_MAPSERVER "Enable (experimental) support for the mapserver library" OFF)
7980

8081
find_package(PNG)
8182
if(PNG_FOUND)
@@ -212,6 +213,17 @@ if(WITH_GEOTIFF)
212213
endif(GEOTIFF_FOUND)
213214
endif (WITH_GEOTIFF)
214215

216+
if(WITH_MAPSERVER)
217+
find_package(MAPSERVER)
218+
if(MAPSERVER_FOUND)
219+
include_directories(${MAPSERVER_INCLUDE_DIR})
220+
target_link_libraries(mapcache ${MAPSERVER_LIBRARY})
221+
set (USE_MAPSERVER 1)
222+
else(MAPSERVER_FOUND)
223+
report_optional_not_found(MAPSERVER)
224+
endif(MAPSERVER_FOUND)
225+
endif (WITH_MAPSERVER)
226+
215227

216228
if(UNIX)
217229
target_link_libraries(mapcache ${CMAKE_DL_LIBS} m )
@@ -259,6 +271,7 @@ status_optional_component("TIFF" "${USE_TIFF}" "${TIFF_LIBRARY}")
259271
status_optional_component("GeoTIFF" "${USE_GEOTIFF}" "${GEOTIFF_LIBRARY}")
260272
status_optional_component("Experimental TIFF write support" "${USE_TIFF_WRITE}" "${TIFF_LIBRARY}")
261273
status_optional_component("PCRE" "${USE_PCRE}" "${PCRE_LIBRARY}")
274+
status_optional_component("Experimental mapserver support" "${USE_MAPSERVER}" "${MAPSERVER_LIBRARY}")
262275

263276
INSTALL(TARGETS mapcache DESTINATION ${CMAKE_INSTALL_LIBDIR})
264277

cmake/FindMAPSERVER.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
FIND_PATH(MAPSERVER_INCLUDE_DIR
3+
NAMES mapserver.h
4+
PATH_SUFFIXES mapserver
5+
)
6+
7+
FIND_LIBRARY(MAPSERVER_LIBRARY
8+
NAMES mapserver
9+
)
10+
11+
set(MAPSERVER_INCLUDE_DIRS ${MAPSERVER_INCLUDE_DIR})
12+
set(MAPSERVER_LIBRARIES ${MAPSERVER_LIBRARY})
13+
include(FindPackageHandleStandardArgs)
14+
find_package_handle_standard_args(MAPSERVER DEFAULT_MSG MAPSERVER_LIBRARY MAPSERVER_INCLUDE_DIR)
15+
mark_as_advanced(MAPSERVER_LIBRARY MAPSERVER_INCLUDE_DIR)

include/mapcache-config.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#cmakedefine USE_TIFF_WRITE 1
1111
#cmakedefine USE_GEOTIFF 1
1212
#cmakedefine USE_PCRE 1
13+
#cmakedefine USE_MAPSERVER 1
1314

1415
#cmakedefine HAVE_STRNCASECMP 1
1516
#cmakedefine HAVE_SYMLINK 1

0 commit comments

Comments
 (0)