-
Notifications
You must be signed in to change notification settings - Fork 482
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
The build failed because of a runtime libraries incompatibility #774
Comments
Thanks for the suggestion. The change was introduced to reduce the risks of DLL hijacking. Would you be able to submit a pull request with a CMakeLists.txt change to specify the runtime using the built-in variables and properties? |
Perhaps reducing the risk of DLL hijacking is the responsibility of the application developer? Several compilers. I'm porting framework to Windows from Linux. But neither MSVS 19 nor MSVS 2022 was able to build due to linking errors. And I must to set only static MT runtime to build. This gives rise to several problems:
I just commented lines with Correct "CMake-style way" to change runtime is using if (MSVC) # AND ($<COMPILE_LANGUAGE> STREQUAL CXX OR $<COMPILE_LANGUAGE> STREQUAL C))
set_property(TARGET "${target}" PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
endif() And variable to set runtime: But, please, don't specify runtime in the library. |
thanks for the recipe. We will evaluate it. As a work-around we can offer a new -DNO_STATIC_MSVC_RUNTIME_LIBRARY=1 option which you can use with cmake when compiling pcm. |
Thank you. It's better than nothing. But if you have a real reason to set the runtime library (like formal SDL requirements), perhaps in the future it would be better to add an option where the user can set an arbitrary runtime? |
@rdementi , why do you added
/MT$<$<CONFIG:Debug>:d>
in the CMakeLists?It breaks builds with another types of runtime and doesn't work in the most cases, due to library incompatibility.
If I comment out the two lines with
target_compile_options
, the library and my project are built successfully.Could you remove this options?
P.S.: It's incorrect to use compiler options to specify runtime: CMake has built-in variables and properties for it, but libraries should not to use this.
The text was updated successfully, but these errors were encountered: