[cmake-developers] [CMake 0014310]: pkg_check_modules(FOO REQUIRED foo) completes even if foo's pkgconfig dependencies failed

Mantis Bug Tracker mantis at public.kitware.com
Wed Jul 24 20:49:59 EDT 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14310 
====================================================================== 
Reported By:                Michał Sawicz
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14310
Category:                   Modules
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-07-24 20:49 EDT
Last Modified:              2013-07-24 20:49 EDT
====================================================================== 
Summary:                    pkg_check_modules(FOO REQUIRED foo) completes even
if foo's pkgconfig dependencies failed
Description: 
When a .pc file contains a "Required: bar", CMake should fail if the module was
REQUIRED and bar wasn't found.

pkg-config exits with exit code 1, but CMake proceeds like nothing happened,
FOO_FOUND is set to 1, while all the other FOO_* remain empty.

This obfuscates missing dependencies and lets the build process continue,
failing then due to missing headers / libraries.

Steps to Reproduce: 
CMakeLists.txt
==============
cmake_minimum_required(VERSION 2.8)

include(FindPkgConfig)

pkg_check_modules(FOO REQUIRED foo)

message("${FOO_FOUND}")
message("${FOO_INCLUDE_DIRS}")


foo.pc
======
Name: foo
Description: foo
Version: 0

Requires: bar
Cflags: -I/usr/include/foo


Steps
=====
# store both files in a directory
$ PKG_CONFIG_PATH=. cmake .

Expected
========
failure

Current
=======
quiet failure

Additional Information: 
CMake Output
============

$ PKG_CONFIG_PATH=. cmake .
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26") 
-- checking for module 'foo'
--   found foo, version 0
Package bar was not found in the pkg-config search path.
Perhaps you should add the directory containing `bar.pc'
to the PKG_CONFIG_PATH environment variable
# === repeated multiple times ===
1

-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/tmp
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-07-24 20:49 Michał Sawicz  New Issue                                    
======================================================================




More information about the cmake-developers mailing list