As requested, here's a new patch with the _NAMES variables unset()-ed and documentation on the HDF5_PREFER_PARALLEL variable.
Best, Paul On Wed, Sep 9, 2015 at 7:00 PM, Brad King <[email protected]> wrote: > On 09/03/2015 05:16 AM, Paul Romano wrote: > > 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 > > Thanks. Please unset() the _NAMES variables when finished so that > they are not exposed publicly. Also please extend the module > documentation to mention HDF5_PREFER_PARALLEL. > > Thanks, > -Brad > >
From 1f322e8c90da7114758d63f6b75572be99d7f84b Mon Sep 17 00:00:00 2001 From: Paul Romano <[email protected]> Date: Sat, 12 Sep 2015 00:07:05 +0800 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 | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index a449132..fd990c4 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -29,7 +29,10 @@ # To provide the module with a hint about where to find your HDF5 # installation, you can set the environment variable HDF5_ROOT. The # Find module will then look in this path when searching for HDF5 -# executables, paths, and libraries. +# executables, paths, and libraries. In the event that both serial and +# parallel HDF5 wrappers are found, the serial version is preferentially +# selected. This behavior can be reversed by setting the variable +# HDF5_PREFER_PARALLEL to true. # # In addition to finding the includes and libraries required to compile # an HDF5 client application, this module also makes an effort to find @@ -103,28 +106,43 @@ 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." ) mark_as_advanced( HDF5_Fortran_COMPILER_EXECUTABLE ) +unset(HDF5_C_COMPILER_NAMES) +unset(HDF5_CXX_COMPILER_NAMES) +unset(HDF5_Fortran_COMPILER_NAMES) + find_program( HDF5_DIFF_EXECUTABLE NAMES h5diff HINTS ENV HDF5_ROOT @@ -378,4 +396,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
