abseil-cpp icon indicating copy to clipboard operation
abseil-cpp copied to clipboard

Add option to build with MSVC static runtime

Open aaron-bray opened this issue 7 months ago • 0 comments

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.

aaron-bray avatar Jul 02 '24 12:07 aaron-bray