2017-10-04 02:37:23 +08:00
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
2020-04-27 22:47:08 +08:00
|
|
|
index e7d2451..f8cc1ba 100644
|
2017-10-04 02:37:23 +08:00
|
|
|
--- a/CMakeLists.txt
|
|
|
|
+++ b/CMakeLists.txt
|
|
|
|
@@ -66,11 +66,7 @@ if(NOT MSVC)
|
|
|
|
"Set to ON|OFF (default) to build GEOS with assert() macro enabled" OFF)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
-option(GEOS_BUILD_STATIC
|
|
|
|
- "Set to OFF|ON (default) to build GEOS static libraries" ON)
|
|
|
|
-
|
|
|
|
-option(GEOS_BUILD_SHARED
|
|
|
|
- "Set to OFF|ON (default) to build GEOS shared libraries" ON)
|
|
|
|
+option(BUILD_SHARED_LIBS "Build GEOS as a shared library" ON)
|
|
|
|
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
option(GEOS_ENABLE_FLOATSTORE
|
|
|
|
diff --git a/capi/CMakeLists.txt b/capi/CMakeLists.txt
|
2020-04-27 22:47:08 +08:00
|
|
|
index 0607b16..877d611 100644
|
2017-10-04 02:37:23 +08:00
|
|
|
--- a/capi/CMakeLists.txt
|
|
|
|
+++ b/capi/CMakeLists.txt
|
2020-04-27 22:47:08 +08:00
|
|
|
@@ -21,17 +21,25 @@ set(geos_c_SOURCES
|
2017-10-04 02:37:23 +08:00
|
|
|
|
2020-04-27 22:47:08 +08:00
|
|
|
file(GLOB geos_capi_HEADERS ${CMAKE_BINARY_DIR}/capi/*.h) # fix source_group issue
|
|
|
|
|
|
|
|
-if(NOT GEOS_ENABLE_MACOSX_FRAMEWORK AND GEOS_BUILD_SHARED)
|
|
|
|
+if(NOT GEOS_ENABLE_MACOSX_FRAMEWORK)
|
|
|
|
# if building OS X framework or only building static libs, CAPI built into C++ library)
|
|
|
|
- add_library(geos_c SHARED ${geos_c_SOURCES})
|
2017-10-04 02:37:23 +08:00
|
|
|
+ add_library(geos_c ${geos_c_SOURCES})
|
|
|
|
|
|
|
|
target_link_libraries(geos_c geos)
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
- set_target_properties(geos_c
|
|
|
|
- PROPERTIES
|
|
|
|
- VERSION ${CAPI_VERSION}
|
|
|
|
- CLEAN_DIRECT_OUTPUT 1)
|
|
|
|
+ if(BUILD_SHARED_LIBS)
|
|
|
|
+ set_target_properties(geos_c
|
|
|
|
+ PROPERTIES
|
|
|
|
+ VERSION ${CAPI_VERSION}
|
|
|
|
+ CLEAN_DIRECT_OUTPUT 1)
|
|
|
|
+ else()
|
|
|
|
+ set_target_properties(geos_c
|
|
|
|
+ PROPERTIES
|
|
|
|
+ OUTPUT_NAME "geos_c"
|
|
|
|
+ PREFIX "lib"
|
|
|
|
+ CLEAN_DIRECT_OUTPUT 1)
|
|
|
|
+ endif()
|
|
|
|
else()
|
|
|
|
set_target_properties(geos_c
|
|
|
|
PROPERTIES
|
|
|
|
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
2020-04-27 22:47:08 +08:00
|
|
|
index 3894a56..f86d823 100644
|
2017-10-04 02:37:23 +08:00
|
|
|
--- a/src/CMakeLists.txt
|
|
|
|
+++ b/src/CMakeLists.txt
|
2020-04-27 22:47:08 +08:00
|
|
|
@@ -24,7 +24,7 @@ if(GEOS_ENABLE_MACOSX_FRAMEWORK)
|
|
|
|
# also 1 binary, so include CAPI here
|
|
|
|
# and, make name all caps
|
2017-10-04 02:37:23 +08:00
|
|
|
|
|
|
|
- add_library(GEOS SHARED ${geos_SOURCES} ${geos_c_SOURCES})
|
|
|
|
+ add_library(GEOS ${geos_SOURCES} ${geos_c_SOURCES})
|
|
|
|
|
2020-04-27 22:47:08 +08:00
|
|
|
math(EXPR CVERSION "${VERSION_MAJOR} + 1")
|
|
|
|
# VERSION = current version, SOVERSION = compatibility version
|
|
|
|
@@ -62,38 +62,27 @@ if(GEOS_ENABLE_MACOSX_FRAMEWORK)
|
2017-10-04 02:37:23 +08:00
|
|
|
|
|
|
|
else()
|
|
|
|
|
|
|
|
- if(GEOS_BUILD_SHARED)
|
|
|
|
- add_library(geos SHARED ${geos_SOURCES} ${geos_ALL_HEADERS})
|
|
|
|
+ add_library(geos ${geos_SOURCES} ${geos_ALL_HEADERS})
|
|
|
|
|
|
|
|
+ if(BUILD_SHARED_LIBS)
|
|
|
|
set_target_properties(geos
|
|
|
|
PROPERTIES
|
|
|
|
DEFINE_SYMBOL GEOS_DLL_EXPORT
|
|
|
|
VERSION ${VERSION}
|
|
|
|
CLEAN_DIRECT_OUTPUT 1)
|
|
|
|
-
|
|
|
|
- install(TARGETS geos
|
|
|
|
- RUNTIME DESTINATION bin
|
|
|
|
- LIBRARY DESTINATION lib
|
|
|
|
- ARCHIVE DESTINATION lib)
|
|
|
|
- endif()
|
|
|
|
-
|
|
|
|
- if(GEOS_BUILD_STATIC)
|
2020-04-27 22:47:08 +08:00
|
|
|
- file(GLOB geos_capi_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../capi/*.h) # fix source_group issue
|
|
|
|
- add_library(geos-static STATIC ${geos_SOURCES} ${geos_c_SOURCES} ${geos_ALL_HEADERS} ${geos_capi_HEADERS})
|
2017-10-04 02:37:23 +08:00
|
|
|
-
|
|
|
|
- set_target_properties(geos-static
|
|
|
|
+ else()
|
|
|
|
+ set_target_properties(geos
|
|
|
|
PROPERTIES
|
|
|
|
OUTPUT_NAME "geos"
|
|
|
|
PREFIX "lib"
|
|
|
|
CLEAN_DIRECT_OUTPUT 1)
|
|
|
|
-
|
|
|
|
- install(TARGETS geos-static
|
|
|
|
- RUNTIME DESTINATION bin
|
|
|
|
- LIBRARY DESTINATION lib
|
|
|
|
- ARCHIVE DESTINATION lib)
|
|
|
|
-
|
|
|
|
endif()
|
|
|
|
|
|
|
|
+ install(TARGETS geos
|
|
|
|
+ RUNTIME DESTINATION bin
|
|
|
|
+ LIBRARY DESTINATION lib
|
|
|
|
+ ARCHIVE DESTINATION lib)
|
|
|
|
+
|
|
|
|
endif() # (GEOS_ENABLE_MACOSX_FRAMEWORK)
|
|
|
|
|
|
|
|
# if(APPLE)
|