diff options
author | Dimitry Andric <dimitry@andric.com> | 2023-05-09 16:59:45 +0200 |
---|---|---|
committer | Dimitry Andric <dimitry@andric.com> | 2023-05-09 17:38:50 +0200 |
commit | 3d9cb5e0c6b36bf7e226890515088259180de212 (patch) | |
tree | 7168e4729eca90fb4d8a8cb4b64c51872fdc6bd2 | |
parent | 251408cfd4ff8112efaa5c82ec81c9574c4bf022 (diff) | |
download | libgit2-3d9cb5e0c6b36bf7e226890515088259180de212.tar.gz |
Work around -Werror problems when detecting qsort variants
If `ENABLE_WERROR` is on, the CMake configure tests for the `qsort_r`
and `qsort_s` variants may fail due to warnings about unused functions
or unused parameters. These warnings can be ignored, so disable them
specifically for running those tests.
-rw-r--r-- | src/CMakeLists.txt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index de591e4e4..db0fd10c7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -58,6 +58,13 @@ add_feature_info(futimens GIT_USE_FUTIMENS "futimens support") # qsort +# for these tests, temporarily save CMAKE_C_FLAGS and disable warnings about +# unused functions and parameters, otherwise they will always fail if +# ENABLE_WERROR is on +set(SAVED_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") +disable_warnings(unused-function) +disable_warnings(unused-parameter) + # old-style FreeBSD qsort_r() has the 'context' parameter as the first argument # of the comparison function: check_prototype_definition(qsort_r @@ -82,6 +89,9 @@ check_prototype_definition(qsort_s "void (qsort_s)(void *base, size_t num, size_t width, int (*compare )(void *, const void *, const void *), void *context)" "" "stdlib.h" GIT_QSORT_S_MSC) +# restore CMAKE_C_FLAGS +set(CMAKE_C_FLAGS "${SAVED_CMAKE_C_FLAGS}") + # random / entropy data check_function_exists(getentropy GIT_RAND_GETENTROPY) |