File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 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
217217 enable_testing ()
218218endif ()
219219
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+
220223add_subdirectory (src)
224+ all_targets_compile_options(src "${SECP256K1_LATE_CFLAGS} " )
221225if (SECP256K1_BUILD_EXAMPLES)
222226 add_subdirectory (examples)
227+ all_targets_compile_options(examples "${SECP256K1_LATE_CFLAGS} " )
223228endif ()
224229
225230message ("\n " )
@@ -292,6 +297,9 @@ else()
292297 message (" - LDFLAGS for executables ............ ${CMAKE_EXE_LINKER_FLAGS_DEBUG} " )
293298 message (" - LDFLAGS for shared libraries ....... ${CMAKE_SHARED_LINKER_FLAGS_DEBUG} " )
294299endif ()
300+ if (SECP256K1_LATE_CFLAGS)
301+ message ("SECP256K1_LATE_CFLAGS ................. ${SECP256K1_LATE_CFLAGS} " )
302+ endif ()
295303message ("\n " )
296304if (SECP256K1_EXPERIMENTAL)
297305 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