Fix absl::log_flags linking on Linux Generator expressions were introduced in CMake version 3.24. Without them including absl::log_flags as an internal dependency causes linking problems on some platforms. So for platforms with an older CMake version we make absl::log_flags a public dependency. Change-Id: I686f41e76b0ac17a03f1cd1d614372a7f130dfd9
diff --git a/internal/ceres/CMakeLists.txt b/internal/ceres/CMakeLists.txt index 921ea9e..c997a4d 100644 --- a/internal/ceres/CMakeLists.txt +++ b/internal/ceres/CMakeLists.txt
@@ -34,7 +34,17 @@ list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES Threads::Threads) # Make dependency visible to the parent CMakeLists.txt set(Threads_DEPENDENCY "find_dependency (Threads)" PARENT_SCOPE) -list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES $<LINK_LIBRARY:WHOLE_ARCHIVE,absl::log_flags>) + +# Generator expressions were introduced in CMake version 3.24. Without +# them including absl::log_flags as an internal dependency causes +# linking problems on some platforms. So for platforms with an older +# CMake version we make absl::log_flags a public dependency. +if(CMAKE_VERSION VERSION_LESS "3.24.0") + list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES absl::log_flags) +else() + list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES $<LINK_LIBRARY:WHOLE_ARCHIVE,absl::log_flags>) +endif() + list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES absl::strings) list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES absl::time)