From 0b924611352b3fbf6c00257d1ecbf36396bdb0d9 Mon Sep 17 00:00:00 2001 From: Giovanni Simoni Date: Fri, 6 Dec 2024 10:43:05 +0100 Subject: [PATCH] cmake: assert non-empty FUZZ_LDFLAGS when FUZZ=ON The invocation of cmake with -DFUZZ=ON will produce an error: set_target_properties called with incorrect number of arguments. The error is due to the fact that the FUZZ_LDFLAGS variable needs to be defined and non-empty to be correctly supplied in the set_target_properties() invocations that follow the introduced assertion. See also: https://cmake.org/cmake/help/latest/command/set_target_properties.html --- fuzz/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fuzz/CMakeLists.txt b/fuzz/CMakeLists.txt index ca272bb9..0bf4bfbf 100644 --- a/fuzz/CMakeLists.txt +++ b/fuzz/CMakeLists.txt @@ -18,6 +18,10 @@ set(FUZZ_LINKER_LANGUAGE "C" CACHE STRING "Linker language for fuzz harnesses") mark_as_advanced(FUZZ_LINKER_LANGUAGE) enable_language(${FUZZ_LINKER_LANGUAGE}) +if(NOT FUZZ_LDFLAGS) + message(FATAL_ERROR "Please define FUZZ_LDFLAGS") +endif() + # fuzz_cred add_executable(fuzz_cred fuzz_cred.c ${COMMON_SOURCES} ${COMPAT_SOURCES}) set_target_properties(fuzz_cred PROPERTIES