Skip to content

Commit c12bc01

Browse files
committed
cmake: Fix passing SECP256K1_APPEND_CFLAGS to clang-cl
This change also makes the compile invocation string more natural by ensuring flags do not follow source files. Linker flags are also amended for consistency.
1 parent 0be7d3d commit c12bc01

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,13 @@ if(CMAKE_GENERATOR MATCHES "Make|Ninja")
286286
# guarantee that the flags appear at the end of the command line.
287287
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.")
288288
if(SECP256K1_APPEND_CFLAGS)
289-
string(APPEND CMAKE_C_COMPILE_OBJECT " ${SECP256K1_APPEND_CFLAGS}")
289+
string(REPLACE "<FLAGS>" "<FLAGS> ${SECP256K1_APPEND_CFLAGS}" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")
290290
endif()
291291

292292
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.")
293293
if(SECP256K1_APPEND_LDFLAGS)
294-
string(APPEND CMAKE_C_CREATE_SHARED_LIBRARY " ${SECP256K1_APPEND_LDFLAGS}")
295-
string(APPEND CMAKE_C_LINK_EXECUTABLE " ${SECP256K1_APPEND_LDFLAGS}")
294+
string(REPLACE "<LINK_FLAGS>" "<LINK_FLAGS> ${SECP256K1_APPEND_LDFLAGS}" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}")
295+
string(REPLACE "<LINK_FLAGS>" "<LINK_FLAGS> ${SECP256K1_APPEND_LDFLAGS}" CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE}")
296296
endif()
297297
endif()
298298

0 commit comments

Comments
 (0)