Commit ccbd250a authored by Szilárd Páll's avatar Szilárd Páll 🚴🏻 Committed by Mark Abraham
Browse files

Turn off hwloc support when static lib found

Hwloc dependencies are not resolved at CMake time when static
libwloc.a is detected and in most of these cases link-time
errors will prevent building GROMACS. As it is hard for a user to know
how to solve such cryptic errors and hwloc is not a required dependency,
we turn off hwloc support when a static lib is detected. The user can
override this on the cmake command line.

Refs #1919

Change-Id: Ic3917e2e59ee4c291b78ee47150e513ae77ced85
parent b7817e2d
......@@ -498,8 +498,18 @@ if(DEFINED HWLOC_LIBRARIES)
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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment