[CMake] Setting MSVC runtime type on CMake command line?
Mateusz Loskot
mateusz at loskot.net
Sat Jan 12 09:08:33 EST 2019
On Sat, 12 Jan 2019 at 14:20, Osman Zakir <osmanzakir90 at hotmail.com> wrote:
>
> I tried to set the runtime to static by passing the "-DMSVC_RUNTIME_TYPE=/MT"
> argument when running CMake, but it generated a warning
Could you paste link to the CMake docs page where this variable is described?
> So what's the correct way to do this?
Modify C/C++ flags. For example, something along these lines
string(REGEX REPLACE "/MD" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
string(REGEX REPLACE "-MT" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
target_compile_options(myexe PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-MT>)
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
More information about the CMake
mailing list