[CMake] Multiple executables sharing object files

James Bigler bigler at cs.utah.edu
Wed Dec 19 15:54:23 EST 2007


On Dec 19, 2007, at 1:44 PM, Joël Schaerer wrote:

> Quoting David Cole <david.cole at kitware.com>:
>
>> One other very good reason, too:
>> Same target may have two source files of the exact same name, but  
>> they exist
>> in different directories (Abc/Object.cxx and Def/Object.cxx). In  
>> that case,
>> the object files will be further hidden in subdirectories to avoid  
>> two files
>> in the "object files directory" from having a name collision.
>
> Does that really justify multiplying compilation time by 2 or more?  
> Who would want multiple files with the same name in the same  
> project anyways? Plus, you could very well create a tree structure  
> in the build directory.
>
> I must be missing something but I really don't get how compiling  
> things multiple times for nothing could seem acceptable.
>>

One thing to consider is that targets may have different compilation  
flags.  I suspect this condition could be detected and build  
multiple .o files.

Another option (gross) is to make a static library out of each object  
file.  This would probably not help, though.

James


>>
>>
>> On 12/19/07, Alexander Neundorf <a.neundorf-work at gmx.net> wrote:
>>>
>>> On Wednesday 19 December 2007, you wrote:
>>> ...
>>> > Yeah, you could even create one static library per executable...
>>> > Awesome! What was the problem with putting all the object files  
>>> in the
>>> > same directory, again? Shouldn't that be an option, at least?  
>>> It would
>>> > be SO much easier than all the dirty hacks I'm being proposed...
>>>
>>> Different targets may be compiled with different compiler flags,  
>>> defines,
>>> etc.
>>> So the object files for the same source files can differ. This is  
>>> used in
>>> some projects.
>>>
>>> Alex
>>> _______________________________________________
>>> CMake mailing list
>>> CMake at cmake.org
>>> http://www.cmake.org/mailman/listinfo/cmake
>>>
>>
>
>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list