How to choose the FindHDF5.cmake to use ?

How to choose the FindHDF5.cmake to use ?

My understanding
(according to tutorials and comments found at the top of FindHDF5.cmake
files) is that to use HDF5, I have to add these 3 lines in the
CMakeLists.txt of my project:
FIND_PACKAGE ( HDF5 1.8.15
)
TARGET_LINK_LIBRARIES ( myDSO PUBLIC ${HDF5_LIBRARIES}
)
TARGET_INCLUDE_DIRECTORIES ( myDSO PUBLIC ${HDF5_INCLUDE_DIRS} )
My
understanding is that all FindHDF5.cmake on all plateforms must always
set HDF5_LIBRARIES and HDF5_INCLUDE_DIRS : this make things portable
(one can compile on any computer with any version of CMake and HDF5).

I
installed the last version of CMake in /tmp/local (the one I had was too
old to support HDF5-1.8.15). Note that FindHDF5.cmake is found in
/tmp/local/share/cmake-3.4/Modules (/tmp/local/share/cmake has not been
created).
/tmp/cmake-3.4.1/BUILD> cmake
-DCMAKE_INSTALL_PREFIX:PATH=/tmp/local ..; make all
install
/tmp/cmake-3.4.1/BUILD> ls /tmp/local/share/
aclocal
cmake-3.4
/tmp/cmake-3.4.1/BUILD> ls
/tmp/local/share/cmake-3.4/Modules/FindHDF5.cmake

/tmp/local/share/cmake-3.4/Modules/FindHDF5.cmake

Now, with the last
version of CMake (3.4), I can build and install the last version of HDF5
(1.8.15) in /tmp/local. Note that another FindHDF5.cmake has been
created by the HDF5 install process in /tmp/local/share/cmake.
/tmp>
export CMAKE_ROOT=/tmp/local/share/cmake-3.4
/tmp> export
CMAKE_MODULE_PATH=/tmp/local/share/cmake-3.4/Modules
/tmp> export
CMAKE_PREFIX_PATH=/tmp/local
/tmp> export
PATH=/tmp/local/bin:$PATH
/tmp> export
LD_LIBRARY_PATH=/tmp/local/lib:$LD_LIBRARY_PATH
/tmp/hdf5-1.8.15/BUILD>
cmake --version
cmake version 3.4.1
/tmp/hdf5-1.8.15/BUILD> cmake
-DCMAKE_INSTALL_PREFIX:PATH=/tmp/local ..; make all
install
/tmp/hdf5-1.8.15/BUILD> ls
/tmp/local/share/cmake/
FindHDF5.cmake hdf5-config.cmake
hdf5-config-version.cmake hdf5-targets.cmake hdf5-targets-noconfig.cmake

OK, now, I am in a situation where I can use HDF5.

First I don't set
HDF5_DIR, so I am supposed to use the FindHDF5.cmake provided by CMake
(in /tmp/local/share/cmake-3.4/Modules) : I have
DF5_hdf5_LIBRARY_RELEASE and HDF5_C_INCLUDE_DIR but NOT HDF5_LIBRARIES
and HDF5_INCLUDE_DIRS.
/tmp/useHDF5/BUILD> rm -fr *; cmake ..; cmake -LA
. | grep HDF5
...
-- Found HDF5:
/tmp/local/lib/libhdf5.a;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so
(found suitable version "1.8.15", minimum required is "1.8.15")

CMakeLists.txt (287 Bytes)

useHDF5.c (0 Bytes)

···

--
Configuring done
-- Generating done
-- Build files have been written to:
/tmp/useHDF5/BUILD
3:-- Build files have been written to:
/tmp/useHDF5/BUILD
52:HDF5_CXX_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5c++
53:HDF5_C_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5cc
54:HDF5_C_INCLUDE_DIR:PATH=/tmp/local/include
55:HDF5_DIFF_EXECUTABLE:FILEPATH=/tmp/local/bin/h5diff
56:HDF5_DIR:PATH=HDF5_DIR-NOTFOUND
57:HDF5_Fortran_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5fc
58:HDF5_IS_PARALLEL:BOOL=FALSE
59:HDF5_dl_LIBRARY_DEBUG:FILEPATH=HDF5_dl_LIBRARY_DEBUG-NOTFOUND
60:HDF5_dl_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libdl.so
61:HDF5_hdf5_LIBRARY_DEBUG:FILEPATH=HDF5_hdf5_LIBRARY_DEBUG-NOTFOUND
62:HDF5_hdf5_LIBRARY_RELEASE:FILEPATH=/tmp/local/lib/libhdf5.a
63:HDF5_m_LIBRARY_DEBUG:FILEPATH=HDF5_m_LIBRARY_DEBUG-NOTFOUND
64:HDF5_m_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libm.so
65:HDF5_pthread_LIBRARY_DEBUG:FILEPATH=HDF5_pthread_LIBRARY_DEBUG-NOTFOUND
66:HDF5_pthread_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libpthread.so
67:HDF5_z_LIBRARY_DEBUG:FILEPATH=HDF5_z_LIBRARY_DEBUG-NOTFOUND
68:HDF5_z_LIBRARY_RELEASE
:FILEPATH=/usr/lib/x86_64-linux-gnu/libz.so

Now
I use HDF5_DIR to point at the FindHDF5.cmake created by the install of
HDF5: I have HDF5_C_LIBRARY but NOT HDF5_LIBRARIES and
HDF5_INCLUDE_DIRS.
/tmp/useHDF5/BUILD> export
HDF5_DIR=/tmp/local/share/cmake
/tmp/useHDF5/BUILD> rm -fr *; cmake ..;
cmake -LA . | grep HDF5
...
-- Found HDF5: /tmp/local/lib/libhdf5.a
(found suitable version "1.8.15", minimum required is "1.8.15")
--
Configuring done
-- Generating done
-- Build files have been written to:
/tmp/useHDF5/BUILD
3:-- Build files have been written to:
/tmp/useHDF5/BUILD
52:HDF5_CXX_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5c++
53:HDF5_C_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5cc
54:HDF5_C_LIBRARY:PATH=/tmp/local/lib/libhdf5.a
55:HDF5_DIFF_EXECUTABLE:FILEPATH=/tmp/local/bin/h5diff
56:HDF5_DIR:PATH=/tmp/local/share/cmake
57:HDF5_Fortran_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5fc

Now,
according to this thread
cmake - What use is find_package() when you need to specify CMAKE_MODULE_PATH? - Stack Overflow,
I give a try to the CMake CONFIG mode.

Using the HDF5Config.cmake from
CMake, I get an (expected) error:
/tmp/useHDF5/BUILD> export
HDF5_DIR=
/tmp/useHDF5/BUILD

rm -fr *; cmake ..; cmake -LA . | grep

HDF5
...
CMake Warning at CMakeLists.txt:4 (FIND_PACKAGE):
Could not
find a package configuration file provided by "HDF5" (requested
version
1.8.15) with any of the following names:
HDF5Config.cmake

hdf5-config.cmake

Using the HDF5Config.cmake installed by
HDF5:
/tmp/useHDF5/BUILD> export
HDF5_DIR=/tmp/local/share/cmake
/tmp/useHDF5/BUILD> rm -fr *; cmake ..;
cmake -LA . | grep HDF5
...
-- Configuring done
-- Generating done
--
Build files have been written to: /tmp/useHDF5/BUILD
3:-- Build files
have been written to:
/tmp/useHDF5/BUILD
52:HDF5_DIR:PATH=/tmp/local/share/cmake

Why can't I
have HDF5_LIBRARIES and HDF5_INCLUDE_DIRS set for me by the CMake of
HDF5 ?

Thanks,

FH

Any clue or ideas on how to do ?...

FH

···

Le 2016-01-13 16:59, houssen a écrit :

How to choose the FindHDF5.cmake to use ?

My understanding (according to tutorials and comments found at the
top of FindHDF5.cmake files) is that to use HDF5, I have to add these
3 lines in the CMakeLists.txt of my project:
FIND_PACKAGE ( HDF5 1.8.15 )
TARGET_LINK_LIBRARIES ( myDSO PUBLIC ${HDF5_LIBRARIES} )
TARGET_INCLUDE_DIRECTORIES ( myDSO PUBLIC ${HDF5_INCLUDE_DIRS} )
My understanding is that all FindHDF5.cmake on all plateforms must
always set HDF5_LIBRARIES and HDF5_INCLUDE_DIRS : this make things
portable (one can compile on any computer with any version of CMake
and HDF5).

I installed the last version of CMake in /tmp/local (the one I had
was too old to support HDF5-1.8.15). Note that FindHDF5.cmake is found
in /tmp/local/share/cmake-3.4/Modules (/tmp/local/share/cmake has not
been created).
/tmp/cmake-3.4.1/BUILD> cmake -DCMAKE_INSTALL_PREFIX:PATH=/tmp/local
..; make all install
/tmp/cmake-3.4.1/BUILD> ls /tmp/local/share/
aclocal cmake-3.4
/tmp/cmake-3.4.1/BUILD> ls
/tmp/local/share/cmake-3.4/Modules/FindHDF5.cmake

Now, with the last version of CMake (3.4), I can build and install
the last version of HDF5 (1.8.15) in /tmp/local. Note that another
FindHDF5.cmake has been created by the HDF5 install process in
/tmp/local/share/cmake.
/tmp> export CMAKE_ROOT=/tmp/local/share/cmake-3.4
/tmp> export CMAKE_MODULE_PATH=/tmp/local/share/cmake-3.4/Modules
/tmp> export CMAKE_PREFIX_PATH=/tmp/local
/tmp> export PATH=/tmp/local/bin:$PATH
/tmp> export LD_LIBRARY_PATH=/tmp/local/lib:$LD_LIBRARY_PATH
/tmp/hdf5-1.8.15/BUILD> cmake --version
cmake version 3.4.1
/tmp/hdf5-1.8.15/BUILD> cmake -DCMAKE_INSTALL_PREFIX:PATH=/tmp/local
..; make all install
/tmp/hdf5-1.8.15/BUILD> ls /tmp/local/share/cmake/
FindHDF5.cmake hdf5-config.cmake hdf5-config-version.cmake
hdf5-targets.cmake hdf5-targets-noconfig.cmake

OK, now, I am in a situation where I can use HDF5.

First I don't set HDF5_DIR, so I am supposed to use the
FindHDF5.cmake provided by CMake (in
/tmp/local/share/cmake-3.4/Modules) : I have DF5_hdf5_LIBRARY_RELEASE
and HDF5_C_INCLUDE_DIR but NOT HDF5_LIBRARIES and HDF5_INCLUDE_DIRS.
/tmp/useHDF5/BUILD> rm -fr *; cmake ..; cmake -LA . | grep HDF5
...
-- Found HDF5:

/tmp/local/lib/libhdf5.a;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so
(found suitable version "1.8.15", minimum required is "1.8.15")
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/useHDF5/BUILD
3:-- Build files have been written to: /tmp/useHDF5/BUILD
52:HDF5_CXX_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5c++
53:HDF5_C_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5cc
54:HDF5_C_INCLUDE_DIR:PATH=/tmp/local/include
55:HDF5_DIFF_EXECUTABLE:FILEPATH=/tmp/local/bin/h5diff
56:HDF5_DIR:PATH=HDF5_DIR-NOTFOUND
57:HDF5_Fortran_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5fc
58:HDF5_IS_PARALLEL:BOOL=FALSE
59:HDF5_dl_LIBRARY_DEBUG:FILEPATH=HDF5_dl_LIBRARY_DEBUG-NOTFOUND

60:HDF5_dl_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libdl.so
61:HDF5_hdf5_LIBRARY_DEBUG:FILEPATH=HDF5_hdf5_LIBRARY_DEBUG-NOTFOUND
62:HDF5_hdf5_LIBRARY_RELEASE:FILEPATH=/tmp/local/lib/libhdf5.a
63:HDF5_m_LIBRARY_DEBUG:FILEPATH=HDF5_m_LIBRARY_DEBUG-NOTFOUND
64:HDF5_m_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libm.so

65:HDF5_pthread_LIBRARY_DEBUG:FILEPATH=HDF5_pthread_LIBRARY_DEBUG-NOTFOUND

66:HDF5_pthread_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libpthread.so
67:HDF5_z_LIBRARY_DEBUG:FILEPATH=HDF5_z_LIBRARY_DEBUG-NOTFOUND
68:HDF5_z_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libz.so

Now I use HDF5_DIR to point at the FindHDF5.cmake created by the
install of HDF5: I have HDF5_C_LIBRARY but NOT HDF5_LIBRARIES and
HDF5_INCLUDE_DIRS.
/tmp/useHDF5/BUILD> export HDF5_DIR=/tmp/local/share/cmake
/tmp/useHDF5/BUILD> rm -fr *; cmake ..; cmake -LA . | grep HDF5
...
-- Found HDF5: /tmp/local/lib/libhdf5.a (found suitable version
"1.8.15", minimum required is "1.8.15")
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/useHDF5/BUILD
3:-- Build files have been written to: /tmp/useHDF5/BUILD
52:HDF5_CXX_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5c++
53:HDF5_C_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5cc
54:HDF5_C_LIBRARY:PATH=/tmp/local/lib/libhdf5.a
55:HDF5_DIFF_EXECUTABLE:FILEPATH=/tmp/local/bin/h5diff
56:HDF5_DIR:PATH=/tmp/local/share/cmake
57:HDF5_Fortran_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5fc

Now, according to this thread

http://stackoverflow.com/questions/20746936/cmake-of-what-use-is-find-package-if-you-need-to-specify-cmake-module-path-an,
I give a try to the CMake CONFIG mode.

Using the HDF5Config.cmake from CMake, I get an (expected) error:
/tmp/useHDF5/BUILD> export HDF5_DIR=
/tmp/useHDF5/BUILD

rm -fr *; cmake ..; cmake -LA . | grep HDF5

...
CMake Warning at CMakeLists.txt:4 (FIND_PACKAGE):
Could not find a package configuration file provided by "HDF5"
(requested
version 1.8.15) with any of the following names:
HDF5Config.cmake
hdf5-config.cmake

Using the HDF5Config.cmake installed by HDF5:
/tmp/useHDF5/BUILD> export HDF5_DIR=/tmp/local/share/cmake
/tmp/useHDF5/BUILD> rm -fr *; cmake ..; cmake -LA . | grep HDF5
...
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/useHDF5/BUILD
3:-- Build files have been written to: /tmp/useHDF5/BUILD
52:HDF5_DIR:PATH=/tmp/local/share/cmake

Why can't I have HDF5_LIBRARIES and HDF5_INCLUDE_DIRS set for me by
the CMake of HDF5 ?

Thanks,

FH

The binary supplied FindHDF5.cmake was a temporary fix before the CMake module
was updated. It will be removed in the next release.
The CMake supplied FindHDF5.cmake module is designed to find the non-cmake
built libraries first.
find_package is preferred for the CMake built binaries.

Allen

···

On Thursday, January 14, 2016 12:26:48 PM houssen wrote:

Any clue or ideas on how to do ?...

FH

Le 2016-01-13 16:59, houssen a écrit :
> How to choose the FindHDF5.cmake to use ?
>
> My understanding (according to tutorials and comments found at the
> top of FindHDF5.cmake files) is that to use HDF5, I have to add these
> 3 lines in the CMakeLists.txt of my project:
> FIND_PACKAGE ( HDF5 1.8.15 )
> TARGET_LINK_LIBRARIES ( myDSO PUBLIC ${HDF5_LIBRARIES} )
> TARGET_INCLUDE_DIRECTORIES ( myDSO PUBLIC ${HDF5_INCLUDE_DIRS} )
> My understanding is that all FindHDF5.cmake on all plateforms must
> always set HDF5_LIBRARIES and HDF5_INCLUDE_DIRS : this make things
> portable (one can compile on any computer with any version of CMake
> and HDF5).
>
> I installed the last version of CMake in /tmp/local (the one I had
> was too old to support HDF5-1.8.15). Note that FindHDF5.cmake is
> found
> in /tmp/local/share/cmake-3.4/Modules (/tmp/local/share/cmake has not
> been created).
> /tmp/cmake-3.4.1/BUILD> cmake -DCMAKE_INSTALL_PREFIX:PATH=/tmp/local
> ..; make all install
> /tmp/cmake-3.4.1/BUILD> ls /tmp/local/share/
> aclocal cmake-3.4
> /tmp/cmake-3.4.1/BUILD> ls
> /tmp/local/share/cmake-3.4/Modules/FindHDF5.cmake
> /tmp/local/share/cmake-3.4/Modules/FindHDF5.cmake
>
> Now, with the last version of CMake (3.4), I can build and install
> the last version of HDF5 (1.8.15) in /tmp/local. Note that another
> FindHDF5.cmake has been created by the HDF5 install process in
> /tmp/local/share/cmake.
> /tmp> export CMAKE_ROOT=/tmp/local/share/cmake-3.4
> /tmp> export CMAKE_MODULE_PATH=/tmp/local/share/cmake-3.4/Modules
> /tmp> export CMAKE_PREFIX_PATH=/tmp/local
> /tmp> export PATH=/tmp/local/bin:$PATH
> /tmp> export LD_LIBRARY_PATH=/tmp/local/lib:$LD_LIBRARY_PATH
> /tmp/hdf5-1.8.15/BUILD> cmake --version
> cmake version 3.4.1
> /tmp/hdf5-1.8.15/BUILD> cmake -DCMAKE_INSTALL_PREFIX:PATH=/tmp/local
> ..; make all install
> /tmp/hdf5-1.8.15/BUILD> ls /tmp/local/share/cmake/
> FindHDF5.cmake hdf5-config.cmake hdf5-config-version.cmake
> hdf5-targets.cmake hdf5-targets-noconfig.cmake
>
> OK, now, I am in a situation where I can use HDF5.
>
> First I don't set HDF5_DIR, so I am supposed to use the
> FindHDF5.cmake provided by CMake (in
> /tmp/local/share/cmake-3.4/Modules) : I have DF5_hdf5_LIBRARY_RELEASE
> and HDF5_C_INCLUDE_DIR but NOT HDF5_LIBRARIES and HDF5_INCLUDE_DIRS.
> /tmp/useHDF5/BUILD> rm -fr *; cmake ..; cmake -LA . | grep HDF5
> ...
> -- Found HDF5:
>
> /tmp/local/lib/libhdf5.a;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/
> x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_6
> 4-linux-gnu/libm.so (found suitable version "1.8.15", minimum required is
> "1.8.15")
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /tmp/useHDF5/BUILD
> 3:-- Build files have been written to: /tmp/useHDF5/BUILD
> 52:HDF5_CXX_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5c++
> 53:HDF5_C_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5cc
> 54:HDF5_C_INCLUDE_DIR:PATH=/tmp/local/include
> 55:HDF5_DIFF_EXECUTABLE:FILEPATH=/tmp/local/bin/h5diff
> 56:HDF5_DIR:PATH=HDF5_DIR-NOTFOUND
> 57:HDF5_Fortran_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5fc
> 58:HDF5_IS_PARALLEL:BOOL=FALSE
> 59:HDF5_dl_LIBRARY_DEBUG:FILEPATH=HDF5_dl_LIBRARY_DEBUG-NOTFOUND
>
> 60:HDF5_dl_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libdl.so
> 61:HDF5_hdf5_LIBRARY_DEBUG:FILEPATH=HDF5_hdf5_LIBRARY_DEBUG-NOTFOUND
> 62:HDF5_hdf5_LIBRARY_RELEASE:FILEPATH=/tmp/local/lib/libhdf5.a
> 63:HDF5_m_LIBRARY_DEBUG:FILEPATH=HDF5_m_LIBRARY_DEBUG-NOTFOUND
> 64:HDF5_m_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libm.so
>
> 65:HDF5_pthread_LIBRARY_DEBUG:FILEPATH=HDF5_pthread_LIBRARY_DEBUG-NOTFOUND
>
> 66:HDF5_pthread_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libpthr
> ead.so 67:HDF5_z_LIBRARY_DEBUG:FILEPATH=HDF5_z_LIBRARY_DEBUG-NOTFOUND
> 68:HDF5_z_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libz.so
>
> Now I use HDF5_DIR to point at the FindHDF5.cmake created by the
> install of HDF5: I have HDF5_C_LIBRARY but NOT HDF5_LIBRARIES and
> HDF5_INCLUDE_DIRS.
> /tmp/useHDF5/BUILD> export HDF5_DIR=/tmp/local/share/cmake
> /tmp/useHDF5/BUILD> rm -fr *; cmake ..; cmake -LA . | grep HDF5
> ...
> -- Found HDF5: /tmp/local/lib/libhdf5.a (found suitable version
> "1.8.15", minimum required is "1.8.15")
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /tmp/useHDF5/BUILD
> 3:-- Build files have been written to: /tmp/useHDF5/BUILD
> 52:HDF5_CXX_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5c++
> 53:HDF5_C_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5cc
> 54:HDF5_C_LIBRARY:PATH=/tmp/local/lib/libhdf5.a
> 55:HDF5_DIFF_EXECUTABLE:FILEPATH=/tmp/local/bin/h5diff
> 56:HDF5_DIR:PATH=/tmp/local/share/cmake
> 57:HDF5_Fortran_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5fc
>
> Now, according to this thread
>
> http://stackoverflow.com/questions/20746936/cmake-of-what-use-is-find-pack
> age-if-you-need-to-specify-cmake-module-path-an, I give a try to the CMake
> CONFIG mode.
>
> Using the HDF5Config.cmake from CMake, I get an (expected) error:
> /tmp/useHDF5/BUILD> export HDF5_DIR=
> /tmp/useHDF5/BUILD
>
>>> rm -fr *; cmake ..; cmake -LA . | grep HDF5
>
> ...
>
> CMake Warning at CMakeLists.txt:4 (FIND_PACKAGE):
> Could not find a package configuration file provided by "HDF5"
>
> (requested
>
> version 1.8.15) with any of the following names:
> HDF5Config.cmake
> hdf5-config.cmake
>
> Using the HDF5Config.cmake installed by HDF5:
> /tmp/useHDF5/BUILD> export HDF5_DIR=/tmp/local/share/cmake
> /tmp/useHDF5/BUILD> rm -fr *; cmake ..; cmake -LA . | grep HDF5
> ...
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /tmp/useHDF5/BUILD
> 3:-- Build files have been written to: /tmp/useHDF5/BUILD
> 52:HDF5_DIR:PATH=/tmp/local/share/cmake
>
> Why can't I have HDF5_LIBRARIES and HDF5_INCLUDE_DIRS set for me by
> the CMake of HDF5 ?
>
> Thanks,
>
> FH

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

OK, thanks.
It seems HDF5_LIBRARIES and HDF5_INCLUDE_DIRS are actually set by the CMake's FindHDF5.cmake with the "internal" type : you can print (and use) them, but, they are invisible with cmake -LA.

Franck

···

Le 2016-01-14 17:32, Allen Byrne a écrit :

The binary supplied FindHDF5.cmake was a temporary fix before the
CMake module
was updated. It will be removed in the next release.
The CMake supplied FindHDF5.cmake module is designed to find the non-cmake
built libraries first.
find_package is preferred for the CMake built binaries.

Allen

On Thursday, January 14, 2016 12:26:48 PM houssen wrote:

Any clue or ideas on how to do ?...

FH

Le 2016-01-13 16:59, houssen a écrit :
> How to choose the FindHDF5.cmake to use ?
>
> My understanding (according to tutorials and comments found at the
> top of FindHDF5.cmake files) is that to use HDF5, I have to add these
> 3 lines in the CMakeLists.txt of my project:
> FIND_PACKAGE ( HDF5 1.8.15 )
> TARGET_LINK_LIBRARIES ( myDSO PUBLIC ${HDF5_LIBRARIES} )
> TARGET_INCLUDE_DIRECTORIES ( myDSO PUBLIC ${HDF5_INCLUDE_DIRS} )
> My understanding is that all FindHDF5.cmake on all plateforms must
> always set HDF5_LIBRARIES and HDF5_INCLUDE_DIRS : this make things
> portable (one can compile on any computer with any version of CMake
> and HDF5).
>
> I installed the last version of CMake in /tmp/local (the one I had
> was too old to support HDF5-1.8.15). Note that FindHDF5.cmake is
> found
> in /tmp/local/share/cmake-3.4/Modules (/tmp/local/share/cmake has not
> been created).
> /tmp/cmake-3.4.1/BUILD> cmake -DCMAKE_INSTALL_PREFIX:PATH=/tmp/local
> ..; make all install
> /tmp/cmake-3.4.1/BUILD> ls /tmp/local/share/
> aclocal cmake-3.4
> /tmp/cmake-3.4.1/BUILD> ls
> /tmp/local/share/cmake-3.4/Modules/FindHDF5.cmake
>
> Now, with the last version of CMake (3.4), I can build and install
> the last version of HDF5 (1.8.15) in /tmp/local. Note that another
> FindHDF5.cmake has been created by the HDF5 install process in
> /tmp/local/share/cmake.
> /tmp> export CMAKE_ROOT=/tmp/local/share/cmake-3.4
> /tmp> export CMAKE_MODULE_PATH=/tmp/local/share/cmake-3.4/Modules
> /tmp> export CMAKE_PREFIX_PATH=/tmp/local
> /tmp> export PATH=/tmp/local/bin:$PATH
> /tmp> export LD_LIBRARY_PATH=/tmp/local/lib:$LD_LIBRARY_PATH
> /tmp/hdf5-1.8.15/BUILD> cmake --version
> cmake version 3.4.1
> /tmp/hdf5-1.8.15/BUILD> cmake -DCMAKE_INSTALL_PREFIX:PATH=/tmp/local
> ..; make all install
> /tmp/hdf5-1.8.15/BUILD> ls /tmp/local/share/cmake/
> FindHDF5.cmake hdf5-config.cmake hdf5-config-version.cmake
> hdf5-targets.cmake hdf5-targets-noconfig.cmake
>
> OK, now, I am in a situation where I can use HDF5.
>
> First I don't set HDF5_DIR, so I am supposed to use the
> FindHDF5.cmake provided by CMake (in
> /tmp/local/share/cmake-3.4/Modules) : I have DF5_hdf5_LIBRARY_RELEASE
> and HDF5_C_INCLUDE_DIR but NOT HDF5_LIBRARIES and HDF5_INCLUDE_DIRS.
> /tmp/useHDF5/BUILD> rm -fr *; cmake ..; cmake -LA . | grep HDF5
> ...
> -- Found HDF5:
>
> /tmp/local/lib/libhdf5.a;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/
> x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_6
> 4-linux-gnu/libm.so (found suitable version "1.8.15", minimum required is
> "1.8.15")
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /tmp/useHDF5/BUILD
> 3:-- Build files have been written to: /tmp/useHDF5/BUILD
> 52:HDF5_CXX_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5c++
> 53:HDF5_C_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5cc
> 54:HDF5_C_INCLUDE_DIR:PATH=/tmp/local/include
> 55:HDF5_DIFF_EXECUTABLE:FILEPATH=/tmp/local/bin/h5diff
> 56:HDF5_DIR:PATH=HDF5_DIR-NOTFOUND
> 57:HDF5_Fortran_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5fc
> 58:HDF5_IS_PARALLEL:BOOL=FALSE
> 59:HDF5_dl_LIBRARY_DEBUG:FILEPATH=HDF5_dl_LIBRARY_DEBUG-NOTFOUND
>
> 60:HDF5_dl_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libdl.so
> 61:HDF5_hdf5_LIBRARY_DEBUG:FILEPATH=HDF5_hdf5_LIBRARY_DEBUG-NOTFOUND
> 62:HDF5_hdf5_LIBRARY_RELEASE:FILEPATH=/tmp/local/lib/libhdf5.a
> 63:HDF5_m_LIBRARY_DEBUG:FILEPATH=HDF5_m_LIBRARY_DEBUG-NOTFOUND
> 64:HDF5_m_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libm.so
>
> 65:HDF5_pthread_LIBRARY_DEBUG:FILEPATH=HDF5_pthread_LIBRARY_DEBUG-NOTFOUND
>
> 66:HDF5_pthread_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libpthr
> ead.so 67:HDF5_z_LIBRARY_DEBUG:FILEPATH=HDF5_z_LIBRARY_DEBUG-NOTFOUND
> 68:HDF5_z_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libz.so
>
> Now I use HDF5_DIR to point at the FindHDF5.cmake created by the
> install of HDF5: I have HDF5_C_LIBRARY but NOT HDF5_LIBRARIES and
> HDF5_INCLUDE_DIRS.
> /tmp/useHDF5/BUILD> export HDF5_DIR=/tmp/local/share/cmake
> /tmp/useHDF5/BUILD> rm -fr *; cmake ..; cmake -LA . | grep HDF5
> ...
> -- Found HDF5: /tmp/local/lib/libhdf5.a (found suitable version
> "1.8.15", minimum required is "1.8.15")
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /tmp/useHDF5/BUILD
> 3:-- Build files have been written to: /tmp/useHDF5/BUILD
> 52:HDF5_CXX_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5c++
> 53:HDF5_C_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5cc
> 54:HDF5_C_LIBRARY:PATH=/tmp/local/lib/libhdf5.a
> 55:HDF5_DIFF_EXECUTABLE:FILEPATH=/tmp/local/bin/h5diff
> 56:HDF5_DIR:PATH=/tmp/local/share/cmake
> 57:HDF5_Fortran_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5fc
>
> Now, according to this thread
>
> http://stackoverflow.com/questions/20746936/cmake-of-what-use-is-find-pack
> age-if-you-need-to-specify-cmake-module-path-an, I give a try to the CMake
> CONFIG mode.
>
> Using the HDF5Config.cmake from CMake, I get an (expected) error:
> /tmp/useHDF5/BUILD> export HDF5_DIR=
> /tmp/useHDF5/BUILD
>
>>> rm -fr *; cmake ..; cmake -LA . | grep HDF5
>
> ...
>
> CMake Warning at CMakeLists.txt:4 (FIND_PACKAGE):
> Could not find a package configuration file provided by "HDF5"
>
> (requested
>
> version 1.8.15) with any of the following names:
> HDF5Config.cmake
> hdf5-config.cmake
>
> Using the HDF5Config.cmake installed by HDF5:
> /tmp/useHDF5/BUILD> export HDF5_DIR=/tmp/local/share/cmake
> /tmp/useHDF5/BUILD> rm -fr *; cmake ..; cmake -LA . | grep HDF5
> ...
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /tmp/useHDF5/BUILD
> 3:-- Build files have been written to: /tmp/useHDF5/BUILD
> 52:HDF5_DIR:PATH=/tmp/local/share/cmake
>
> Why can't I have HDF5_LIBRARIES and HDF5_INCLUDE_DIRS set for me by
> the CMake of HDF5 ?
>
> Thanks,
>
> FH

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org

http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5