[CMake] multiple project hsaring the same files.

Ken Martin ken.martin at kitware.com
Mon Sep 26 10:28:14 EDT 2005


> >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.
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?

Thanks
Ken






More information about the CMake mailing list