File tree 2 files changed +20
-0
lines changed
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -217,9 +217,14 @@ if(SECP256K1_BUILD_BENCHMARK OR SECP256K1_BUILD_TESTS OR SECP256K1_BUILD_EXHAUST
217
217
enable_testing ()
218
218
endif ()
219
219
220
+ set (SECP256K1_LATE_CFLAGS "" CACHE STRING "Compiler flags that are added to the command line after all other flags added by the build system." )
221
+ include (AllTargetsCompileOptions)
222
+
220
223
add_subdirectory (src)
224
+ all_targets_compile_options(src "${SECP256K1_LATE_CFLAGS} " )
221
225
if (SECP256K1_BUILD_EXAMPLES)
222
226
add_subdirectory (examples)
227
+ all_targets_compile_options(examples "${SECP256K1_LATE_CFLAGS} " )
223
228
endif ()
224
229
225
230
message ("\n " )
@@ -292,6 +297,9 @@ else()
292
297
message (" - LDFLAGS for executables ............ ${CMAKE_EXE_LINKER_FLAGS_DEBUG} " )
293
298
message (" - LDFLAGS for shared libraries ....... ${CMAKE_SHARED_LINKER_FLAGS_DEBUG} " )
294
299
endif ()
300
+ if (SECP256K1_LATE_CFLAGS)
301
+ message ("SECP256K1_LATE_CFLAGS ................. ${SECP256K1_LATE_CFLAGS} " )
302
+ endif ()
295
303
message ("\n " )
296
304
if (SECP256K1_EXPERIMENTAL)
297
305
message (
Original file line number Diff line number Diff line change
1
+ # Add compile options to all targets added in the subdirectory.
2
+ function (all_targets_compile_options dir options )
3
+ get_directory_property (targets DIRECTORY ${dir} BUILDSYSTEM_TARGETS)
4
+ separate_arguments (options )
5
+ set (compiled_target_types STATIC_LIBRARY SHARED_LIBRARY OBJECT_LIBRARY EXECUTABLE)
6
+ foreach (target ${targets} )
7
+ get_target_property (type ${target} TYPE )
8
+ if (type IN_LIST compiled_target_types)
9
+ target_compile_options (${target} PRIVATE ${options} )
10
+ endif ()
11
+ endforeach ()
12
+ endfunction ()
You can’t perform that action at this time.
0 commit comments