set(Hwloc_FIND_QUIETLY TRUE)
endif()
find_package(Hwloc 1.5)
-if(HWLOC_FOUND)
- set(GMX_HWLOC_DEFAULT ON)
+if (HWLOC_FOUND)
+ if (HWLOC_LIBRARIES MATCHES ".a$")
+ set(_STATIC_HWLOC TRUE)
+ endif()
+
+ gmx_check_if_changed(HWLOC_FOUND_CHANGED HWLOC_FOUND)
+ if (_STATIC_HWLOC AND HWLOC_FOUND_CHANGED)
+ message(STATUS "Static hwloc library found, will not attempt using it as it could lead to link-time errors. To use the detected library, manually set GMX_HWLOC=ON and you will likely have to pass appropriate linker flags too to satisfy the link-time dependencies of your hwloc library. Try "pkg-config --libs --static hwloc" for suggestions on what you will need.")
+ set(GMX_HWLOC_DEFAULT OFF)
+ else()
+ set(GMX_HWLOC_DEFAULT ON)
+ endif()
else()
set(GMX_HWLOC_DEFAULT OFF)
endif()