CMake: Use CMAKE_CXX_STANDARD to require C++98
[geos.git] / capi / CMakeLists.txt
blob859722b8d9b710cd23334a3de350d6c0c2c3749a
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 #################################################################################
14 if(WIN32)
15     add_definitions("-DGEOS_DLL_EXPORT=1")
16 endif()
18 set(geos_c_SOURCES
19   geos_c.cpp
20   geos_ts_c.cpp)
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)
30   if (WIN32)
31     set_target_properties(geos_c
32       PROPERTIES
33       VERSION ${CAPI_VERSION}
34       CLEAN_DIRECT_OUTPUT 1)
35   else()
36     set_target_properties(geos_c
37       PROPERTIES
38       VERSION ${CAPI_VERSION}
39       SOVERSION ${CAPI_SOVERSION}
40       CLEAN_DIRECT_OUTPUT 1)
41   endif()
43 endif()
45 #################################################################################
46 # Installation
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\")")
53 else()
54   install(FILES ${CMAKE_CURRENT_BINARY_DIR}/geos_c.h
55     DESTINATION include)
56 endif()
58 if(NOT GEOS_ENABLE_MACOSX_FRAMEWORK) 
59   install(TARGETS geos_c
60     RUNTIME DESTINATION bin
61     LIBRARY DESTINATION lib
62     ARCHIVE DESTINATION lib)
63 endif()
65 #################################################################################
66 # Group source files for IDE source explorers (e.g. Visual Studio)
67 #################################################################################
69 source_group("Header Files" FILES ${geos_capi_HEADERS})