[poppler] synthesis of LIBS/LDFLAGS from the library pathname, by cmake? (Re: Requires.private field missing in poppler.pc)

suzuki toshiya mpsuzuki at hiroshima-u.ac.jp
Thu Mar 22 02:21:36 UTC 2018


Hi all,

maybe it's not appropriate to ask about cmake itself in
this mailing list, but please let me try.

my question is: is there any standard way to make "-Lxxx
-lyyy" style compiler option string (fitting to the target
platform appropriately) from the pathname of the library?

following is the background why I ask such.

1) some of the dependencies are trackable by pkg-config.
it is not so hard to gather their info into Requires.private.
see a patch:
https://github.com/mpsuzuki/poppler/commit/53117b4ef37fbcd2a00ca4cdf51e0e894320f2a3
and its result:
https://travis-ci.org/mpsuzuki/poppler/jobs/356664623

on the end of the log, you can find the content of
pc files and pkg-config --libs --static results.

2) some of the dependencies are not tracked by pkg-config
e.g. libjpeg package have so many variants, some of them
have libjpeg.pc, but others do not. for example, see
https://travis-ci.org/mpsuzuki/poppler/jobs/356676011
from line 733-757. libjpeg-turbo8-dev does not provide
libjpeg.pc. for cmake, the lack of pc files for JPEG
is not regarded as critical, cmake building process starts
well.

2a) cmake's package finder (e.g. please see FindJPEG.cmake)
sets the pathnames of the libraries, but it does not set
ready-to-use LIBS or LDFLAGS values. it is significant
difference from pkg-config.

2b) it would be possible to make "-Lxxx -lyyy" string from
the pathname of the libraries, but yet I could not find
the existing function to do such. fortunately, there is
a cmake variable to know the suffix of the shared library
on target platform (CMAKE_SHARED_LIBRARY_SUFFIX), it would
be possible to do such by myself, but I guess there is
already existing feature. (this is the question)

Regards,
mpsuzuki

suzuki toshiya wrote:
>> Therefore, it would
>> be considerable to discuss cairo in poppler-glib.pc,
> 
> oh, poppler-glib.pc defines cairo dependency explicitly.
> sorry for overlooking that.
> 
> Regards,
> mpsuzuki
> 
> 
> suzuki toshiya wrote:
>> Dear Jeroen,
>>
>> Indeed, some tweaks for poppler.pc and poppler-cpp.pc are
>> expected, but cairo is not in there.
>>
>> There is CairoOutputDev which is dependent with cairo,
>> but libpoppler does not include it. The object files for
>> CairoOutputDev are directly linked (not via any library)
>> to pdftocairo and libpoppler-glib. Therefore, it would
>> be considerable to discuss cairo in poppler-glib.pc,
>> but no need for poppler.pc and poppler-cpp.pc.
>>
>> I would try to propose some patch.
>>
>> Regards,
>> mpsuzuki
>>
>> Albert Astals Cid wrote:
>>> El dimarts, 20 de març de 2018, a les 18:57:32 CET, Jeroen Ooms va escriure:
>>>> Currently pkg-config does not correctly list the dependency libs for
>>>> static linking when running with --static:
>>>>
>>>>   pkg-config --libs --static poppler-cpp
>>>>     -lpoppler-cpp -lpoppler
>>>>
>>>> The output of --static should also include the recursive dependencies
>>>> such as -lcairo -llcms2 -lopenjp2 -ltiff. For comparsion try
>>>> 'pkg-config --libs libcurl' with and without --static'.
>>>>
>>>> I think to resolve this, cmake should add a line like this to the
>>>> poppler.pc file:
>>>>
>>>>   Requires.private: cairo
>>> Side note, afaik we don't link cairo to poppler core at all.
>>>
>>>> Or alternatively hardcode dependency linker flags in Libs.private
>>>> field in poppler.pc:
>>>>
>>>>   Libs.private: -lcairo -lz -lgobject-2.0 -lffi -lglib-2.0 -lintl
>>>> -lpcre -lintl -liconv -lpcre -lpixman-1 -lfontconfig -lexpat
>>>> -lfreetype -lz -lbz2 -lpng16 -lz
>>>>
>>>> And possibly other dependencies that poppler was configured with.
>>>> However I am not sure how to implement this but I think it should be
>>>> an option in cmake.
>>> As previously stated, personally i don't really care about static linking, so 
>>> patches welcome.
>>>
>>> Cheers,
>>>   Albert
>>>
>>>> Thank you!
>>>> _______________________________________________
>>>> poppler mailing list
>>>> poppler at lists.freedesktop.org
>>>> https://lists.freedesktop.org/mailman/listinfo/poppler
>>>
>>>
>>> _______________________________________________
>>> poppler mailing list
>>> poppler at lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/poppler
>> _______________________________________________
>> poppler mailing list
>> poppler at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/poppler
> 
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/poppler



More information about the poppler mailing list