[CMake] What is the proper way to 'distribute' .cmake-files?

Jean-Christophe Fillion-Robin jchris.fillionr at kitware.com
Tue May 3 09:41:56 EDT 2011


Hi Jakob,

In your project, you could add the following:

SET(CMAKE_MODULE_PATH ENV{EXTRA_CMAKE_MODULE_PATH} ${CMAKE_MODULE_PATH})

Then, you could set the environment variable EXTRA_CMAKE_MODULE_PATH to the
central location where you could copy all your common cmake modules,
function or macro ...

See
http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_MODULE_PATH
and http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:set

Hth
Jc


On Tue, May 3, 2011 at 9:32 AM, J.S. van Bethlehem <
j.s.van.bethlehem at astro.rug.nl> wrote:

> Hello,
> While trying to create a build-system using CMake for some of my libraries,
> I notice that I keep using some macros and functions over and over again. I
> thought it would be nice to put some .cmake-files in some central place on
> the system (Linux, CMake 2.8.4) The obvious place would be to put them into
> the cmake-installation tree, but I'd rather have it in a separate place,
> such that it is clear what is personal and what came with CMake.  So where
> can I put stuff, such that eg the 'include()' command would find it?
>
> I can't really find anything about this in the documentation, so I'm sorry
> if the question is too obvious maybe.... Things I thought of:
> * some other places that 'include()' looks - can't find anything about that
> (besides the module path, but that is obviously not known by 'outside'
> library-build-systems)
> * make the set of .cmake-files into a full package itself, with all the
> config-files that go with it (but then I'd probably have to do use_package()
> somehow instead of a simple 'include')
>
> Hopefully someone has some pointers.
>
> Yours sincerely,
> Jakob van Bethlehem
>
> _______________________________________________
> 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
>



-- 
+1 919 869 8849
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110503/0c5723b0/attachment-0001.htm>


More information about the CMake mailing list