[CMake] CMAKE_MODULE_PATH ignored

Micha Hergarden micha.hergarden at gmail.com
Mon Feb 8 14:22:17 EST 2016


On 08/02/16 19:35, Alain Miniussi wrote:
> 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
>
How do you set CMAKE_MODULE_PATH exactly? I used to have a modified
module in my source archive and prepend that dir to the variable:
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
${CMAKE_MODULE_PATH})

Regards,
Micha

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160208/d07815da/attachment.sig>


More information about the CMake mailing list