[CMake] Creating a common (= across several projects) CMake module/include-file/library
Jean-Christophe Fillion-Robin
jchris.fillionr at kitware.com
Mon May 13 18:27:03 EDT 2013
Hi,
To download the common file(s) at configure time, you could follow the
approach discussed here:
http://cmake.3232098.n2.nabble.com/is-it-possible-to-download-CMake-modules-at-configure-time-td7583968.html#a7584113
Hth
Jc
On Mon, May 13, 2013 at 6:17 PM, Matthew Woehlke <
matthew.woehlke at kitware.com> wrote:
> On 2013-05-11 17:22, Shlomi Fish wrote:
>
>> many of my CMake-based projects carry a common top-level "Common.cmake"
>> file
>> that I copy from one project to another and enhance, and since this is
>> duplicate code/functionality I would like to consolidate it.
>>
>> What I want to be able to do is say something like:
>>
>> <CODE>
>> INCLUDE(ShlomifCommon)
>> </CODE>
>>
>> at the top, and then have it read from a system wide "ShlomifCommon.cmake"
>> file that I will maintain in one central location, and install.
>>
>
> If you put the file in one of CMake's default module search paths, it
> should Just Work. And/or if you arrange for your software process to set
> CMAKE_MODULE_PATH to the location of the same, then again it should Just
> Work.
>
> For redistribution, I would have your project do a list(APPEND) on the
> same to where the file will exist when building from a distribution source
> package. In development, just don't have a copy in that location (or you
> could put one there to override the system copy if for some reason you need
> to do so).
>
> Another option to consider is keeping the file in an external repository
> and using your VCS's external-repo support to bring it into your other
> projects. This way the file exists in your source tree, but your VCS is
> tracking it against a central repository, rather than each project's repo
> having independent copies. (This will also probably make getting the file
> into your source packages easier.)
>
>
> For a bonus point, I'd like to have a way to copy this file into
>> every project's tarball so it won't require installation.
>>
>
> How do you create tarballs?
>
> --
> Matthew
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/**
> opensource/opensource.html<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<http://www.cmake.org/Wiki/CMake_FAQ>
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/**listinfo/cmake<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/20130513/53a33017/attachment.htm>
More information about the CMake
mailing list