[CMake] CMAKE_MODULE_PATH ignored

Alain Miniussi alain.miniussi at oca.eu
Mon Feb 8 13:35:44 EST 2016


On 08/02/2016 18:43, Alain Miniussi wrote:
>
> Hi,
>
> I am trying to fix FindHDF5.cmake (support for HDF5_ROOT is broken, only environment variable is supported and it will be eventually probably ignored in find_program).
>
> To that end, I'd like to copy it in my source tree and use that version instead of the one in /usr/shared/cmake.
>
> According to the documentation, all I have to do is to indicate the search directory for the FindXXX.cmak files through CMAKE_MODULE_PATH.
>
>  From the cmake --trace:
>
> /../trunk/CMakeLists.txt(49):  message(status  CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH} )
> ## This is the correct PATH, containing the FindHDF5.cmake file
> status CMAKE_MODULE_PATH: /scratch/alainm/view/seiscope/codes/3D_Acoustic/FFWI/trunk/tools/build/
> ## Next line:
> /.../trunk/CMakeLists.txt(50):  find_package(HDF5 COMPONENTS CXX Fortran )
> ## Wrong path selected:
> /usr/share/cmake/Modules/FindHDF5.cmake(63):  include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake )
>
> How do I tell cmake I want *my* path to be selected ?
>
> Thanks
>

Renaming FindHDF5.cmake in FindH5.cmake (or whatever is not present in the global cmake install) helps, but then I also need to replicate all dependencies (FindPackageMessage.cmake, SelectLibraryConfigurations.cmake...), shouldn't cmake look in the /usr/shar/cmake/... for those ?

Thanks

Alain



More information about the CMake mailing list