[CMake] Building library with a collection of source + pre-existing object files (which are not compiled via the cmake build system)
Tom Kacvinsky
tom.kacvinsky at vectorcast.com
Tue Sep 9 11:31:44 EDT 2014
Thank you, Nils.
Tom
On Tue, Sep 9, 2014 at 11:25 AM, Nils Gladitz <nilsgladitz at gmail.com> wrote:
> On 09.09.2014 17:02, Tom Kacvinsky wrote:
>
>> Hi,
>>
>> I have not been able to find this in the cmake documentation. I have a
>> collection of source that needs to be compiled via the cmake build system,
>> plus a collection of object files that were compiled outside the cmake
>> build system. I want to combine the two of these to make a shared library,
>> but apparently add_library only takes a list of source files. Is there a
>> way of getting cmake to build a shared library with the collection of
>> source and object files I have? I know I could make an archive of the
>> object files and use that library in target_link_libraries, but I would
>> like to avoid this if I can.
>>
>>
> You should be able to list your object files like regular source files.
> If they have known object file extensions they should be detected as such
> (.obj, .o, .lo).
> Otherwise you can try setting the EXTERNAL_OBJECT[1] source file property
> for them.
>
> Nils
>
> [1] www.cmake.org/cmake/help/v3.0/prop_sf/EXTERNAL_OBJECT.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140909/a6e482ca/attachment.html>
More information about the CMake
mailing list