CMakeLists.txt


Log

Author Commit Date CI Message
Patrick Steinhardt f05f90d8 2017-09-15T10:28:32 cmake: fix linker error with dbghelper library When the MSVC_CRTDBG option is set by the developer, we will link in the dbghelper library to enable memory lead detection in MSVC projects. We are doing so by adding it to the variable `CMAKE_C_STANDARD_LIBRARIES`, so that it is linked for every library and executable built by CMake. But this causes our builds to fail with a linker error: ``` LINK: fatal error LNK1104: cannot open file 'advapi32.lib;Dbghelp.lib' ``` The issue here is that we are treating the variable as if it were an array of libraries by setting it via the following command: ``` SET(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES}" "Dbghelp.lib") ``` The generated build commands will then simply stringify the variable, concatenating all the contained libraries with a ";". This causes the observed linking failure. To fix the issue, we should just treat the variabable as a simple string. So instead of adding multiple members, we just add the "Dbghelp.lib" library to the existing string, separated by a space character.
Patrick Steinhardt a64532e1 2017-06-13T11:05:09 cmake: disable optimization on debug builds While our debug builds on MSVC platforms already tune the code optimizer to aid debugging code, all the other platforms still use the default optimization level. This makes it hard for developers on these platforms to actually debug code while maintaining his sanity due to optimizations like inlined code, elided variables etc. To help this common use case, we can simply follow the MSVC example and turn off code optimization with "-O0" for debug builds. While it would be preferable to instead use "-Og" supported by more modern compilers, we cannot guarantee that this level is available on all supported platforms.
Patrick Steinhardt 61399953 2017-06-13T11:03:38 cmake: set "-D_DEBUG" on non-Windows platforms In our code base, we have some occasions where we use the "_DEBUG" preprocessor macro to enable additional code which should not be part of release builds. While we define this flag on MSVC platforms, it is guarded by the conditional `WIN32 AND NOT CYGWIN` on other platforms since 19be3f9e6 (Improve MSVC compiler, linker flags, 2013-02-13). While this condition can be fulfilled by the MSVC platform, it is never encountered due to being part of the `ELSE` part of `IF (MSVC)`. The intention of the conditional was most likely to avoid the preprocessor macro on Cygwin platforms, but to include it on everthing else. As such, the correct condition here would be `IF (NOT CYGWIN)` instead. But digging a bit further, the condition is only ever used in two places: 1. To skip the test in "core::structinit", which should also work on Cygwin. 2. In "src/win32/git2.rc", where it is used to set additional file flags. As this file is included in MSVC builds only, it cannot cause any harm to set "_DEBUG" on Cygwin here. As such, we can simply drop the conditional and always set "-D_DEBUG" on all platforms.
Patrick Steinhardt e94be4c0 2017-06-13T11:08:19 cmake: remove stale comment on precompiled headers In commit 9f75a9ce7 (Turning on runtime checks when building debug under MSVC., 2012-03-30), we introduced a comment "Precompiled headers", which actually refers to no related commands. Seeing that the comment never had anything to refer to, we can simply remove it here.
Patrick Steinhardt db1abffa 2017-06-07T14:59:38 sha1dc: do not use standard includes The updated SHA1DC library allows us to use custom includes instead of using standard includes. Due to requirements with cross-platform, we provide some custom system includes files like for example the "stdint.h" file on Win32. Because of this, we want to make sure to avoid breaking cross-platform compatibility when SHA1DC is enabled. To use the new mechanism, we can simply define `SHA1DC_NO_STANDARD_INCLUDES`. Furthermore, we can specify custom include files via two defines, which we now use to include our "common.h" header.
Edward Thomson f218508f 2017-06-07T10:54:48 ctest: temporarily disable UNC path tests (Temporarily) disable UNC path tests to work around AppVeyor issues.
Patrick Steinhardt a4de1ae3 2017-04-25T10:14:19 cmake: define GIT_HTTPS when HTTPS is supported
Edward Thomson 9f128d2a 2017-03-02T20:56:47 cmake: drop unset `SHA1_TYPE` We never set `SHA1_TYPE` to `builtin`. Don't bother testing for it.
Edward Thomson 2dfd1294 2017-02-24T13:34:01 hash: include sha1collisiondetection Include the SHA1 collision attack detection library from https://github.com/cr-marcstevens/sha1collisiondetection
Edward Thomson a371a8ae 2017-02-24T13:03:15 hash: rename implementation selection constants
Patrick Steinhardt a02e8a38 2017-03-01T13:58:15 cmake: only enable supported compiler warning flags We currently unconditionally enable the "-Wall" and "-Wextra" flags. Some platforms rely on compilers which do not support these flags, though. One of these platforms is Haiku, which does not support "-Wextra" due to being stuck on GCC version 2. Fix builds on such platforms by adding these flags only if supported by the compiler.
Elliot Saba e56e4c76 2016-12-30T17:59:47 CMakeLists: Move `http-parser` block down by `zlib`, update error message
Elliot Saba 236a690c 2016-11-20T22:46:01 Allow Windows with WinHTTP to use external http-parser
Arthur Schreiber 36117978 2016-10-06T18:30:30 Fix the existence check for `regcomp_l`. `xlocale.h` only defines `regcomp_l` if `regex.h` was included as well. Also change the test cases to actually test `p_regcomp` works with a multibyte locale.
Arthur Schreiber ab96ca55 2016-10-06T13:15:31 Make sure we use the `C` locale for `regcomp` on macOS.
Patrick Steinhardt 528b2f7d 2016-09-05T13:24:07 cmake: add curl library path The `PKG_CHECK_MODULES` function searches a pkg-config module and then proceeds to set various variables containing information on how to link to the library. In contrast to the `FIND_PACKAGE` function, the library path set by `PKG_CHECK_MODULES` will not necessarily contain linking instructions with a complete path to the library, though. So when a library is not installed in a standard location, the linker might later fail due to being unable to locate it. While we already honor this when configuring libssh2 by adding `LIBSSH2_LIBRARY_DIRS` to the link directories, we fail to do so for libcurl, preventing us to build libgit2 on e.g. FreeBSD. Fix the issue by adding the curl library directory to the linker search path.
Patrick Steinhardt b6a2fd0e 2016-06-20T11:09:49 cmake: do not use -fPIC for MSYS2 The MSYS2 build system automatically compiles all code with position-independent code. When we manually add the -fPIC flag to the compiler flags, MSYS2 will loudly complain about PIC being the default and thus not required. Fix the annoyance by stripping -fPIC in MSYS2 enviroments like it is already done for MinGW.
Edward Thomson 0aaba445 2016-06-01T11:33:58 Merge pull request #3796 from mmuman/haiku Preliminary Haiku port
Elan Ruusamäe 13b0b7d5 2016-05-27T10:20:35 Update CMakeLists.txt typo fix
François Revol d94f5037 2016-05-22T23:23:58 CMakeLists: Add libnetwork for Haiku
Edward Thomson 097b0761 2016-04-29T10:18:04 cmake: include threading libraries in pkg-config Include any required threading libraries in our `libgit2.pc`.
Carlos Martín Nieto b8353236 2016-04-19T10:50:30 CI: run proxy tests with ctest Running clar directly on appveyor makes it think the command returned failure, so it stops the tests. Running it via ctest lets it go through.
Sebastian Schuberth 035430b7 2016-03-24T14:10:29 CMakeLists: Further improve the error messages regarding CMAKE_SIZEOF_VOID_P
Sebastian Schuberth f9601e6f 2016-03-23T20:37:39 CMakeLists: Show the pointer size for an unsupported architecture Showing the pointer size gives a hint as to why we think this is an unsupported architecture.
Edward Thomson 3a43677e 2016-03-18T06:37:04 Merge pull request #3660 from mstrap/mingw MinGW builds should optionally create DLLs without "lib" prefix
Marc Strapetz 059f33bf 2016-03-15T18:32:37 Option "LIBGIT2_PREFIX" to set the CMAKE's TARGET_PROPERTIES PREFIX This is especially useful in combination with MinGW to yield the Windows-compliant DLL name "git2.dll" instead of "libgit2.dll"
Marc Strapetz 08f030ce 2016-03-15T18:20:32 CMake: do not overwrite but only append to CMAKE_C_FLAGS_DEBUG This is useful to force "smart" IDEs (like CLIon) to use debug flag -g even it may have decided that "-D_DEBUG" (which is already present) is sufficient.
Edward Thomson 2d880712 2016-03-03T15:08:12 Enable nanosecond resolution by default Nanosecond resolution is now the default in git itself. Enable this as our default as well.
Carlos Martín Nieto ba9bb664 2016-03-03T19:21:07 tests: create a ctest target for cred_callback
Edward Thomson 6cc4bac8 2016-02-28T11:31:10 Merge pull request #3577 from rossdylan/rossdylan/pooldebug Add a new build flag to disable the pool allocator
Edward Thomson 3d6a42d1 2016-02-25T11:23:19 nsec: support NDK's crazy nanoseconds Android NDK does not have a `struct timespec` in its `struct stat` for nanosecond support, instead it has a single nanosecond member inside the struct stat itself. We will use that and use a macro to expand to the `st_mtim` / `st_mtimespec` definition on other systems (much like the existing `st_mtime` backcompat definition).
Ross Delinger ed0571f8 2016-01-12T16:08:38 Add a new build flag to disable the pool allocator and pass all git_pool_malloc calls straight to git__malloc
Arthur Schreiber 8a0133c0 2016-01-05T19:07:27 Add winhttp dependencies to pc file.
Sebastian Schuberth 0878ca9b 2015-10-07T10:31:07 CMakeLists: Compare CMAKE_SIZEOF_VOID_P as a number, not as a string
Jacques Germishuys eb11fac6 2015-11-20T18:57:13 Detect stat's structure
Carlos Martín Nieto 75a0ccf5 2015-11-12T19:53:09 Merge pull request #3170 from CmdrMoozy/nsec_fix git_index_entry__init_from_stat: set nsec fields in entry stats
Edward Thomson 7208ff4d 2015-10-22T20:17:19 cmake: split sources into original paths for Xcode and MSVC The MSVC_SPLIT_SOURCES function is helpful for other IDEs, like Xcode, and will split the source files up into their target directories, instead of merely placing them all in a "Sources" directory. Rename MSVC_SPLIT_SOURCES to IDE_SPLIT_SOURCES and enable it for Xcode.
Edward Thomson ac7e50dd 2015-10-14T08:30:51 Merge pull request #3453 from libgit2/cmn/warn-python CMake: be more explicit with python errors
Carlos Martín Nieto e3f94c71 2015-10-06T13:35:45 CMake: be more explicit with python errors There's been a few reports of users not understanding what the python error means, so spell out the options they have.
Axel Rasmussen c7b17fb5 2015-10-01T18:01:32 Merge branch 'master' into nsec_fix_next
Carlos Martín Nieto ba1a5553 2015-09-30T17:44:10 Merge pull request #3446 from ethomson/portability portability: use `CHECK_FUNCTION_EXISTS` for checking whether functions exist...
Edward Thomson e683d152 2015-09-30T05:49:04 qsort_r/qsort_s: detect their support
Edward Thomson 8649dfd8 2015-09-29T13:36:37 p_futimes: support using futimens when available
Axel Rasmussen 360dd4da 2015-06-23T10:02:48 win32: define our own POSIX struct stat, and support USE_NSEC
Axel Rasmussen c963fe1d 2015-06-23T09:05:49 cmake: fix CMake code organization problem
Axel Rasmussen e9e6df2c 2015-06-15T09:28:55 cmake: Only provide USE_NSEC if struct stat members are avilable. This allows us to remove OS checks from source code, instead relying on CMake to detect whether or not `struct stat` has the nanoseconds members we rely on.
Axel Rasmussen e7de893e 2015-06-01T13:43:54 cmake: add USE_NSEC, and only check nanosec m/ctime if enabled
Dominique Leuenberger 5540d9db 2015-09-10T16:11:10 pkg-config: fix directory references in libgit2.pc Before: libdir=/usr//usr/lib64 includedir=/usr//usr/include After: libdir=/usr/lib64 includedir=/usr/include (note the duplication of /usr in the before case)
Carlos Martín Nieto 01fe8374 2015-09-03T13:35:15 Revert "Get rid of libssh2 embedding" The embedding was removed as a libssh2 release with Windows crypto support became available, but dependencies are still annoying so this ahs been requested again. This reverts commit 20dcb7315cd4c5760c68402998fd9e5a6bf5505d.
Carlos Martín Nieto b445940e 2015-08-19T12:53:31 CMake: fall back to OpenSSL on older OS X Starting at OS X 10.8, the Security framework offers some functions which are unified across OS X and iOS. These are the functions that we use. Older versions of OS X do not have these functions and we fail to compile. In these situations, fall back to using OpenSSL for our TLS stream instead.
Slava Karpenko c27b4afc 2015-08-06T11:06:17 Forcing libssh2 lib location OS X may have libssh2 in diff locations, so CHECK_LIBRARY_EXISTS may check the wrong lib; forcing it to use a found directory.
Ben Chatelain 2da64edb 2015-07-27T18:28:29 Add -Wdocumentation flag if supported
Edward Thomson a522d8c1 2015-07-11T17:35:59 Merge pull request #3292 from tkelman/patch-1 Increase required version of cmake to 2.8
Tony Kelman 37c84dc5 2015-07-05T10:07:48 Increase required version of cmake to 2.8
Jeff Hostetler 93b42728 2015-06-09T14:38:30 Include stacktrace summary in memory leak output.
Carlos Martín Nieto fd2d11a1 2015-06-28T13:57:06 CMake: treat the ld flags as a list These are treated as a list by CMake itself, which means that treating them as a simple string can put semicolons in our ld command-line if we have libraries which are not installed on the standard locations. Treat the variable as a CMake list and replace it with the space-delimited list just before writing it out to our pc file.
Carlos Martín Nieto 790cabf0 2015-06-26T13:51:41 pc: Put libcurl and libssh2 in Libs.private Pass on to whoever wants to link to libgit2 statically the flags that we would have used for these libraries. Putting them in Requires.private as we do now makes pkg-config put their dependencies in the linker arguments as well, which is not what we want.
Arthur Schreiber 65f2d155 2015-06-25T21:49:48 List `libcurl` in the generated `libgit2.pc`
Carlos Martín Nieto cf9d5f76 2015-06-03T04:57:00 curl: find and link with the library if it's available by default
Marius Ungureanu e488bef4 2015-06-19T12:53:37 Quote LIBSSH2_LIBRARIES call Credits to @directhex It is possible for PKG_CHECK_MODULES(LIBSSH2 libssh2) to LIBSSH2_LIBRARIES to a string with more than one library in it - e.g. if your libssh2 was built against libgcrypt, it will be "ssh2;gcrypt" Quoting the string is needed, or CHECK_LIBRARY_EXISTS will fail.
Michał Górny 1679ec12 2015-05-24T18:27:15 cmake: Add CMake check for libssh2 memory credential passing support
Carlos Martín Nieto 20dcb731 2015-05-12T11:33:45 Get rid of libssh2 embedding It was added as a workaround while the project had code to use WinCNG but had not made a release with it. There is now a release of libssh2 with WinCNG support, so this option is redundant. Let's get rid of it before people start liking it too much.
Carlos Martín Nieto 25f355cb 2015-05-06T18:39:39 Merge pull request #3086 from yongthecoder/master Android build doesn't need deps/regex
Arthur Schreiber 7a5c7559 2015-05-05T22:36:24 Ensure frameworks are mentioned in libgit2.pc When building on Mac OS X, the `CoreFoundation` and `Security` frameworks where missing from `Libs.private` in the generated `libgit2.pc` file.
Yong Li 57aa839c 2015-05-04T09:41:34 Android build doesn't need deps/regex deps/regex was included in Android build because Android NDK 4 has a packaging bug and doesn't have the regular expression functions defined in its libc.so. The bug has been fixed in subsequent Android NDK releases. If it is still necessary to work around the bug in Android NDK 4, we should consider to use an option like ANDROID_NDK_RELEASE or ANDROID_NDK_RELEASE_NUM.
Carlos Martín Nieto 24e53d2f 2015-03-19T09:55:20 Rename GIT_SSL to GIT_OPENSSL This is what it's meant all along, but now we actually have multiple implementations, it's clearer to use the name of the library.
Carlos Martín Nieto 6bb54cbf 2014-11-02T13:23:32 Add a SecureTransport TLS channel As an alternative to OpenSSL when we're on OS X. This one can actually take advantage of stacking the streams.
Jeff Hostetler d06c589f 2015-04-10T06:15:06 Add MSVC CRTDBG memory leak reporting.
Tony Kelman b631e0d9 2015-03-19T07:25:25 Use swprintf_s everywhere except mingw.org
Tony Kelman 547517d7 2015-03-16T14:49:23 use a different .def file for 64 bit
Tony Kelman d612e48e 2015-03-16T13:30:10 Fix out-of-tree build link against crypt32 for CertFreeCertificateContext
Philip Kelley 8f426d7d 2014-06-09T11:43:25 Win32: Enable WinHTTP for MinGW
Tony Kelman 06353282 2015-03-05T15:48:08 Only run -ionline tests IF (WINHTTP OR OPENSSL_FOUND)
Jeff Hostetler 9a859ef5 2015-03-02T09:21:55 Added cl_perf_timer. Updated global trace to include timers.
Jeff Hostetler 6b5c0886 2015-02-13T16:58:14 Provide mechanism to let CLAR globally setup git_trace()
Leo Yang 2d2aa1ff 2015-02-13T17:28:35 Fix Mac build without OpenSSL If OpenSSL is disabled on Mac the SHA1 implementation goes to the CommonCrypto from the system. In this case we should not include the generic hash impl. Otherwise there would be duplicated impls which fail the build.
Carlos Martín Nieto 5a2a5771 2015-02-12T00:34:48 Merge pull request #2845 from rakuco/libssh2-detection-fix Add libssh2's library and include directories.
Yury G. Kudryashov e15a0849 2015-02-04T00:15:11 Tell user if libssh was not found Fixes #2665
Raphael Kubo da Costa 461fd5a0 2015-01-24T16:15:12 Add libssh2's library and include directories. Follow-up to 4f91bfa ("Find libssh2 via pkg-config"): FindPkgConfig sets <foo>_INCLUDE_DIRS, not <foo>_INCLUDE_DIR like FindLIBSSH2 did. Additionally, if using only FindPkgConfig to find libssh2, we have to call LINK_DIRECTORIES() as well to pass the appropriate -L entries, otherwise the build will only work if libssh2.so is in a directory searched automatically by the linker.
Leo Yang 7641327c 2015-01-13T16:53:07 Add option to turn off OpenSSL
Edward Thomson 6e1205ef 2014-12-22T12:40:04 cmake: include FindPkgConfig for windows Apparently FindPkgConfig is not included by default on VS builds, only Unix and Unix-like (mingw) builds.
Carlos Martín Nieto 4f91bfa3 2014-12-05T10:32:59 Find libssh2 via pkg-config We don't really need our own module to find libssh2. Using pkg-config lets the standard tool do the work for us and let us fit more naturally in the workflow as we respect the pkg-config search paths.
Carlos Martín Nieto 79b0ae4e 2014-10-27T10:30:57 Flip THREADSAFE's default to ON Threads are here to stay; and for a while now, users have had to call the initialization function which sets up threads and crypto regardless of whether the library was built threadsafe or not.
Edward Thomson a747ea49 2014-10-24T14:01:13 Merge pull request #2647 from ethomson/clar_tmpname clar: use a custom temp directory name
Edward Thomson 29eed1c7 2014-10-24T10:50:57 clar: use a custom temp directory name
Carlos Martín Nieto d9c0dbb0 2014-10-24T13:29:11 hash: use CommonCrypto on OSX for SHA-1 OSX has its own cryptographic library, let's make use of it instead of calling out to OpenSSL.
Carlos Martín Nieto 3753110a 2014-06-17T15:37:21 Provide option to embed libssh2
Edward Thomson 23135afa 2014-08-14T11:52:20 Introduce proper http authentication API
Edward Thomson 315cb38e 2014-07-31T18:43:20 Add GSSAPI support for SPNEGO/Kerberos auth over HTTP
Carlos Martín Nieto 00b8c216 2014-06-30T23:18:37 ssh: always declare the libssh2 types This lets a user decide they do want to use keyboard-interactive after they've compiled.
Carlos Martín Nieto eac63e67 2014-06-30T10:03:36 ssh: create the right callback signature based on build options When linking against libssh2, create the transport.h such that it contains its definition for custom crypto and keyboard-interactive callbacks. If we don't link against libssh2, create an equivalent signature which has void pointers instead of pointers to libssh2 structures. This would be one way to fix #2438.
Carlos Martín Nieto 99807672 2014-06-08T19:42:54 Change SOVERSION at API breaks Since the SOVERSION doesn't need to follow the library's version and simply needs to be monotonically increasing whenever we release something that breaks the ABI, we can set some number and allow multiple versions of the library to be installed side-by-side. We start here with the minor version as that's what we release for now, and it allows to backport this change to earlier versions.
Jeff King 6bcb0987 2014-05-08T00:35:56 cmake: s/ICONV/Iconv/ in FIND_PACKAGE The cmake module we provide is in the file FindIconv.cmake, so we must match the case correctly. It happens to work in practice because we only turn on ICONV on Darwin, and people generally have case-insensitive filesystems there. Note that we only need to update the package name here. The package itself still sets the all-uppercase ICONV_FOUND flag, so we continue to use uppercase in the rest of cmake.
Russell Belfer cd424ad5 2014-04-28T16:39:53 Add GIT_STATUS_OPT_UPDATE_INDEX and use trace API This adds an option to refresh the stat cache while generating status. It also rips out the GIT_PERF stuff I had an makes use of the trace API to keep statistics about what happens during diff.
Russell Belfer 240f4af3 2014-04-28T14:04:29 Add build option for diff internal statistics
Vicent Marti 9d878fc4 2014-05-01T01:23:10 Merge pull request #2304 from jacquesg/solaris Solaris!
Jacques Germishuys 98b8fcff 2014-04-29T20:45:02 Build regex.c for Solaris. Added required defines for Solaris
Carlos Martín Nieto f5fc63bc 2014-04-30T10:55:58 Don't exclude libssh2 from MinGW It reportedly works. It does not however work when cross-compiling on Travis, so let's disable it there. This fixes #2311.
Ting-Wei Lan 096ac799 2014-02-13T22:38:23 Workaround missing .pc files on FreeBSD This fixes #2118
Carlos Martín Nieto 04739e9f 2014-04-30T10:15:44 Unquiet CMake output The point of this phase is to know what we have and not. Show the user a clear indication of what we have.