rizsotto / Bear

Bear is a tool that generates a compilation database for clang tooling.
GNU General Public License v3.0
4.76k stars 312 forks source link

Build fails with outdated `fmt` installed on the system #453

Closed ton closed 2 years ago

ton commented 2 years ago

When building from source on a machine that has an outdated version of fmt installed, the build fails for the spdlog_dependency. I suspect the problem is that for the fmt dependency, the build environment is updated with the path to the required fmt version, but the compiler will still pick up the fmt version installed on the system somehow.

The following naïve patch fixes the issue for me; but there is probably a better way to fix this.

diff --git a/third_party/fmt/CMakeLists.txt b/third_party/fmt/CMakeLists.txt
index 9a4b60f..579a2b6 100644
--- a/third_party/fmt/CMakeLists.txt
+++ b/third_party/fmt/CMakeLists.txt
@@ -33,7 +33,7 @@ else ()

     include(GNUInstallDirs)
     list(APPEND PREFIX_PATH "${DEPENDENCIES_INSTALL_PREFIX}/fmt_dependency")
-    set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH};${PREFIX_PATH}
+    set(CMAKE_PREFIX_PATH ${PREFIX_PATH};${CMAKE_PREFIX_PATH}
             CACHE PATH "append fmt library into the search path"
             FORCE)
 endif ()
rizsotto commented 2 years ago

Thanks @ton , can you create a PR for this? (Please also include other third party dependencies which has similar lines in the CMake file.)

rizsotto commented 2 years ago

fix will be on master soon.

ton commented 2 years ago

Thanks, I just wanted to start a pull request but you already fixed it, great!