From 76895903c1b34d41bf5590ebe3ec5de92339e9df Mon Sep 17 00:00:00 2001 From: Ingo Meyer Date: Mon, 17 Jun 2024 16:41:07 +0200 Subject: [PATCH] Fix RHEL system dependencies builds with installed libxml2 On RHEL 9 based Linux distributions, `libxml2` is found in `/lib64` by default since the `PATH` variable is inspected by CMake to find potential prefix paths (`/bin` is present in `PATH` before `/usr/bin`). This causes errors because no `/include` directory is present on Linux and this is not checked by the LibXml2 config file. Therefore, disable the inspection of the `PATH` variable by setting `NO_SYSTEM_ENVIRONMENT_PATH` option. See for more details. --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d7d80249b..ed36d99d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,7 +117,13 @@ if(GR_USE_BUNDLED_LIBRARIES) # (`ONLY_CMAKE_FIND_ROOT_PATH` option is not inherited to `find_package` calls within the LibXml2 config file) find_package(LibXml2 NO_MODULE ONLY_CMAKE_FIND_ROOT_PATH) else() - find_package(LibXml2 NO_MODULE) + # On RHEL 9 based Linux distributions, `libxml2` is found in `/lib64` by default since the `PATH` variable is + # inspected by CMake to find potential prefix paths (`/bin` is present in `PATH` before `/usr/bin`). This causes + # errors because no `/include` directory is present on Linux and this is not checked by the LibXml2 config file. + # Therefore, disable the inspection of the `PATH` variable by setting `NO_SYSTEM_ENVIRONMENT_PATH` option. + # See for more details. + find_package(LibXml2 NO_MODULE NO_SYSTEM_ENVIRONMENT_PATH) endif() # Find the following packages only in 3rdparty, if `GR_USE_BUNDLED_LIBRARIES` is set