Skip to content

Commit 2f2ccc4

Browse files
committed
Merge #1600: cmake: Introduce SECP256K1_APPEND_LDFLAGS variable
421ed1b cmake: Introduce `SECP256K1_APPEND_LDFLAGS` variable (Hennadii Stepanov) Pull request description: ACKs for top commit: jonasnick: ACK 421ed1b Tree-SHA512: 044b84b86a98e30268189dc92c4b8045e146451f3849a9863eb8f99490df53f1f02ae0fc74d74dc6ede0ea0c55653c142f409c77e1967505a085f31e4c472443
2 parents 1988855 + 421ed1b commit 2f2ccc4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,14 @@ if(SECP256K1_APPEND_CFLAGS)
276276
string(APPEND CMAKE_C_COMPILE_OBJECT " ${SECP256K1_APPEND_CFLAGS}")
277277
endif()
278278

279+
set(SECP256K1_APPEND_LDFLAGS "" CACHE STRING "Linker 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.")
280+
if(SECP256K1_APPEND_LDFLAGS)
281+
# Appending to this low-level rule variable is the only way to
282+
# guarantee that the flags appear at the end of the command line.
283+
string(APPEND CMAKE_C_CREATE_SHARED_LIBRARY " ${SECP256K1_APPEND_LDFLAGS}")
284+
string(APPEND CMAKE_C_LINK_EXECUTABLE " ${SECP256K1_APPEND_LDFLAGS}")
285+
endif()
286+
279287
add_subdirectory(src)
280288
if(SECP256K1_BUILD_EXAMPLES)
281289
add_subdirectory(examples)
@@ -355,6 +363,9 @@ endif()
355363
if(SECP256K1_APPEND_CFLAGS)
356364
message("SECP256K1_APPEND_CFLAGS ............... ${SECP256K1_APPEND_CFLAGS}")
357365
endif()
366+
if(SECP256K1_APPEND_LDFLAGS)
367+
message("SECP256K1_APPEND_LDFLAGS .............. ${SECP256K1_APPEND_LDFLAGS}")
368+
endif()
358369
message("")
359370
if(print_msan_notice)
360371
message(

0 commit comments

Comments
 (0)