Skip to content

Commit 7c987ec

Browse files
committed
cmake: Call enable_testing() unconditionally
This change simplifies the code. Also comments has been added to highlight the code structure.
1 parent 6aa5765 commit 7c987ec

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

CMakeLists.txt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.15)
77
cmake_policy(SET CMP0092 NEW)
88
endif()
99

10+
#=============================
11+
# Project / Package metadata
12+
#=============================
1013
project(libsecp256k1
1114
# The package (a.k.a. release) version is based on semantic versioning 2.0.0 of
1215
# the API. All changes in experimental modules are treated as
@@ -16,6 +19,8 @@ project(libsecp256k1
1619
HOMEPAGE_URL "https://github.com/bitcoin-core/secp256k1"
1720
LANGUAGES C
1821
)
22+
enable_testing()
23+
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
1924

2025
if(CMAKE_VERSION VERSION_LESS 3.21)
2126
# Emulates CMake 3.21+ behavior.
@@ -37,11 +42,15 @@ set(${PROJECT_NAME}_LIB_VERSION_CURRENT 4)
3742
set(${PROJECT_NAME}_LIB_VERSION_REVISION 1)
3843
set(${PROJECT_NAME}_LIB_VERSION_AGE 2)
3944

45+
#=============================
46+
# Language setup
47+
#=============================
4048
set(CMAKE_C_STANDARD 90)
4149
set(CMAKE_C_EXTENSIONS OFF)
4250

43-
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
44-
51+
#=============================
52+
# Configurable options
53+
#=============================
4554
option(BUILD_SHARED_LIBS "Build shared libraries." ON)
4655
option(SECP256K1_DISABLE_SHARED "Disable shared library. Overrides BUILD_SHARED_LIBS." OFF)
4756
if(SECP256K1_DISABLE_SHARED)
@@ -269,10 +278,6 @@ if(SECP256K1_BUILD_CTIME_TESTS)
269278
unset(msan_enabled)
270279
endif()
271280

272-
if(SECP256K1_BUILD_BENCHMARK OR SECP256K1_BUILD_TESTS OR SECP256K1_BUILD_EXHAUSTIVE_TESTS OR SECP256K1_BUILD_CTIME_TESTS OR SECP256K1_BUILD_EXAMPLES)
273-
enable_testing()
274-
endif()
275-
276281
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.")
277282
if(SECP256K1_APPEND_CFLAGS)
278283
# Appending to this low-level rule variable is the only way to

0 commit comments

Comments
 (0)