trouble with hdf5-1.8.17 cmake

After installing hdf5-1.8.17 using a cmake build I am using

find_package(HDF5 COMPONENTS CXX C NO_MODULE REQUIRED static)

and target_link_libraries(my_target .... ${HDF5_EXPORT_LIBRARIES})
but my link fails with
/usr/bin/ld.x: cannot find -lhdf5_hl_cpp-shared}

which is clearly wrong since I didn't ask for HL in my components and I did ask for static, not shared

If I'm not supposed to use the catch all variable ${HDF5_EXPORT_LIBRARIES}, then what should I use?

If I ask for
target_link_libraries(my_target hdf5 hdf5_cpp)
it fails with cannot find -lhdf5

if I ask for (the actual target names declared as inport in the hdf5-config.cmake)
target_link_libraries(my_target hdf5-static hdf5_cpp-static)
it fails with cannot find -lhdf5-static

Cmake does not seem to be resolving the target correctly
What is the correct target name to use?

thanks

JB

···

--
John Biddiscombe, email:biddisco @.at.@ cscs.ch

CSCS, Swiss National Supercomputing Centre | Tel: +41 (91) 610.82.07
Via Trevano 131, 6900 Lugano, Switzerland | Fax: +41 (91) 610.82.82

Sorry for the noise. I have fixed this, it was being caused by a stray "}" in one of my target_link_library commands. why it affected the hdf5 libs I have no idea, but using ${HDF5_EXPORT_LIBRARIES} seems to be ok now

JB

···

From: Hdf-forum [mailto:hdf-forum-bounces@lists.hdfgroup.org] On Behalf Of Biddiscombe, John A.
Sent: 05 October 2016 15:26
To: hdf-forum@lists.hdfgroup.org
Subject: [Hdf-forum] trouble with hdf5-1.8.17 cmake

After installing hdf5-1.8.17 using a cmake build I am using

find_package(HDF5 COMPONENTS CXX C NO_MODULE REQUIRED static)

and target_link_libraries(my_target .... ${HDF5_EXPORT_LIBRARIES})
but my link fails with
/usr/bin/ld.x: cannot find -lhdf5_hl_cpp-shared}

which is clearly wrong since I didn't ask for HL in my components and I did ask for static, not shared

If I'm not supposed to use the catch all variable ${HDF5_EXPORT_LIBRARIES}, then what should I use?

If I ask for
target_link_libraries(my_target hdf5 hdf5_cpp)
it fails with cannot find -lhdf5

if I ask for (the actual target names declared as inport in the hdf5-config.cmake)
target_link_libraries(my_target hdf5-static hdf5_cpp-static)
it fails with cannot find -lhdf5-static

Cmake does not seem to be resolving the target correctly
What is the correct target name to use?

thanks

JB

--
John Biddiscombe, email:biddisco @.at.@ cscs.ch


CSCS, Swiss National Supercomputing Centre | Tel: +41 (91) 610.82.07
Via Trevano 131, 6900 Lugano, Switzerland | Fax: +41 (91) 610.82.82