[CMake] Linking object file with executable

Dmytro Ovdiienko dmitriy.ovdienko at gmail.com
Wed May 20 10:09:07 EDT 2009


Ankit,

You have to explain CMake how to handle "*.obj" files.
Find emails how to add ASM support. They should help you.

Regards.

Dima



2009/5/20 ankit jain <ankitguddu at gmail.com>

>
>
> 2009/5/20 Dmytro Ovdiienko <dmitriy.ovdienko at gmail.com>
>
>> Hi Ankit.
>>
>>
>> Did you try TARGET_LINK_LIBRARIES?
>>
>> TARGET_LINK_LIBRARIES( myexe ${myobj} )
>
>
> It gives error as myfile.obj.lib not found..
> Since it is not library it is not valid to give like this...
>
> Ankit
>
>
>>
>>
>> 2009/5/19 ankit jain <ankitguddu at gmail.com>
>>
>>> Hi all,
>>>
>>> My Cmakelists contains:
>>>
>>> set(myobj  ${CMAKE_CURRENT_SOURCE_DIR}/../objfolder/myfile.obj)
>>> add_executable(myexe  main.c ${myobj})
>>>
>>> This myfile.obj object file is generated while building objfolder before
>>> creating this executable
>>>
>>> Now on building this executable i got a warning:
>>>
>>> main.obj: warning: earlier declaration of a function f1() found in
>>> myfile.obj: second definition ignored..
>>>
>>> This means it is taking the f1() function from myfile.obj but i want f1()
>>> function to be taken from main.obj..
>>>
>>> What to do?
>>>
>>> Also it is imp. to link this myfile.obj file to myexe  executable since
>>> it depends on other functions of this object file..
>>> So this object file has to be there.
>>> Just tell me how function f1() can be taken from main.c rahter than from
>>> myfile.obj evenif it still gives warning as:
>>>
>>> myfile.obj:warning: earlier definition of function f1() found in main.c
>>> (since if it takes f1() from main.c): second def. ignored
>>>
>>> Regards-
>>> Ankit Jain
>>>
>>>
>>>
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the CMake FAQ at:
>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.cmake.org/mailman/listinfo/cmake
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090520/2dfffd3f/attachment.htm>


More information about the CMake mailing list