Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to disable use of static runtime #19

Merged

Conversation

nidefawl
Copy link
Contributor

@nidefawl nidefawl commented Feb 7, 2022

With this pull request a new option is added PM_USE_STATIC_RUNTIME that allows disabling the use of the static runtime.
PM_USE_STATIC_RUNTIME defaults to ON

@rbdannenberg rbdannenberg merged commit 9641e03 into PortMidi:master Feb 12, 2022
@rbdannenberg
Copy link
Contributor

I merged the request so it exists as a commit one can reference, but in my tests, the pre-existing code to achieve a static runtime did not work, I think because CMake puts the compiler flags into the cache, so even when you change the flags, it has no effect. I think this used to work, but I'm not sure how. Perhaps it does work if you clear the cache. What I'm seeing now is that the new option has no effect. I see now that CMake has a new mechanism for MSVC linker flags and the flags used in PortMidi are both deprecated and used by default (!) in the latest CMake versions. I'm going to replace all this with target options and make it work as intended, including the PM_USE_STATIC_RUNTIME option.

To answer a question I saw in my email, but not sure where it was posted, yes I think it's a mistake to combine static linking with a DLL runtime -- if you want to make a binary that is free of dependencies and can run on another machine without including and installing additional DLLs, you should link the runtime statically, because "the CRT DLL is no longer considered a system file." Microsoft suggests you should install a separate copy of the CRT DLL for every application. That seems to be the approach advocated by CMake and MSVC, but it seems simpler to just use a static version of the CRT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants