[CMake] Installing Find*.cmake to the correct folder using NSIS configured by cmake on windows platform

Michael Wild themiwi at gmail.com
Tue Jan 26 04:04:12 EST 2010


On 26. Jan, 2010, at 9:59 , Eric Noulard wrote:

> 2010/1/26 Michael Wild <themiwi at gmail.com>:
>> 
>> On 26. Jan, 2010, at 9:02 , Mika.Rajala at patria.fi wrote:
>> 
>>> 
>>> Hi
>>> 
>>> How can i tell the NSIS installer, using cmake, to install my Find*.cmake
>>> script to the ${CMAKE_ROOT}/Modules directory?
>>> 
>>> Writing that to the "install" command doesn't work.
>>> 
>>> I did try googling for anwsers for the better part of yesterday so if it
>>> can be found on the internet, please provide some assistance.
>>> 
>>> -mika
>> 
>> You shouldn't do that! For your own project, don't write a FindXXX.cmake, but a XXXConfig.cmake or XXX-config.cmake (as described by the documentation of find_package). Also, refer to the same documentation to find out in which directories CMake tries to find such a file.
>> 
>> In order to write such a XXXConfig.cmake file, you should also look into install(EXPORT ...).
> 
> Michael is right and I should have tell you that too,
> May be installing your FindXXX.cmake is not the good way to go at all.
> 
> see reference on XXXXConfig.cmake there
> http://www.cmake.org/pipermail/cmake/2010-January/034778.html

It is not necessarily wrong, if e.g. the XXXConfig.cmake file must find some other package to work. But then, you install that FindXXX.cmake file along with the XXXConfig.cmake and in the XXXConfig.cmake file temporarily expand the CMAKE_MODULE_PATH variable before calling find_package (or include() it directly after setting variables such as YYY_FIND_REQUIRED etc).


Michael


More information about the CMake mailing list