Update for release
[geos.git] / capi / CMakeLists.txt
blob77d75b524a78731eab5c048c33180bbc4cbade57
1 #################################################################################
2 # $Id$
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 #################################################################################
15 if(WIN32)
16     add_definitions("-DGEOS_DLL_EXPORT=1")
17 endif()
19 set(geos_c_SOURCES
20   geos_c.cpp
21   geos_ts_c.cpp)
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
33     PROPERTIES
34     VERSION ${CAPI_VERSION}
35     CLEAN_DIRECT_OUTPUT 1)
36 endif()
38 if(APPLE) 
39   set_target_properties(geos PROPERTIES 
40   BUILD_WITH_INSTALL_RPATH TRUE 
41   INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}") 
42 endif() 
44 #################################################################################
45 # Installation
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\")")
52 else()
53   install(FILES ${CMAKE_CURRENT_BINARY_DIR}/geos_c.h
54     DESTINATION include)
55 endif()
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)
62 endif()
64 #################################################################################
65 # Group source files for IDE source explorers (e.g. Visual Studio)
66 #################################################################################
68 source_group("Header Files" FILES ${geos_capi_HEADERS})