[Bug 1038] New: KDLConfig.cmake.in changes PKG_CONFIG_PATH environment variable and doesn't restore it.

http://bugs.orocos.org/show_bug.cgi?id=1038

Summary: KDLConfig.cmake.in changes PKG_CONFIG_PATH environment
variable and doesn't restore it.
Product: KDL
Version: kdl-trunk
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P3
Component: Build system
AssignedTo: orocos-dev [..] ...
ReportedBy: hersh [..] ...
CC: orocos-dev [..] ...
Estimated Hours: 0.0

This lost me an afternoon's work.

Line 18 in KDLConfig.cmake.in:

set(ENV{PKG_CONFIG_PATH} "@CMAKE_INSTALL_PREFIX@/lib/pkgconfig/")

changes the contents of the environment variable PKG_CONFIG_PATH, which breaks
any other uses of pkg-config later in the cmake session.

The workaround I am currently using looks like this:

set(saved_PKG_CONFIG_PATH $ENV{PKG_CONFIG_PATH})
find_package(orocos_kdl)
set(ENV{PKG_CONFIG_PATH} ${saved_PKG_CONFIG_PATH})

This does work for me, but should not be necessary.

You could put similar lines in KDLConfig.cmake.in as a first pass, to at least
avoid corrupting the variable for others. If you do, please use a very unique
temporary variable name, since cmake variables are all in a single namespace.

I'm pretty sure there is a better way though.

Ruben Smits's picture

[Bug 1038] KDLConfig.cmake.in changes PKG_CONFIG_PATH environmen

http://bugs.orocos.org/show_bug.cgi?id=1038

Ruben Smits <ruben [dot] smits [..] ...> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |ruben.smits@intermodalics.e
| |u
Resolution| |DUPLICATE