MantisBT - CMake
View Issue Details
0016028CMakeModulespublic2016-03-22 06:542016-06-10 14:21
David Wagner 
Stephen Kelly 
normalminoralways
closedfixed 
LinuxUbuntu
CMake 3.2.2 
CMake 3.3 
0016028: find_dependency not looking for the correct FOUND variable
find_package(Xyz) may set either XYZ_FOUND (the default) or Xyz_FOUND (if overriden by the called) but find_dependency will only look for Xyz_FOUND.

This means that calling, for instance, "find_dependency(LibXml2)" will always fail because upon finding the package, the LIBXML2_FOUND variable is set.

See a patch below. If you'd prefer, I can submit it on github.

--- /usr/share/cmake-3.2/Modules/CMakeFindDependencyMacro.cmake 2015-04-13 19:09:00.000000000 +0200
+++ cmake/CMakeFindDependencyMacro.cmake 2016-03-22 11:24:08.959963959 +0100
@@ -72,7 +72,8 @@
       set_property(GLOBAL PROPERTY _CMAKE_${dep}_TRANSITIVE_DEPENDENCY TRUE)
     endif()
 
- if (NOT ${dep}_FOUND)
+ string(TOUPPER ${dep} DEP)
+ if (NOT ${DEP}_FOUND AND NOT ${dep}_FOUND)
       set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency ${dep} could not be found.")
       set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False)
       return()
No tags attached.
duplicate of 0015412closed  FPHSA should set ExactCase_FOUND variable 
Issue History
2016-03-22 06:54David WagnerNew Issue
2016-03-22 10:16Brad KingNote Added: 0040741
2016-03-22 10:29Stephen KellyRelationship addedduplicate of 0015412
2016-03-22 10:30Stephen KellyNote Added: 0040742
2016-03-22 10:30Stephen KellyStatusnew => resolved
2016-03-22 10:30Stephen KellyFixed in Version => CMake 3.3
2016-03-22 10:30Stephen KellyResolutionopen => fixed
2016-03-22 10:30Stephen KellyAssigned To => Stephen Kelly
2016-03-22 11:03David WagnerNote Added: 0040744
2016-03-22 11:12Brad KingNote Added: 0040746
2016-06-10 14:21Kitware RobotNote Added: 0041218
2016-06-10 14:21Kitware RobotStatusresolved => closed

Notes
(0040741)
Brad King   
2016-03-22 10:16   
FindLibXml2 uses FIND_PACKAGE_HANDLE_STANDARD_ARGS which sets both the ExactCase_FOUND and the UPPERCASE_FOUND variables. Any idea why that is not causing this to work?
(0040742)
Stephen Kelly   
2016-03-22 10:30   
The reporter is using CMake 3.2.
(0040744)
David Wagner   
2016-03-22 11:03   
Strange that I didn't find 0015412 when I looked for "find_dependency". Will you consider back-porting the fix or not?
(0040746)
Brad King   
2016-03-22 11:12   
Sorry, we don't maintain the older releases upstream.
(0041218)
Kitware Robot   
2016-06-10 14:21   
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.