Skip to content

find_package: avoid showing files as directories when searching config files

sanchayanghosh requested to merge sanchayanghosh/cmake:master into master

Teach cmFileListGeneratorBase::Consider to skip non-directories so that all call sites get the check.

Original Description

I am currently new to cmake development. I wanted to start with trying to resolve Issue #21212 (closed) . I know I should have commented before starting on this, but I wasn't sure if I could be able to make the requisite changes. I still have to verify compatibility of the code with earlier versions of C++ (11,14). In C++ 17, the output I get is:

find_package considered the following locations for the Config module:

/Volumes/seagate_hdd/test_files/CMake_Ref/FooBarConfig.cmake
/Volumes/seagate_hdd/test_files/CMake_Ref/foobar-config.cmake
/Volumes/seagate_hdd/test_files/CMake_Ref/FooBarConfig/FooBarConfig.cmake
/Volumes/seagate_hdd/test_files/CMake_Ref/FooBarConfig/foobar-config.cmake

The file was not found.

Using the same tree structure as the maintainer used when he opened the issue.

Kindly peruse my code and suggest changes. Meanwhile, I will update definitions so that the code may be more versatile. Apologies for any deviations from standard coding practices.

Topic-rename: find_package-check-dir
Fixes: #21212 (closed)

Edited by Brad King

Merge request reports