Skip to content

Commit

Permalink
Added validation of upperbound fmtlib version check.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Luo committed Dec 12, 2024
1 parent ae54f7b commit 3dc9eb7
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions components/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/<dist>/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/<dist>/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")
Expand All @@ -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")
Expand Down

0 comments on commit 3dc9eb7

Please sign in to comment.