For a while now, CMake refuses to mix relative references (i.e. -L / -l)
with absolute paths in target_link_libraries
Now, I've come to a point where I am wondering: what is the "preferred"
option ? to do
link_directories(PATH)
target_link_libraries(TARGET LIBNAME)
or
target_link_libraries(TARGET LIB_ABSOLUTE_PATH)
?
Sylvain
-lLIBNAME vs. absolute path in CMake code
Sylvain, you'll get this twice. I was not answering to the list as well.
Sorry.
2010/8/3 Sylvain Joyeux <sylvain [dot] joyeux [..] ...>
> On 08/03/2010 12:07 PM, Adolfo Rodríguez Tsouroukdissian wrote:
>
>
>
> On Tue, Aug 3, 2010 at 11:31 AM, Sylvain Joyeux <sylvain [dot] joyeux [..] ...>wrote:
>
>> For a while now, CMake refuses to mix relative references (i.e. -L / -l)
>> with absolute paths in target_link_libraries
>>
>> Now, I've come to a point where I am wondering: what is the "preferred"
>> option ? to do
>>
>> link_directories(PATH)
>> target_link_libraries(TARGET LIBNAME)
>>
>> or
>>
>> target_link_libraries(TARGET LIB_ABSOLUTE_PATH)
>>
>
> This one. It's unambiguous. More here
> http://www.vtk.org/Wiki/CMake_2.6_Notes#Link_Line_Generation
>
> For that to work, we need the pkg-config files to list the absolute path in
> Libs: as well, right ?
>
Not a pkg-config expert here, but sounds like the way to go.
-lLIBNAME vs. absolute path in CMake code
On Tuesday 03 August 2010 13:23:50 Adolfo Rodríguez Tsouroukdissian wrote:
> Sylvain, you'll get this twice. I was not answering to the list as well.
> Sorry.
>
> 2010/8/3 Sylvain Joyeux <sylvain [dot] joyeux [..] ...>
>
> > On 08/03/2010 12:07 PM, Adolfo Rodríguez Tsouroukdissian wrote:
> >
> > On Tue, Aug 3, 2010 at 11:31 AM, Sylvain Joyeux
<sylvain [dot] joyeux [..] ...>wrote:
> >> For a while now, CMake refuses to mix relative references (i.e. -L / -l)
> >> with absolute paths in target_link_libraries
> >>
> >> Now, I've come to a point where I am wondering: what is the "preferred"
> >> option ? to do
> >>
> >> link_directories(PATH)
> >> target_link_libraries(TARGET LIBNAME)
> >>
> >> or
> >>
> >> target_link_libraries(TARGET LIB_ABSOLUTE_PATH)
> >
> > This one. It's unambiguous. More here
> > http://www.vtk.org/Wiki/CMake_2.6_Notes#Link_Line_Generation
I agree fully here.
> >
> > For that to work, we need the pkg-config files to list the absolute path
> > in Libs: as well, right ?
>
> Not a pkg-config expert here, but sounds like the way to go.
cmake manuals say that you may only use pkg-config to HINT in find_library and
find_file, but never to use the -L/-l flags directly. I don't think listing
absolute paths in .pc files will help because the tool will convert them (?).
I'm aiming for creating a .cmake file for orocos-rtt such that dependees don't
need the .pc file if they are using cmake.
Peter
-lLIBNAME vs. absolute path in CMake code
On Aug 3, 2010, at 08:53 , Peter Soetens wrote:
> On Tuesday 03 August 2010 13:23:50 Adolfo Rodríguez Tsouroukdissian wrote:
>> Sylvain, you'll get this twice. I was not answering to the list as well.
>> Sorry.
>>
>> 2010/8/3 Sylvain Joyeux <sylvain [dot] joyeux [..] ...>
>>
>>> On 08/03/2010 12:07 PM, Adolfo Rodríguez Tsouroukdissian wrote:
>>>
>>> On Tue, Aug 3, 2010 at 11:31 AM, Sylvain Joyeux
> <sylvain [dot] joyeux [..] ...>wrote:
>>>> For a while now, CMake refuses to mix relative references (i.e. -L / -l)
>>>> with absolute paths in target_link_libraries
>>>>
>>>> Now, I've come to a point where I am wondering: what is the "preferred"
>>>> option ? to do
>>>>
>>>> link_directories(PATH)
>>>> target_link_libraries(TARGET LIBNAME)
>>>>
>>>> or
>>>>
>>>> target_link_libraries(TARGET LIB_ABSOLUTE_PATH)
>>>
>>> This one. It's unambiguous. More here
>>> http://www.vtk.org/Wiki/CMake_2.6_Notes#Link_Line_Generation
>
> I agree fully here.
+1
>>> For that to work, we need the pkg-config files to list the absolute path
>>> in Libs: as well, right ?
>>
>> Not a pkg-config expert here, but sounds like the way to go.
>
> cmake manuals say that you may only use pkg-config to HINT in find_library and
> find_file, but never to use the -L/-l flags directly. I don't think listing
> absolute paths in .pc files will help because the tool will convert them (?).
>
> I'm aiming for creating a .cmake file for orocos-rtt such that dependees don't
> need the .pc file if they are using cmake.
Very happy to hear that!
S