bazelbuild / rules_foreign_cc

Build rules for interfacing with "foreign" (non-Bazel) build systems (CMake, configure-make, GNU Make, boost, ninja, Meson)
https://bazelbuild.github.io/rules_foreign_cc
Apache License 2.0
650 stars 232 forks source link

CMake build script always sets `CMAKE_RANLIB` to an empty string. #1189

Open ormandi opened 3 months ago

ormandi commented 3 months ago

The cmake build script always overrides the cache value CMAKE_RANLIB with an empty string.

This is, I assume, due to the following snippet:

    # However, if no CMAKE_RANLIB was passed, pass the empty value for it explicitly,
    # as it is legacy and autodetection of ranlib made by CMake automatically
    # breaks some cross compilation builds,
    # see https://github.com/envoyproxy/envoy/pull/6991
    if not params.cache.get("CMAKE_RANLIB"):
        params.cache.update({"CMAKE_RANLIB": ""})

As far as I can tell, the condition of this if-statement always evaluates to True since as params.cache is built the item corresponding to the key CMAKE_RANLIB is popped (i.e. removed) if it was present (here) and naturally evaluates to True if the mentioned key was not present at all.

I assume to fix this one need to do basically do two things: