On 19. Mar, 2009, at 1:09, Alexander Neundorf wrote:
On Thursday 19 March 2009, Philip Lowman wrote:
On Wed, Mar 18, 2009 at 7:05 PM, Alexander Neundorf
<[email protected]
wrote:
On Wednesday 18 March 2009, Denis Scherbakov wrote:
You could do the following:
ADD_LIBRARY(intermediate STATIC a.cpp)
ADD_LIBRARY(foo b.cpp)
TARGET_LINK_LIBRARIES(foo intermediate)
ADD_LIBRARY(bar c.cpp)
TARGET_LINK_LIBRARIES(bar intermediate)
That's not portable if bar and foo are shared libraries.
See it as a feature that cmake recognizes that these files have to
be
compiled
separately for separate targets, since separate targets may have
other
compile flags etc, so may need different object files.
In theory the Makefile generator could be adapted to share object
files
across targets provided all the compilation flags are the same.
This would
obviously take time and introduce additional complexity. It would
also be
of limited benefit since usually source files are not compiled in
more than
one library or executable.
Also, in theory you could reuse object files compiled for a shared
library
(with -fPIC) in static libraries (on certain platforms). Since
preprocessor definitions usually always change per target when
using shared
libraries due to export definitions, however, this would also be of
limited
benefit.
Basically it would be the same as the so-called "convenience"
libraries with
autotools.
I think there is a feature request for this somewhere in the bug
tracker.
Alex
If this REALLY is an issue for the OP, he definitely should have a
look at ccache. It not only avoids redundant compilations during a
single build, it also does so after a "make clean". A rather large
code which takes 4-5 hours to compile on my machine can be rebuilt
within 10 minutes using ccache.
This is far better than "convenience libraries" can do, because they
can only work for a single build.
Just my 2 cents...
Michael
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake