CPack adds weird Dll's to the installer

out project (GitHub - OpenMS/OpenMS: The codebase of the OpenMS project) uses CMake + CPack with NSIS to create a Windows installer.
In our CMake scripts we use include(InstallRequiredSystemLibraries) ( and install(RUNTIME_DEPENDENCY_SET ... to collect dependent runtimes and ship them with the installer. They finally end up in ./bin/ on the target machine.

Now, depending on which system we compile our software, the resulting Windows installer sometimes contains some extra Dll’s, which cause our software to break when the user tries to run it after installing it on his system.
On my development machine, the installer does not add extra Dll’s. However, on our CI/CD, which uses GitHub actions runners for Windows (Server 2022, I believe), the resulting installers are broken. This makes it exceptionally hard to debug, since we do not control these Github runners, and cannot interact with them.

The error message on the target system after running the installer and starting our app is something like:
Could not find procedure entry point _CxxFrameHandler4 in UxTheme.dll

The extra Dll’s which CPacks adds to the installer are:


Removing these dll’s from the ./bin/ directory allows to successfully start our application.

I do not even know where to start to debug the problem, since I cannot find any reference to any of these dll’s when 'grep’ing the CMake source code.

One solution is to add these Dll’s to a blacklist, but I feel this is not very maintainable and requires us to test each installer.
So, is there a generic fix which excludes ‘unneeded’ Dll’s which are apparently harmful?

1 Like

trying to push this up.
(and if that fails, I will have to go a very painful bughunt :slight_smile: )

1 Like