The following issue has been SUBMITTED. 
====================================================================== 
https://cmake.org/Bug/view.php?id=15810 
====================================================================== 
Reported By:                bchretien
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15810
Category:                   Modules
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-10-27 01:29 EDT
Last Modified:              2015-10-27 01:29 EDT
====================================================================== 
Summary:                    FindPkgConfig.cmake: error returned to the user may
be wrong when checking for package existence
Description: 
In some cases, CMake returns the following error:

-- Checking for module 'foo'
--   Package 'foo' not found

When the actual error returned by pkg-config is actually:

  Package 'bar', required by 'foo', not found

This seems related to https://cmake.org/Bug/view.php?id=14310, however I did not
have the exact same problem: CMake does stop with an error, just not the correct
one.

Steps to Reproduce: 
I used the same example as in https://cmake.org/Bug/view.php?id=14310

CMakeLists.txt
==============

cmake_minimum_required(VERSION 2.8)
include(FindPkgConfig)
pkg_check_modules(FOO REQUIRED foo)

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, explaining that 'foo' was found but `bar` was not.

Current
======

Failure, explaining that 'foo' was not found.

Additional Information: 
I made a patch that solves this issue. Now, the actual error is forwarded to the
user, for instance:

-- Checking for module 'foo'
--   Package 'bar', required by 'foo', not found

For the standard case (i.e. the package was indeed not found), the CMake error
was:

-- Checking for module 'foo'
--   Package 'foo' not found

But with this patch, it now prints:

-- Checking for module 'foo'
--   No package 'foo' found
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-10-27 01:29 bchretien      New Issue                                    
2015-10-27 01:29 bchretien      File Added:
0001-FindPkgConfig-return-the-actual-error-when-a-package.patch                 
  
======================================================================

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to