[CMake] preventing redundant compilations

Tyler Roscoe tyler at cryptio.net
Tue Mar 17 15:56:13 EDT 2009


On Tue, Mar 17, 2009 at 12:43:50PM -0700, Bill O'Hara wrote:
> One of the users I support complained about the following:
> 
> add_library(foo a.c b.c)
> add_library(bar a.c c.c)
> 
> because a.c will be compiled twice (the real case is more complex of course
> but essentially the same thing with more files). While its possible to pull
> a.c out into a library and link against it, this adds complexity for the end
> users who need to think about it while updating the build files.

The problem that leaps out at me is that it might be difficult for CMake
to determine if a.c is getting all the same definitions and other
compiler flags when compiled in the context of library foo as opposed to
the context of library bar.

tyler


More information about the CMake mailing list