MantisBT - CMake
View Issue Details
0013755CMakeModulespublic2012-11-28 17:202012-11-29 03:25
Nick Hutchinson 
Alex Neundorf 
normalminoralways
closedfixed 
LinuxUbuntu12.10
CMake 2.8.10.2 
 
0013755: find_package_handle_standard_args(XX DEFAULT_MSG XX_FOUND) always succeeds
The following CMakeList.txt file always succeeds with "--Found XX: TRUE". It ought not to; XX_FOUND has not been declared anywhere. I would expect find_package_handle_standard_args() to report that XX could not be found, and to set XX_FOUND to false.

~~~~
cmake_minimum_required(VERSION 2.8.8)
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args(XX DEFAULT_MSG XX_FOUND)
No tags attached.
Issue History
2012-11-28 17:20Nick HutchinsonNew Issue
2012-11-29 02:46Alex NeundorfNote Added: 0031754
2012-11-29 02:46Alex NeundorfAssigned To => Alex Neundorf
2012-11-29 02:46Alex NeundorfStatusnew => confirmed
2012-11-29 03:24Alex NeundorfNote Added: 0031755
2012-11-29 03:24Alex NeundorfStatusconfirmed => closed
2012-11-29 03:24Alex NeundorfResolutionopen => fixed
2012-11-29 03:25Alex NeundorfNote Added: 0031756
2012-11-29 03:25Alex NeundorfStatusclosed => feedback
2012-11-29 03:25Alex NeundorfResolutionfixed => reopened
2012-11-29 03:25Alex NeundorfNote Added: 0031757
2012-11-29 03:25Alex NeundorfStatusfeedback => closed
2012-11-29 03:25Alex NeundorfResolutionreopened => fixed

Notes
(0031754)
Alex Neundorf   
2012-11-29 02:46   
That's a nice one ;-)
This is the cmake code:

set(${_NAME_UPPER}_FOUND TRUE)
# check if all passed variables are valid
foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
   if(NOT ${_CURRENT_VAR})
      set(${_NAME_UPPER}_FOUND FALSE)
      set(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}")
   endif()
endforeach()

So the _FOUND variable is initially set to TRUE, and only set to FALSE if something is missing. But since the _FOUND variable is the only thing which is checked, and this has been preset to TRUE, it is not missing...
(0031755)
Alex Neundorf   
2012-11-29 03:24   
This is now fixed in next and should be in 2.8.11.
(0031756)
Alex Neundorf   
2012-11-29 03:25   
...just for adding a comment
(0031757)
Alex Neundorf   
2012-11-29 03:25   
It is the branch MinorFixFPHSA_13755, containing just this one commit:
4809cad FPHSA: don't succeed if only checking for XX_FOUND (0013755)