From eb63fda2e24d007e31742587984a30e086249d43 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Thu, 25 Apr 2013 11:52:17 -0500 Subject: git_atomic_ssize for 64-bit atomics only on 64-bit platforms --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 6bd25aacc..1831c8717 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -277,6 +277,15 @@ ELSE() ENDIF() FILE(GLOB SRC_GIT2 src/*.c src/transports/*.c src/xdiff/*.c) +# Determine architecture of the machine +IF (CMAKE_SIZEOF_VOID_P EQUAL 8) + ADD_DEFINITIONS(-DGIT_ARCH_64) +ELSEIF (CMAKE_SIZEOF_VOID_P EQUAL 4) + ADD_DEFINITIONS(-DGIT_ARCH_32) +ELSE() + message(FATAL_ERROR "Unsupported architecture") +ENDIF() + # Compile and link libgit2 ADD_LIBRARY(git2 ${SRC_GIT2} ${SRC_OS} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1} ${WIN_RC}) TARGET_LINK_LIBRARIES(git2 ${SSL_LIBRARIES}) -- cgit v1.2.1 From ac1d85cf11ceb8bf9c9600ce9c29d5d037220cfb Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Mon, 29 Apr 2013 11:00:05 -0500 Subject: cmake 2.6 parser bug workaround --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 1831c8717..9f6b06bf1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -293,7 +293,7 @@ TARGET_OS_LIBRARIES(git2) # Workaround for Cmake bug #0011240 (see http://public.kitware.com/Bug/view.php?id=11240) # Win64+MSVC+static libs = linker error -IF(MSVC AND NOT BUILD_SHARED_LIBS AND (${CMAKE_SIZEOF_VOID_P} MATCHES "8") ) +IF(MSVC AND GIT_ARCH_64 AND NOT BUILD_SHARED_LIBS) SET_TARGET_PROPERTIES(git2 PROPERTIES STATIC_LIBRARY_FLAGS "/MACHINE:x64") ENDIF() -- cgit v1.2.1 From b641c00eebb3c60e8719c0dfc55dde91ca30a5d2 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Fri, 3 May 2013 17:35:50 +0200 Subject: clar: Always generate the test suite --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f6b06bf1..5a228e342 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -337,7 +337,7 @@ IF (BUILD_CLAR) ADD_CUSTOM_COMMAND( OUTPUT ${CLAR_PATH}/clar.suite - COMMAND ${PYTHON_EXECUTABLE} generate.py -xonline . + COMMAND ${PYTHON_EXECUTABLE} generate.py -f -xonline . DEPENDS ${SRC_TEST} WORKING_DIRECTORY ${CLAR_PATH} ) -- cgit v1.2.1 From 7369b3c3bf396e466d065f9921415fe2b9d69a7a Mon Sep 17 00:00:00 2001 From: Brad Morgan Date: Tue, 7 May 2013 14:26:33 -0400 Subject: Added libssh2 cmake module --- CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 6bd25aacc..20d63fecb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,8 @@ PROJECT(libgit2 C) CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") + # Build options # OPTION( SONAME "Set the (SO)VERSION of the target" ON ) @@ -138,6 +140,15 @@ ELSE() FILE(GLOB SRC_ZLIB deps/zlib/*.c) ENDIF() +IF(NOT LIBSSH2_LIBRARY) + FIND_PACKAGE(LIBSSH2 QUIET) +ENDIF() +IF (LIBSSH2_FOUND) + ADD_DEFINITIONS(-DGIT_SSH) + INCLUDE_DIRECTORIES(${LIBSSH2_INCLUDE_DIR}) + SET(SSH_LIBRARIES ${LIBSSH2_LIBRARIES}) +ENDIF() + # Platform specific compilation flags IF (MSVC) @@ -280,6 +291,7 @@ FILE(GLOB SRC_GIT2 src/*.c src/transports/*.c src/xdiff/*.c) # Compile and link libgit2 ADD_LIBRARY(git2 ${SRC_GIT2} ${SRC_OS} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1} ${WIN_RC}) TARGET_LINK_LIBRARIES(git2 ${SSL_LIBRARIES}) +TARGET_LINK_LIBRARIES(git2 ${SSH_LIBRARIES}) TARGET_OS_LIBRARIES(git2) # Workaround for Cmake bug #0011240 (see http://public.kitware.com/Bug/view.php?id=11240) @@ -340,6 +352,7 @@ IF (BUILD_CLAR) ADD_EXECUTABLE(libgit2_clar ${SRC_GIT2} ${SRC_OS} ${SRC_CLAR} ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1}) TARGET_LINK_LIBRARIES(libgit2_clar ${SSL_LIBRARIES}) + TARGET_LINK_LIBRARIES(libgit2_clar ${SSH_LIBRARIES}) TARGET_OS_LIBRARIES(libgit2_clar) MSVC_SPLIT_SOURCES(libgit2_clar) -- cgit v1.2.1 From 000e68961cb44b04435a733e151f8b1357547bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sun, 12 May 2013 15:35:02 +0200 Subject: CMake: don't try to use bundled zlib when the system's path is in the cache The code surrounding zlib bundling did not take into consideration that ZLIB_LIBRARY gets cached, and assumed that FIND(ZLIB) would always set ZLIB_FOUND, which does not hold true, as this variable signifies that we have found the package and had to look at the system, as its location was not cached. Only use the bundled sources if the external zlib is neither newly-found nor cached. --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a228e342..402ff2226 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -131,7 +131,9 @@ ENDIF() IF (ZLIB_FOUND) INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS}) LINK_LIBRARIES(${ZLIB_LIBRARIES}) -ELSE() + # Fake the message CMake would have shown + MESSAGE("-- Found zlib: ${ZLIB_LIBRARY}") +ELSEIF (NOT ZLIB_LIBRARY) MESSAGE( "zlib was not found; using bundled 3rd-party sources." ) INCLUDE_DIRECTORIES(deps/zlib) ADD_DEFINITIONS(-DNO_VIZ -DSTDC -DNO_GZIP) -- cgit v1.2.1 From 3bbc87d697b24725beb8dcd41fa83ca604d3a9e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Tue, 14 May 2013 23:09:26 +0200 Subject: CMake: allow appending a string to the library filename This helps us install multiple versions of the library side-by-side. --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 402ff2226..1ffe1ddd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ OPTION( BUILD_EXAMPLES "Build library usage example apps" OFF ) OPTION( TAGS "Generate tags" OFF ) OPTION( PROFILE "Generate profiling information" OFF ) OPTION( ENABLE_TRACE "Enables tracing support" OFF ) +OPTION( SONAME_APPEND "Append the given string to the library's filename" OFF ) IF(MSVC) # This option is only availalbe when building with MSVC. By default, # libgit2 is build using the stdcall calling convention, as that's what @@ -304,6 +305,9 @@ MSVC_SPLIT_SOURCES(git2) IF (SONAME) SET_TARGET_PROPERTIES(git2 PROPERTIES VERSION ${LIBGIT2_VERSION_STRING}) SET_TARGET_PROPERTIES(git2 PROPERTIES SOVERSION ${LIBGIT2_VERSION_MAJOR}) + IF (SONAME_APPEND) + SET_TARGET_PROPERTIES(git2 PROPERTIES OUTPUT_NAME "git2-${SONAME_APPEND}") + ENDIF() ENDIF() CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libgit2.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libgit2.pc @ONLY) -- cgit v1.2.1 From ccf1a2ba5fbd2a7d71be3e9bb895e3f2ac45e9b5 Mon Sep 17 00:00:00 2001 From: nulltoken Date: Tue, 21 May 2013 11:37:13 +0200 Subject: cmake: Fix indentation --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 3aa3770b8..0499dc90a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,8 +106,8 @@ ENDIF() # Specify sha1 implementation IF (WIN32 AND NOT MINGW AND NOT SHA1_TYPE STREQUAL "builtin") - ADD_DEFINITIONS(-DWIN32_SHA1) - FILE(GLOB SRC_SHA1 src/hash/hash_win32.c) + ADD_DEFINITIONS(-DWIN32_SHA1) + FILE(GLOB SRC_SHA1 src/hash/hash_win32.c) ELSEIF (OPENSSL_FOUND AND NOT SHA1_TYPE STREQUAL "builtin") ADD_DEFINITIONS(-DOPENSSL_SHA1) ELSE() @@ -155,7 +155,7 @@ ENDIF() # Platform specific compilation flags IF (MSVC) - STRING(REPLACE "/Zm1000" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + STRING(REPLACE "/Zm1000" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") # /GF - String pooling # /MP - Parallel build @@ -170,7 +170,7 @@ IF (MSVC) SET(CRT_FLAG_DEBUG "/MTd") SET(CRT_FLAG_RELEASE "/MT") ELSE() - SET(CRT_FLAG_DEBUG "/MDd") + SET(CRT_FLAG_DEBUG "/MDd") SET(CRT_FLAG_RELEASE "/MD") ENDIF() -- cgit v1.2.1 From 095bfd748766966f5515bdfe64867d6a09287123 Mon Sep 17 00:00:00 2001 From: nulltoken Date: Tue, 21 May 2013 11:38:24 +0200 Subject: cmake: Update Windows resources to reflect the optional vendor string Make InternalName and OriginalFilename resources reflect the name of the compiled binary. --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 0499dc90a..016d77ad1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -321,8 +321,19 @@ IF (SONAME) SET_TARGET_PROPERTIES(git2 PROPERTIES OUTPUT_NAME "git2-${SONAME_APPEND}") ENDIF() ENDIF() + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libgit2.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libgit2.pc @ONLY) +IF (NOT BUILD_SHARED_LIBS) + SET(LIBGIT2_NAME_PREFIX "lib") +ENDIF() + +IF (SONAME_APPEND) + SET(LIBGIT2_NAME_SUFFIX "-${SONAME_APPEND}") +ENDIF() + +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/src/win32/git2.rc.cmake ${WIN_RC} @ONLY) + IF (MSVC_IDE) # Precompiled headers SET_TARGET_PROPERTIES(git2 PROPERTIES COMPILE_FLAGS "/Yuprecompiled.h /FIprecompiled.h") -- cgit v1.2.1 From 7a6e0281c6367a278e1e06235c9a7217088d1205 Mon Sep 17 00:00:00 2001 From: Veeti Paananen Date: Thu, 2 May 2013 14:07:22 +0300 Subject: Build with the system's http-parser installation if available --- CMakeLists.txt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 016d77ad1..b931dc5f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,8 @@ PROJECT(libgit2 C) CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") +# Add find modules to the path +SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") # Build options # @@ -100,8 +101,16 @@ ELSE () IF (NOT AMIGA) FIND_PACKAGE(OpenSSL) ENDIF () - FILE(GLOB SRC_HTTP deps/http-parser/*.c) - INCLUDE_DIRECTORIES(deps/http-parser) + + FIND_PACKAGE(HTTP_Parser QUIET) + IF (HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2) + INCLUDE_DIRECTORIES(${HTTP_PARSER_INCLUDE_DIRS}) + LINK_LIBRARIES(${HTTP_PARSER_LIBRARIES}) + ELSE() + MESSAGE("http-parser was not found or is too old; using bundled 3rd-party sources.") + INCLUDE_DIRECTORIES(deps/http-parser) + FILE(GLOB SRC_HTTP deps/http-parser/*.c) + ENDIF() ENDIF() # Specify sha1 implementation -- cgit v1.2.1 From 5a6e45cc841194a61ccad1006ad4a4b9aa2ecbc5 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Wed, 12 Jun 2013 21:14:04 +0200 Subject: Revert "cmake: Update Windows resources to reflect the optional vendor string" This reverts commit 095bfd748766966f5515bdfe64867d6a09287123. --- CMakeLists.txt | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index b931dc5f1..f06a84299 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -330,19 +330,8 @@ IF (SONAME) SET_TARGET_PROPERTIES(git2 PROPERTIES OUTPUT_NAME "git2-${SONAME_APPEND}") ENDIF() ENDIF() - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libgit2.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libgit2.pc @ONLY) -IF (NOT BUILD_SHARED_LIBS) - SET(LIBGIT2_NAME_PREFIX "lib") -ENDIF() - -IF (SONAME_APPEND) - SET(LIBGIT2_NAME_SUFFIX "-${SONAME_APPEND}") -ENDIF() - -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/src/win32/git2.rc.cmake ${WIN_RC} @ONLY) - IF (MSVC_IDE) # Precompiled headers SET_TARGET_PROPERTIES(git2 PROPERTIES COMPILE_FLAGS "/Yuprecompiled.h /FIprecompiled.h") -- cgit v1.2.1 From c1cf1af46a541419160473decb0955dda6ac721e Mon Sep 17 00:00:00 2001 From: nulltoken Date: Wed, 12 Jun 2013 21:15:58 +0200 Subject: cmake: Add option to specify the name of the binary --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index f06a84299..bdc46d0b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,8 @@ OPTION( BUILD_EXAMPLES "Build library usage example apps" OFF ) OPTION( TAGS "Generate tags" OFF ) OPTION( PROFILE "Generate profiling information" OFF ) OPTION( ENABLE_TRACE "Enables tracing support" OFF ) -OPTION( SONAME_APPEND "Append the given string to the library's filename" OFF ) +OPTION( LIBGIT2_FILENAME "Name of the produced binary" OFF ) + IF(MSVC) # This option is only availalbe when building with MSVC. By default, # libgit2 is build using the stdcall calling convention, as that's what @@ -326,8 +327,9 @@ MSVC_SPLIT_SOURCES(git2) IF (SONAME) SET_TARGET_PROPERTIES(git2 PROPERTIES VERSION ${LIBGIT2_VERSION_STRING}) SET_TARGET_PROPERTIES(git2 PROPERTIES SOVERSION ${LIBGIT2_VERSION_MAJOR}) - IF (SONAME_APPEND) - SET_TARGET_PROPERTIES(git2 PROPERTIES OUTPUT_NAME "git2-${SONAME_APPEND}") + IF (LIBGIT2_FILENAME) + ADD_DEFINITIONS(-DLIBGIT2_FILENAME=\"${LIBGIT2_FILENAME}\") + SET_TARGET_PROPERTIES(git2 PROPERTIES OUTPUT_NAME ${LIBGIT2_FILENAME}) ENDIF() ENDIF() CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libgit2.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libgit2.pc @ONLY) -- cgit v1.2.1 From c41281ad3af420bcfe4afae6acdbe95039290525 Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Wed, 19 Jun 2013 13:36:59 +0200 Subject: CMakeLists: fix zlib linker setup b53671a (Search for zlib unconditional, 2012-12-18) changed things around to always (even on windows, that's what the subject refers to) call FIND_PACKAGE(ZLIB). However, it did not correctly handle the case where ZLIB_LIBRARY is cached, either by the user setting it manually or by an earlier search. In that case, the IF(ZLIB_FOUND) would not trigger (that variable is not cached) and we'd instead use the built-in version. 000e689 (CMake: don't try to use bundled zlib when the system's path is in the cache, 2013-05-12) tried to fix that, but it actually made the problem worse: now with ZLIB_LIBRARY cached, _neither_ of the blocks would execute, resulting in a linker error for me when trying to build such a doubly-configured setup. To fix the issue, we just trust CMake to do the right thing. If ZLIB_LIBRARY is set (either from user or cache) then the find_library in FindZLIB.cmake will use that instead of searching again. So we can unconditionally (for real this time) call FIND_PACKAGE(ZLIB), and just check its result. --- CMakeLists.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index bdc46d0b3..34d56b3fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,17 +136,15 @@ IF(WIN32 OR AMIGA) ENDIF() # Optional external dependency: zlib -IF(NOT ZLIB_LIBRARY) - # It's optional, but FIND_PACKAGE gives a warning that looks more like an - # error. - FIND_PACKAGE(ZLIB QUIET) -ENDIF() +# It's optional, but FIND_PACKAGE gives a warning that looks more like an +# error. +FIND_PACKAGE(ZLIB QUIET) IF (ZLIB_FOUND) INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS}) LINK_LIBRARIES(${ZLIB_LIBRARIES}) # Fake the message CMake would have shown MESSAGE("-- Found zlib: ${ZLIB_LIBRARY}") -ELSEIF (NOT ZLIB_LIBRARY) +ELSE() MESSAGE( "zlib was not found; using bundled 3rd-party sources." ) INCLUDE_DIRECTORIES(deps/zlib) ADD_DEFINITIONS(-DNO_VIZ -DSTDC -DNO_GZIP) -- cgit v1.2.1