find_package performance and cmGlobalGenerator::GetDirectoryContent
Hello everyone! I've noticed that my CMakeLists.txt calls SystemTools::ModifiedTime(dir)
a lot of times during find_package
calls. It's pretty slow since I have a lot of search paths.
https://gitlab.kitware.com/cmake/cmake/-/blob/v3.23.0/Source/cmGlobalGenerator.cxx#L3063
I do not want my CMakeLists to support the case when files that are searched are being changed between find_package
calls.
How can I workaround? Any idea would be highly appreciated: fixing it on the CMakeLists level and/or fixing it somehow in the CMake codebase (I am familiar with the contribution process). Maybe we need some kind of API to tell find_package
to not update the directories cache? Thanks!
Edited by Brad King