[CMake] Using CMake as a VC7 workspace generator with external makefiles

Brad King brad.king at kitware.com
Fri Jun 17 10:25:16 EDT 2005


Richard Maunder wrote:
> Hi,
> 
> A slightly unusual question... 
> 
> We have a project with it's own makefile/config script based build
> system. For all sorts of reasons this can't be converted over to CMake.
> However we have no VC7 .sln/.prj generated under Windows, and I wondered
> if CMake could be used to generate these. Ideally what I'd like to do
> is:
> 
> i) Create a top level CMakelist.txt => .sln
> 
> ii) Use ADD_SUBS for each of our module subdirectories, containing a
> simple 
> CMakelists.txt, which collects (FILE_GLOBS) the cpp/h files, and creates
> an 'empty' target => VC7 .prj.
> 
> iii) Have a top level target (on .sln only) with custom target calling
> external top level makefile.
> 
> I'm stuck on step ii) - the only way to generate .prj files seems to use
> ADD_LIBRARY/ADD_EXECUTABLE which results in normal lib/exe target.
> 
> A second problem is that if I do create projects in step ii) manually
> via VC7's NewProject -> C++ Proj -> General -> Makefile Project, then
> each of these makes a call to 'make' when a build all is done. I'd like
> just a single target/call to make regardless of what user tries to build
> in solution tree.
> 
> Does this make any sense? Is it vaguely possibly or should I look
> elsewhere for a tool to do this?

You can probably use ADD_CUSTOM_TARGET to accomplish this.  It would 
have the custom command to call make once on the external makefile.

-Brad


More information about the CMake mailing list