ENH: Include system runtime libraries
This is part of addressing https://github.com/Slicer/Slicer/issues/7847.
This avoids a termination fault when running the CLI executable when it was built with a newer MSVC relative to another computer with an older runtime. Including the runtime libraries will make sure compatibility is correct instead of falling back to the system version.
Slicer is already expected to package the needed runtime along the application.
I will look at the referenced issue to better understand and see how to fix the root cause.
It seems that the Slicer.exe launcher itself needs MSVC runtime DLLs, which is an issue, because it will not find them if they are in the bin subfolder. The best would be to link Slicer.exe statically so that it does not need any DLLs to run.
(ignore what I wrote before - since this only comes up when launching a CLI and not when launching Slicer itself, the launcher itself should be fine)
I am testing this now.
Since the variable CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION is set, I anticipate the libraries will also be installed in the lib/Slicer-X.Y/cli-modules directory.
| Top-level install directory | lib/Slicer-X.Y/cli-modules install directory |
|---|---|
I am also implementing the following:
- moving the call to
InstallRequiredSystemLibrariesinto theif(NOT LOCAL_SEM_NO_INSTALL)block - saving & restoring the values of
CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATIONandCMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENTvariables if these were already set
Locally testing the changes, we can observe that the system libraries are now installed along side the CLIs (in addition of being installed in the top-level bin directory):
| Top-level install directory | lib/Slicer-X.Y/cli-modules install directory |
|---|---|
| ! |