1 #################################################################################
4 # GEOS C library build configuration for CMake build system
6 # Copyright (C) 2009 Mateusz Loskot <mateusz@loskot.net>
8 # This is free software; you can redistribute and/or modify it under
9 # the terms of the GNU Lesser General Public Licence as published
10 # by the Free Software Foundation.
11 # See the COPYING file for more information.
13 #################################################################################
16 add_definitions("-DGEOS_DLL_EXPORT=1")
23 file(GLOB geos_capi_HEADERS ${CMAKE_BINARY_DIR}/capi/*.h) # fix source_group issue
25 if(NOT APPLE AND NOT GEOS_ENABLE_MACOSX_FRAMEWORK)
26 # if building OS X framework, CAPI built into C++ library
27 add_library(geos_c SHARED ${geos_c_SOURCES})
29 target_link_libraries(geos_c geos-static)
31 # TODO: Enable SOVERSION property
32 set_target_properties(geos_c
34 VERSION ${CAPI_VERSION}
35 CLEAN_DIRECT_OUTPUT 1)
38 set_target_properties(geos PROPERTIES
39 BUILD_WITH_INSTALL_RPATH TRUE
40 INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}")
44 #################################################################################
46 #################################################################################
48 if(APPLE AND GEOS_ENABLE_MACOSX_FRAMEWORK)
49 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/geos_c.h
50 DESTINATION GEOS.framework/Versions/${VERSION_MAJOR}/Headers)
51 install(CODE "execute_process(COMMAND sed -E -i \"\" \"s,# *include[[:space:]]+<geos/,#include <GEOS/,g\" \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/GEOS.framework/Versions/${VERSION_MAJOR}/Headers/geos_c.h\")")
53 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/geos_c.h
57 if(NOT APPLE AND NOT GEOS_ENABLE_MACOSX_FRAMEWORK)
58 install(TARGETS geos_c
59 RUNTIME DESTINATION bin
60 LIBRARY DESTINATION lib
61 ARCHIVE DESTINATION lib)
64 #################################################################################
65 # Group source files for IDE source explorers (e.g. Visual Studio)
66 #################################################################################
68 source_group("Header Files" FILES ${geos_capi_HEADERS})