[CMake] need two compilation to achieve success

Bill Hoffman bill.hoffman at kitware.com
Mon Jun 1 13:56:16 EDT 2009


eial at cs.bgu.ac.il wrote:
> On Mon 01 Jun 15:28 2009 Bill Hoffman wrote:
>> eial at cs.bgu.ac.il wrote:
>>> On Mon 01 Jun 8:18 2009 Tyler Roscoe wrote:
>>> thanks for the tip, it solved the issue.
>>>
>>>
>> I am glad that worked for you but something else is wrong...  How are 
>> you linking bin/libs/libAgathaUtils.so' to `bin/AgathaHud' ?  You should 
>> have something like:
>>
>> target_link_libraries(AgathaHud AgathaUtils)
>>
>> That should add the dependency for you.   Do you have that?
>>
>> -Bill
>>
> 
> I have this:
> TARGET_LINK_LIBRARIES(AgathaHud ${LIBRARY_OUTPUT_PATH}/libAgathaUtils.so 
>                                 ${LIBRARY_OUTPUT_PATH}/libAgathaEngine.so
>                                 ${LIBRARY_OUTPUT_PATH}/libAgathaThreads.so
>                                 cv
>                                 PocoXML
>                                 PocoFoundation
>                                 AR
>                                 ARMulti
>                                 ARvideo)
> 
> 

OK, that is not correct.  For targets that CMake builds, you can just 
use the target name.  What you have now will only work on some systems 
and not work if you use OUTPUT_NAME or other properties on those 
libraries.

You want:
target_link_libraries(AgathaHud AgathaUtils AgathaEntine AgathaThreads)

That is assuming that AgathaUtils AgathaEntine AgathaThreads are all 
built in the same project by CMake.

-Bill



More information about the CMake mailing list