Blame SOURCES/cmake-boostmpi.patch

5cd5b1
commit a22eeca3fd7fe022e06001428d5e903913467fa0
5cd5b1
Author: Brad King <brad.king@kitware.com>
5cd5b1
Date:   Fri Feb 7 16:45:10 2014 -0500
5cd5b1
5cd5b1
    FindBoost: Search next to MPI libraries for boost_mpi (#14739)
5cd5b1
    
5cd5b1
    Some distributions place boost_mpi next to the MPI libraries against
5cd5b1
    which it was built instead of next to the other Boost libraries.  If
5cd5b1
    find_package(MPI) has already been run prior to find_package(Boost) then
5cd5b1
    MPI_CXX_LIBRARIES or MPI_C_LIBRARIES may be set to the location of the
5cd5b1
    MPI libraries.  Teach FindBoost.cmake to look there for boost_mpi and
5cd5b1
    boost_mpi_python after looking next to the other Boost libraries but
5cd5b1
    not consider the location to be Boost_LIBRARY_DIR.
5cd5b1
5cd5b1
diff -Nrup a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
5cd5b1
--- a/Modules/FindBoost.cmake	2014-01-16 12:15:08.000000000 -0500
5cd5b1
+++ b/Modules/FindBoost.cmake	2016-03-02 16:10:18.252811225 -0500
5cd5b1
@@ -279,10 +279,15 @@ endmacro()
5cd5b1
 macro(_Boost_FIND_LIBRARY var)
5cd5b1
   find_library(${var} ${ARGN})
5cd5b1
 
5cd5b1
-  # If we found the first library save Boost_LIBRARY_DIR.
5cd5b1
-  if(${var} AND NOT Boost_LIBRARY_DIR)
5cd5b1
-    get_filename_component(_dir "${${var}}" PATH)
5cd5b1
-    set(Boost_LIBRARY_DIR "${_dir}" CACHE PATH "Boost library directory" FORCE)
5cd5b1
+  if(${var})
5cd5b1
+    # If this is the first library found then save Boost_LIBRARY_DIR.
5cd5b1
+    if(NOT Boost_LIBRARY_DIR)
5cd5b1
+      get_filename_component(_dir "${${var}}" PATH)
5cd5b1
+      set(Boost_LIBRARY_DIR "${_dir}" CACHE PATH "Boost library directory" FORCE)
5cd5b1
+    endif()
5cd5b1
+  elseif(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
5cd5b1
+    # Try component-specific hints but do not save Boost_LIBRARY_DIR.
5cd5b1
+    find_library(${var} HINTS ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT} ${ARGN})
5cd5b1
   endif()
5cd5b1
 
5cd5b1
   # If Boost_LIBRARY_DIR is known then search only there.
5cd5b1
@@ -906,6 +911,28 @@ foreach(COMPONENT ${Boost_FIND_COMPONENT
5cd5b1
   set( _boost_docstring_release "Boost ${COMPONENT} library (release)")
5cd5b1
   set( _boost_docstring_debug   "Boost ${COMPONENT} library (debug)")
5cd5b1
 
5cd5b1
+  # Compute component-specific hints.
5cd5b1
+  set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "")
5cd5b1
+  if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python")
5cd5b1
+    foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES})
5cd5b1
+      if(IS_ABSOLUTE "${lib}")
5cd5b1
+        get_filename_component(libdir "${lib}" PATH)
5cd5b1
+        string(REPLACE "\\" "/" libdir "${libdir}")
5cd5b1
+        list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT ${libdir})
5cd5b1
+      endif()
5cd5b1
+    endforeach()
5cd5b1
+  endif()
5cd5b1
+
5cd5b1
+  # Consolidate and report component-specific hints.
5cd5b1
+  if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
5cd5b1
+    list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
5cd5b1
+    if(Boost_DEBUG)
5cd5b1
+      message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
5cd5b1
+        "Component-specific library search paths for ${COMPONENT}: "
5cd5b1
+        "${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT}")
5cd5b1
+    endif()
5cd5b1
+  endif()
5cd5b1
+
5cd5b1
   #
5cd5b1
   # Find RELEASE libraries
5cd5b1
   #