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.
This commit is contained in:
Hennadii Stepanov 2025-02-20 12:41:44 +00:00
parent ea929c0848
commit 2c4b229c90
No known key found for this signature in database
GPG key ID: 410108112E7EA81F

View file

@ -386,6 +386,7 @@ endif()
target_link_options(sanitize_interface INTERFACE ${SANITIZER_LDFLAGS}) target_link_options(sanitize_interface INTERFACE ${SANITIZER_LDFLAGS})
if(BUILD_FUZZ_BINARY) if(BUILD_FUZZ_BINARY)
target_link_libraries(core_interface INTERFACE ${FUZZ_LIBS})
include(CheckSourceCompilesWithFlags) include(CheckSourceCompilesWithFlags)
check_cxx_source_compiles_with_flags(" check_cxx_source_compiles_with_flags("
#include <cstdint> #include <cstdint>
@ -394,6 +395,7 @@ if(BUILD_FUZZ_BINARY)
// No main() function. // No main() function.
" FUZZ_BINARY_LINKS_WITHOUT_MAIN_FUNCTION " FUZZ_BINARY_LINKS_WITHOUT_MAIN_FUNCTION
LDFLAGS ${SANITIZER_LDFLAGS} LDFLAGS ${SANITIZER_LDFLAGS}
LINK_LIBRARIES ${FUZZ_LIBS}
) )
endif() endif()