MantisBT - CMake
View Issue Details
0013125CMakeModulespublic2012-04-12 23:202012-09-03 16:01
Orion Poplawski 
Rolf Eike Beer 
highmajoralways
closedfixed 
CMake 2.8.8 
CMake 2.8.9CMake 2.8.9 
0013125: FindPkgConfig.cmake not setting PKG_CONFIG_FOUND in 2.8.8
From https://bugzilla.redhat.com/show_bug.cgi?id=812188 [^]

A few of my packages use pkg-config from within CMake to resolve build
dependencies, using the FindPkgConfig.cmake module shipped with CMake.
According to the comments in rawhide's FindPkgConfig.cmake:

# It sets the following variables:
# PKG_CONFIG_FOUND ... true if pkg-config works on the system
# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
# PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found
# (since CMake 2.8.8)
# PKG_CONFIG_FOUND ... if pkg-config executable was found

(note the two lines mentioning PKG_CONFIG_FOUND with different meanings)

Most of my packages check for PKG_CONFIG_FOUND before trying to use pkg-config,
and the fact that this module is no longer setting that variable means that
CMake isn't picking up on all of the available dependencies. The result is
FTBFS errors and missing program features on builds that do succeed.

Version-Release number of selected component (if applicable):
cmake-2.8.8-0.2.rc2.fc18.x86_64
The following simple CMakeLists.txt can be used to recreate the problem:

======begin CMakeLists.txt======
cmake_minimum_required(VERSION 2.8)

include(FindPkgConfig)

if(PKG_CONFIG_FOUND)
 message(STATUS "PkgConfig Found.")
else(PKG_CONFIG_FOUND)
 message(STATUS "PkgConfig Not Found.")
endif(PKG_CONFIG_FOUND)

message(STATUS "PkgConfig Executable: ${PKG_CONFIG_EXECUTABLE}")
======end CMakeLists.txt======

cmake-2.8.8-0.2.rc2.fc18.x86_64 in rawhide (f18) produces the following output:
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.25")
-- PkgConfig Not Found.
-- PkgConfig Executable: /usr/bin/pkg-config

cmake-2.8.7-4.fc17.x86_64 in f17 produces:
-- PkgConfig Found.
-- PkgConfig Executable: /usr/bin/pkg-config
No tags attached.
patch 13125.patch (595) 2012-04-12 23:56
https://public.kitware.com/Bug/file/4295/13125.patch
patch Rolf-cmake_13125-nocolor.patch (2,062) 2012-04-13 03:12
https://public.kitware.com/Bug/file/4297/Rolf-cmake_13125-nocolor.patch
Issue History
2012-04-12 23:20Orion PoplawskiNew Issue
2012-04-12 23:56Yury G. KudryashovNote Added: 0029140
2012-04-12 23:56Yury G. KudryashovFile Added: 13125.patch
2012-04-13 00:03Yury G. KudryashovNote Edited: 0029140bug_revision_view_page.php?bugnote_id=29140#r602
2012-04-13 02:51Rolf Eike BeerNote Added: 0029142
2012-04-13 02:51Rolf Eike BeerFile Added: cmake_13125.patch
2012-04-13 02:52Rolf Eike BeerAssigned To => Rolf Eike Beer
2012-04-13 02:52Rolf Eike BeerStatusnew => assigned
2012-04-13 02:54Yury G. KudryashovNote Added: 0029143
2012-04-13 02:55Yury G. KudryashovNote Edited: 0029143bug_revision_view_page.php?bugnote_id=29143#r604
2012-04-13 03:00Yury G. KudryashovNote Added: 0029144
2012-04-13 03:12Yury G. KudryashovFile Added: Rolf-cmake_13125-nocolor.patch
2012-04-13 03:13Yury G. KudryashovNote Edited: 0029144bug_revision_view_page.php?bugnote_id=29144#r606
2012-04-13 03:21Rolf Eike BeerFile Deleted: cmake_13125.patch
2012-04-13 03:22Rolf Eike BeerNote Added: 0029145
2012-04-13 16:59Rolf Eike BeerNote Added: 0029153
2012-04-13 16:59Rolf Eike BeerStatusassigned => resolved
2012-04-13 16:59Rolf Eike BeerResolutionopen => fixed
2012-04-13 16:59Rolf Eike BeerFixed in Version => CMake 2.8.8
2012-04-13 16:59Rolf Eike BeerTarget Version => CMake 2.8.8
2012-04-19 08:56Rolf Eike BeerStatusresolved => feedback
2012-04-19 08:56Rolf Eike BeerResolutionfixed => reopened
2012-04-19 08:57Rolf Eike BeerStatusfeedback => resolved
2012-04-19 08:57Rolf Eike BeerResolutionreopened => fixed
2012-04-19 08:57Rolf Eike BeerProduct Version => CMake 2.8.8
2012-04-19 08:57Rolf Eike BeerFixed in VersionCMake 2.8.8 => CMake 2.8.9
2012-04-19 08:57Rolf Eike BeerTarget VersionCMake 2.8.8 => CMake 2.8.9
2012-04-19 08:57Rolf Eike BeerSummaryFindPkgConfig.cmake not setting PKG_CONFIG_FOUND in 2.8.8 rc2 (and rc1) => FindPkgConfig.cmake not setting PKG_CONFIG_FOUND in 2.8.8
2012-09-03 16:01David ColeNote Added: 0030860
2012-09-03 16:01David ColeStatusresolved => closed

Notes
(0029140)
Yury G. Kudryashov   
2012-04-12 23:56   
(edited on: 2012-04-13 00:03)
The regression was introduced by my commit 55c3435d88618d7ed935736604e7ab989cef4b28. I've attached 13125.patch.

The same patch is available as git commit:
git pull git@gitorious.org:~urkud1/cmake/urkud-cmake.git fix-FindPkgConfig

I have to go right now, so I haven't tested the patch. Test it, please.

The regression in docs was introduced by 27501155c7bcc04ada498407ad3d6fd40dbea2bd.

(0029142)
Rolf Eike Beer   
2012-04-13 02:51   
Yury, why don't you just call fphsa(PKG_CONFIG ...)?
(0029143)
Yury G. Kudryashov   
2012-04-13 02:54   
(edited on: 2012-04-13 02:55)
Because find_package() sets PkgConfig_FIND_REQUIRED, not PKG_CONFIG_FIND_REQUIRED. Look at 0012620.

(0029144)
Yury G. Kudryashov   
2012-04-13 03:00   
(edited on: 2012-04-13 03:13)
Rolf, your patch contains ASCII color sequences. I've uploaded an updated version of your patch (without colors).

(0029145)
Rolf Eike Beer   
2012-04-13 03:22   
Ok, valid point. Will commit a merge of our patches tonight.
(0029153)
Rolf Eike Beer   
2012-04-13 16:59   
Fix merged as 8bd38d7070b1cec6ed27b71d0359f1b2ccd1e1c8 to next.
(0030860)
David Cole   
2012-09-03 16:01   
Closing resolved issues that have not been updated in more than 4 months.