From 8bda42cc12a11e7348abadc8288f0372191918cc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 5 Dec 2021 13:55:33 +1300 Subject: Merge pull request #2970 from mwtoews/static-extra-libs (#2971) Refactor proj.pc to use EXTRA_LIBS; add -lpthread to Libs.private Co-authored-by: Even Rouault --- cmake/ProjUtilities.cmake | 18 +++++++++++------- configure.ac | 11 ++++++++++- proj.pc.in | 2 +- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/cmake/ProjUtilities.cmake b/cmake/ProjUtilities.cmake index 55d53cbb..333b01f0 100644 --- a/cmake/ProjUtilities.cmake +++ b/cmake/ProjUtilities.cmake @@ -76,21 +76,25 @@ function(configure_proj_pc) set(datadir "$\{datarootdir\}") set(PACKAGE "proj") set(VERSION ${PROJ_VERSION}) - set(SQLITE3_LIBS -lsqlite3) + # Build list for Libs.private + set(EXTRA_LIBS + -lstdc++ + -lsqlite3 + ${CMAKE_THREAD_LIBS_INIT} + ) if(TIFF_ENABLED) - set(TIFF_LIBS -ltiff) + list(APPEND EXTRA_LIBS -ltiff) endif() if(CURL_ENABLED) - set(CURL_LIBS -lcurl) + list(APPEND EXTRA_LIBS -lcurl) endif() - set(EXTRA_LIBS "-lstdc++") if(HAVE_LIBM) - list(APPEND EXTRA_LIBS "-lm") + list(APPEND EXTRA_LIBS -lm) endif() if(HAVE_LIBDL) - list(APPEND EXTRA_LIBS "-ldl") + list(APPEND EXTRA_LIBS -ldl) endif() - # Join list with a space + # Join list with a space; list(JOIN) added CMake 3.12 string(REPLACE ";" " " _tmp_str "${EXTRA_LIBS}") set(EXTRA_LIBS "${_tmp_str}") diff --git a/configure.ac b/configure.ac index d3b1aa2d..f303cd77 100644 --- a/configure.ac +++ b/configure.ac @@ -325,7 +325,16 @@ dnl --------------------------------------------------------------------------- dnl Check for extra libraries, required for static linking with pkg-config dnl --------------------------------------------------------------------------- -EXTRA_LIBS="-lstdc++" +EXTRA_LIBS="-lstdc++ -lsqlite3" +if test "no$THREAD_LIB" != "no"; then + EXTRA_LIBS="$EXTRA_LIBS $THREAD_LIB" +fi +if test "x$enable_tiff" != "xno" -o "x$enable_tiff" = ""; then + EXTRA_LIBS="$EXTRA_LIBS -ltiff" +fi +if test "$FOUND_CURL" = "yes" ; then + EXTRA_LIBS="$EXTRA_LIBS -lcurl" +fi if test "$HAVE_LIBM" != "no" ; then EXTRA_LIBS="$EXTRA_LIBS -lm" fi diff --git a/proj.pc.in b/proj.pc.in index d63a3d9d..54c5bfcc 100644 --- a/proj.pc.in +++ b/proj.pc.in @@ -10,5 +10,5 @@ Description: Coordinate transformation software library Requires: Version: @VERSION@ Libs: -L${libdir} -lproj -Libs.private: @SQLITE3_LIBS@ @TIFF_LIBS@ @CURL_LIBS@ @EXTRA_LIBS@ +Libs.private: @EXTRA_LIBS@ Cflags: -I${includedir} -- cgit v1.2.3