Skip to content

Commit 203376c

Browse files
build: add CMake option for disabling symbol visibility attributes
Co-authored-by: Tim Ruffing <me@real-or-random.org>
1 parent 57b520d commit 203376c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ endif()
4242

4343
option(SECP256K1_INSTALL "Enable installation." ${PROJECT_IS_TOP_LEVEL})
4444

45+
option(SECP256K1_ENABLE_API_VISIBILITY_ATTRIBUTES "Enable visibility attributes in the API." ON)
46+
4547
## Modules
4648

4749
# We declare all options before processing them, to make sure we can express
@@ -312,6 +314,7 @@ else()
312314
set(cross_status "FALSE")
313315
endif()
314316
message("Cross compiling ....................... ${cross_status}")
317+
message("Visibility attributes ................. ${SECP256K1_ENABLE_VISIBILITY_ATTRIBUTES}")
315318
message("Valgrind .............................. ${SECP256K1_VALGRIND}")
316319
get_directory_property(definitions COMPILE_DEFINITIONS)
317320
string(REPLACE ";" " " definitions "${definitions}")

src/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ add_library(secp256k1_precomputed OBJECT EXCLUDE_FROM_ALL
5454
# from being exported.
5555
target_sources(secp256k1 PRIVATE secp256k1.c $<TARGET_OBJECTS:secp256k1_precomputed>)
5656

57+
if(NOT SECP256K1_ENABLE_VISIBILITY_ATTRIBUTES)
58+
target_compile_definitions(secp256k1 PRIVATE SECP256K1_NO_VISIBILITY_ATTRIBUTES)
59+
endif()
60+
5761
# Create a helper lib that parent projects can use to link secp256k1 into a
5862
# static lib.
5963
add_library(secp256k1_objs INTERFACE)

0 commit comments

Comments
 (0)