Hi list,

Hope you're doing well. I have a question about using CMake to patch the
source code in a project I work on. This is the situation:

- Project includes C++ transpiled from a different specialized language
- That transpiler is not cross-platform, so we include transpiled C++ in
our source tree
- The generated code does not compile with MSVC 2013 because of a bug
(specifically
https://support.microsoft.com/en-us/help/315481/bug-too-many-unnested-loops-incorrectly-causes-a-c1061-compiler-error
)
- Vendor of transpiler will not patch for this case, so we need to modify
the source ourselves

We don't want to _directly_ modify the source because that means we'll have
to [remember to] do it on a regular basis, when new or updated source files
are added. The patching is simple enough that it can be done with a regex.
I am not very experienced with CMake, but I'm aware that two ways of
modifying source files are:

1. configure_file(), which doesn't seem to give tools for this purpose.
2. file(READ ...) followed by file(WRITE ...). I've gotten my regex to work
with it, but my attempt overwrites the source file in-place, unlike
configure_file() which places the modified file in the build tree.

Is there a way to do (2) correctly? By which I mean, can I do a form of
configure_file() using a regex? Or is there an altogether easier solution
that's staring me in the face?

Thank you very much in advance for your help,

Brian H
-- 

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

Reply via email to