From 904125075e72228b9c24d49c6243bc756c542c74 Mon Sep 17 00:00:00 2001 From: Em Date: Tue, 14 Jun 2011 06:37:10 -0700 Subject: [PATCH] Port MSVC specific Waf compilation flags to CMake and remove dynamic dependence to msvcr100.dll on Windows The '/MT' and '/MTd' flags replace the dynamic link to 'msvcr100.dll' with a static link to 'libcmt.lib'. This has the nice effect to ease the deployment of libgit2 by removing the dependence on 'msvcr100.dll' which is not deployed by default on Windows. --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index cf108ffde..a7f732816 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,13 @@ OPTION (BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" OFF) OPTION (BUILD_TESTS "Build Tests" ON) OPTION (THREADSAFE "Build libgit2 as threadsafe" OFF) +# Platform specific compilation flags +IF (MSVC) + SET(CMAKE_C_FLAGS "/TC /W4 /WX /nologo /Zi") + SET(CMAKE_C_FLAGS_DEBUG "/Od /RTC1 /RTCc /DEBUG /MTd") + SET(CMAKE_C_FLAGS_RELEASE "/MT /O2") +ENDIF() + # Build Release by default IF (NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)