[CMake] Setting CMAKE_MODULE_PATH in CMakeLists.txt

Eric Noulard eric.noulard at gmail.com
Fri Aug 6 20:38:41 EDT 2010


2010/8/7 Jashank Jeremy <jashank.jeremy at optusnet.com.au>:
> Hi,
>
> I'm working on a project that requires an additional module, which is
> shipped with the project, but I'd like CMake to add CMAKE_SOURCE_PATH
> to CMAKE_MODULE_PATH to pick up the additional module.
>
> I've tried adding
>
> set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_PATH}:${CMAKE_MODULE_PATH}")

LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_PREFIX}")

usually works for me.


>
> to my CMakeLists.txt; this, however, doesn't work. I don't especially
> want developers to have to move the file to a directory on their
> CMAKE_MODULE_PATH, nor do I want to have to get them to set an
> environment variable every time they want to build.
>
> Is there a way around this?

appending CMAKE_MODULE_PATH works for me on several project.
Do not forget to modify CMAKE_MODULE_PATH in the CMakeLists.txt
BEFORE requiring your macro with any

include
find_package
etc...



-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list