abseil-cpp
abseil-cpp copied to clipboard
Add option to build with MSVC static runtime
The correct CMake policy is set, but there is no option to switch the msvc runtime when configuring the project.
Since MSVC is a multiconfiguration build tool, we need to set this CMake variable internal to the project to ensure that all of the supported build configurations get properly set (i.e. Release
builds use /MT
or /MD
and Debug
builds use /MTd
or /MDd
).
I tried to explictly set these flags (i.e. -DCMAKE_CXX_FLAGS_XXX) when configuring the project, but these flags were being overwritten due to explicitly setting compiler flags.
If we want to support this functionality using MSVC and CMake 3.10 - 3.14, we would need to manually update the various CMAKE_CXX_FLAGS, but since this project is explictly setting flag it might require a bit more experimenting. Depends how much we want to support MSVC and CMake < 3.15, which might be a pretty rare edge case.