Skip to content

Commit

Permalink
cmake: Move FUZZ_BINARY_LINKS_WITHOUT_MAIN_FUNCTION check
Browse files Browse the repository at this point in the history
This change ensures that this check log won't be printed in between of
the secp256k1's and Bitcoin Core's summaries.
  • Loading branch information
hebasto committed Jul 2, 2024
1 parent 2296161 commit 2995f0f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,17 @@ if(SANITIZERS)
endif()
target_link_options(sanitize_interface INTERFACE ${SANITIZER_LDFLAGS})

if(BUILD_FUZZ_BINARY)
include(CheckSourceCompilesAndLinks)
check_cxx_source_links_with_flags("${SANITIZER_LDFLAGS}" "
#include <cstdint>
#include <cstddef>
extern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { return 0; }
// No main() function.
" FUZZ_BINARY_LINKS_WITHOUT_MAIN_FUNCTION
)
endif()

include(AddBoostIfNeeded)
add_boost_if_needed()

Expand Down
8 changes: 0 additions & 8 deletions src/test/fuzz/util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ target_link_libraries(test_fuzz
Boost::headers
)

include(CheckSourceCompilesAndLinks)
check_cxx_source_links_with_flags("${SANITIZER_LDFLAGS}" "
#include <cstdint>
#include <cstddef>
extern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { return 0; }
// No main() function.
" FUZZ_BINARY_LINKS_WITHOUT_MAIN_FUNCTION
)
if(NOT FUZZ_BINARY_LINKS_WITHOUT_MAIN_FUNCTION)
target_compile_definitions(test_fuzz PRIVATE PROVIDE_FUZZ_MAIN_FUNCTION)
endif()

0 comments on commit 2995f0f

Please sign in to comment.