[CMake] Reusing an already built object

Naram Qashat cyberbotx at cyberbotx.com
Mon Oct 12 18:13:04 EDT 2009


Say I have a main executable and a number of shared libraries that rely on that 
executable.  Say I have a certain C++ source that is required to be built by not 
only the main executable, but also every single shared library (the source in 
question is a Windows-specific file to handle memory allocations).  I have found 
that when using a Visual Studio generator, CMake causes the source file to be 
rebuilt for every single shared library, causing an increase in build time.  Is 
there an easy way to have the object file not be rebuilt every single time, but 
be reused for all the shared libraries?  The source file is included in the main 
executable through add_executable(), and it's added to each of the shared 
libraries through add_library().

Thanks,
Naram Qashat


More information about the CMake mailing list