[CMake] Convince Cmake to use a compile rule without having a LIBRARY or EXECUTABLE target

Bill Hoffman bill.hoffman at kitware.com
Fri Apr 13 14:06:53 EDT 2007


Brandon J. Van Every wrote:
> http://www.cmake.org/Wiki/CMake_Useful_Variables has variables for 
> putting executable and library files in a common directory, but I 
> don't see anything for object files.  Do you actually need object 
> files in a common directory?  Why?
>
> Cheers,
> Brandon Van Every
>
>
> d.1234567890 wrote:
>> In our (relatively large) project, we sometimes "just" want to compile (check for syntax) a part (typically one directory) of the complete project. This very often saves a lot of time just to figure out that a small error fails the complete project to rebuild. Another option I hat tried, was to create several (library) targets that would be used to build the individual source directories but this failed because I did not find a way to convince CMake to put all objects (I've also ask on this list for help on this) in the main target build directory.
>>     
The best thing I could think of is to use a static library.  The 
overhead of creating a static library is pretty low. There is no way to 
tell cmake where to put object files, as they are in different 
directories for good reason. You don't want the objects from one target 
clobbering the object of the same name in another target.

-Bill



More information about the CMake mailing list