we are currently investigating switching from MPC (GitHub - DOCGroup/MPC: MPC (The Makefile, Project, and Workspace Creator)) to CMake. As a test, I am trying to convert a slightly larger C++ project to CMake. Now I am stuck on generating the Visual Studio solution.
With MPC we have generated one Visual Studio solution with 8 different configurations for the Windows platform:
Dll_Ansi_Release_StaticRTL = The same with multi-byte character set
Dll_Ansi_Debug_StaticRTL = …
Dll_Ansi_Release_DllRTL = …
Dll_Ansi_Debug_DllRTL = …
My idea was to map this project structure using presets. I was able to create a solution with the different configurations, but then I failed to assign the different options to the individual configurations within the solution. I didn’t find a way to do this either in the presets themselves or via generator expressions.
Since I’m relatively new to CMake, I wanted to ask here what is the right way to do something like this in Cmake? Is something like this even possible with Cmake? Or is the only sensible solution to create 8 different Visual Studion solutions for the described configurations?
This works so far, except for the configuration specifc assignment of the Windows runtime library. As far as I know, there is no configuration specific CMAKE_MSVC_RUNTIME_LIBRARY variable. And I can´t set the compiler/linker flags for the runtime library directly, because it will be overwritten by the default value of the CMAKE_MSVC_RUNTIME_LIBRARY variable defined internaly by CMake.
Can anyone help me to solve this? How can I set CMAKE_MSVC_RUNTIME_LIBRARY on a configuration specific basis?