[cmake-developers] FindPkgConfig and CMAKE_PREFIX_PATH

Alexander Neundorf neundorf at kde.org
Tue Oct 22 15:46:01 EDT 2013


On Tuesday 22 October 2013, Daniele E. Domenichelli wrote:
> Hello all,
> 
> FindPkgConfig does not support the CMAKE_PREFIX_PATH variable.
> This is because pkg-config uses the PKG_CONFIG_PATH and does not know
> anything
> about CMAKE_PREFIX_PATH.
> 
> As a consequence, pkg-config packages built and installed in a non standard
> directory using ExternalProject, cannot be found, while cmake ones can
> be easily
> located setting the CMAKE_PREFIX_PATH variable.
> 
> Do you think it could make sense to add to FindPkgConfig something like
> this?
> 
>   set(_pkgconfig_path $ENV{PKG_CONFIG_PATH})
>   foreach(_dir ${CMAKE_PREFIX_PATH})
>     set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${_dir}/lib/pkgconfig")
>   endforeach()
> 
>   [...] (search for package)
> 
>   set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path})

good idea I think.
I guess it should also take lib64/ and the multiarch lib dirs into account.
You may have a look into GNUInstallDirs.cmake, there this is handled too.


Alex



More information about the cmake-developers mailing list