]> git.proxmox.com Git - libgit2.git/blobdiff - CMakeLists.txt
Cleanup TYPECHANGE support
[libgit2.git] / CMakeLists.txt
index a8e646d061a519a378905f3b7d9d7cd83ca9ec2f..7a7a943e582be6c9cd0f9177f22767b765a06d30 100644 (file)
@@ -29,7 +29,12 @@ ENDIF()
 # Find required dependencies
 INCLUDE_DIRECTORIES(src include deps/http-parser)
 
-FILE(GLOB SRC_HTTP deps/http-parser/*.c)
+IF (WIN32 AND NOT MINGW)
+       ADD_DEFINITIONS(-DGIT_WINHTTP)
+ELSE ()
+       FIND_PACKAGE(OpenSSL)
+       FILE(GLOB SRC_HTTP deps/http-parser/*.c)
+ENDIF()
 
 # Specify sha1 implementation
 IF (SHA1_TYPE STREQUAL "ppc")
@@ -62,7 +67,7 @@ ENDIF()
 
 # Installation paths
 SET(INSTALL_BIN bin CACHE PATH "Where to install binaries to.")
-SET(INSTALL_LIB lib CACHE PATH "Where to install libraries to.")
+SET(LIB_INSTALL_DIR lib CACHE PATH "Where to install libraries to.")
 SET(INSTALL_INC include CACHE PATH "Where to install headers to.")
 
 # Build options
@@ -75,7 +80,7 @@ OPTION (PROFILE "Generate profiling information" OFF)
 
 # Platform specific compilation flags
 IF (MSVC)
-       # Not using __stdcall with the CRT causes problems
+       # Default to stdcall, as that's what the CLR expects and how the Windows API is built
        OPTION (STDCALL "Buildl libgit2 with the __stdcall convention" ON)
 
        SET(CMAKE_C_FLAGS "/W4 /MP /nologo /Zi ${CMAKE_C_FLAGS}")
@@ -106,7 +111,6 @@ IF (NOT CMAKE_BUILD_TYPE)
        SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
 ENDIF ()
 
-FIND_PACKAGE(OpenSSL)
 IF (OPENSSL_FOUND)
   ADD_DEFINITIONS(-DGIT_SSL)
   INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
@@ -159,13 +163,18 @@ IF (MSVC)
    SET_SOURCE_FILES_PROPERTIES(src/win32/precompiled.c COMPILE_FLAGS "/Ycprecompiled.h")
 ENDIF ()
 
+# Backward compatibility with INSTALL_LIB variable
+if (INSTALL_LIB)
+       set(LIB_INSTALL_DIR "${INSTALL_LIB}")
+ENDIF()
+
 # Install
 INSTALL(TARGETS git2
        RUNTIME DESTINATION ${INSTALL_BIN}
-       LIBRARY DESTINATION ${INSTALL_LIB}
-       ARCHIVE DESTINATION ${INSTALL_LIB}
+       LIBRARY DESTINATION ${LIB_INSTALL_DIR}
+       ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
 )
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgit2.pc DESTINATION ${INSTALL_LIB}/pkgconfig )
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgit2.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
 INSTALL(DIRECTORY include/git2 DESTINATION ${INSTALL_INC} )
 INSTALL(FILES include/git2.h DESTINATION ${INSTALL_INC} )