aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2021-12-05 13:55:33 +1300
committerGitHub <noreply@github.com>2021-12-05 13:55:33 +1300
commit8bda42cc12a11e7348abadc8288f0372191918cc (patch)
tree63a7a072b5432c692f1aec91caf8d2c212bb2a5a
parentebe3aadd69801ea911fb7ec6e2cfaa0777167d7c (diff)
downloadPROJ-8bda42cc12a11e7348abadc8288f0372191918cc.tar.gz
PROJ-8bda42cc12a11e7348abadc8288f0372191918cc.zip
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 <even.rouault@spatialys.com>
-rw-r--r--cmake/ProjUtilities.cmake18
-rw-r--r--configure.ac11
-rw-r--r--proj.pc.in2
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}