[cmake-developers] [CMake 0016028]: find_dependency not looking for the correct FOUND variable

Mantis Bug Tracker mantis at public.kitware.com
Tue Mar 22 06:54:38 EDT 2016


The following issue has been SUBMITTED. 
====================================================================== 
https://cmake.org/Bug/view.php?id=16028 
====================================================================== 
Reported By:                David Wagner
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   16028
Category:                   Modules
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2016-03-22 06:54 EDT
Last Modified:              2016-03-22 06:54 EDT
====================================================================== 
Summary:                    find_dependency not looking for the correct FOUND
variable
Description: 
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()

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2016-03-22 06:54 David Wagner   New Issue                                    
======================================================================



More information about the cmake-developers mailing list