[CMake] need two compilation to achieve success

Michael Wild themiwi at gmail.com
Wed Jun 3 11:37:38 EDT 2009


On 3. Jun, 2009, at 15:15, eial at cs.bgu.ac.il wrote:

>
> On Tue 02 Jun 7:33 2009 eial at cs.bgu.ac.il wrote:
>>
>> On Mon 01 Jun 20:56 2009 Bill Hoffman wrote:
>>> 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
>>>
>>
>> yes they are built in the same project.
>> changing you your suggestions results in two new problems:
>> 1) removing ${LIBRARY_OUTPUT_PATH} results in "/usr/lib/gcc/x86_64- 
>> pc-linux-gnu/4.3.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot  
>> find -lAgathaUtils" error, the structure of the output dir is bin  
>> for the binary and bin/libs for the libs.
>> 2) with ${LIBRARY_OUTPUT_PATH}, compilation fails due to unknown  
>> reference to all vars and functions that are part of the external  
>> libs.
>> I've encountered this before and that was the only way that I've  
>> found to solve it.
>>
>>
>>
>>
>> _______________________________________________
>> 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
>>
>
> any hints? now it doesn't compile
>

Please show us the "target_link_libraries" command you use, otherwise  
we can't help you. Just saying "it doesn't work" won't get you  
anywhere... I suspect now that you are doing this:

target_link_libraries( AgathaHud libAgathaUtils.so libAtathaEntine.so  
libAgathaThreads.so )

which would be COMPLETELY wrong (see the answer by Bill above...)

Michael


More information about the CMake mailing list