Skip to content

Commit 4706be2

Browse files
committed
cmake: Reimplement SECP256K1_APPEND_CFLAGS using Bitcoin Core approach
1 parent c2764db commit 4706be2

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,16 @@ if(SECP256K1_BUILD_BENCHMARK OR SECP256K1_BUILD_TESTS OR SECP256K1_BUILD_EXHAUST
284284
enable_testing()
285285
endif()
286286

287-
set(SECP256K1_APPEND_CFLAGS "" CACHE STRING "Compiler flags that are added to the command line after all other flags added by the build system.")
288-
include(AllTargetsCompileOptions)
287+
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.")
288+
if(SECP256K1_APPEND_CFLAGS)
289+
# Appending to this low-level rule variable is the only way to
290+
# guarantee that the flags appear at the end of the command line.
291+
string(APPEND CMAKE_C_COMPILE_OBJECT " ${SECP256K1_APPEND_CFLAGS}")
292+
endif()
289293

290294
add_subdirectory(src)
291-
all_targets_compile_options(src "${SECP256K1_APPEND_CFLAGS}")
292295
if(SECP256K1_BUILD_EXAMPLES)
293296
add_subdirectory(examples)
294-
all_targets_compile_options(examples "${SECP256K1_APPEND_CFLAGS}")
295297
endif()
296298

297299
message("\n")

cmake/AllTargetsCompileOptions.cmake

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)