[CMake] relative CMAKE_MODULE_PATH

Pau Garcia i Quiles pgquiles at elpauer.org
Mon Feb 16 05:48:58 EST 2009


Hello,

This works for me with CMake CVS:

SET( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake )

On Mon, Feb 16, 2009 at 11:26 AM, Johannes Stallkamp
<johannes.stallkamp at rub.de> wrote:
> Hello list,
>
> is it possible to set a relative path as CMAKE_MODULE_PATH ? I
> actually had problems with that (CMake 2.6.3-RC 8)
> Is it because the relative path would be resolved w.r.t current build
> dir and not w.r.t. to the directory with CMakeLists.txt ?
>
> Reason:
> I want to point CMAKE_MODULE_PATH to a directory in the source tree
> which contains a file with a couple of cmake macros and some
> customized modules.
>
> These should be available in all projects. These projects may be
> located at varying depth within the tree.
> e.g. (simplified view)
>
> ROOT
> |-common components
>    |-libraryA
>    |-libraryB
>    |-CMakeMacros
> |-applicationA
>    |-subcomponentA
>    |-plugins
>        |-pluginA
>        |-pluginB
>        |-pluginC
> |-applicationB
>
>
> Initially, I just used
>
> INCLUDE( "../../CMakeMacros/localmacros.cmake")
> ( ../ varying according to project location, of course )
>
> which is fine, as long as I only want to use that single file but
> creates problems if I want to add custom/customized modules.
>
> However,
>    SET( CMAKE_MODULE_PATH "../../CMakeModules")
>    INCLUDE( localmacros )
> does not work. CMake complains that it cannot find that file.
>
> My current workaround is
>    SET( CMAKE_MODULE_PATH
> "${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeModules")
>    INCLUDE( localmacros )
>
>
> Is that necessary or is there a more elegant way I'm not aware of?
>
> Kind Regards
> Johannes
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)


More information about the CMake mailing list