summaryrefslogtreecommitdiff
path: root/CMake/AbseilHelpers.cmake
diff options
context:
space:
mode:
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,