From 2c4b229c906de6250500d3af2b44808e90b9ce0b Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 20 Feb 2025 12:41:44 +0000 Subject: [PATCH] cmake: Introduce `FUZZ_LIBS` CMake distinguishes recommended methods for handling (1) linker options and (2) libraries used during linking. Therefore, it is both reasonable and consistent to introduce a dedicated variable for the latter, particularly when a build environment, such as OSS-Fuzz, requires linking against additional libraries. --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5945d38c44a..e637079de51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -386,6 +386,7 @@ endif() target_link_options(sanitize_interface INTERFACE ${SANITIZER_LDFLAGS}) if(BUILD_FUZZ_BINARY) + target_link_libraries(core_interface INTERFACE ${FUZZ_LIBS}) include(CheckSourceCompilesWithFlags) check_cxx_source_compiles_with_flags(" #include @@ -394,6 +395,7 @@ if(BUILD_FUZZ_BINARY) // No main() function. " FUZZ_BINARY_LINKS_WITHOUT_MAIN_FUNCTION LDFLAGS ${SANITIZER_LDFLAGS} + LINK_LIBRARIES ${FUZZ_LIBS} ) endif()