Allow system/local Abseil master
Add special handling when `absl_VERSION` is empty. This is
the case when the `master` branch of `abseil-cpp` was installed using
`CMake`. In that case check for VLOG availability through the CMake
target `absl::absl_vlog_is_on`.
Fixes: https://github.com/ceres-solver/ceres-solver/issues/1098
Change-Id: I3367aeb65caceb11558d8d6265dafe3ecc9a4875
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 60f8f75..c02cb9c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -157,8 +157,12 @@
# For some reason unknown to me having the version number in the
# find_package call fails. So we check for he minimum version
# manually.
- if (absl_VERSION VERSION_LESS 20240116)
- message(FATAL_ERROR "The version of abseil installed on the system is " ${absl_VERSION} " need at least 20240116")
+ if ("${absl_VERSION}" STREQUAL "")
+ if (NOT TARGET absl::absl_vlog_is_on)
+ message(FATAL_ERROR "The version of abseil installed on the system provides no version info and is missing TARGET 'absl::absl_vlog_is_on', need at least 20240116.0")
+ endif()
+ elseif (absl_VERSION VERSION_LESS 20240116)
+ message(FATAL_ERROR "The version of abseil installed on the system is '${absl_VERSION}' need at least 20240116")
endif()
endif()