From 7335ee3eac986b0af0def78f585cb856b64bbe7d Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Wed, 4 Sep 2013 18:58:40 +0100 Subject: [PATCH] Fix debug build on Windows Specify static linking to VC runtime libs under both debug and release builds MD-19678 #time 10m --- CMakeLists.txt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2232a85..5d75e02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,16 +17,19 @@ include_directories(external) include_directories(external/TinyThread/source) if (WIN32) -include_directories(external/zlib/) -include_directories(external/bzip2) -include_directories(external/win32cpp/include) + include_directories(external/zlib/) + include_directories(external/bzip2) + include_directories(external/win32cpp/include) -# Link the updater binary statically with the Visual C++ runtime -# so that the executable can function standalone -set(CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /Ob2 /D NDEBUG") -set(CMAKE_C_FLAGS_RELEASE "/MT /O2 /Ob2 /D NDEBUG") -remove_definitions(-DUNICODE -D_UNICODE) + # Link the updater binary statically with the Visual C++ runtime + # so that the executable can function standalone + set(CMAKE_CXX_FLAGS_DEBUG "/MT") + set(CMAKE_C_FLAGS_DEBUG "/MT") + set(CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /Ob2 /D NDEBUG") + set(CMAKE_C_FLAGS_RELEASE "/MT /O2 /Ob2 /D NDEBUG") + + remove_definitions(-DUNICODE -D_UNICODE) else() # optimize for reduced code size set(CMAKE_CXX_FLAGS_RELEASE "-Os")