Commit 407f2fdd by Stan Hu Committed by Copybara-Service

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 c9c0fd51

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
parent 4b6e59a9
......@@ -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")
......
......@@ -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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment