Tim- I did notice your issue about Fortran HL not working but wasn't sure
what the original problem was or if it was still relevant. Anyway, I'm glad
we got a fix in, albeit four years later -- better late than never!

Brad- here's a new patch based off of 8ea7611 that uses the new
NAMES_PER_DIR option of find_program as well adds the HDF5_PREFER_PARALLEL
variable. The only case I know of where h5cc and h5pcc would get into the
same directory is in /usr/bin, e.g. the hdf5-helpers and
libhdf5-openmpi-dev packages in debian. However, the packagers don't use
the name h5pcc but rather h5pcc.mpich and h5pcc.openmpi, so in that case
HDF5_PREFER_PARALLEL doesn't actually help. Anyway, I'm going to cogitate
on the best way to handle that and may return with one more patch to handle
this situation.

Best,
Paul

On Wed, Sep 2, 2015 at 10:38 PM, Brad King <brad.k...@kitware.com> wrote:

> On 09/02/2015 11:35 AM, Tim Gallagher wrote:
> > it looks like this work supersedes that patch.
>
> Okay, thanks for checking!
>
> -Brad
>
>
From 636a9a244c508ad840dc8f78230171307d3e6e89 Mon Sep 17 00:00:00 2001
From: Paul Romano <paul.k.rom...@gmail.com>
Date: Thu, 3 Sep 2015 15:29:51 +0700
Subject: [PATCH] FindHDF5: Add NAMES_PER_DIR and introduce
 HDF5_PREFER_PARALLEL

The calls to find_program now use NAMES_PER_DIR so that the first executable
(e.g. h5pcc) appearing on their PATH will get chosen. The HDF5_PREFER_PARALLEL
variable swaps the search order when it is set to true in the event that a
directory being search contains both h5cc and h5pcc.
---
 Modules/FindHDF5.cmake | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index a449132..ea8526d 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -103,23 +103,34 @@ else()
     endforeach()
 endif()
 
+# Determine whether to search for serial or parallel executable first
+if(HDF5_PREFER_PARALLEL)
+  set(HDF5_C_COMPILER_NAMES h5pcc h5cc)
+  set(HDF5_CXX_COMPILER_NAMES h5pc++ h5c++)
+  set(HDF5_Fortran_COMPILER_NAMES h5pfc h5fc)
+else()
+  set(HDF5_C_COMPILER_NAMES h5cc h5pcc)
+  set(HDF5_CXX_COMPILER_NAMES h5c++ h5pc++)
+  set(HDF5_Fortran_COMPILER_NAMES h5fc h5pfc)
+endif()
+
 # try to find the HDF5 wrapper compilers
 find_program( HDF5_C_COMPILER_EXECUTABLE
-    NAMES h5cc h5pcc
+    NAMES ${HDF5_C_COMPILER_NAMES} NAMES_PER_DIR
     HINTS ENV HDF5_ROOT
     PATH_SUFFIXES bin Bin
     DOC "HDF5 Wrapper compiler.  Used only to detect HDF5 compile flags." )
 mark_as_advanced( HDF5_C_COMPILER_EXECUTABLE )
 
 find_program( HDF5_CXX_COMPILER_EXECUTABLE
-    NAMES h5c++ h5pc++
+    NAMES ${HDF5_CXX_COMPILER_NAMES} NAMES_PER_DIR
     HINTS ENV HDF5_ROOT
     PATH_SUFFIXES bin Bin
     DOC "HDF5 C++ Wrapper compiler.  Used only to detect HDF5 compile flags." )
 mark_as_advanced( HDF5_CXX_COMPILER_EXECUTABLE )
 
 find_program( HDF5_Fortran_COMPILER_EXECUTABLE
-    NAMES h5fc h5pfc
+    NAMES ${HDF5_Fortran_COMPILER_NAMES} NAMES_PER_DIR
     HINTS ENV HDF5_ROOT
     PATH_SUFFIXES bin Bin
     DOC "HDF5 Fortran Wrapper compiler.  Used only to detect HDF5 compile flags." )
@@ -378,4 +389,3 @@ find_package_handle_standard_args( HDF5
     REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS
     VERSION_VAR   HDF5_VERSION
 )
-
-- 
2.1.4

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to