<div dir="ltr">Hi, <div><br></div><div style>To download the common file(s) at configure time, you could follow the approach discussed here: <a href="http://cmake.3232098.n2.nabble.com/is-it-possible-to-download-CMake-modules-at-configure-time-td7583968.html#a7584113">http://cmake.3232098.n2.nabble.com/is-it-possible-to-download-CMake-modules-at-configure-time-td7583968.html#a7584113</a></div>
<div style><br></div><div style>Hth</div><div style>Jc</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, May 13, 2013 at 6:17 PM, Matthew Woehlke <span dir="ltr"><<a href="mailto:matthew.woehlke@kitware.com" target="_blank">matthew.woehlke@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 2013-05-11 17:22, Shlomi Fish wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
many of my CMake-based projects carry a common top-level "Common.cmake" file<br>
that I copy from one project to another and enhance, and since this is<br>
duplicate code/functionality I would like to consolidate it.<br>
<br>
What I want to be able to do is say something like:<br>
<br>
<CODE><br>
INCLUDE(ShlomifCommon)<br>
</CODE><br>
<br>
at the top, and then have it read from a system wide "ShlomifCommon.cmake"<br>
file that I will maintain in one central location, and install.<br>
</blockquote>
<br></div>
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.<br>
<br>
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).<br>
<br>
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.)<div class="im">
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
For a bonus point, I'd like to have a way to copy this file into<br>
every project's tarball so it won't require installation.<br>
</blockquote>
<br></div>
How do you create tarballs?<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Matthew</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/<u></u>CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/<u></u>listinfo/cmake</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>+1 919 869 8849<br>
</div>