CMakeLists.txt 1.18 KB
Newer Older
1 2 3 4
find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
find_package(Ruby REQUIRED)
include_directories(${RUBY_INCLUDE_DIRS})
5 6 7 8
include_directories(${PROJECT_SOURCE_DIR}/mapscript/swiginc)
include_directories(${PROJECT_SOURCE_DIR}/mapscript/)
include_directories(${PROJECT_SOURCE_DIR}/mapscript/ruby)

9 10 11 12 13 14 15
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 ()

swig_link_libraries(rubymapscript ${RUBY_LIBRARY} ${MAPSERVER_LIBMAPSERVER})
16 17 18

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

20
if(APPLE)
21
    set_target_properties(${SWIG_MODULE_rubymapscript_REAL_NAME} PROPERTIES SUFFIX ".bundle")
22
endif(APPLE)
23

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