[CMake] Using CMake as a VC7 workspace generator with external
makefiles
Richard Maunder
Richard.Maunder at cern.ch
Fri Jun 17 11:47:22 EDT 2005
Hi Brad,
Thanks for the reply. Yes I think ADD_CUSTOM_TARGET could work for
making the makefile call.
However I am stuck with another problem - which I didn't explain well. I
have a top-level CMakelists.txt:
PROJECT (MyProj)
SUBDIRS(Mod1 Mod2 Mod3 .....)
ADD_CUSTOM_TARGET(....call to make......)
Then in each Mod1, Mod2 etc subdir a CMakelist.txt:
FILE(GLOB Hdrs inc/*.h)
FILE(GLOB Srcs src/*.cxx src/*.c)
ADD_LIBRARY(gl ${Hdrs} ${Srcs})
I'd like CMake to generate a VC7 Makefile Project - equivalent to
setting the 'Configuration Type' in the General Properties of an
exisiting VC7 Proj to 'Makefile' - for each of these modules/subdirs.
I'd like the GLOB'd sources to be hung off this, and ideally be able to
specify the various parameters for this project type (make exe path /
args etc).
I thought prehaps there might be a CMAKE_XXX var or some other way to do
this? ADD_LIBRARY / ADD_EXECUTABLE only seem to be capable of making
lib/dll/exe projects?
Thanks
Richard
>-----Original Message-----
>From: Brad King [mailto:brad.king at kitware.com]
>Sent: Friday, June 17, 2005 4:25 PM
>To: Richard Maunder
>Cc: cmake at cmake.org
>Subject: Re: [CMake] Using CMake as a VC7 workspace generator
>with external makefiles
>
>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