MantisBT - CMake
View Issue Details
0015805CMakeModulespublic2015-10-20 17:182016-06-10 14:31
Sam Thursfield 
Ben Boeckel 
normalminoralways
closedmoved 
 
 
0015805: pkg_get_variable from FindPkgConfig should honour search path from CMAKE_PREFIX_PATH
The pkg_get_variable function from FindPkgConfig.cmake that is added in CMake 3.4.0 is really useful! However, it needs to honour the same search path as pkg_check_modules, otherwise it doesn't work when packages are not installed in standard prefixes
Use attached test case

Expected output:

Magic word is: xyzzy

Actual output:

Package cmake-pkgconfig-test was not found in the pkg-config search path.
Perhaps you should add the directory containing `cmake-pkgconfig-test.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cmake-pkgconfig-test' found
CMake Error at CMakeLists.txt:15 (message):
  Did not pick up magic_word variable from cmake-pkgconfig-test.pc

No tags attached.
related to 0015804closed Kitware Robot FindPkgConfig pkg_check_modules command should return full path to shared libraries in _LIBRARIES variable 
? cmake-pkg-get-variable-testcase.sh (685) 2015-10-20 17:18
https://public.kitware.com/Bug/file/5553/cmake-pkg-get-variable-testcase.sh
patch cmake-pkg-get-variable-search-path.patch (7,953) 2015-10-20 17:19
https://public.kitware.com/Bug/file/5554/cmake-pkg-get-variable-search-path.patch
Issue History
2015-10-20 17:18Sam ThursfieldNew Issue
2015-10-20 17:18Sam ThursfieldFile Added: cmake-pkg-get-variable-testcase.sh
2015-10-20 17:19Sam ThursfieldNote Added: 0039659
2015-10-20 17:19Sam ThursfieldFile Added: cmake-pkg-get-variable-search-path.patch
2015-10-20 17:28Ben BoeckelAssigned To => Ben Boeckel
2015-10-20 17:28Ben BoeckelStatusnew => assigned
2015-10-20 17:28Ben BoeckelNote Added: 0039660
2015-10-20 17:29Ben BoeckelNote Added: 0039661
2015-10-20 17:59Ben BoeckelNote Added: 0039662
2015-10-21 08:28Brad KingRelationship addedrelated to 0015804
2015-10-23 16:21Rolf Eike BeerNote Added: 0039672
2015-10-23 17:23Ben BoeckelNote Added: 0039673
2016-06-10 14:29Kitware RobotNote Added: 0042864
2016-06-10 14:29Kitware RobotStatusassigned => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0039659)
Sam Thursfield   
2015-10-20 17:19   
Patch attached
(0039660)
Ben Boeckel   
2015-10-20 17:28   
Thanks. I hadn't considered that case. I'll look into trying to write a test case for it as well.
(0039661)
Ben Boeckel   
2015-10-20 17:29   
Well, a test case in the test suite :) .
(0039662)
Ben Boeckel   
2015-10-20 17:59   
Alright, I have your patch amended to keep the current test suite passing (you missed using $ENV{} when saving the old value). I'll work on a test cases for CMAKE_PREFIX_PATH this week.
(0039672)
Rolf Eike Beer   
2015-10-23 16:21   
There are some needless or dangerous variable dereferences, like

 if (NOT "${foo}" STREQUAL "")

Just use

 if (NOT foo STREQUAL "")
(0039673)
Ben Boeckel   
2015-10-23 17:23   
Fixed on the branch I made (for the bits that moved at least).
(0042864)
Kitware Robot   
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.