Commit 904125075e72228b9c24d49c6243bc756c542c74

Em 2011-06-14T06:37:10

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cf108ff..a7f7328 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)