MantisBT - CMake
View Issue Details
0014381CMakeCMakepublic2013-08-29 03:522014-10-06 10:32
JussiP 
Brad King 
normalminoralways
closedfixed 
anyanyany
CMake 2.8.11 
CMake 3.1CMake 3.1 
0014381: Inconsistent behaviour between find_package and pkg_check_modules
Find_package and pkg_check_modules behave differently with regard to the REQUIRED keyword. Find_package halts immediately with an error, but pkg_check_modules does not.

The entire point of REQUIRED is to halt the configuration if something can't be found. Having the user check the return code by themselves is equivalent to not having the REQUIRED keyword at all.

Please change the behaviour of pkg_check_modules to exit on error when REQUIRED is defined.
Run this:

---

project(depdemo C)
cmake_minimum_required(VERSION 2.8.1)

find_package(PkgConfig REQUIRED)

pkg_check_modules(DEPS REQUIRED notexisting)

message(STATUS "This should never be printed.")

---

The message text is printed even though it should not be.
No tags attached.
Issue History
2013-08-29 03:52JussiPNew Issue
2014-03-24 09:08Brad KingNote Added: 0035482
2014-03-24 09:08Brad KingAssigned To => Brad King
2014-03-24 09:08Brad KingStatusnew => resolved
2014-03-24 09:08Brad KingResolutionopen => fixed
2014-03-24 09:08Brad KingFixed in Version => CMake 3.1
2014-03-24 09:08Brad KingTarget Version => CMake 3.1
2014-10-06 10:32Robert MaynardNote Added: 0036951
2014-10-06 10:32Robert MaynardStatusresolved => closed

Notes
(0035482)
Brad King   
2014-03-24 09:08   
A patch to address this has been applied here:

 FindPkgConfig: Stop processing when REQUIRED package not found
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=63a4c0af [^]
(0036951)
Robert Maynard   
2014-10-06 10:32   
Closing resolved issues that have not been updated in more than 4 months.