[cmake-developers] [PATCH v2] FindHDF5.cmake HDF5_VERSION Support
Huebl, Axel
a.huebl at hzdr.de
Mon May 11 07:32:16 EDT 2015
On 11.05.2015 10:51, Rolf Eike Beer wrote:
> Am 11.05.2015 10:29, schrieb Huebl, Axel:
>> On 08.05.2015 19:07, Huebl, Axel wrote:
>>> This commit adds VERSION support for HDF5 from
>>> the same sources as it adds the HDF5_IS_PARALLEL
>>> flag.
>>>
>>> Previously posted on
>>> https://github.com/Kitware/CMake/pull/153
>>>
>>> and improved with feedback from
>>>
>>> - Brad King
>>> - Rolf Eike Beer
>
>>> @@ -343,6 +346,16 @@ if( NOT HDF5_FOUND )
>>> if( HDF5_HAVE_PARALLEL_DEFINE )
>>> set( HDF5_IS_PARALLEL TRUE )
>>> endif()
>>> + unset(HDF5_HAVE_PARALLEL_DEFINE)
>>> +
>>> + file( STRINGS "${_dir}/H5pubconf.h"
>>> + HDF5_VERSION_DEFINE
>>> + REGEX "^[ \t]*#[ \t]*define[ \t]+H5_VERSION[ \t]+" )
>>> + if( "${HDF5_VERSION_DEFINE}" MATCHES
>>> + "H5_VERSION[ \t]+\"([0-9]+\\.[0-9]+\\.[0-9]+)\"" )
>>> + set( HDF5_VERSION "${CMAKE_MATCH_1}" )
>>> + endif()
>>> + unset(HDF5_VERSION_DEFINE)
>>> endif()
>>> endforeach()
>>> set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL
>>
>> I double checked some of the previous releases and pre-releases usually
>> take the format with appended "-something", e.g.
>> 1.8.10-patch1
>>
>> One could skip the "subrelease" but still avoid breaking the configure
>> by looking for a H5_VERSION of format
>>
>> #define "X.Y.Z
>>
>> (neglecting the last ").
>>
>>> - if( "${HDF5_VERSION_DEFINE}" MATCHES
>>> - "H5_VERSION[ \t]+\"([0-9]+\\.[0-9]+\\.[0-9]+)\"" )
>>> + if( "${HDF5_VERSION_DEFINE}" MATCHES
>>> + "H5_VERSION[ \t]+\"([0-9]+\\.[0-9]+\\.[0-9]+)" )
>>
>>
>> Any comments on that?
>
> Then I would change the regex to:
>
> "H5_VERSION[ \t]+\"([0-9]+\\.[0-9]+\\.[0-9]+[^"]*)"
>
> This would include whatever comes next into the visible string, but
> CMake should be able to deal with that just fine (please check, as you
> seem to have the versions available).
>
> Eike
Eike,
good point - let's match it's a valid C-string. I would simply use
if( "${HDF5_VERSION_DEFINE}" MATCHES
"H5_VERSION[ \t]+\"([0-9]+\\.[0-9]+\\.[0-9]+).*\"" )
to match the group correctly.
(Indeed, all my posts are tested :) )
Axel
--
Axel Huebl
Phone +49 351 260 3582
https://www.hzdr.de/crp
Computational Radiation Physics
Laser Particle Acceleration Division
Helmholtz-Zentrum Dresden - Rossendorf e.V.
Bautzner Landstrasse 400, 01328 Dresden
POB 510119, D-01314 Dresden
Vorstand: Prof. Dr.Dr.h.c. R. Sauerbrey
Prof. Dr.Dr.h.c. P. Joehnk
VR 1693 beim Amtsgericht Dresden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5099 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150511/cc68b724/attachment-0001.bin>
More information about the cmake-developers
mailing list