[GEOS] Generate debug library names with d suffix (#3371)

* [GEOS] Generate debug library names with `d` suffix

Currently geos.lib name is used for both, debug and optimised
GEOS libraries. This leads to situation when:
```
find_library(GEOS_LIBRARY_DEBUG NAMES geos)
find_library(GEOS_LIBRARY_RELEASE NAMES geos)
```

finds the same library for both
```
GEOS_LIBRARY_DEBUG=D:/vcpkg/installed/x64-windows/debug/lib/geos.lib
GEOS_LIBRARY_RELEASE=D:/vcpkg/installed/x64-windows/debug/lib/geos.lib
```

This is minimal patch that works around the problem.

Next, complete fix should be submitted to GEOS upstream,
preferably using exported targets.

* [libspatialite] Add missing geos suffixes in static builds
This commit is contained in:
Mateusz Loskot 2018-05-01 10:14:18 +02:00 committed by Robert Schumacher
parent c4caf29213
commit 793019b9cd
5 changed files with 12 additions and 9 deletions

View File

@ -55,7 +55,7 @@ file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/libpng16d.lib" PNG_LIBRA
# Setup geos libraries + include path
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" GEOS_INCLUDE_DIR)
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/geos_c.lib" GEOS_LIBRARY_REL)
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/geos_c.lib" GEOS_LIBRARY_DBG)
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/geos_cd.lib" GEOS_LIBRARY_DBG)
# Setup expat libraries + include path
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" EXPAT_INCLUDE_DIR)

View File

@ -1,3 +1,3 @@
Source: geos
Version: 3.6.2-2
Version: 3.6.2-3
Description: Geometry Engine Open Source

View File

@ -31,7 +31,10 @@ file(DOWNLOAD http://svn.osgeo.org/geos/branches/3.6/cmake/modules/GenerateSourc
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS -DGEOS_ENABLE_TESTS=False
PREFER_NINJA # Disable this option if project cannot be built with Ninja
OPTIONS
-DCMAKE_DEBUG_POSTFIX=d
-DGEOS_ENABLE_TESTS=False
)
vcpkg_install_cmake()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
@ -39,11 +42,11 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/geos)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/geos/COPYING ${CURRENT_PACKAGES_DIR}/share/geos/copyright)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libgeos.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libgeos.lib)
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libgeos.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libgeosd.lib)
else()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/geos.lib ${CURRENT_PACKAGES_DIR}/debug/lib/geos.lib)
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/geos_c.lib ${CURRENT_PACKAGES_DIR}/debug/lib/geos_c.lib)
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/geos.lib ${CURRENT_PACKAGES_DIR}/debug/lib/geosd.lib)
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/geos_c.lib ${CURRENT_PACKAGES_DIR}/debug/lib/geos_cd.lib)
endif()

View File

@ -24,14 +24,14 @@ if(VCPKG_CRT_LINKAGE STREQUAL dynamic)
set(CL_FLAGS_DBG "/MDd /Zi")
set(CL_FLAGS_REL "/MD /Ox")
set(GEOS_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/geos_c.lib")
set(GEOS_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/geos_c.lib")
set(GEOS_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/geos_cd.lib")
set(LIBXML2_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/libxml2.lib")
set(LIBXML2_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/libxml2.lib")
else()
set(CL_FLAGS_DBG "/MTd /Zi")
set(CL_FLAGS_REL "/MT /Ox")
set(GEOS_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/libgeos_c.lib ${CURRENT_INSTALLED_DIR}/lib/libgeos.lib")
set(GEOS_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/libgeos_c.lib ${CURRENT_INSTALLED_DIR}/debug/lib/libgeos.lib")
set(GEOS_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/libgeos_cd.lib ${CURRENT_INSTALLED_DIR}/debug/lib/libgeosd.lib")
set(LIBXML2_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/libxml2.lib ${CURRENT_INSTALLED_DIR}/lib/lzma.lib ws2_32.lib")
set(LIBXML2_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/libxml2.lib ${CURRENT_INSTALLED_DIR}/debug/lib/lzma.lib ws2_32.lib")
endif()

View File

@ -23,7 +23,7 @@ if(VCPKG_CRT_LINKAGE STREQUAL dynamic)
set(CL_FLAGS_DBG "/MDd /Zi")
set(CL_FLAGS_REL "/MD /Ox")
set(GEOS_LIBS_REL "${LDIR}/lib/geos_c.lib")
set(GEOS_LIBS_DBG "${LDIR}/debug/lib/geos_c.lib")
set(GEOS_LIBS_DBG "${LDIR}/debug/lib/geos_cd.lib")
set(LIBXML2_LIBS_REL "${LDIR}/lib/libxml2.lib")
set(LIBXML2_LIBS_DBG "${LDIR}/debug/lib/libxml2.lib")
set(SPATIALITE_LIBS_REL "${LDIR}/lib/spatialite.lib")