[CMake] Technique for generating projects that depend on generated sources

Bill Hoffman bill.hoffman at kitware.com
Thu Feb 26 21:03:52 EST 2009

Steve Huston wrote:
> I'm working on a project that involves generating a large chunk of the
> sources from separate definitions. The set of generated source files
> is not known before it is generated.
> The approach I've tried so far (and I'm very new to cmake) is to
> define a custom_command that does the source generation, then run
> cmake over again to regenerate the project files.
> I tried this out with Microsoft Visual Studio... When I tried a build
> from inside Visual Studio the command to generate the sources happened
> like I want, but when it tried to re-run cmake to regenerate the
> project with the now-known set of generated sources, an error was
> thrown because cmake couldn't update VS macros while VS is running.
> So close, yet so far... ;-)
> Is there a common pattern for how to address this type of situation?

Look at the FAQ:



More information about the CMake mailing list