[CMake] Overriding read-only project's CMakeLists.txt

John Drescher drescherjm at gmail.com
Tue Dec 29 11:50:16 EST 2009


> Where can I put build instructions that are build-host-wide, not
> project-wide?
>
> I'm relatively new to cmake. I want to "inject" some code before the
> project's own script, and I'd prefer not to modify the project (since then
> I'd have to maintain the patch).
>
> I want to set the CMAKE_<target>_PREFIX variables based on the version of
> Visual Studio used and whether it's a debug or release build. (I've been
> given code to do this on the VTK list, but I don't see how to use it apart
> from editing VTK's file.)
>

You can create your own CMakeLists.txt file that drives the build
process for the dependencies. This way I believe you can inject these
variables. This was discussed recently (in the last 2 to 3 weeks) on
the list.

Also I think you can pass these on the command line via a batch file
that calls cmake or cmake-gui for the user.

John


More information about the CMake mailing list