Skip to content

Commit 4c57c7a

Browse files
Merge #1554: cmake: Clean up testing code
7c987ec cmake: Call `enable_testing()` unconditionally (Hennadii Stepanov) 6aa5765 cmake: Delete `CTest` module (Hennadii Stepanov) Pull request description: 1. Delete `CTest` module. The `CTest` module handles `CDash` integration, which we do not use. It is not required for testing functionality. 2. Clean up cases when to invoke `enable_testing()` The `enable_testing()` command invocation is required for `add_test()` commands, which are used only for `{noverify_}tests`, `exhaustive_tests` and examples. ACKs for top commit: real-or-random: utACK 7c987ec theStack: ACK 7c987ec Tree-SHA512: f2628a4c4363b86f7c49d705df192e76368997e3f01cb736fcc272330bbf481af023d29d9faec17878d3bf74e4d265870cd93953406ae4612cd717811f22dd1a
2 parents 472faaa + 7c987ec commit 4c57c7a

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

CMakeLists.txt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
cmake_minimum_required(VERSION 3.16)
22

3+
#=============================
4+
# Project / Package metadata
5+
#=============================
36
project(libsecp256k1
47
# The package (a.k.a. release) version is based on semantic versioning 2.0.0 of
58
# the API. All changes in experimental modules are treated as
@@ -9,6 +12,8 @@ project(libsecp256k1
912
HOMEPAGE_URL "https://github.com/bitcoin-core/secp256k1"
1013
LANGUAGES C
1114
)
15+
enable_testing()
16+
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
1217

1318
if(CMAKE_VERSION VERSION_LESS 3.21)
1419
# Emulates CMake 3.21+ behavior.
@@ -30,11 +35,15 @@ set(${PROJECT_NAME}_LIB_VERSION_CURRENT 4)
3035
set(${PROJECT_NAME}_LIB_VERSION_REVISION 2)
3136
set(${PROJECT_NAME}_LIB_VERSION_AGE 2)
3237

38+
#=============================
39+
# Language setup
40+
#=============================
3341
set(CMAKE_C_STANDARD 90)
3442
set(CMAKE_C_EXTENSIONS OFF)
3543

36-
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
37-
44+
#=============================
45+
# Configurable options
46+
#=============================
3847
option(BUILD_SHARED_LIBS "Build shared libraries." ON)
3948
option(SECP256K1_DISABLE_SHARED "Disable shared library. Overrides BUILD_SHARED_LIBS." OFF)
4049
if(SECP256K1_DISABLE_SHARED)
@@ -262,13 +271,6 @@ if(SECP256K1_BUILD_CTIME_TESTS)
262271
unset(msan_enabled)
263272
endif()
264273

265-
include(CTest)
266-
# We do not use CTest's BUILD_TESTING because a single toggle for all tests is too coarse for our needs.
267-
mark_as_advanced(BUILD_TESTING)
268-
if(SECP256K1_BUILD_BENCHMARK OR SECP256K1_BUILD_TESTS OR SECP256K1_BUILD_EXHAUSTIVE_TESTS OR SECP256K1_BUILD_CTIME_TESTS OR SECP256K1_BUILD_EXAMPLES)
269-
enable_testing()
270-
endif()
271-
272274
set(SECP256K1_APPEND_CFLAGS "" CACHE STRING "Compiler flags that are appended to the command line after all other flags added by the build system. This variable is intended for debugging and special builds.")
273275
if(SECP256K1_APPEND_CFLAGS)
274276
# Appending to this low-level rule variable is the only way to

0 commit comments

Comments
 (0)