diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2022-09-19 05:38:56 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2022-09-19 06:34:51 -0400 |
commit | c11724686c145e8074d46b2289e2a857613ea4a2 (patch) | |
tree | 5bb93ce4e334fb9b9043468cd7a477a65a96b80c /cmake | |
parent | c8d5b43bbcf0bb04d0d20602248c0eb905b2c81f (diff) | |
download | libgit2-c11724686c145e8074d46b2289e2a857613ea4a2.tar.gz |
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`.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/ExperimentalFeatures.cmake | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cmake/ExperimentalFeatures.cmake b/cmake/ExperimentalFeatures.cmake index f23bfe376..57a66e68d 100644 --- a/cmake/ExperimentalFeatures.cmake +++ b/cmake/ExperimentalFeatures.cmake @@ -1,8 +1,19 @@ +# 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() |