Merge branch release-2016
[alexxy/gromacs.git] / CMakeLists.txt
index f0bca63a4c9ed80bba56912bca64d840f991d2c3..c76572b9b2a8c4a6982575a67e9b53ca5691dc5d 100644 (file)
@@ -484,8 +484,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()