robotology / ycm-cmake-modules

YCM (YCM CMake modules) is a collection of various useful CMake modules.
http://robotology.github.io/ycm-cmake-modules
Other
50 stars 22 forks source link

FindOrBuildPackage: Do not run find_package if YCM_DISABLE_SYSTEM_PACKAGES is ON #404

Closed traversaro closed 2 years ago

traversaro commented 2 years ago

In FindOrBuildPackage a preliminary find_package is run to decide if it make sense to provide to the user the USE_SYSTEM_${_PKG} option. However if YCM_DISABLE_SYSTEM_PACKAGES is ON, the USE_SYSTEM_${_PKG} option is already disabled, so we can skip the find_package calls.

This change should dramatically reduce the CMake configuration for superbuilds in which YCM_DISABLE_SYSTEM_PACKAGES is ON and that have many subpackages.

traversaro commented 2 years ago

I tested locally in a WSL2 instance, and this PR reduce the CMake configuration from 42 seconds (top) to 12 seconds (bottom): local_build

traversaro commented 2 years ago

The test in https://github.com/robotology/robotology-superbuild/pull/1093 were successful.