mapnik / mapnik

Mapnik is an open source toolkit for developing mapping applications

Home Page:http://mapnik.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CMake: library paths is not propagted to plugin/util/test build

alsaleem00 opened this issue · comments

I managed to compile mapnik using the cmake build system.
However, when it comes to building plugins/util/test parts, make process stops with
ld: error: unable to find library -lharfbuzz
ld: error: unable to find library -lcairo
ld: error: unable to find library -lproj

I set the variable:
set(CMAKE_SHARED_LINKER_FLAGS "-L${BDIR}/harfbuzz/lib -L${BDIR}/cairo/lib -L${BDIR}/proj/lib -L${BDIR}/icu/lib -licudata")

but it looks it only applies to libmapnik build.
I am using non-system folders (not using pkg-config)

So, how to set library paths for plugin/util/test builds?

export LD_LIBRARY_PATH did not work either.
However, adding
link_directories(${BDIR}/cairo/lib ${BDIR}/harfbuzz/lib ${BDIR}/proj/lib)

did it.
Why would plugin/input/sqlite need harfbuzz or proj or cairo ?

If you have non standard installation paths, I'm recommending setting up a cmake Toolchain file. There you specify exactly the same targets of the find package cmake/pkg config generated targets. Furthermore you have to Set xxx_FOUND to true, since then the pkg config thing will not overwrite your custom targets.

Why would plugin/input/sqlite need harfbuzz or proj or cairo ?

Because they have a dependency on libmapnik and libmapnik has those public link interfaces.

Set xxx_FOUND

Well noted.
But i do not know the right set(xxx_LIBRARY ....) set(xxx_INCLUDE_DIR ....) for each package.
For example
set(ICU_I18N_LIBRARY_RELEASE ${ICU_LBASE}/libicui18n.so.70.1)
set(Boost_FILESYSTEM_LIBRARY_RELEASE ${BOOST_ROOT}/lib/libboost_filesystem.so)

There no way i can figure out these without looking into Findxxxx and/or Cmake log

And your library install dirs haven't any cmake files or pkgconfig files?

"Most" libraries do not have cmake (only configure).
Since I can not use system /usr/lib or /usr/lib/pkgconfig, I can not use pkgconfig files *.pc of these libraries. Isn't it?
This works for libs compiled with cmake:
find_package(LibXml2 REQUIRED PATHS ${BDIR}/xml2)

Can I use *.pc files in cmake? How?

If you don't move the files manually, harfbuzz and cairo can be found via pkgconf. Usually this file is in your /lib/pkgconf

For boost etc. the cmake find modules are packaged with cmake itself. Please lookup the paths you need to set in the docs https://cmake.org/cmake/help/latest/module/FindBoost.html

https://cmake.org/cmake/help/latest/module/FindICU.html

PROJ >= 7? But at least >=8 are providing its own cmake config files

I searched for using *.pc in cmake project but could not find a solution.
I will stick with using link_directories
Thanks for your help.