diff options
author | Mike Kruskal <62662355+mkruskal-google@users.noreply.github.com> | 2023-05-04 07:32:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-04 10:32:38 -0400 |
commit | c2435f8342c2d0ed8101cb43adfd605fdc52dca2 (patch) | |
tree | 2a3fe1b580a19ec04ed892a96f4dfdb30a4479f6 | |
parent | b971ac5250ea8de900eae9f95e06548d14cd95fe (diff) |
CMake: Install TESTONLY libraries and their dependencies (#1442)20230125.3
This patch cherry-picks 807763a7f57dcf0ba4af7c3b218013e8f525e811
#1407
---------
Co-authored-by: Derek Mauro <dmauro@google.com>
-rw-r--r-- | CMake/AbseilHelpers.cmake | 92 | ||||
-rw-r--r-- | absl/base/config.h | 2 |
2 files changed, 45 insertions, 49 deletions
diff --git a/CMake/AbseilHelpers.cmake b/CMake/AbseilHelpers.cmake index 6d059e7e..f452a676 100644 --- a/CMake/AbseilHelpers.cmake +++ b/CMake/AbseilHelpers.cmake @@ -153,55 +153,54 @@ function(absl_cc_library) # Generate a pkg-config file for every library: if(ABSL_ENABLE_INSTALL) - if(NOT ABSL_CC_LIB_TESTONLY) - if(absl_VERSION) - set(PC_VERSION "${absl_VERSION}") - else() - set(PC_VERSION "head") - endif() - if(NOT _build_type STREQUAL "dll") - set(LNK_LIB "${LNK_LIB} -labsl_${_NAME}") - endif() - foreach(dep ${ABSL_CC_LIB_DEPS}) - if(${dep} MATCHES "^absl::(.*)") - # for DLL builds many libs are not created, but add - # the pkgconfigs nevertheless, pointing to the dll. - if(_build_type STREQUAL "dll") - # hide this MATCHES in an if-clause so it doesn't overwrite - # the CMAKE_MATCH_1 from (${dep} MATCHES "^absl::(.*)") - if(NOT PC_DEPS MATCHES "abseil_dll") - # Join deps with commas. - if(PC_DEPS) - set(PC_DEPS "${PC_DEPS},") - endif() - # don't duplicate dll-dep if it exists already - set(PC_DEPS "${PC_DEPS} abseil_dll = ${PC_VERSION}") - set(LNK_LIB "${LNK_LIB} -labseil_dll") - endif() - else() + if(absl_VERSION) + set(PC_VERSION "${absl_VERSION}") + else() + set(PC_VERSION "head") + endif() + if(NOT _build_type STREQUAL "dll") + set(LNK_LIB "${LNK_LIB} -labsl_${_NAME}") + endif() + foreach(dep ${ABSL_CC_LIB_DEPS}) + if(${dep} MATCHES "^absl::(.*)") + # for DLL builds many libs are not created, but add + # the pkgconfigs nevertheless, pointing to the dll. + if(_build_type STREQUAL "dll") + # hide this MATCHES in an if-clause so it doesn't overwrite + # the CMAKE_MATCH_1 from (${dep} MATCHES "^absl::(.*)") + if(NOT PC_DEPS MATCHES "abseil_dll") # Join deps with commas. if(PC_DEPS) set(PC_DEPS "${PC_DEPS},") endif() - set(PC_DEPS "${PC_DEPS} absl_${CMAKE_MATCH_1} = ${PC_VERSION}") + # don't duplicate dll-dep if it exists already + set(PC_DEPS "${PC_DEPS} abseil_dll = ${PC_VERSION}") + set(LNK_LIB "${LNK_LIB} -labseil_dll") endif() - 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. - elseif(${cflag} MATCHES "^-m") - # Don't impose CPU instruction requirements on others, as - # the code performs feature detection on runtime. else() - set(PC_CFLAGS "${PC_CFLAGS} ${cflag}") + # Join deps with commas. + if(PC_DEPS) + set(PC_DEPS "${PC_DEPS},") + endif() + set(PC_DEPS "${PC_DEPS} absl_${CMAKE_MATCH_1} = ${PC_VERSION}") endif() - endforeach() - string(REPLACE ";" " " PC_LINKOPTS "${ABSL_CC_LIB_LINKOPTS}") - FILE(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/lib/pkgconfig/absl_${_NAME}.pc" CONTENT "\ + 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. + elseif(${cflag} MATCHES "^-m") + # Don't impose CPU instruction requirements on others, as + # the code performs feature detection on runtime. + else() + set(PC_CFLAGS "${PC_CFLAGS} ${cflag}") + endif() + endforeach() + string(REPLACE ";" " " PC_LINKOPTS "${ABSL_CC_LIB_LINKOPTS}") + FILE(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/lib/pkgconfig/absl_${_NAME}.pc" CONTENT "\ prefix=${CMAKE_INSTALL_PREFIX}\n\ exec_prefix=\${prefix}\n\ libdir=${CMAKE_INSTALL_FULL_LIBDIR}\n\ @@ -214,9 +213,8 @@ Version: ${PC_VERSION}\n\ Requires:${PC_DEPS}\n\ Libs: -L\${libdir} ${PC_LINKOPTS} $<$<NOT:$<BOOL:${ABSL_CC_LIB_IS_INTERFACE}>>:${LNK_LIB}>\n\ Cflags: -I\${includedir}${PC_CFLAGS}\n") - INSTALL(FILES "${CMAKE_BINARY_DIR}/lib/pkgconfig/absl_${_NAME}.pc" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") - endif() + INSTALL(FILES "${CMAKE_BINARY_DIR}/lib/pkgconfig/absl_${_NAME}.pc" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") endif() if(NOT ABSL_CC_LIB_IS_INTERFACE) @@ -346,9 +344,7 @@ Cflags: -I\${includedir}${PC_CFLAGS}\n") endif() endif() - # TODO currently we don't install googletest alongside abseil sources, so - # installed abseil can't be tested. - if(NOT ABSL_CC_LIB_TESTONLY AND ABSL_ENABLE_INSTALL) + if(ABSL_ENABLE_INSTALL) install(TARGETS ${_NAME} EXPORT ${PROJECT_NAME}Targets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/absl/base/config.h b/absl/base/config.h index 0631ab60..05d960b6 100644 --- a/absl/base/config.h +++ b/absl/base/config.h @@ -112,7 +112,7 @@ // LTS releases can be obtained from // https://github.com/abseil/abseil-cpp/releases. #define ABSL_LTS_RELEASE_VERSION 20230125 -#define ABSL_LTS_RELEASE_PATCH_LEVEL 2 +#define ABSL_LTS_RELEASE_PATCH_LEVEL 3 // Helper macro to convert a CPP variable to a string literal. #define ABSL_INTERNAL_DO_TOKEN_STR(x) #x |