SIRF-SuperBuild icon indicating copy to clipboard operation
SIRF-SuperBuild copied to clipboard

USE_SYSTEM_* and CMake caching creates trouble

Open KrisThielemans opened this issue 3 years ago • 3 comments

It is generally dangerous to change USE_SYSTEM_* settings after a first configure, and certainly so after a first build. This is because find_package will remember various settings anyway, so deciding to use a system library after the first configure is probably not going to work.

Currently therefore, we need to recommend users to set these variables from the command line (setting it from the GUI is too late, as the first configure will cache the variables already). This needs to be added to our README.md (we have https://github.com/SyneRBI/SIRF/wiki/Rebuilding-after-upgrades by the way, but this is a bit different)

On the superbuild side, there are few things we can do about this in the future:

  • detect of someone changes the USE_SYSTEM_ variable, and then try to handle it (or at least warn)
  • Possibly we should switch the default of these variables to ON. @bathomas set them to OFF at the time to make sure we know which version we are using, but it's contrary to usual CMake philosophy, and most people want to set them to ON anyway. (If the corresponding find_package fails, then no variables are cached, and hence changing it to OFF will not cause problems).
  • try and be very clever and find which cached variables exist and somehow get rid of them. However, this needs to be done both in the SIRF-SuperBuild cache and in the projects that depend on the respective library (not sure if this can be done and it seems quite fragile anyway)

KrisThielemans avatar Mar 16 '22 10:03 KrisThielemans

The second option seems better to me.

paskino avatar Mar 17 '22 07:03 paskino

Is this for 3.2?

paskino avatar Mar 17 '22 07:03 paskino

No, we really need to get 3.2 out asap

KrisThielemans avatar Mar 17 '22 07:03 KrisThielemans