[CMake] Alternative to configure_file

Ryan Pavlik ryan.pavlik at gmail.com
Fri Apr 17 18:02:47 EDT 2015


Well, if the file needs to have the substitutions performed, like after an
edit, CMake will have to run. What you could do is write a standalone cmake
script that just does the configure file step, then add it as a custom
command on a custom target, just running that configure script in script
mode and passing the needed variables on the command line. Then, a change
in your python file won't trigger a full cmake configure: it will just run
the small cmake script that essentially exists to apply the variable
substitutions.

Ryan

On Fri, Apr 17, 2015, 4:00 PM Neil Carlson <neil.n.carlson at gmail.com> wrote:

> I'm working within a very large project on a python script.  The script
> gets passed through configure_file to replace some @VAR@ strings with
> some file paths that are defined when cmake is run; this generates the
> final script.  The side effect is that whenever I modify the file and run
> make, it re-runs cmake to regenerate the build system, and that cascades
> into all sorts of other things that are completely orthogonal to the script
> being rebuilt.  Is there some more appropriate alternative to
> configure_file that should be used instead?   Thanks for your expert advice!
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150417/11bc0e1f/attachment.html>


More information about the CMake mailing list