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
Prior to CMake 3.15 the /MT or /MTd flags could simply be added to CMAKE_C_FLAGS_DEBUG or CMAKE_C_FLAGS_RELEASE.
Starting with CMake 3.15 the CMAKE_MSVC_RUNTIME_LIBRARY abstraction should be used instead -- values provided in the other locations are ignored.
Seems primarily like a cmake bug to me... Should CMAKE_MSVC_RUNTIME_LIBRARY really be set independent of what platform/compiler that's used? Can you please provide your suggested fix as a pull request?
I agree with you that it is a cmake issue - but I think this is mostly because they're trying to improve the vexing issue of handling the Microsoft compiler's setting of the relevant options controlling the C/C++ runtime library.
The existing code handling CURL_STATIC_CRT in curl's CMakeLists.txt is already WIN32 specific, and the additional flags /MT and /MTd are Microsoft specific, so I think adding the CMAKE_MSVC_RUNTIME_LIBRARY setting here is appropriate.
The behaviour is controlled by cmake policy CMP0091, which is automatically set to NEW if your top project declares minimum version of cmake to 3.15+. It must have been #4975 that introduced the problem for curl.
If I understand the description of CMAKE_MSVC_RUNTIME_LIBRARY correctly, cmake will only apply it where it makes sense, so it can be set without thinking about other platforms/compilers, etc.