On 26.09.07 15:13:38, Dizzy wrote: > On Wednesday 26 September 2007 14:55:52 Joachim Ziegler wrote: > > Hello, > > > > I have two targets that have nearly the same sources: > > > > ADD_EXECUTABLE(startCompletionServer StartCompletionServer.cpp > > ${BASEFILES}) ADD_EXECUTABLE(test-adler32 test-adler32.cpp ${BASEFILES}) > > > > I wonder why every object file belonging to the BASEFILES is built > > twice, once for the first target, once again for the second. This > > doubles my compile time!? > > You will notice that cmake is building files inside a build directory > different for each target. So it is ment to be that way (normally you may > have different compile flags for different targets so you want that). If you > do not want that then just put your BASEFILES in a "convenience library" and > reuse it from both targets such as:
Note that this creates a static convenience library which is not portable to some architectures without extra compiler flags (need -fPIC on amd64 and maybe other 64bit architectures). Another way is to create a shared lib (and also install that one), but don't provide headers for the library and don't give it a SOVERSION so people won't link against it. Andreas -- A gift of a flower will soon be made to you. _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake