pineapple/externals/vcpkg/ports/geos/fix-exported-config.patch
2022-07-23 03:01:36 +02:00

76 lines
2.2 KiB
Diff
Executable file

diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index bc0e774..e3ca0bd 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -45,11 +45,18 @@ function(configure_install_geos_pc)
set(includedir "$\{prefix\}/${CMAKE_INSTALL_INCLUDEDIR}")
set(libdir "$\{exec_prefix\}/${CMAKE_INSTALL_LIBDIR}")
set(VERSION ${GEOS_VERSION})
- set(EXTRA_LIBS "-lstdc++")
+ if(APPLE OR CMAKE_ANDROID_STL_TYPE MATCHES "^c\\+\\+")
+ set(EXTRA_LIBS "-lc++")
+ elseif(UNIX OR MINGW)
+ set(EXTRA_LIBS "-lstdc++")
+ else()
+ set(EXTRA_LIBS "")
+ endif()
if(HAVE_LIBM)
list(APPEND EXTRA_LIBS "-lm")
endif()
list(JOIN EXTRA_LIBS " " EXTRA_LIBS)
+ set(EXTRA_LIBS "${EXTRA_LIBS}" PARENT_SCOPE) # for geos-config
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/geos.pc.in
@@ -61,9 +68,9 @@ function(configure_install_geos_pc)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endfunction()
+configure_install_geos_pc()
if(NOT MSVC)
configure_install_geos_config()
- configure_install_geos_pc()
endif()
option(BUILD_ASTYLE "Build astyle (Artistic Style) tool" OFF)
diff --git a/tools/geos-config.in b/tools/geos-config.in
index 6eff1eb..8827f6a 100644
--- a/tools/geos-config.in
+++ b/tools/geos-config.in
@@ -1,9 +1,11 @@
#!/bin/sh
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-includedir=@includedir@
-libdir=@libdir@
+DIRNAME=$(dirname $0)
+TOOLS=$(dirname $DIRNAME)
+prefix=$(CDPATH= cd -- "${DIRNAME%/tools/geos/*}" && pwd -P)
+exec_prefix=${prefix}
+includedir=${prefix}/include
+libdir=${prefix}${TOOLS##*/geos}/lib
usage()
{
@@ -47,16 +49,16 @@ while test $# -gt 0; do
echo -L${libdir} -lgeos-@VERSION_RELEASE@
;;
--clibs)
- echo -L${libdir} -lgeos_c
+ echo -L${libdir} -lgeos_c $(if test "@BUILD_SHARED_LIBS@" != "ON"; then echo "-lgeos @EXTRA_LIBS@"; fi)
;;
--cclibs)
- echo -L${libdir} -lgeos
+ echo -L${libdir} -lgeos $(if test "@BUILD_SHARED_LIBS@" != "ON"; then echo "@EXTRA_LIBS@"; fi)
;;
--static-clibs)
- echo -L${libdir} -lgeos_c -lgeos -lm
+ echo -L${libdir} -lgeos_c -lgeos @EXTRA_LIBS@
;;
--static-cclibs)
- echo -L${libdir} -lgeos -lm
+ echo -L${libdir} -lgeos @EXTRA_LIBS@
;;
--cflags)
echo -I${includedir}