Open pierreguillot opened 6 months ago
I spent hours debugging why it doesn't respect setting static msvc linking.
I tried with set(MSVC_RUNTIME_LIBRARY, "MultiThreaded")
or set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MT")
Eventually the only way worked:
if (MSVC)
set(CompilerFlags
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
)
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
endif()
Any hope of this? same issue on Windows. :(
It would be great to be able to define the MSVC runtime library via CMAKE_MSVC_RUNTIME_LIBRARY (or the MSVC_RUNTIME_LIBRARY property). However, this feature has only been included in CMake 3.15. Would it be possible to set this version as the minimum? Or set the minimum version to 3.5 only if it is not yet defined?
P.S. I can create a PR if necessary.