[CMake] How to find GetPrerequisites.cmake ?

Nicolas Desprès nicolas.despres at gmail.com
Mon Nov 3 15:23:54 EST 2008


On Mon, Nov 3, 2008 at 9:11 PM, Stephen Collyer
<scollyer at netspinner.co.uk> wrote:
> Nicolas Desprès wrote:
>> On Mon, Nov 3, 2008 at 8:47 PM, Stephen Collyer
>> <scollyer at netspinner.co.uk> wrote:
>>> I'm trying to call this script at install time with
>>> something like:
>>>
>>> INSTALL(SCRIPT "${CMAKE_MODULE_PATH}/GetPrerequisites.cmake")
>>>
>>> I've tried a variety of variables in place of CMAKE_MODULE_PATH,
>>> but none of them seem to point to the right location for the
>>> default Cmake modules. Could someone tell me what I should be
>>> using in place of CMAKE_MODULE_PATH here ? I'm running with
>>> cmake 2.6.1.
>>>
>>
>> CMAKE_MODULE_PATH is probably set to your module path instead of the
>> cmake's module path. That's why the path given to install(SCRIPT)
>> point to the wrong place.
>
> I've set CMAKE_MODULE_PATH like this:
>
> SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules"
> ${CMAKE_MODULE_PATH})
>

You are prepending ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules" to the
original value of CMAKE_MODULE_PATH, right?
It looks weird to me. I think

SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules")

is what you need.

> Shouldn't that allow cmake to search on the augmented path,
> including the original default path ?
>
>> Try something like that:
>>
>> configure_file(
>>    ${CMAKE_CURRENT_SOURCE_DIR}/install-script.cmake.in
>>    ${CMAKE_CURRENT_BINARY_DIR}/install-script.cmake
>>    )
>> install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/install-script.cmake)
>>
>> where install-script.cmake.in contains:
>>
>> include(GetPrerequisites)
>
> Can you explain how that include works - how will it find
> GetPrerequisites, if my earlier attempts failed ?
>

As explain here:

http://www.cmake.org/cmake/help/cmake2.6docs.html#command:include

the include command do the file look up for you if you give the name
of a module. First searching in your custom module path and then in
the cmake's module path.

Cheers,

-- 
Nicolas Desprès


More information about the CMake mailing list