File: CMakeLists.txt

package info (click to toggle)
mapserver 7.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 16,620 kB
  • sloc: ansic: 176,974; cpp: 58,161; python: 2,969; xml: 1,676; cs: 997; yacc: 856; lex: 766; java: 588; perl: 428; makefile: 374; sh: 184; tcl: 158; ruby: 55
file content (43 lines) | stat: -rw-r--r-- 1,933 bytes parent folder | download | duplicates (2)
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
find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
find_package(Ruby REQUIRED)
include_directories(${RUBY_INCLUDE_DIRS})
include_directories(${PROJECT_SOURCE_DIR}/mapscript/swiginc)
include_directories(${PROJECT_SOURCE_DIR}/mapscript/)
include_directories(${PROJECT_SOURCE_DIR}/mapscript/ruby)

if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 3.7)
    swig_add_library(rubymapscript TYPE MODULE LANGUAGE ruby SOURCES ../mapscript.i)
else ()
    swig_add_module(rubymapscript ruby ../mapscript.i)
endif ()

# Ruby 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(rubymapscript ${RUBY_LIBRARY} ${MAPSERVER_LIBMAPSERVER})

set_target_properties(${SWIG_MODULE_rubymapscript_REAL_NAME} PROPERTIES PREFIX "")
set_target_properties(${SWIG_MODULE_rubymapscript_REAL_NAME} PROPERTIES OUTPUT_NAME mapscript)

if(APPLE)
    set_target_properties(${SWIG_MODULE_rubymapscript_REAL_NAME} PROPERTIES SUFFIX ".bundle")
endif(APPLE)

set(mapscript_files $<TARGET_FILE:${SWIG_MODULE_rubymapscript_REAL_NAME}>)
execute_process(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts RbConfig::CONFIG['vendorarchdir']" OUTPUT_VARIABLE RUBY_VENDORARCHDIR OUTPUT_STRIP_TRAILING_WHITESPACE)
install(FILES ${mapscript_files} DESTINATION ${RUBY_VENDORARCHDIR})