update FindGflags.cmake to work on CentOS 8.x (#1409)
Summary: Update FindGflags.cmake to work on recent CentOS and RedHat distributions. On these distributions the CMake package configuration installed by the gflags-devel RPM is slightly broken, and sets `gflags_INCLUDE_DIR` to a directory that does not exist. This happens because `/lib64` is symlinked to `/usr/lib64`, and CMake ends up searching `/lib64` before `/usr/lib64` by default when searching for packages. Therefore it finds `gflags-config.cmake` via the `/lib64` symlink. However, `gflags-config.cmake` computes the include directory relative to where its config file was found, and this relative path computation only works when using the actual `/usr/lib64` path where it was installed. When found via `/lib64` it returns a bogus `//include` path that does not exist. This updates `FindGflags.cmake` to verify if the `gflags_INCLUDE_DIR` path actually exists, and set it to a sane location instead. This also updates the code to use the `gflags-shared` target that is exported by the default gflags package configuration if it was only built as a shared library. Pull Request resolved: https://github.com/facebook/folly/pull/1409 Reviewed By: yfeldblum Differential Revision: D23588288 fbshipit-source-id: b68a717953ae0521f568d7bcfd05ca33cd6dc578
Showing
Please register or sign in to comment