Commit c1172468 by Edward Thomson

cmake: provide empty experimental.h for non-cmake users

Not everybody builds libgit2 using cmake; provide an `experimental.h`
with no experiments configured for those that do not. To support this,
we also now create compile definitions for experimental functionality,
to supplant that empty `experimental.h`. cmake will continue to generate
the proper `experimental.h` file for use with `make install`.
parent c8d5b43b
# Experimental feature support for libgit2 - developers can opt in to
# experimental functionality, like sha256 support. When experimental
# functionality is enabled, we set both a cmake flag *and* a compile
# definition. The cmake flag is used to generate `experimental.h`,
# which will be installed by a `make install`. But the compile definition
# is used by the libgit2 sources to detect the functionality at library
# build time. This allows us to have an in-tree `experimental.h` with
# *no* experiments enabled. This lets us support users who build without
# cmake and cannot generate the `experimental.h` file.
if(EXPERIMENTAL_SHA256)
add_feature_info("SHA256 API" ON "experimental SHA256 APIs")
set(EXPERIMENTAL 1)
set(GIT_EXPERIMENTAL_SHA256 1)
add_compile_definitions(GIT_EXPERIMENTAL_SHA256)
else()
add_feature_info("SHA256 API" OFF "experimental SHA256 APIs")
endif()
......
/*
* Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_experimental_h__
#define INCLUDE_experimental_h__
/*
* This file exists to support users who build libgit2 with a bespoke
* build system and do not use our cmake configuration. Normally, cmake
* will create `experimental.h` from the `experimental.h.in` file and
* will include the generated file instead of this one. For non-cmake
* users, we bundle this `experimental.h` file which will be used
* instead.
*/
#endif
/*
* Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_experimental_h__
#define INCLUDE_experimental_h__
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment