File: CMakeLists.txt

package info (click to toggle)
mapserver 6.4.1-5+deb8u3
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 12,960 kB
  • ctags: 19,791
  • sloc: ansic: 119,501; cpp: 54,044; python: 3,055; xml: 1,676; cs: 875; lex: 741; yacc: 707; java: 588; perl: 428; makefile: 382; sh: 373; tcl: 158; ruby: 55
file content (47 lines) | stat: -rw-r--r-- 2,207 bytes parent folder | download | duplicates (4)
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
FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})

FIND_PACKAGE(JNI)
FIND_PACKAGE(Java)
if(NOT JNI_INCLUDE_DIRS OR NOT Java_JAVAC_EXECUTABLE OR NOT Java_JAR_EXECUTABLE)
   message(SEND_ERROR "Could not find required Java componenents. Try setting the JAVA_HOME environment variable (required on e.g. Ubuntu)")
endif(NOT JNI_INCLUDE_DIRS OR NOT Java_JAVAC_EXECUTABLE OR NOT Java_JAR_EXECUTABLE)

INCLUDE_DIRECTORIES(${JNI_INCLUDE_DIRS})
include_directories(${PROJECT_SOURCE_DIR}/mapscript/swiginc)
include_directories(${PROJECT_SOURCE_DIR}/mapscript/)
include_directories(${PROJECT_SOURCE_DIR}/mapscript/java)
SET (CMAKE_SWIG_OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/edu/umn/gis/mapscript")
SET(CMAKE_SWIG_FLAGS -package edu.umn.gis.mapscript)
SWIG_ADD_MODULE(javamapscript java ../mapscript.i)

# Java mapscript fails to build with -Werror=format-security

if(${CMAKE_C_FLAGS} MATCHES "-Werror=format-security")
  string(REPLACE "-Werror=format-security" "" TMP "${CMAKE_C_FLAGS}")
  set(CMAKE_C_FLAGS "${TMP}")
endif(${CMAKE_C_FLAGS} MATCHES "-Werror=format-security")

if(${CMAKE_CXX_FLAGS} MATCHES "-Werror=format-security")
  string(REPLACE "-Werror=format-security" "" TMP "${CMAKE_CXX_FLAGS}")
  set(CMAKE_CXX_FLAGS "${TMP}")
endif(${CMAKE_CXX_FLAGS} MATCHES "-Werror=format-security")

if(${CMAKE_CPP_FLAGS} MATCHES "-Werror=format-security")
  string(REPLACE "-Werror=format-security" "" TMP "${CMAKE_CPP_FLAGS}")
  set(CMAKE_CPP_FLAGS "${TMP}")
endif(${CMAKE_CPP_FLAGS} MATCHES "-Werror=format-security")

SWIG_LINK_LIBRARIES(javamapscript ${MAPSERVER_LIBMAPSERVER})

ADD_CUSTOM_COMMAND(TARGET javamapscript
                      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
                      POST_BUILD
                      COMMAND ${Java_JAVAC_EXECUTABLE} edu/umn/gis/mapscript/*.java
                      COMMAND ${Java_JAR_EXECUTABLE} cf mapscript.jar edu
                      COMMENT "Compiling java source files, creating mapscript.jar"
                      )

get_target_property(LOC_MAPSCRIPT_LIB ${SWIG_MODULE_javamapscript_REAL_NAME} LOCATION)
install(FILES ${LOC_MAPSCRIPT_LIB} DESTINATION lib/jni)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mapscript.jar DESTINATION share/java)