summaryrefslogtreecommitdiff
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
* cmake: Sort source files for reproducible buildspks/cmake-sort-reproducible-buildsPatrick Steinhardt2020-05-151-0/+2
| | | | | | | | | | | We currently use `FILE(GLOB ...)` in most places to find source and header files. This is problematic in that the order of files returned depends on the operating system's directory iteration order and may thus not be deterministic. As a result, we link object files in unspecified order, which may cause the linker to emit different code across runs. Fix this issue by sorting all code used as input to the libgit2 library to improve the reliability of reproducible builds.
* cmake: streamline backend detectionPatrick Steinhardt2020-04-013-86/+61
| | | | | | | We're currently doing unnecessary work to auto-detect backends even if the functionality is disabled altogether. Let's fix this by removing the extraneous FOO_BACKEND variables, instead letting auto-detection modify the variable itself.
* cmake: use install directories provided via GNUInstallDirsPatrick Steinhardt2020-03-141-5/+3
| | | | | | | | | | | | | | | | | | | | | | | We currently hand-code logic to configure where to install our artifacts via the `LIB_INSTALL_DIR`, `INCLUDE_INSTALL_DIR` and `BIN_INSTALL_DIR` variables. This is reinventing the wheel, as CMake already provide a way to do that via `CMAKE_INSTALL_<DIR>` paths, e.g. `CMAKE_INSTALL_LIB`. This requires users of libgit2 to know about the discrepancy and will require special hacks for any build systems that handle these variables in an automated way. One such example is Gentoo Linux, which sets up these paths in both the cmake and cmake-utils eclass. So let's stop doing that: the GNUInstallDirs module handles it in a better way for us, especially so as the actual values are dependent on CMAKE_INSTALL_PREFIX. This commit removes our own set of variables and instead refers users to use the standard ones. As a second benefit, this commit also fixes our pkgconfig generation to use the GNUInstallDirs module. We had a bug there where we ignored the CMAKE_INSTALL_PREFIX when configuring the libdir and includedir keys, so if libdir was set to "lib64", then libdir would be an invalid path. With GNUInstallDirs, we can now use `CMAKE_INSTALL_FULL_LIBDIR`, which handles the prefix for us.
* Merge pull request #5422 from pks-t/pks/cmake-booleansEdward Thomson2020-03-064-0/+29
|\ | | | | CMake booleans
| * cmake: sanitize boolean options passed by userPatrick Steinhardt2020-02-244-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Starting with our conversions to mix backend-autodetection and selection into a single variable (USE_GSSAPI, USE_HTTPS, USE_SHA1), we have introduced a simple STREQUAL to check for "ON", which indicates that the user wants us to auto-detect available backends and pick any one that's available. This behaviour deviates from previous behaviour, as passing a value like "yes", "on" or "true" will in fact be treated like a backend name and result in autodetection failure. Fix the issue by introducing a new function `SanitizeBool`. Given a variable that may hold a boolean value, the function will sanitize that variable to hold either "ON" or "OFF". In case it is not a recognized boolean, we will just keep the value as-is. This fixes the above described issue.
* | Fix #5410: fix installing libgit2.pc in wrong locationTomasz Kłoczko2020-02-191-35/+4
|/ | | | | | | | Remove using custom PKG_BUILD_PREFIu, PKG_BUILD_LIBDIR and PKG_BUILD_INCLUDEDIR variables. Use cmake CMAKE_INSTALL_PREFIX, LIB_INSTALL_DIR, INCLUDE_INSTALL_DIR instead. This patch fixes install libgit2.pc file in correct location and simpifies cmake module.
* gssapi: show information about disabled GSSAPIEdward Thomson2020-01-241-1/+1
| | | | | | When USE_GSSAPI=OFF, still show information about what SPNEGO is, even though it's disabled. This is for parity with other disabled features like SSH and debugpool that still show details about what is disabled.
* Merge pull request #5238 from tiennou/feature/macos-gssPatrick Steinhardt2019-10-172-0/+81
|\ | | | | macOS GSS Support
| * negotiate: use GSS.framework on macOSEtienne Samson2019-10-132-0/+81
| |
* | cmake: correct the link stanza for CoreFoundationEtienne Samson2019-10-131-1/+1
|/ | | | | | | | LIBRARIES is the (absolute?) path to the library. LDFLAGS is the full linker stanza to correctly link with this lib. By passing LIBRARIES as LIBGIT_LIBS, the linker ends up with the absolute path for the SDK'ed version of CoreFoundation (which doesn't exist), instead of the familiar `-framework CoreFoundation`.
* Merge pull request #5226 from pks-t/pks/regexp-apiEdward Thomson2019-09-281-3/+2
|\ | | | | regexp: implement a new regular expression API
| * posix: remove superseded POSIX regex wrappersPatrick Steinhardt2019-09-211-3/+2
| | | | | | | | | | | | The old POSIX regex wrappers have been superseded by our own regexp API that provides a higher-level abstraction. Remove the POSIX wrappers in favor of the new one.
* | cmake: streamline *.pc file handling via a moduleEtienne Samson2019-09-141-0/+110
|/
* cmake: fix various misuses of MESSAGE()Patrick Steinhardt2019-09-134-7/+7
| | | | | | | | | | The MESSAGE() function expects as first argument the message type, e.g. STATUS or FATAL_ERROR. In some places, we were misusing this to either not provide any type, which would then erroneously print the message to standard error, or to use FATAL instead of FATAL_ERROR. Fix all of these instances. Also, remove some MESSAGE invocations that are obvious leftovers from debugging the build system.
* cmake: properly abort if no mbedTLS cert location is foundPatrick Steinhardt2019-09-131-1/+1
| | | | | | | | | | | | When using mbedTLS as backend, then the user may specify the location of where system certificates are installed. If no such location is provided by the user, CMake will try to autodetect the location by using the openssl executable, if installed. If no location could be detected, then the mbedTLS is essentially worthless as it is completely unable to verify any certificates. To avoid use of such misconfigured mbedTLS configurations, let's error out if we were unable to find out the location.
* cmake: remove extraneous loggingEtienne Samson2019-09-101-2/+0
|
* cmake: include SHA1 headers into our source filesPatrick Steinhardt2019-07-181-6/+6
| | | | | | | | | | | | When selecting the SHA1 backend, we only include the respective C implementation of the selected backend. But since commit bd48bf3fb (hash: introduce source files to break include circles, 2019-06-14), we have introduced separate headers and compilation units for all hashes. So by not including the headers, we may not honor them to compute whether a file needs to be recompiled and they also will not be displayed in IDEs. Add the header files to fix this problem.
* cmake: report whether we are using sub-second stat informationPatrick Steinhardt2019-07-111-0/+6
| | | | | | | | | | Depending on the platform and on build options, we may or may not build libgit2 with support for nanoseconds when using `stat` calls. It's currently unclear though whether sub-second stat information is used at all. Add feature info for this to tell at configure time whether it's being used or not.
* Merge pull request #4438 from pks-t/pks/hash-algorithmPatrick Steinhardt2019-06-271-4/+6
|\ | | | | Multiple hash algorithms
| * hash: move SHA1 implementations into 'sha1/' folderPatrick Steinhardt2019-06-241-6/+6
| | | | | | | | | | | | | | | | | | | | | | As we will include additional hash algorithms in the future due to upstream git discussing a move away from SHA1, we should accomodate for that and prepare for the move. As a first step, move all SHA1 implementations into a common subdirectory. Also, create a SHA1-specific header file that lives inside the hash folder. This header will contain the SHA1-specific header includes, function declarations and the SHA1 context structure.
| * hash: introduce source files to break include circlesPatrick Steinhardt2019-06-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The hash source files have circular include dependencies right now, which shows by our broken generic hash implementation. The "hash.h" header declares two functions and the `git_hash_ctx` typedef before actually including the hash backend header and can only declare the remaining hash functions after the include due to possibly static function declarations inside of the implementation includes. Let's break this cycle and help maintainability by creating a real implementation file for each of the hash implementations. Instead of relying on the exact include order, we now especially avoid the use of `GIT_INLINE` for function declarations.
* | win32: support upgrading warnings to errors (/WX)Edward Thomson2019-06-241-1/+5
|/ | | | | | | | | | | For MSVC, support warnings as errors by providing the /WX compiler flags. (/WX is the moral equivalent of -Werror.) Disable warnings as errors ass part of xdiff, since it contains warnings. But as a component of git itself, we want to avoid skew and keep our implementation as similar as possible to theirs. We'll work with upstream to fix these issues, but in the meantime, simply let those continue to warn.
* cmake: Modulize our TLS & hash detectionEtienne Samson2019-06-142-0/+190
| | | | | | | | | | | | | | | The interactions between `USE_HTTPS` and `SHA1_BACKEND` have been streamlined. Previously we would have accepted not quite working configurations (like, `-DUSE_HTTPS=OFF -DSHA1_BACKEND=OpenSSL`) and, as the OpenSSL detection only ran with `USE_HTTPS`, the link would fail. The detection was moved to a new `USE_SHA1`, modeled after `USE_HTTPS`, which takes the values "CollisionDetection/Backend/Generic", to better match how the "hashing backend" is selected, the default (ON) being "CollisionDetection". Note that, as `SHA1_BACKEND` is still used internally, you might need to check what customization you're using it for.
* regex: optionally use PCRE2Edward Thomson2019-05-191-0/+38
| | | | | | | Use PCRE2 and its POSIX compatibility layer if requested by the user. Although PCRE2 is adequate for our needs, the PCRE2 POSIX layer as installed on Debian and Ubuntu systems is broken, so we do not opt-in to it by default to avoid breaking users on those platforms.
* regex: use system PCRE if availableEdward Thomson2019-05-191-0/+38
| | | | | Attempt to locate a system-installed version of PCRE and use its POSIX compatibility layer, if possible.
* fix typocheese12019-04-071-1/+1
|
* Make ENABLE_WERROR actually worklhchavez2019-01-102-10/+9
| | | | | | | | | | | This change explicitly adds -Werror to the CFLAGS. Due to the way that the ADD_C_FLAG_IF_SUPPORTED() macro was mangling the flag name to convert it into a define name, any warning that had a dash in its name was not being correctly enabled. Additionally, any flag that is enabled implicitly by the compiler (like -Wunused-result and -Wdeprecated-declarations) would not cause an error unless they were explicitly enabled with the ENABLE_WARNINGS() macro.
* util: make the qsort_r check work on macOSEtienne Samson2018-08-242-0/+125
| | | | | | | | This performs a compile-check by using CMake support, to differentiate the GNU version from the BSD version of qsort_r. Module taken from 4f252abea5f1d17c60f6ff115c9c44cc0b6f1df6, which I've checked against CMake 2.8.11.
* cmake: detect and use libc-provided iconvPatrick Steinhardt2018-08-241-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While most systems provide a separate iconv library against which applications can link, musl based systems do not provide such a library. Instead, iconv functions are directly included in the C library. As our current CMake module to locate the iconv library only checks whether a library exists somewhere in the typical library directories, we will never build libgit2 with libiconv support on such systems. Extend the iconv module to also search whether libc provides iconv functions, which we do by checking whether the `iconv_open` function exists inside of libc. If this is the case, we will default to use the libc provided one instead of trying to use a separate libiconv. While this changes which iconv we use on systems where both libc and an external libiconv exist, to the best of my knowledge common systems only provide either one or the other. Note that libiconv support in musl is held kind of basic. To quote musl libc's page on functional differences from glibc [1]: The iconv implementation musl is very small and oriented towards being unobtrusive to static link. Its character set/encoding coverage is very strong for its size, but not comprehensive like glibc’s. As we assume iconv to be a lot more capable than what musl provides, some of our tests will fail if using iconv on musl-based platforms. [1]: https://wiki.musl-libc.org/functional-differences-from-glibc.html
* cmake: error out if required C flags are not supportedPatrick Steinhardt2018-08-031-1/+13
| | | | | | | We do want to notify users compiling our source code early on if they try to use C flags which aren't supported. Add a new macro `AddCFlag`, which results in a fatal error in case the flag is not supported, and use it for our fuzzing flags.
* cmake: resolve libraries found by pkg-configPatrick Steinhardt2018-05-091-0/+28
| | | | | | | | | | | | | | | | | | | Libraries found by CMake modules are usually handled with their full path. This makes linking against those libraries a lot more robust when it comes to libraries in non-standard locations, as otherwise we might mix up libraries from different locations when link directories are given. One excemption are libraries found by PKG_CHECK_MODULES. Instead of returning libraries with their complete path, it will return the variable names as well as a set of link directories. In case where multiple sets of the same library are installed in different locations, this can lead the compiler to link against the wrong libraries in the end, when link directories of other dependencies are added. To fix this shortcoming, we need to manually resolve library paths returned by CMake against their respective library directories. This is an easy task to do with `FIND_LIBRARY`.
* mbedtls: initial supportEtienne Samson2018-04-111-0/+93
|
* cmake: move ENABLE_WARNINGS to a moduleethomson/cmake_fixesEdward Thomson2018-02-051-0/+14
|
* cmake: Move IDE source munging to a moduleEdward Thomson2018-02-021-0/+22
| | | | | Move the odd code that provides a hierarchical display for projects within the IDEs to its own module.
* cmake: move nanosecond detection to a moduleEdward Thomson2018-02-021-0/+20
| | | | Move the nanosecond detection in time structures to its own module.
* cmake: make our macOS helpers more CMake-yEtienne Samson2017-10-232-14/+50
|
* cmake: fix indentation before enhancingEtienne Samson2017-10-232-12/+12
|
* Don't search iconv in /opt/localJiří Techet2015-05-011-3/+0
| | | | | | | Since OpenSSL isn't used any more on OS X, there is no dependency on any MacPorts library under /opt/local and there is no danger of conflicts between MacPorts and system iconv. For this reason the system iconv can always be used now.
* Add a SecureTransport TLS channelCarlos Martín Nieto2015-04-232-0/+18
| | | | | As an alternative to OpenSSL when we're on OS X. This one can actually take advantage of stacking the streams.
* Find libssh2 via pkg-configcmn/pkg-config-sshCarlos Martín Nieto2014-12-051-44/+0
| | | | | | 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.
* Add GSSAPI support for SPNEGO/Kerberos auth over HTTPEdward Thomson2014-08-151-0/+324
|
* Introduce AddCFlagIfSupported CMake macroJacques Germishuys2014-04-191-0/+16
|
* We never search for libiconv via pkg-configSascha Cunz2014-01-301-1/+1
| | | | | So we actually also never know that we can set a dependency on it in pkg-config. Instead always give it the -L and -l options.
* Find and use a MacPorts version of libiconv. Fixes #2017.Sascha Cunz2014-01-301-2/+10
| | | | | | | - Add correct -I, -L and -l flags - Search for libiconv in /opt/local/[include|lib] before in the system path. See #2017 for details. - Give splitted -L and -l arguments to pkg-config
* Cleanup FindIconv.cmakeSascha Cunz2014-01-301-12/+5
| | | | | Doesn't change anything. Just removes stuff that was probably missed to remove when this was imported.
* Improve iconv finding for cmakeRussell Belfer2013-12-021-0/+42
| | | | | | * add FindIconv helper for CMake iconv detection * only default using iconv to ON for MacOS * update pkg-config generation to include iconv dependency better
* Build with the system's http-parser installation if availableVeeti Paananen2013-05-301-0/+39
|
* Changed case of FindLibSSH2.cmake to FindLIBSSH2.cmakeBrad Morgan2013-05-151-0/+0
|
* Renamed FindLibSSH2.cmakeBrad Morgan2013-05-151-0/+0
|
* Added libssh2 cmake moduleBrad Morgan2013-05-071-0/+44