summaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
authorGravatar Stan Hu <stanhu@gmail.com>2023-07-31 12:46:32 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-07-31 12:47:51 -0700
commit407f2fdd5ec6f79287919486aa5869b346093906 (patch)
tree7bb1993a2cb0af168c8cd2a4aa9ce2c4fb43a91a /CMake
parent4b6e59a96304c9a44e186295bffa8a890adb8762 (diff)
PR #1498: Fix order of link options in pkg-config files
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1498 In Windows, a few libraries (`dbghelp`, `advapi32`, and `bcrypt`) are added via link options. However, the .pc files produced for pkg-config erroneously include them before the abseil libraries. This can cause undefined references when trying to build against abseil. This commit swaps the order and adds the custom link options after the abseil dependencies. The following is a list of `.pc` files affected by this and the additional link options used: * all: `-L${libdir}` * `absl_base.pc`: `-ladvapi32` * `absl_random_internal_seed_material.pc`: `-lbcrypt` * `absl_symbolize.pc`: `-ldbghelp` Closes https://github.com/abseil/abseil-cpp/issues/1497 Merge af61f6d5d5fa7b390fc2e009652cd6da68b0fd38 into c9c0fd5185067208e1cc4227d16122571762af39 Merging this change closes #1498 COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1498 from stanhu:sh-fix-pc-link-order af61f6d5d5fa7b390fc2e009652cd6da68b0fd38 PiperOrigin-RevId: 552564626 Change-Id: I9d2a6ab99993bb4315dc94eade2cd419f1109c13
Diffstat (limited to 'CMake')
-rw-r--r--CMake/AbseilDll.cmake2
-rw-r--r--CMake/AbseilHelpers.cmake2
2 files changed, 2 insertions, 2 deletions
diff --git a/CMake/AbseilDll.cmake b/CMake/AbseilDll.cmake
index f8dea458..f0d984ae 100644
--- a/CMake/AbseilDll.cmake
+++ b/CMake/AbseilDll.cmake
@@ -788,7 +788,7 @@ Name: ${_dll}\n\
Description: Abseil DLL library\n\
URL: https://abseil.io/\n\
Version: ${absl_VERSION}\n\
-Libs: -L\${libdir} ${PC_LINKOPTS} $<$<NOT:$<BOOL:${ABSL_CC_LIB_IS_INTERFACE}>>:-l${_dll}>\n\
+Libs: -L\${libdir} $<$<NOT:$<BOOL:${ABSL_CC_LIB_IS_INTERFACE}>>:-l${_dll}> ${PC_LINKOPTS}\n\
Cflags: -I\${includedir}${PC_CFLAGS}\n")
INSTALL(FILES "${CMAKE_BINARY_DIR}/lib/pkgconfig/${_dll}.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
diff --git a/CMake/AbseilHelpers.cmake b/CMake/AbseilHelpers.cmake
index de63531b..5a6c57fd 100644
--- a/CMake/AbseilHelpers.cmake
+++ b/CMake/AbseilHelpers.cmake
@@ -211,7 +211,7 @@ Description: Abseil ${_NAME} library\n\
URL: https://abseil.io/\n\
Version: ${PC_VERSION}\n\
Requires:${PC_DEPS}\n\
-Libs: -L\${libdir} ${PC_LINKOPTS} $<$<NOT:$<BOOL:${ABSL_CC_LIB_IS_INTERFACE}>>:${LNK_LIB}>\n\
+Libs: -L\${libdir} $<$<NOT:$<BOOL:${ABSL_CC_LIB_IS_INTERFACE}>>:${LNK_LIB}> ${PC_LINKOPTS}\n\
Cflags: -I\${includedir}${PC_CFLAGS}\n")
INSTALL(FILES "${CMAKE_BINARY_DIR}/lib/pkgconfig/absl_${_NAME}.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")