[cmake-developers] Topic hdf5-module-bug-fix
Will Dicharry
wdicharry at stellarscience.com
Wed May 25 14:59:21 EDT 2011
I fixed your issues and added a couple more fixes for problems with the
module. They have been merged with stage/next.
Thanks,
Will
Brad King wrote:
> On 05/24/2011 03:04 PM, Will Dicharry wrote:
>
>> Brad King wrote:
>>
>>> Therefore if someone finds HDF5 twice the second time may take the wrong
>>> logic path. The proper value to test after the find_package call is
>>> HDF5_FOUND to know whether or not the config file was found and loaded.
>>>
>> Won't this have the same problem? HDF5_FOUND gets set by
>> FindPackageHandleStandardArgs, so the second time find_package(HDF5)
>> gets called on a system with the autoconf HDF5 build we'll take the
>> wrong control path and call get_target_properties on targets that don't
>> exist.
>>
>
> Yes, you're right.
>
>
>> That's why I used the INCLUDE_DIR in the first place (forgetting
>> about the backwards compatibility thing at the end). Is there something
>> else I can branch on?
>>
>
> The find_package command will set HDF5_DIR to the directory containing
> the config file. However, there is a different organization we can use.
>
> The general form should be something like
>
> if(NOT HDF5_FOUND)
> find_package(HDF5 QUIET NO_MODULE)
> if(HDF5_FOUND)
> # ... map hdf5-config values to our outputs
> endif()
> endif()
>
> if(NOT HDF5_FOUND)
> # old-style search
> endif()
>
> if(HDF5_FOUND)
> # Generic logic (if any) when HDF5 is found by either method.
> # Logic should be safe to run twice or have its own guard.
> endif()
>
> By including the "NOT HDF5_FOUND" guard around each block then it does
> not matter how many times the module is included.
>
> -Brad
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5852 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20110525/b2347101/attachment-0002.bin>
More information about the cmake-developers
mailing list