[CMake] target name tweak

SK sk at metrokings.com
Sun Aug 15 20:19:03 EDT 2010


On Sun, Aug 15, 2010 at 2:19 PM, Magnus Therning <magnus at therning.org> wrote:
> On 15/08/10 22:11, SK wrote:
>> When using the D language compiler 'dmd' on windows, I'm stuck with a
>> linker that gets confused with object file names like foo.c.obj.  The
>> linker can only handle a single dot in the object file name, as in
>> foo.o
>>
>> How can I set target names to just be the base name without the source
>> extension?  I need to do this in the language support module, e.g.
>> Modules\Platform\Windows-dmd.cmake, so that users don't need to hack
>> this in their own CMakeLists.txt files.
>
> Instead of adding '.obj' to the full filename, first extract the
> filename-extension (see get_filename_component()) and then add '.o' to that.
>

Thanks Magnus, but in language support module, I don't see a way to do
this.  None of the existing modules specify how to create the output
name.  Instead they merely specify the name of the extension, e.g.
".obj".  How can I use the get_filename_component() in a generic way
that covers all targets?


More information about the CMake mailing list