cmake: Add SECP256K1_LATE_CFLAGS
configure option
This commit is contained in:
parent
1f33bb2b1c
commit
42f8c51402
@ -217,9 +217,14 @@ if(SECP256K1_BUILD_BENCHMARK OR SECP256K1_BUILD_TESTS OR SECP256K1_BUILD_EXHAUST
|
|||||||
enable_testing()
|
enable_testing()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(SECP256K1_LATE_CFLAGS "" CACHE STRING "Compiler flags that are added to the command line after all other flags added by the build system.")
|
||||||
|
include(AllTargetsCompileOptions)
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
all_targets_compile_options(src "${SECP256K1_LATE_CFLAGS}")
|
||||||
if(SECP256K1_BUILD_EXAMPLES)
|
if(SECP256K1_BUILD_EXAMPLES)
|
||||||
add_subdirectory(examples)
|
add_subdirectory(examples)
|
||||||
|
all_targets_compile_options(examples "${SECP256K1_LATE_CFLAGS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message("\n")
|
message("\n")
|
||||||
@ -292,6 +297,9 @@ else()
|
|||||||
message(" - LDFLAGS for executables ............ ${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
message(" - LDFLAGS for executables ............ ${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
||||||
message(" - LDFLAGS for shared libraries ....... ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
|
message(" - LDFLAGS for shared libraries ....... ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
|
||||||
endif()
|
endif()
|
||||||
|
if(SECP256K1_LATE_CFLAGS)
|
||||||
|
message("SECP256K1_LATE_CFLAGS ................. ${SECP256K1_LATE_CFLAGS}")
|
||||||
|
endif()
|
||||||
message("\n")
|
message("\n")
|
||||||
if(SECP256K1_EXPERIMENTAL)
|
if(SECP256K1_EXPERIMENTAL)
|
||||||
message(
|
message(
|
||||||
|
12
cmake/AllTargetsCompileOptions.cmake
Normal file
12
cmake/AllTargetsCompileOptions.cmake
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Add compile options to all targets added in the subdirectory.
|
||||||
|
function(all_targets_compile_options dir options)
|
||||||
|
get_directory_property(targets DIRECTORY ${dir} BUILDSYSTEM_TARGETS)
|
||||||
|
separate_arguments(options)
|
||||||
|
set(compiled_target_types STATIC_LIBRARY SHARED_LIBRARY OBJECT_LIBRARY EXECUTABLE)
|
||||||
|
foreach(target ${targets})
|
||||||
|
get_target_property(type ${target} TYPE)
|
||||||
|
if(type IN_LIST compiled_target_types)
|
||||||
|
target_compile_options(${target} PRIVATE ${options})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endfunction()
|
Loading…
x
Reference in New Issue
Block a user