[CMake] ADD_SUBDIRECTORY() and mulitple PROJECT() definitions

Stephane Rouleau (Consultant) stephane.rouleau at autodesk.com
Mon May 21 12:33:02 EDT 2007


Hi,
 
As I feared, this did not generate much traffic.  Either we're mis-using
CMake, or we have a peculiar setup.  :)
 
In any case I went ahead and modified the vcproj generators in cmake so
they don't output multiple instances of the same projecs within a given
.sln file, and it solved our problem.  Question is now, is there any
interest for this behavior to make it into the CVS stream?  
 
Regards,
 
Stephane

  _____  

From: cmake-bounces+stephane.rouleau=autodesk.com at cmake.org
[mailto:cmake-bounces+stephane.rouleau=autodesk.com at cmake.org] On Behalf
Of Stephane Rouleau (Consultant)
Sent: May 15, 2007 7:42 PM
To: cmake at cmake.org
Subject: [CMake] ADD_SUBDIRECTORY() and mulitple PROJECT() definitions


Hi,
 
We may be using cmake in strange new ways that were not expected (or
intended), so if this is not exactly correct let me know and we'll
stretch it in another direction...  Also this may be a bit confusing,
I'm trying to simplify our setup as much as possible for the purpose of
this message.
 
CMakeLists.txt
projA\CMakeLists.txt
projB\CMakeLists.txt..
..
 
Nothing crazy so far -- what's in "root" basically will generate a
top-level project, which can be used to build "all", and depends on
projA and B.  projA depends on nothing, and projB depends on projA.

We build out of tree, and know that, within a given build tree,
everything is 'compatible' -- as such, we only want to have a single
.vcproj for every project.  Thus when we perform the ADD_SUBDIRECTORY()
on a given project, we use the same output folder, so that, in the end,
we end up with (using a Visual Studio 8 generator):
 
all.sln
all.vcproj
projA\projA.sln
projA\projA.vcproj
projB\projB.sln  (grabs ../projA.vcproj)
projB\projB.vcproj
 
and NOT
...
projB\projB.sln  (grabs ./projA.vcproj)
projB\projA.vcproj
projB\projB.vcproj
 
the problem is that all.sln ends up with two Project() entries of
"projA" -- one for itself, and one from projB.
 
Is it expected that ADD_SUBDIRECTORY() will add it in the current
PROJECT(), but also in every parent PROJECT()?  Is there a way around
this?
 
(BTW, I just tried not sharing the projA.vcproj and generating two
instances -- the resulting all.sln ends up with two copies of projA,
with the same name, but in different locations, which is still not a
valid solution.)
 
Stephane Rouleau
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070521/f48d590a/attachment.html


More information about the CMake mailing list