When hwloc is used and is installed outside of the default paths, the omp CMake target
needs to provide the needed include path thru the CMake target by adding it with
target_include_directories to it, so libompd gets it as well when it defines it's cmake
target using target_link_libraries.
As suggested in D122667
Please fix
https://github.com/llvm/llvm-project/blob/dd018b96d4cce044feb9edd6b5da59b718231ace/openmp/runtime/cmake/config-ix.cmake#L336
check_include_file(hwloc.h LIBOMP_HAVE_HWLOC_H)
guarantees the hwloc.h file can be found but doesn't mean ${LIBOMP_HWLOC_INSTALL_DIR}/include is a valid path.
Please add before check_include_file
find_path(LIBOMP_HWLOC_INCLUDE_DIR NAMES hwloc.h HINTS ${LIBOMP_HWLOC_INSTALL_DIR} PATH_SUFFIXES include)
to confirm a solid include path to the header file,
and then use LIBOMP_HWLOC_INCLUDE_DIR in target_include_directories here.