CPackIFW find_program searches are slow
include(CPackIFW)
seems needlessly slow. I am specifying the path to my QtIFW installation using the QTIFWDIR
environment variable, but CPackIFW
seems to be searching many other directories first.
I modified the source of CPackIFW
locally to add some timestamp logging and found that it takes ~30 seconds to find a single executable. There are 5 executables that need to be found and they each take about this long. This leads to initial configures (no cache) taking multiple minutes.
I was able to drastically reduce the configure time with any of the following:
- Add
NO_DEFAULT_PATH
to allfind_program
calls inCPackIFW.cmake
(find_program takes ~1 second) - Reduce the
_CPACK_IFW_VERSIONS
list inCPackIFW.cmake
to contain only the version I have installed (find_program takes ~1 second) - Set all of the
CMAKE_FIND_USE_*_PATH
toOFF
beforeinclude(CPackIFW)
(find_program takes ~5 seconds)
I think the combination of find_program
searching other directories before the PATHS
it is given, combined with the large number of PATH_SUFFIXES
passed to find_program
by CPackIFW
, is the crux of the problem. This could be improved by ensuring that user provided paths are checked first (ie. the QTIFWDIR
environment variable) or generally giving the user more control over the arguments to find_program
(limiting the versions?).
The executables for QtIFW
are also generally located within the same folders and yet CPackIFW
does a fresh search for each successive executable. Checking the previous executables folder first would probably be significantly faster.