[Piglit] [Patch v2] cmake: Use waffle PackageConfig instead of pkg-find.

Jose Fonseca jfonseca at vmware.com
Wed Feb 4 13:37:51 PST 2015


On 04/02/15 21:25, Dylan Baker wrote:
> Well, isn't that what LD_LIBRARY_PATH is for? Linking or loading
> libraries out of non standard locations I mean.

That doesn't work if waffle is built as a static library. Or Windows 
where the linker needs the path to the import library.

> Looking through my usr/lib/cmake folder I'm seeing no one set full paths
> for <project>_LIBRARIES.  I do see at least one project that defines
> <project>_LIBRARIES as "-L${<project>_LIBRARY_DIRS} <project>", which
> doesn't seem right to me.

Most of the modules in /usr/share/cmake-3.0/Modules/Find*.cmake do set 
fullpaths

    $ grep '^#.*_LIB\w\+_DIR' /usr/share/cmake-3.0/Modules/Find*.cmake

And I could only find one on /usr/lib/x86_64-linux-gnu/cmake/ FWIW:

   $ grep -R '^#.*_LIB\w\+_DIR' /usr/lib/x86_64-linux-gnu/cmake/
   /usr/lib/x86_64-linux-gnu/cmake/Waffle/WaffleConfig.cmake:# 
Waffle_LIBRARY_DIRS - Library directories to search for link libraries

> I think I'll talk to the cmake guys and see what they think the right
> solution is.
>
> Consider this patch on hold until I get this sorted.

You can actually commit it as is now.  As is not a huge deal for me -- I 
modified my piglit build script to pass 
-DWaffle_LIBRARIES=/full/path/to/waffle

Jose

>
> Dylan
>
> On Tue, Feb 03, 2015 at 09:13:32PM +0000, Jose Fonseca wrote:
>> Dylan,
>>
>>
>> When the original commit went in, I also noticed one further issue (but
>> after the change was reverted I forgot to write it up):
>>
>>
>> Waffle sets two variables Waffle_LIBRARY_DIRS and Waffle_LIBRARIES.
>>
>> But with this change, piglit uses Waffle_LIBRARIES from Waffle, and
>> never uses Waffle_LIBRARY_DIRS, so if Waffle is installed into a non
>> standard place, piglit fails to build with "ld: cannot find -lwaffle-1"
>>
>> (I hit this on my build slaves because I don't install waffle into /usr
>> or /usr/local.)
>>
>> But worst thing is, I'm not sure this can be cleanly fixes from piglit
>> side.
>>
>> We could add
>>
>>     link_directories(${Waffle_LIBRARY_DIRS})
>>
>> But per
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.cmake.org_cmake_help_v3.0_command_link-5Fdirectories.html&d=AwIFAg&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=kkqmKUcDIcQPxT8oKvgXFXzRVz1HAxFlPZStIcLPNds&s=syh16ZuaT26f2uLAtmPxmdd2fhxOMq6aT6eNaPw7ytQ&e=  I
>> think the right fix would be to fix Waffle to export full paths in
>> Waffle_LIBRARIES, and kill Waffle_LIBRARY_DIRS.  I believe this is the
>> right way -- and cmake will emit the -L option automatically...
>>
>>
>> Jose
>>
>
> [snip]
>



More information about the Piglit mailing list