View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015634CMakeCMakepublic2015-06-29 09:132016-06-10 14:31
ReporterHeinrich Fink 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product VersionCMake 3.2.3 
Target VersionFixed in Version 
Summary0015634: Support for pkgconfig --define-variable
DescriptionIt is often necessary to re-define the prefix variable of pkgconfig scripts to adapt to different compilation environments. This is usually done via "pkg-config --define-variable=prefix=/my/dev/root/libs". Unfortunately this workflow is not support by CMake scripts that use pkgconfig. A simple option to define additional agurments for pkg-config when invoked would be helpful already. Manually redefining the pkg-config executable path, to already contain the additional argument, wouldn't work.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0038996)
Heinrich Fink (reporter)
2015-06-29 10:39

It should be noted that our current workaround is to set the PKG_CONFIG environment variable to a custom shell script that looks like this:

#!/bin/bash
pkg-config --define-variable=SOME_VAR=SOME_PATH $*
(0038997)
Brad King (manager)
2015-06-29 10:46

The public pkg_check_modules and pkg_search_module macros provided by the FindPkgConfig module contain many internal invocations of pkg-config. Perhaps some additional/optional argument or variable could be checked by these macros to pass extra options to pkg-config like this.

However, if your goal is just to search additional prefixes, the CMake way to do that is to set CMAKE_PREFIX_PATH as would be done for any other CMake package.
(0038998)
Heinrich Fink (reporter)
2015-06-29 10:57

In my understanding, CMAKE_PREFIX_PATH, wouldn't be enough in our case. That would only allow to search for *.pc files in additional directories, but not actually replace a variable of the *.pc files themselves.

My web search today showed that there was a patch for this a while ago: http://www.cmake.org/pipermail/cmake/2009-February/027404.html [^]

Like you mentioned, this would be one solution, but I couldn't find the actual patch, as it was capped from the mailing archive.
(0038999)
Brad King (manager)
2015-06-29 11:30

Re 0015634:0038998: Okay. If you want to try to revive that patch, please read CONTRIBUTING.rst for the preferred contribution path.

Since that patch was drafted we now have Tests/RunCMake/FindPkgConfig/ to test the module. The test case will need to be updated to cover the new feature too.
(0039373)
danblack (reporter)
2015-09-08 20:00

along a similar lines I wouldn't mind seeing the pkg-config --variable={VAR} extraction.

Is extracting all variables by default an API break? What CMake interface/macro would you choose for this and --define-variable?

Planned use - grabbing systemd directories: http://www.freedesktop.org/software/systemd/man/systemd.html#System%20unit%20directories [^]
(0042801)
Kitware Robot (administrator)
2016-06-10 14:29

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2015-06-29 09:13 Heinrich Fink New Issue
2015-06-29 10:39 Heinrich Fink Note Added: 0038996
2015-06-29 10:46 Brad King Note Added: 0038997
2015-06-29 10:57 Heinrich Fink Note Added: 0038998
2015-06-29 11:30 Brad King Note Added: 0038999
2015-09-08 20:00 danblack Note Added: 0039373
2016-06-10 14:29 Kitware Robot Note Added: 0042801
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team