[CMake] CMAKE_MODULE_PATH ignored

Attila Krasznahorkay attila.krasznahorkay at gmail.com
Tue Feb 9 08:12:51 EST 2016


Hi,

I myself use statements like:

list( INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/modules )

at the beginning of my main CMakeLists.txt file, and it works exactly as one would expect. I also override some CMake provided modules like this.

Cheers,
        Attila

> On 08 Feb 2016, at 20:22, Micha Hergarden <micha.hergarden at gmail.com> wrote:
> 
> 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
> 
> -- 
> 
> Powered by www.kitware.com
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
> 
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake



More information about the CMake mailing list