Bug 812188

Summary: FindPkgConfig.cmake not setting PKG_CONFIG_FOUND
Product: [Fedora] Fedora Reporter: Rich Mattes <richmattes>
Component: cmakeAssignee: Orion Poplawski <orion>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jreznik, orion, pertusus, pmachata, rdieter
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
URL: http://public.kitware.com/Bug/view.php?id=13125
Whiteboard:
Fixed In Version: cmake-2.8.8-0.4.rc2.fc18 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-04-14 22:09:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rich Mattes 2012-04-13 02:33:17 UTC
Description of problem:
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

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

How reproducible:

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

cmake-2.8.7-4.fc16.x86_64 in f16 produces:
-- PkgConfig Found.
-- PkgConfig Executable: /usr/bin/pkg-config

Comment 1 Orion Poplawski 2012-04-13 03:22:03 UTC
Filed upstream.

Comment 2 Orion Poplawski 2012-04-14 03:54:39 UTC
Building cmake-2.8.8-0.3.rc2.fc18 in rawhide now, which should fix this issue.  Please test when available and note the result here.

Comment 3 Rex Dieter 2012-04-14 20:44:02 UTC
Seems still not fixed.  I'm seeing failures building telepathy-qt4 too.

put in some diagostic into the cmake module,

find_package(PkgConfig)
...
message(STATUS "PKG_CONFIG_FOUND, PkgConfig_FOUND : ${PKG_CONFIG_FOUND}, ${PkgConfig_FOUND}")

and it prints:

PKG_CONFIG_FOUND, PkgConfig_FOUND : ,

Comment 4 Rex Dieter 2012-04-14 21:26:55 UTC
OK, found the problem

from FindPackageHandleStandardArgs.cmake:
# It also sets the <UPPERCASED_NAME>_FOUND variable.

notice the *UPPERCASED* part, so
set(PKG_CONFIG_FOUND "${PkgConfig_FOUND}")
does not work, but
set(PKG_CONFIG_FOUND "${PKGCONFIG_FOUND}")
does.

I'll adjust our local patch accordingly, and poke upstream.

Comment 5 Rex Dieter 2012-04-14 21:43:15 UTC
OK, I guess I'm silly today, can't figure out how to add a comment to the upstream report... Orion, mind helping me out there (or give me a clue how to do it)?

Comment 6 Rex Dieter 2012-04-14 22:09:45 UTC
Build cmake-2.8.8-0.4.rc2.fc18 , and confirmed good (for me)

Comment 7 Orion Poplawski 2012-04-14 23:26:33 UTC
(In reply to comment #5)
> OK, I guess I'm silly today, can't figure out how to add a comment to the
> upstream report... Orion, mind helping me out there (or give me a clue how to
> do it)?


I think you need to reopen it first.  Thanks for fixing this.

Comment 8 Rex Dieter 2012-04-15 01:41:03 UTC
I can't see any way for me to reopen it either, I guess I can just file a new one

Comment 9 Rex Dieter 2012-04-15 01:44:31 UTC
http://public.kitware.com/Bug/view.php?id=13132