[cmake] Enable static building

OSS Fuzz strongly recommends static linking for tests [1]. Patch enables
static linking for a fuzzing test added in commit
2ad1469612 ("Add fuzzer for
certificate_data_set_pem()").

1. https://google.github.io/oss-fuzz/further-reading/fuzzer-environment/#runtime-dependencies
This commit is contained in:
Sergey Bronnikov
2023-05-17 19:44:04 +03:00
committed by akallabeth
parent 9b355c3b0c
commit 3cbef821c0

View File

@@ -199,6 +199,11 @@ if (BUILD_FUZZERS)
set(BUILD_TESTING ON)
if (BUILD_SHARED_LIBS STREQUAL "OFF")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(CMAKE_CXX_FLAGS "-static ${CMAKE_CXX_FLAGS}")
endif()
# A special target with fuzzer and sanitizer flags.
add_library(fuzzer_config INTERFACE)