How to enable MSVC static runtime linking with CMake

In the process of converting a Projucer-base build to a CMake based build I wonder what’s the right way to enable MSVC static runtime linkage for Windows builds?

The simplest way is to use CMake 3.15 or higher (you should set cmake_minimum_required(VERSION 3.15)), and to use the MSVC_RUNTIME_LIBRARY property, or the CMAKE_MSVC_RUNTIME_LIBRARY variable.

1 Like