cmake3 bug in find_dependency

David Faure faure at kde.org
Sun Feb 23 10:12:27 UTC 2014


With cmake from git master or release,

find_dependency(KF5DesignerPlugin "4.96.0")

calls this cmake code:

macro(find_dependency dep)
  if (NOT ${dep}_FOUND)
    if (${ARGV1})
      set(version ${ARGV1})
    endif()
    set(exact_arg)
    [...]

which according to --trace, leads to

share/cmake-3.0/Modules/CMakeFindDependencyMacro.cmake(31):  if(NOT KF5DesignerPlugin_FOUND )
share/cmake-3.0/Modules/CMakeFindDependencyMacro.cmake(32):  if(4.96.0 )
share/cmake-3.0/Modules/CMakeFindDependencyMacro.cmake(35):  set(exact_arg )

i.e. the if (4.96.0) evaluates to false, and version is not set.

As a result, I get some old value of ${version} being used, it seems... it's set to 5.2 (from earlier find_package for Qt)

CMake Error at share/cmake-3.0/Modules/CMakeFindDependencyMacro.cmake:53 (find_package):
  Could not find a configuration file for package "KF5DesignerPlugin" that is
  compatible with requested version "5.2".

Did something change with the behavior of if()?
Or is this a bug in CMakeFindDependencyMacro.cmake?

cmake v2.8.12.2 works, but doesn't have find_dependency at all - so I guess it works
via the one provided by ECM, which doesn't have this bug:  macro(find_dependency dep version) ... 
no if().

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5



More information about the Kde-buildsystem mailing list