[CMake] multiple project hsaring the same files.

Alexander Neundorf a.neundorf-work at gmx.net
Tue Sep 27 03:58:23 EDT 2005


> Von: "Ken Martin" <ken.martin at kitware.com> 
>  
> > >That's a new feature. 
> > > 
> > just out of curiosity  - why is this a feature (and not a bug)  ;-) 
> >  
> > Jan. 
>  
> This is regarding the same source file being used in multiple targets 
> producing multiple .o files. The motivation is that each target may 
> want to compile that source file with different options or compile 
> flags. So we have to support having multiple .o files from a single 
> source file. It would be nice if CMake would automatically figure out 
> if there needs to be one .o or multiple .o by examining the compile 
> flags, this could be implemented as an optimization (doesn't impact 
> CMakeList files at all).  But I think that in many cases the compile 
> lines are different even if the differences are not 
> significant. For example different include paths being specified that 
> are not used by the source file. So this optimization would probably 
> not work. 
 
Yes, this doesn't sound very reliable. 
 
> We could support a property that indicates where an object file should 
> go. The question then becomes should it be a cmake, target, or source 
> file property? What level of granularity is best? (and the answer is 
> probably to support all three with the most specific taking priority if 
> more than one is specified)  Thoughts? 
 
I'd vote for having something so that I can compile a bunch of object 
files and then have a way to include them in different targets. This 
would be functionally equivalent to the libtool convenience libs. 
I.e. either creating a static lib and then link this static lib with 
platform-specific flags to the binary/shared library (that's what libtool 
does), or just tell cmake to compile some source files, and then have the 
list of created object files available in some variable, which I can add 
to the sources of other targets. 
 
Bye 
Alex 
 

-- 
Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner


More information about the CMake mailing list