From 3dc9eb7e8724769c7d2b5605b13985ce9e6b7d62 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Thu, 12 Dec 2024 15:22:40 +0800 Subject: [PATCH] Added validation of upperbound fmtlib version check. --- components/core/CMakeLists.txt | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/components/core/CMakeLists.txt b/components/core/CMakeLists.txt index f83068731..31ca054a0 100644 --- a/components/core/CMakeLists.txt +++ b/components/core/CMakeLists.txt @@ -120,15 +120,15 @@ find_package(spdlog ${spdlog_MIN_VERSION} REQUIRED) if(spdlog_FOUND) message(STATUS "Found spdlog ${spdlog_VERSION}") else() + message("You may want to re-run `components/core/tools/scripts/lib_install//install-packages-from-source.sh`") if (CLP_USE_STATIC_LIBS) - message(FATAL_ERROR "Could not find static libraries for spdlog. You may want to re-run - `components/core/tools/scripts/lib_install//install-packages-from-source.sh`") + message(FATAL_ERROR "Could not find static libraries for spdlog.") else() message(FATAL_ERROR "Could not find libraries for spdlog.") endif() endif() -# Determine the compatible fmt w.r.t to spdlog +# Determine the lower bound version compatibility of fmt w.r.t to spdlog if(spdlog_VERSION VERSION_GREATER_EQUAL "1.15.0") set(FMT_MIN_VERSION "11.0.0") elseif(spdlog_VERSION VERSION_GREATER_EQUAL "1.12.0") @@ -146,6 +146,22 @@ endif() # - We only try to link to the static library find_package(fmt ${FMT_MIN_VERSION} REQUIRED) if(fmt_FOUND) + # Determine the upper bound version compatibility of fmt w.r.t to spdlog + if(spdlog_VERSION VERSION_GREATER_EQUAL "1.15.0") + # Empty block, no upper version limit + elseif(spdlog_VERSION VERSION_GREATER_EQUAL "1.12.0") + if (fmt_VERSION VERSION_GREATER_EQUAL "11.0.0") + message(FATAL_ERROR "Unsupported fmt version (${fmt_VERSION}). Support version: 10.0.0 <= version < 11.0.0") + endif() + elseif(spdlog_VERSION VERSION_GREATER_EQUAL "1.11.0") + if (fmt_VERSION VERSION_GREATER_EQUAL "10.0.0") + message(FATAL_ERROR "Unsupported fmt version (${fmt_VERSION}). Support version: 9.0.0 <= version < 10.0.0") + endif() + elseif(spdlog_VERSION VERSION_GREATER_EQUAL "1.9.0") + if (fmt_VERSION VERSION_GREATER_EQUAL "9.0.0") + message(FATAL_ERROR "Unsupported fmt version (${fmt_VERSION}). Support version: 8.0.0 <= version < 9.0.0") + endif() + endif() message(STATUS "Found fmt ${fmt_VERSION}") else() message(FATAL_ERROR "Could not find static libraries for fmt")