[CMake] How to find GetPrerequisites.cmake ?

Stephen Collyer scollyer at netspinner.co.uk
Mon Nov 3 15:11:05 EST 2008


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})

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 ?

-- 
Regards

Steve Collyer
Netspinner Ltd


More information about the CMake mailing list