On 06/08/2010 10:21 PM, Torri, Stephen CIV NSWCDD, W15 wrote:
>> From: [email protected] on behalf of Yifei Li
>> Sent: Tue 6/8/2010 4:15 PM
>> To: [email protected]
>> Subject: Re: [CMake] dependency problem
>>
>> Thank you for reply.
>>
>> I already tried that. I think the problem was caused by 'find_library' in
>> my plugin's CMakeLists.txt, because it failed to find
>> MyLib
>>
>> I use a variable to hold the result of 'find_library' and that variable is
>> in turn used in target_link_libraries
>
> Assuming both "MyLib" and the plugin exist in the same project I could do this
>
> (CMakeLists.txt for MyLib)
> add_library ( MyLib SHARED ${SOURCE})
>
> (CMakeLists.txt for plugin)
> add_dependencies ( MyLib )
Illegal as it would add a dependency *of* MyLib *on* nothing.
> add_library ( plugin SHARED ${SOURCE} )
> target_link_libraries ( plugin MyLib )
>
> I don't see you needing to use find_library. That is intended to find a
> library external to the existing project. It should not be necessary to find
> a library internal to a project.
You even don't need ADD_DEPENDENCIES() in the plugins' CMakeLists.txt
files as TARGET_LINK_LIBRARIES() tracks such dependencies by itself.
Regards,
Michael
_______________________________________________
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