1 #################################################################################
3 # GEOS C library build configuration for CMake build system
5 # Copyright (C) 2009 Mateusz Loskot <mateusz@loskot.net>
7 # This is free software; you can redistribute and/or modify it under
8 # the terms of the GNU Lesser General Public Licence as published
9 # by the Free Software Foundation.
10 # See the COPYING file for more information.
12 #################################################################################
15 add_definitions("-DGEOS_DLL_EXPORT=1")
22 file(GLOB geos_capi_HEADERS ${CMAKE_BINARY_DIR}/capi/*.h) # fix source_group issue
24 if(NOT GEOS_ENABLE_MACOSX_FRAMEWORK)
25 # if building OS X framework, CAPI built into C++ library
26 add_library(geos_c SHARED ${geos_c_SOURCES})
28 target_link_libraries(geos_c geos)
31 set_target_properties(geos_c
33 VERSION ${CAPI_VERSION}
34 CLEAN_DIRECT_OUTPUT 1)
36 set_target_properties(geos_c
38 VERSION ${CAPI_VERSION}
39 SOVERSION ${CAPI_SOVERSION}
40 CLEAN_DIRECT_OUTPUT 1)
45 #################################################################################
47 #################################################################################
49 if(APPLE AND GEOS_ENABLE_MACOSX_FRAMEWORK)
50 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/geos_c.h
51 DESTINATION GEOS.framework/Versions/${VERSION_MAJOR}/Headers)
52 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\")")
54 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/geos_c.h
58 if(NOT GEOS_ENABLE_MACOSX_FRAMEWORK)
59 install(TARGETS geos_c
60 RUNTIME DESTINATION bin
61 LIBRARY DESTINATION lib
62 ARCHIVE DESTINATION lib)
65 #################################################################################
66 # Group source files for IDE source explorers (e.g. Visual Studio)
67 #################################################################################
69 source_group("Header Files" FILES ${geos_capi_HEADERS})