Skip to content

Commit 1a56bff

Browse files
committed
build: Disable some targets when external callbacks are enabled
The benchmarks, constant-time tests and examples are not supposed to be built when external callbacks are enabled.
1 parent 09df0bf commit 1a56bff

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,12 @@ if(SECP256K1_VALGRIND)
150150
endif()
151151
endif()
152152

153-
option(SECP256K1_BUILD_BENCHMARK "Build benchmarks." ON)
153+
include(CMakeDependentOption)
154+
cmake_dependent_option(SECP256K1_BUILD_BENCHMARK "Build benchmarks." ON "NOT SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS" OFF)
154155
option(SECP256K1_BUILD_TESTS "Build tests." ON)
155156
option(SECP256K1_BUILD_EXHAUSTIVE_TESTS "Build exhaustive tests." ON)
156-
option(SECP256K1_BUILD_CTIME_TESTS "Build constant-time tests." ${SECP256K1_VALGRIND})
157-
option(SECP256K1_BUILD_EXAMPLES "Build examples." OFF)
157+
cmake_dependent_option(SECP256K1_BUILD_CTIME_TESTS "Build constant-time tests." ${SECP256K1_VALGRIND} "NOT SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS" OFF)
158+
cmake_dependent_option(SECP256K1_BUILD_EXAMPLES "Build examples." ON "NOT SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS" OFF)
158159

159160
# Redefine configuration flags.
160161
# We leave assertions on, because they are only used in the examples, and we want them always on there.

configure.ac

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ AC_ARG_ENABLE(external_default_callbacks,
189189
AS_HELP_STRING([--enable-external-default-callbacks],[enable external default callback functions [default=no]]), [],
190190
[SECP_SET_DEFAULT([enable_external_default_callbacks], [no], [no])])
191191

192+
if test x"$enable_external_default_callbacks" = x"yes"; then
193+
enable_benchmark="no"
194+
enable_ctime_tests="no"
195+
enable_examples="no"
196+
fi
197+
192198
# Test-only override of the (autodetected by the C code) "widemul" setting.
193199
# Legal values are:
194200
# * int64 (for [u]int64_t),

0 commit comments

Comments
 (0)