[CMake] linking with .so w/ non-standard names

Kenneth Chang kchang at athenacr.com
Fri Aug 14 14:22:20 EDT 2009


Just downloaded 2.6.4, same behavior.

Do I have to mark the .so extension so it's recognized as a linkable item?

Kenny

Dominik Szczerba wrote:
> Try latest!
>
> BTW> I am doing such tricks for annoying bad-named stuff:
>
>     SET_SOURCE_FILES_PROPERTIES(
>         ${FLEXLM_OBJECTS}
>         PROPERTIES
>         EXTERNAL_OBJECT true # if it should be compiled or only linked
>         GENERATED false      # if the obj-files exist before build time
>     )
>
> - Dominik
>
> Kenneth Chang wrote:
>> kchang at fiji:~$ cmake --version
>> cmake version 2.6-patch 2
>>
>> Michael Wild wrote:
>>> What version of CMake are you using? Anything before 2.6 used to do 
>>> this, newer versions shouldn't.
>>>
>>> Michael
>>>
>>> On 14. Aug, 2009, at 18:23, Kenneth Chang wrote:
>>>
>>>> Tried this, ABCD_LIBRARY gets the correct path, but for some 
>>>> reason, target_link_libraries likes to convert it to -Lxxx -lyyy on 
>>>> the link line. (I've previously typed the name of the file directly 
>>>> into the target_link_libraries() command too)
>>>>
>>>> I'm seeing some of these properties like EXTERNAL_OBJECT, but it's 
>>>> not really working either.
>>>>
>>>> set_source_files_properties(
>>>> abcd.so
>>>> PROPERTIES
>>>> EXTERNAL_OBJECT true
>>>> GENERATED true
>>>> LOCATION /path/to/so
>>>> )
>>>>
>>>> add_executable( sfitqd
>>>> sfitqd.cc
>>>> abcd.so
>>>> )
>>>>
>>>>
>>>> Michael Wild wrote:
>>>>> Perhaps something like this:
>>>>>
>>>>> set( CMAKE_SHARED_LIBRARY_PREFIX_bak ${CMAKE_SHARED_LIBRARY_PREFIX} )
>>>>> set( CMAKE_SHARED_LIBRARY_PREFIX )
>>>>> find_library( ABCD_LIBRARY abcd )
>>>>> set( CMAKE_SHARED_LIBRARY_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX_bak} )
>>>>>
>>>>> ....
>>>>>
>>>>> target_link_libraries( a.out ${ABCD_LIBRARY} )
>>>>>
>>>>>
>>>>> HTH
>>>>>
>>>>> Michael
>>>>>
>>>>> On 14. Aug, 2009, at 0:16, Clinton Stimpson wrote:
>>>>>
>>>>>> How about this:
>>>>>> target_link_libraries(a.out /path/to/abcd.so)
>>>>>> If you use find_library(), then you should be getting full names 
>>>>>> already.
>>>>>>
>>>>>> Clint
>>>>>>
>>>>>> Kenneth Chang wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I have this third party library that has a .so named like 
>>>>>>> abcd.so instead of libabcd.so. Putting the name in
>>>>>>>
>>>>>>> target_link_libraries( a.out abcd.so )
>>>>>>>
>>>>>>> doesn't work because this generates -labcd on the link line and 
>>>>>>> then ld can't find it. What do I need to do to get this to link?
>>>>>>>
>>>>>>> Thanks!
>>>>>>> Kenny
>>>>>>> _______________________________________________
>>>>>>> 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
>>>>>> _______________________________________________
>>>>>> 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
>>
>> _______________________________________________
>> 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
>>
>
>



More information about the CMake mailing list