You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CMake module not automatically setting build and MSVC runtime type #8046
When building cURL as a CMake subproject on Windows with MSVC, I was running into linker errors with the VC runtime. It appears the larger Meson project's settings regarding the build type and b_vscrt are not passed down, so if the CMake subproject builds debug by default and the higher-level project is release or debugoptimized, you will be trying to link against two different versions of the runtime.
In my case, I can solve this by just setting MSVC_RUNTIME_LIBRARY or CMAKE_BUILD_TYPE (which will then default to the optimized runtime). I opted for the latter and now it links correctly, but I wanted to see if not propagating this is intentional or not. If it is, it might be worth mentioning this in the documentation, as I would not have guessed that it would be a problem.
In the meantime, setting either of the two CMake variables (preferably in a cross or native file using the new [cmake] section) would be the way to go.
I have a similar problem where meson is adding '/MD' to a subproject (in this case RmlUI) when it should not since I am using 'b_vscrt=static_from_buildtype'.
Activity
mensinda commentedon Nov 28, 2020
Doing this internally should be possible.
In the meantime, setting either of the two CMake variables (preferably in a cross or native file using the new
[cmake]section) would be the way to go.szanni commentedon Nov 21, 2022
Confirmed. The issue still presents itself for:
0.64.03.24.0I would consider this to be a bug though, not an enhancement.
Linking fails miserably otherwise and the error message is sadly not terribly helpful.
The other setting that does not get passed down is
b_staticpic. Happy to open another issue (probably one already exists).The following did the trick for me, the project I am using does not have a well formed CMakeList.txt like curl:
germandiagogomez commentedon Mar 27, 2024
I have a similar problem where meson is adding '/MD' to a subproject (in this case RmlUI) when it should not since I am using 'b_vscrt=static_from_buildtype'.
I would expect '/MT' to be passed.
joukewitteveen commentedon Apr 2, 2024
This may be fixed by #12947.