From 0a165f9dcd2fd585e4eb843206c51c6e564cdfd0 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Mon, 7 Dec 2015 15:52:45 -0800 Subject: [PATCH] build: static link the CRT for cmake+msvc build --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index adeba97e..9dc144fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,8 +35,11 @@ if (WIN32) set(CMAKE_EXE_LINKER_FLAGS -Wl,--stack,${STACKSIZE}) endif (WIN32) +#MSVC: /MT is to static link the CRT. if (MSVC) - set(CMAKE_EXE_LINKER_FLAGS /STACK:${STACKSIZE} ) + set(CMAKE_EXE_LINKER_FLAGS "/STACK:${STACKSIZE}") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT") + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd") endif (MSVC) add_subdirectory(bspinfo)