]> git.proxmox.com Git - libgit2.git/commitdiff
Don't use precompiled headers for command-line based VC builds.
authorSascha Cunz <Sascha@BabbelBox.org>
Mon, 19 Nov 2012 03:40:58 +0000 (04:40 +0100)
committerSascha Cunz <Sascha@BabbelBox.org>
Mon, 19 Nov 2012 04:00:02 +0000 (05:00 +0100)
The reason, why libgit2 currently cannot support compiling via the command-line
tools cl/nmake from WinSDK and/or Microsoft Visual Studio, seems to be a
missing dependency on the generated precompiled header file.

The Visual Studio IDE automatically inserts this dependency when it sees the
right combination of "/Y" parameters.

This patch allows to compile using command line tools by disabling precompiled
headers for NON-IDE builds.

CMakeLists.txt

index bde872fe470e1ff13df90dcee0624b68f75b5f2c..b0eef700ec0eca1620f88e572d565930dce70645 100644 (file)
@@ -172,7 +172,7 @@ SET_TARGET_PROPERTIES(git2 PROPERTIES VERSION ${LIBGIT2_VERSION_STRING})
 SET_TARGET_PROPERTIES(git2 PROPERTIES SOVERSION ${LIBGIT2_VERSION_MAJOR})
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libgit2.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libgit2.pc @ONLY)
 
-IF (MSVC)
+IF (MSVC_IDE)
    # Precompiled headers
    SET_TARGET_PROPERTIES(git2 PROPERTIES COMPILE_FLAGS "/Yuprecompiled.h /FIprecompiled.h")
    SET_SOURCE_FILES_PROPERTIES(src/win32/precompiled.c COMPILE_FLAGS "/Ycprecompiled.h")
@@ -211,7 +211,7 @@ IF (BUILD_CLAR)
        ADD_EXECUTABLE(libgit2_clar ${SRC} ${CLAR_PATH}/clar_main.c ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1})
        TARGET_LINK_LIBRARIES(libgit2_clar ${CMAKE_THREAD_LIBS_INIT} ${SSL_LIBRARIES})
 
-        IF (MSVC)
+        IF (MSVC_IDE)
            # Precompiled headers
            SET_TARGET_PROPERTIES(libgit2_clar PROPERTIES COMPILE_FLAGS "/Yuprecompiled.h /FIprecompiled.h")
         ENDIF ()