[Openmp-commits] [openmp] [libomp] Fix hwloc include for non-standard paths (PR #184087)
Michael Kruse via Openmp-commits
openmp-commits at lists.llvm.org
Mon Mar 2 06:04:00 PST 2026
================
@@ -189,6 +189,14 @@ else()
set(LIBOMP_LINKER_LANGUAGE CXX)
endif()
if(${LIBOMP_USE_HWLOC})
+ target_include_directories(obj.omp
+ PUBLIC
+ "$<BUILD_INTERFACE:${LIBOMP_HWLOC_INCLUDE_DIR}>"
+ "$<INSTALL_INTERFACE:${LIBOMP_HWLOC_INCLUDE_DIR}>"
+ )
+ # omp itself uses obj.omp and thus doesn't need to include hwloc headers
+ # itself. However, we want to propagate the include to consumers of omp (e.g.
+ # libompd).
----------------
Meinersbur wrote:
I see. It doesn't require special mentioning that something does not not needed, by rather why it is repeated.
```
if(${LIBOMP_USE_HWLOC})
# Since we are using an object, the PRIVATE and INTERFACE options are split (instead of using PUBLIC): obj.omp for compiling itself, omp for propagating the options to other libraries that depend on it, e.g. libompd.
target_include_directories(obj.omp
PRIVATE
"$<BUILD_INTERFACE:${LIBOMP_HWLOC_INCLUDE_DIR}>"
"$<INSTALL_INTERFACE:${LIBOMP_HWLOC_INCLUDE_DIR}>"
)
target_include_directories(omp
INTERFACE
"$<BUILD_INTERFACE:${LIBOMP_HWLOC_INCLUDE_DIR}>"
"$<INSTALL_INTERFACE:${LIBOMP_HWLOC_INCLUDE_DIR}>"
)
```
Consider [experimenting with](https://cmake.org/cmake/help/latest/command/target_link_libraries.html#linking-object-libraries)
```cmake
target_link_libraries(omp PUBLIC obj.omp)
```
such that a single `PUBLIC` on `obj.omp` would suffice, which gets transitively propoageted to omp's dependees.
https://github.com/llvm/llvm-project/pull/184087
More information about the Openmp-commits
mailing list