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

Michael Jackson mike.jackson at bluequartz.net
Tue May 3 10:03:45 EDT 2011


I took your second approach for my own projects and have a "project" that just contains all of my custom CMake files. Using Git submodules (or the equivalent SVN/CVS) makes this relatively easy to implement. Your main project just has this "subproject" as a git submodule. This way changes/updates/enhancements you make to your central cmake files can be easily pulled in by the other projects. Just my 2 cents.
___________________________________________________________
Mike Jackson                      www.bluequartz.net
Principal Software Engineer       mike.jackson at bluequartz.net 
BlueQuartz Software               Dayton, Ohio

On May 3, 2011, at 9:41 AM, Jean-Christophe Fillion-Robin wrote:

> 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
> 
> _______________________________________________
> 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



More information about the CMake mailing list