Skip to content

Commit 2c4b229

Browse files
committed
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.
1 parent ea929c0 commit 2c4b229

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ endif()
386386
target_link_options(sanitize_interface INTERFACE ${SANITIZER_LDFLAGS})
387387

388388
if(BUILD_FUZZ_BINARY)
389+
target_link_libraries(core_interface INTERFACE ${FUZZ_LIBS})
389390
include(CheckSourceCompilesWithFlags)
390391
check_cxx_source_compiles_with_flags("
391392
#include <cstdint>
@@ -394,6 +395,7 @@ if(BUILD_FUZZ_BINARY)
394395
// No main() function.
395396
" FUZZ_BINARY_LINKS_WITHOUT_MAIN_FUNCTION
396397
LDFLAGS ${SANITIZER_LDFLAGS}
398+
LINK_LIBRARIES ${FUZZ_LIBS}
397399
)
398400
endif()
399401

0 commit comments

Comments
 (0)