Skip to content

Commit

Permalink
cmake: assert non-empty FUZZ_LDFLAGS when FUZZ=ON
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dacav committed Dec 6, 2024
1 parent 79e43f3 commit 0b92461
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fuzz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0b92461

Please sign in to comment.