summaryrefslogtreecommitdiff
path: root/CMake/AbseilHelpers.cmake
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2020-10-21 00:01:29 -0700
committerGravatar Gennadiy Rozental <rogeeff@google.com>2020-10-22 02:21:05 -0400
commiteb317a701b83bf9a4f2a035d75747a3d76a48324 (patch)
treeb208a95534ae461724c9f170d500915a18fa6381 /CMake/AbseilHelpers.cmake
parent4b915e70929ca2d6152240facc83d3d38c5d5f28 (diff)
Export of internal Abseil changes
-- d09230db053c544c2dc7fd7d95d1ebe4302071e9 by Abseil Team <absl-team@google.com>: Move testonly_uses_linear_node_search to BtreeNodePeer PiperOrigin-RevId: 338210523 -- 7b11c945dbba7a354103c194877eba240f7f0cbc by Derek Mauro <dmauro@google.com>: Allow pinning to a GoogleTest commit to make the build reproducible Allow using a cached copy of the commit to avoid depending on GitHub PiperOrigin-RevId: 338115715 -- 8414f496c570a6398744da8324e158b39a2e3d92 by Andy Getzendanner <durandal@google.com>: Generate a pkg-config file per absl_cc_library. PiperOrigin-RevId: 337986219 GitOrigin-RevId: d09230db053c544c2dc7fd7d95d1ebe4302071e9 Change-Id: Iae398ab8ad5c0c6833abd01aa5198315f5b6fa99
Diffstat (limited to 'CMake/AbseilHelpers.cmake')
-rw-r--r--CMake/AbseilHelpers.cmake39
1 files changed, 39 insertions, 0 deletions
diff --git a/CMake/AbseilHelpers.cmake b/CMake/AbseilHelpers.cmake
index 8b2925c5..e63db3a8 100644
--- a/CMake/AbseilHelpers.cmake
+++ b/CMake/AbseilHelpers.cmake
@@ -137,6 +137,45 @@ function(absl_cc_library)
set(_build_type "static")
endif()
+ # Generate a pkg-config file for every library:
+ if(${_build_type} STREQUAL "static" OR ${_build_type} STREQUAL "shared")
+ if(NOT ABSL_CC_LIB_TESTONLY)
+ if(absl_VERSION)
+ set(PC_VERSION "${absl_VERSION}")
+ else()
+ set(PC_VERSION "head")
+ endif()
+ foreach(dep ${ABSL_CC_LIB_DEPS})
+ if(${dep} MATCHES "^absl::(.*)")
+ set(PC_DEPS "${PC_DEPS} absl_${CMAKE_MATCH_1} = ${PC_VERSION}")
+ endif()
+ endforeach()
+ foreach(cflag ${ABSL_CC_LIB_COPTS})
+ if(${cflag} MATCHES "^(-Wno|/wd)")
+ # These flags are needed to suppress warnings that might fire in our headers.
+ set(PC_CFLAGS "${PC_CFLAGS} ${cflag}")
+ elseif(${cflag} MATCHES "^(-W|/w[1234eo])")
+ # Don't impose our warnings on others.
+ else()
+ set(PC_CFLAGS "${PC_CFLAGS} ${cflag}")
+ endif()
+ endforeach()
+ FILE(GENERATE OUTPUT "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig/absl_${_NAME}.pc" CONTENT "\
+prefix=${CMAKE_INSTALL_PREFIX}\n\
+exec_prefix=\${prefix}\n\
+libdir=\${prefix}/lib\n\
+includedir=\${prefix}/include\n\
+\n\
+Name: absl_${_NAME}\n\
+Description: Abseil ${_NAME} library\n\
+URL: https://abseil.io/\n\
+Version: ${PC_VERSION}\n\
+Requires.private:${PC_DEPS}\n\
+Libs: -L\${libdir} $<JOIN:${ABSL_CC_LIB_LINKOPTS}, > $<$<NOT:$<BOOL:${ABSL_CC_LIB_IS_INTERFACE}>>:-labsl_${_NAME}>\n\
+Cflags: -I\${includedir}${PC_CFLAGS}\n")
+ endif()
+ endif()
+
if(NOT ABSL_CC_LIB_IS_INTERFACE)
if(${_build_type} STREQUAL "dll_dep")
# This target depends on the DLL. When adding dependencies to this target,