[cmake] Add upstream patch to find Boost MPI library (bug #756141)

Orion Poplawski orion at fedoraproject.org
Tue Feb 11 15:41:33 UTC 2014


commit 496495b0bd1cb73133dca1dfb336300008eba647
Author: Orion Poplawski <orion at nwra.com>
Date:   Tue Feb 11 08:42:10 2014 -0700

    Add upstream patch to find Boost MPI library (bug #756141)

 cmake-boostmpi.patch |   67 ++++++++++++++++++++++++++++++++++++++++++++++++++
 cmake.spec           |   10 ++++++-
 2 files changed, 76 insertions(+), 1 deletions(-)
---
diff --git a/cmake-boostmpi.patch b/cmake-boostmpi.patch
new file mode 100644
index 0000000..817d314
--- /dev/null
+++ b/cmake-boostmpi.patch
@@ -0,0 +1,67 @@
+commit a22eeca3fd7fe022e06001428d5e903913467fa0
+Author: Brad King <brad.king at kitware.com>
+Date:   Fri Feb 7 16:45:10 2014 -0500
+
+    FindBoost: Search next to MPI libraries for boost_mpi (#14739)
+    
+    Some distributions place boost_mpi next to the MPI libraries against
+    which it was built instead of next to the other Boost libraries.  If
+    find_package(MPI) has already been run prior to find_package(Boost) then
+    MPI_CXX_LIBRARIES or MPI_C_LIBRARIES may be set to the location of the
+    MPI libraries.  Teach FindBoost.cmake to look there for boost_mpi and
+    boost_mpi_python after looking next to the other Boost libraries but
+    not consider the location to be Boost_LIBRARY_DIR.
+
+diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
+index ae8baab..945694d 100644
+--- a/Modules/FindBoost.cmake
++++ b/Modules/FindBoost.cmake
+@@ -305,10 +305,15 @@ endmacro()
+ macro(_Boost_FIND_LIBRARY var)
+   find_library(${var} ${ARGN})
+ 
+-  # If we found the first library save Boost_LIBRARY_DIR.
+-  if(${var} AND NOT Boost_LIBRARY_DIR)
+-    get_filename_component(_dir "${${var}}" PATH)
+-    set(Boost_LIBRARY_DIR "${_dir}" CACHE PATH "Boost library directory" FORCE)
++  if(${var})
++    # If this is the first library found then save Boost_LIBRARY_DIR.
++    if(NOT Boost_LIBRARY_DIR)
++      get_filename_component(_dir "${${var}}" PATH)
++      set(Boost_LIBRARY_DIR "${_dir}" CACHE PATH "Boost library directory" FORCE)
++    endif()
++  elseif(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
++    # Try component-specific hints but do not save Boost_LIBRARY_DIR.
++    find_library(${var} HINTS ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT} ${ARGN})
+   endif()
+ 
+   # If Boost_LIBRARY_DIR is known then search only there.
+@@ -935,6 +940,28 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
+   set( _boost_docstring_release "Boost ${COMPONENT} library (release)")
+   set( _boost_docstring_debug   "Boost ${COMPONENT} library (debug)")
+ 
++  # Compute component-specific hints.
++  set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "")
++  if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python")
++    foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES})
++      if(IS_ABSOLUTE "${lib}")
++        get_filename_component(libdir "${lib}" PATH)
++        string(REPLACE "\\" "/" libdir "${libdir}")
++        list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT ${libdir})
++      endif()
++    endforeach()
++  endif()
++
++  # Consolidate and report component-specific hints.
++  if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
++    list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
++    if(Boost_DEBUG)
++      message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
++        "Component-specific library search paths for ${COMPONENT}: "
++        "${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT}")
++    endif()
++  endif()
++
+   #
+   # Find RELEASE libraries
+   #
diff --git a/cmake.spec b/cmake.spec
index 8165a9d..a30f542 100644
--- a/cmake.spec
+++ b/cmake.spec
@@ -13,7 +13,7 @@
 
 Name:           cmake
 Version:        2.8.12.2
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Cross-platform make system
 
 Group:          Development/Tools
@@ -56,6 +56,10 @@ Patch8:         cmake-qtdeps.patch
 # Fix FindFreetype for 2.5.1+
 # http://public.kitware.com/Bug/view.php?id=14601
 Patch9:		cmake-FindFreetype.patch
+# Upstream patch to find Boost MPI library
+# http://www.cmake.org/Bug/view.php?id=14739
+# https://bugzilla.redhat.com/show_bug.cgi?id=756141
+Patch10:        cmake-boostmpi.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -125,6 +129,7 @@ The %{name}-gui package contains the Qt based GUI for CMake.
 %patch7 -p1
 %patch8 -p1
 %patch9 -p1
+%patch10 -p1
 # Setup copyright docs for main package
 mkdir _doc
 find Source Utilities -type f -iname copy\* | while read f
@@ -236,6 +241,9 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
 
 
 %changelog
+* Tue Feb 11 2014 Orion Poplawski <orion at cora.nwra.com> - 2.8.12.2-2
+- Add upstream patch to find Boost MPI library (bug #756141)
+
 * Tue Jan 28 2014 Orion Poplawski <orion at cora.nwra.com> - 2.8.12.2-1
 - Update to 2.8.12.2
 


More information about the scm-commits mailing list