[CMake] FindHDF5.cmake and the "hl" versions of hdf5 libs

Michael Jackson mike.jackson at bluequartz.net
Wed Sep 1 10:56:43 EDT 2010


I guess what would be nice is that the FindHDF5.cmake file can take  
components like "C", "C++" "HL", "Fortran" instead of hard coding them  
into the FindHDF5.cmake file.

Will, As maintainer of the hdf5 find module can you make this happen  
before the next release of CMake?
___________________________________________________________
Mike Jackson                      www.bluequartz.net

On Sep 1, 2010, at 10:54 AM, James C. Sutherland wrote:

>
>
> On Wed, Sep 1, 2010 at 8:06 AM, Michael Jackson <mike.jackson at bluequartz.net 
> > wrote:
> This probably isn't the best solution but until CMake fixes the bug  
> and includes the updated FindHDF5.cmake file in the next or future  
> release this is what you have to do:
>
> Copy the FindHDF5.cmake file from the current CMake distribution  
> that you are using and place it somewhere in your project folder,  
> say ${PROJECT_ROOT}/Resources/CMake/Modules.
>
> Then in your CMakeLists.txt file use the following line somewhere  
> BEFORE you start looking for your libraries:
>
> set (CMAKE_MODULES_DIR ${PROJECT_SOURCE_DIR}/Resources/CMake/Modules  
> ${CMAKE_MODULE_PATH})
>
> Now, edit the FindHDF5.cmake file (the one that you copied into your  
> project) to remove the offending lines/fix the bug. The above line  
> will effectively substitute your corrected version for the one that  
> ships with cmake. When CMake has a release where the bug is fixed  
> then you can remove this workaround.
>
> If your fix is general enough attach the corrected file to the bug  
> report.
>
> Cheers.
>
> ___________________________________________________________
> Mike Jackson                      www.bluequartz.net
>
>
>
> Just in case someone else tries this, there was a typo above.  Use  
> the following:
>
> set ( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/Resources/CMake/ 
> Modules ${CMAKE_MODULE_PATH} )
>
> Also, as per Mike Jackson's suggestion (off-list), the following  
> changes are necessary in FindHDF5.cmake:
> Line 178:
>  set( HDF5_C_LIBRARY_NAMES_INIT hdf5_hl hdf5 )
>
> change to
>   set( HDF5_C_LIBRARY_NAMES_INIT hdf5 )
>
> This fixed the problem for me.
>
> Many thanks to Mike for the quick fix!
>
> James



More information about the CMake mailing list