Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[bug] CMakeDeps generates a MODULE require instead of CONFIG #11201

@paulharris

Description

@paulharris

See other bug report below,
a simple project requiring Freetype will fail as Freetype will call
find_dependency(brotli REQUIRE MODULE),
but brotli does not have a MODULE finder, only a CONFIG finder.

RE my comment, "it isn't so simple as disabling that flag"

For my example, if you do a conan install, and then comment out that flag, it does find Freetype::Freetype, but it then fails to find Brotli (looking for Findbrotli.cmake)

CMake Error at /build/msrap2/devenv/share/cmake-3.23/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):                                                                                                    
No "Findbrotli.cmake" found in CMAKE_MODULE_PATH.
Call Stack (most recent call first):
build/FindFreetype.cmake:25 (find_dependency)
CMakeLists.txt:5 (find_package)

FindFreetype.cmake:25 is:
       find_dependency(${_DEPENDENCY} REQUIRED ${${_DEPENDENCY}_FIND_MODE}) 
which ends up calling
find_package(brotli REQUIRED;MODULE)

Seems to be a bug in CMakeDeps, and it should be reported to conan client. It doesn't make sense that CMakeDeps generate a module file for freetype recipe calling find_dependency(brotli REQUIRED MODULE), since brotli recipe doesn't have cmake_find_mode set to both. It should call find_dependency(brotli REQUIRED CONFIG).

Originally posted by @SpaceIm in conan-io/conan-center-index#10687 (comment)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions