MantisBT - CMake
View Issue Details
0015352CMakeCMakepublic2015-01-14 13:112015-11-02 09:13
Joachim Wuttke 
Brad King 
normalminoralways
closedfixed 
amd64Debianjessie
CMake 3.0.2 
CMake 3.3CMake 3.3 
0015352: FPHSA: Document the kind of variable that should be given to REQUIRED_VARS
Code example:

set (FOO_LIBRARIES ${FOO_LIB_A} ${FOO_LIB_B})
find_package_handle_standard_args (FOO DEFAULT_MSG FOO_LIBRARIES FOO_INCLUDE_DIR)

If lib A is missing, I get the error message:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
FOO_LIB_A

However, if lib B (or more generally, the last item in FOO_LIBRARIES) is missing, I get the less informative:

CMake Error at /usr/share/cmake-3.0/Modules/FindPackageHandleStandardArgs.cmake:136 (message):
  Could NOT find Foo (missing: FOO_LIBRARIES)
Call Stack (most recent call first):
  /usr/share/cmake-3.0/Modules/FindPackageHandleStandardArgs.cmake:343 (_FPHSA_FAILURE_MESSAGE)
  my_cmake_modules/FindFoo.cmake:84 (find_package_handle_standard_args)
No tags attached.
Issue History
2015-01-14 13:11Joachim WuttkeNew Issue
2015-01-14 16:42Brad KingStatusnew => acknowledged
2015-01-14 16:42Brad KingSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=1670#r1670
2015-01-15 07:31Brad KingNote Added: 0037695
2015-04-15 14:47Brad KingAssigned To => Brad King
2015-04-15 14:47Brad KingStatusacknowledged => assigned
2015-04-15 14:47Brad KingTarget Version => CMake 3.3
2015-04-15 14:47Brad KingSummaryfind_package_handle_standard_args generates inadequate error message when last item in a list is unavailable => FPHSA: Document the kind of variable that should be given to REQUIRED_VARS
2015-04-15 14:47Brad KingNote Added: 0038527
2015-04-15 14:48Brad KingStatusassigned => resolved
2015-04-15 14:48Brad KingResolutionopen => fixed
2015-04-15 14:48Brad KingFixed in Version => CMake 3.3
2015-04-17 10:48Brad KingNote Edited: 0038527bug_revision_view_page.php?bugnote_id=38527#r1765
2015-11-02 09:13Robert MaynardNote Added: 0039778
2015-11-02 09:13Robert MaynardStatusresolved => closed

Notes
(0037695)
Brad King   
2015-01-15 07:31   
The FOO_LIBRARIES is not the correct variable to give to FPHSA. Instead it should be FOO_LIB_A and FOO_LIB_B. The idea is that FPHSA checks if all the variables are set and if not then gives a user-facing error message that lists the ones that are not set. Therefore they should be the variables (actually cache entries) that the user is capable of modifying.
(0038527)
Brad King   
2015-04-15 14:47   
(edited on: 2015-04-17 10:48)
After revising and cleaning up the documentation:

 FPHSA: Revise and format documentation
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a3ad275c [^]

I've added an explicit note about what is mentioned in 0015352:0037695:

 FPHSA: Document REQUIRED_VARS recommendation (0015352)
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=84f06d0c [^]

(0039778)
Robert Maynard   
2015-11-02 09:13   
Closing resolved issues that have not been updated in more than 4 months.