From 09e8fd25b1a5411472564e599ad15059bbf9e8d6 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 20 Feb 2025 12:38:35 +0000 Subject: [PATCH 1/6] build: Don't override CMake's default try_compile target CMake assumes the default value internally, so overriding this causes problems. The minimal speedup of skipping the linker isn't worth the complexity of setting it to static. --- cmake/module/CheckSourceCompilesAndLinks.cmake | 13 ++----------- cmake/module/TestAppendRequiredLibraries.cmake | 4 ++-- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/cmake/module/CheckSourceCompilesAndLinks.cmake b/cmake/module/CheckSourceCompilesAndLinks.cmake index 88c897d5243..53d0617a905 100644 --- a/cmake/module/CheckSourceCompilesAndLinks.cmake +++ b/cmake/module/CheckSourceCompilesAndLinks.cmake @@ -6,15 +6,6 @@ include_guard(GLOBAL) include(CheckCXXSourceCompiles) include(CMakePushCheckState) -# This avoids running the linker. -set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) - -macro(check_cxx_source_links source) - set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE) - check_cxx_source_compiles("${source}" ${ARGN}) - set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) -endmacro() - macro(check_cxx_source_compiles_with_flags flags source) cmake_push_check_state(RESET) set(CMAKE_REQUIRED_FLAGS ${flags}) @@ -27,13 +18,13 @@ macro(check_cxx_source_links_with_flags flags source) cmake_push_check_state(RESET) set(CMAKE_REQUIRED_FLAGS ${flags}) list(JOIN CMAKE_REQUIRED_FLAGS " " CMAKE_REQUIRED_FLAGS) - check_cxx_source_links("${source}" ${ARGN}) + check_cxx_source_compiles("${source}" ${ARGN}) cmake_pop_check_state() endmacro() macro(check_cxx_source_links_with_libs libs source) cmake_push_check_state(RESET) set(CMAKE_REQUIRED_LIBRARIES "${libs}") - check_cxx_source_links("${source}" ${ARGN}) + check_cxx_source_compiles("${source}" ${ARGN}) cmake_pop_check_state() endmacro() diff --git a/cmake/module/TestAppendRequiredLibraries.cmake b/cmake/module/TestAppendRequiredLibraries.cmake index 5352102c7a4..c1030a641fe 100644 --- a/cmake/module/TestAppendRequiredLibraries.cmake +++ b/cmake/module/TestAppendRequiredLibraries.cmake @@ -26,7 +26,7 @@ function(test_append_socket_library target) ") include(CheckSourceCompilesAndLinks) - check_cxx_source_links("${check_socket_source}" IFADDR_LINKS_WITHOUT_LIBSOCKET) + check_cxx_source_compiles("${check_socket_source}" IFADDR_LINKS_WITHOUT_LIBSOCKET) if(NOT IFADDR_LINKS_WITHOUT_LIBSOCKET) check_cxx_source_links_with_libs(socket "${check_socket_source}" IFADDR_NEEDS_LINK_TO_LIBSOCKET) if(IFADDR_NEEDS_LINK_TO_LIBSOCKET) @@ -78,7 +78,7 @@ function(test_append_atomic_library target) ") include(CheckSourceCompilesAndLinks) - check_cxx_source_links("${check_atomic_source}" STD_ATOMIC_LINKS_WITHOUT_LIBATOMIC) + check_cxx_source_compiles("${check_atomic_source}" STD_ATOMIC_LINKS_WITHOUT_LIBATOMIC) if(STD_ATOMIC_LINKS_WITHOUT_LIBATOMIC) return() endif() From 88ee6800c9686931a1550b41fa634b0c6c3988a7 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 20 Feb 2025 12:38:55 +0000 Subject: [PATCH 2/6] cmake: Delete `check_cxx_source_links_with_flags` macro --- CMakeLists.txt | 2 +- cmake/module/CheckSourceCompilesAndLinks.cmake | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 279c3627913..86edfb628fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -387,7 +387,7 @@ target_link_options(sanitize_interface INTERFACE ${SANITIZER_LDFLAGS}) if(BUILD_FUZZ_BINARY) include(CheckSourceCompilesAndLinks) - check_cxx_source_links_with_flags("${SANITIZER_LDFLAGS}" " + check_cxx_source_compiles_with_flags("${SANITIZER_LDFLAGS}" " #include #include extern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { return 0; } diff --git a/cmake/module/CheckSourceCompilesAndLinks.cmake b/cmake/module/CheckSourceCompilesAndLinks.cmake index 53d0617a905..7a2751c2c7d 100644 --- a/cmake/module/CheckSourceCompilesAndLinks.cmake +++ b/cmake/module/CheckSourceCompilesAndLinks.cmake @@ -14,14 +14,6 @@ macro(check_cxx_source_compiles_with_flags flags source) cmake_pop_check_state() endmacro() -macro(check_cxx_source_links_with_flags flags source) - cmake_push_check_state(RESET) - set(CMAKE_REQUIRED_FLAGS ${flags}) - list(JOIN CMAKE_REQUIRED_FLAGS " " CMAKE_REQUIRED_FLAGS) - check_cxx_source_compiles("${source}" ${ARGN}) - cmake_pop_check_state() -endmacro() - macro(check_cxx_source_links_with_libs libs source) cmake_push_check_state(RESET) set(CMAKE_REQUIRED_LIBRARIES "${libs}") From 71bf8294a985d818a9d855390bd8503a9ae8074a Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 20 Feb 2025 12:39:03 +0000 Subject: [PATCH 3/6] cmake: Convert `check_cxx_source_compiles_with_flags` to a function --- CMakeLists.txt | 3 +- cmake/crc32c.cmake | 7 ++-- cmake/introspection.cmake | 12 ++++--- cmake/minisketch.cmake | 7 ++-- .../module/CheckSourceCompilesAndLinks.cmake | 35 +++++++++++++++---- 5 files changed, 48 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86edfb628fb..185ed4ed711 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -387,12 +387,13 @@ target_link_options(sanitize_interface INTERFACE ${SANITIZER_LDFLAGS}) if(BUILD_FUZZ_BINARY) include(CheckSourceCompilesAndLinks) - check_cxx_source_compiles_with_flags("${SANITIZER_LDFLAGS}" " + check_cxx_source_compiles_with_flags(" #include #include extern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { return 0; } // No main() function. " FUZZ_BINARY_LINKS_WITHOUT_MAIN_FUNCTION + LDFLAGS ${SANITIZER_LDFLAGS} ) endif() diff --git a/cmake/crc32c.cmake b/cmake/crc32c.cmake index 16fde7f95da..ec54e864c04 100644 --- a/cmake/crc32c.cmake +++ b/cmake/crc32c.cmake @@ -7,6 +7,7 @@ # buildsystem. include(CheckCXXSourceCompiles) +include(CheckSourceCompilesAndLinks) # Check for __builtin_prefetch support in the compiler. check_cxx_source_compiles(" @@ -42,7 +43,7 @@ if(MSVC) else() set(SSE42_CXXFLAGS -msse4.2) endif() -check_cxx_source_compiles_with_flags("${SSE42_CXXFLAGS}" " +check_cxx_source_compiles_with_flags(" #include #if defined(_MSC_VER) #include @@ -58,11 +59,12 @@ check_cxx_source_compiles_with_flags("${SSE42_CXXFLAGS}" " return l; } " HAVE_SSE42 + CXXFLAGS ${SSE42_CXXFLAGS} ) # Check for ARMv8 w/ CRC and CRYPTO extensions support in the compiler. set(ARM64_CRC_CXXFLAGS -march=armv8-a+crc+crypto) -check_cxx_source_compiles_with_flags("${ARM64_CRC_CXXFLAGS}" " +check_cxx_source_compiles_with_flags(" #include #include @@ -76,6 +78,7 @@ check_cxx_source_compiles_with_flags("${ARM64_CRC_CXXFLAGS}" " return 0; } " HAVE_ARM64_CRC32C + CXXFLAGS ${ARM64_CRC_CXXFLAGS} ) add_library(crc32c_common INTERFACE) diff --git a/cmake/introspection.cmake b/cmake/introspection.cmake index 29c93869a73..ec756207e21 100644 --- a/cmake/introspection.cmake +++ b/cmake/introspection.cmake @@ -164,7 +164,7 @@ if(NOT MSVC) # Check for SSE4.1 intrinsics. set(SSE41_CXXFLAGS -msse4.1) - check_cxx_source_compiles_with_flags("${SSE41_CXXFLAGS}" " + check_cxx_source_compiles_with_flags(" #include int main() @@ -175,12 +175,13 @@ if(NOT MSVC) return _mm_extract_epi32(r, 3); } " HAVE_SSE41 + CXXFLAGS ${SSE41_CXXFLAGS} ) set(ENABLE_SSE41 ${HAVE_SSE41}) # Check for AVX2 intrinsics. set(AVX2_CXXFLAGS -mavx -mavx2) - check_cxx_source_compiles_with_flags("${AVX2_CXXFLAGS}" " + check_cxx_source_compiles_with_flags(" #include int main() @@ -189,12 +190,13 @@ if(NOT MSVC) return _mm256_extract_epi32(l, 7); } " HAVE_AVX2 + CXXFLAGS ${AVX2_CXXFLAGS} ) set(ENABLE_AVX2 ${HAVE_AVX2}) # Check for x86 SHA-NI intrinsics. set(X86_SHANI_CXXFLAGS -msse4 -msha) - check_cxx_source_compiles_with_flags("${X86_SHANI_CXXFLAGS}" " + check_cxx_source_compiles_with_flags(" #include int main() @@ -205,12 +207,13 @@ if(NOT MSVC) return _mm_extract_epi32(_mm_sha256rnds2_epu32(i, j, k), 0); } " HAVE_X86_SHANI + CXXFLAGS ${X86_SHANI_CXXFLAGS} ) set(ENABLE_X86_SHANI ${HAVE_X86_SHANI}) # Check for ARMv8 SHA-NI intrinsics. set(ARM_SHANI_CXXFLAGS -march=armv8-a+crypto) - check_cxx_source_compiles_with_flags("${ARM_SHANI_CXXFLAGS}" " + check_cxx_source_compiles_with_flags(" #include int main() @@ -222,6 +225,7 @@ if(NOT MSVC) vsha256su1q_u32(a, b, c); } " HAVE_ARM_SHANI + CXXFLAGS ${ARM_SHANI_CXXFLAGS} ) set(ENABLE_ARM_SHANI ${HAVE_ARM_SHANI}) endif() diff --git a/cmake/minisketch.cmake b/cmake/minisketch.cmake index 7407739ed94..6feffa7d3a7 100644 --- a/cmake/minisketch.cmake +++ b/cmake/minisketch.cmake @@ -2,13 +2,15 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or https://opensource.org/license/mit/. +include(CheckSourceCompilesAndLinks) + # Check for clmul instructions support. if(MSVC) - set(CLMUL_CXXFLAGS) + set(CLMUL_CXXFLAGS "") else() set(CLMUL_CXXFLAGS -mpclmul) endif() -check_cxx_source_compiles_with_flags("${CLMUL_CXXFLAGS}" " +check_cxx_source_compiles_with_flags(" #include #include @@ -22,6 +24,7 @@ check_cxx_source_compiles_with_flags("${CLMUL_CXXFLAGS}" " return e == 0; } " HAVE_CLMUL + CXXFLAGS ${CLMUL_CXXFLAGS} ) add_library(minisketch_common INTERFACE) diff --git a/cmake/module/CheckSourceCompilesAndLinks.cmake b/cmake/module/CheckSourceCompilesAndLinks.cmake index 7a2751c2c7d..7967f38eded 100644 --- a/cmake/module/CheckSourceCompilesAndLinks.cmake +++ b/cmake/module/CheckSourceCompilesAndLinks.cmake @@ -6,13 +6,34 @@ include_guard(GLOBAL) include(CheckCXXSourceCompiles) include(CMakePushCheckState) -macro(check_cxx_source_compiles_with_flags flags source) - cmake_push_check_state(RESET) - set(CMAKE_REQUIRED_FLAGS ${flags}) - list(JOIN CMAKE_REQUIRED_FLAGS " " CMAKE_REQUIRED_FLAGS) - check_cxx_source_compiles("${source}" ${ARGN}) - cmake_pop_check_state() -endmacro() +#[=[ +Check once if C++ source code can be compiled. + +Options: + + CXXFLAGS - A list of additional flags to pass to the compiler. + + LDFLAGS - A list of additional flags to pass to the linker. + + LINK_LIBRARIES - A list of libraries to add to the link command. + +For historical reasons, among the CMake `CMAKE_REQUIRED_*` variables that influence +`check_cxx_source_compiles()`, only `CMAKE_REQUIRED_FLAGS` is a string rather than +a list. Additionally, `target_compile_options()` also expects a list of options. + +The `check_cxx_source_compiles_with_flags()` function handles this case and accepts +`CXXFLAGS` as a list, simplifying the code at the caller site. + +#]=] +function(check_cxx_source_compiles_with_flags source result_var) + cmake_parse_arguments(PARSE_ARGV 2 _ "" "" "CXXFLAGS;LDFLAGS;LINK_LIBRARIES") + list(JOIN __CXXFLAGS " " CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_LINK_OPTIONS ${__LDFLAGS}) + set(CMAKE_REQUIRED_LIBRARIES ${__LINK_LIBRARIES}) + include(CheckCXXSourceCompiles) + check_cxx_source_compiles("${source}" ${result_var}) + set(${result_var} ${${result_var}} PARENT_SCOPE) +endfunction() macro(check_cxx_source_links_with_libs libs source) cmake_push_check_state(RESET) From 8d238c1dfde28bbd38bfba84136900724c0d7d95 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 20 Feb 2025 12:39:12 +0000 Subject: [PATCH 4/6] cmake: Delete `check_cxx_source_links*` macros --- .../module/CheckSourceCompilesAndLinks.cmake | 9 ------ .../module/TestAppendRequiredLibraries.cmake | 28 +++++++++++-------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/cmake/module/CheckSourceCompilesAndLinks.cmake b/cmake/module/CheckSourceCompilesAndLinks.cmake index 7967f38eded..02bd7265bf7 100644 --- a/cmake/module/CheckSourceCompilesAndLinks.cmake +++ b/cmake/module/CheckSourceCompilesAndLinks.cmake @@ -3,8 +3,6 @@ # file COPYING or https://opensource.org/license/mit/. include_guard(GLOBAL) -include(CheckCXXSourceCompiles) -include(CMakePushCheckState) #[=[ Check once if C++ source code can be compiled. @@ -34,10 +32,3 @@ function(check_cxx_source_compiles_with_flags source result_var) check_cxx_source_compiles("${source}" ${result_var}) set(${result_var} ${${result_var}} PARENT_SCOPE) endfunction() - -macro(check_cxx_source_links_with_libs libs source) - cmake_push_check_state(RESET) - set(CMAKE_REQUIRED_LIBRARIES "${libs}") - check_cxx_source_compiles("${source}" ${ARGN}) - cmake_pop_check_state() -endmacro() diff --git a/cmake/module/TestAppendRequiredLibraries.cmake b/cmake/module/TestAppendRequiredLibraries.cmake index c1030a641fe..cb403f1e16d 100644 --- a/cmake/module/TestAppendRequiredLibraries.cmake +++ b/cmake/module/TestAppendRequiredLibraries.cmake @@ -25,10 +25,13 @@ function(test_append_socket_library target) } ") - include(CheckSourceCompilesAndLinks) + include(CheckCXXSourceCompiles) check_cxx_source_compiles("${check_socket_source}" IFADDR_LINKS_WITHOUT_LIBSOCKET) if(NOT IFADDR_LINKS_WITHOUT_LIBSOCKET) - check_cxx_source_links_with_libs(socket "${check_socket_source}" IFADDR_NEEDS_LINK_TO_LIBSOCKET) + include(CheckSourceCompilesAndLinks) + check_cxx_source_compiles_with_flags("${check_socket_source}" IFADDR_NEEDS_LINK_TO_LIBSOCKET + LINK_LIBRARIES socket + ) if(IFADDR_NEEDS_LINK_TO_LIBSOCKET) target_link_libraries(${target} INTERFACE socket) else() @@ -77,16 +80,17 @@ function(test_append_atomic_library target) } ") - include(CheckSourceCompilesAndLinks) + include(CheckCXXSourceCompiles) check_cxx_source_compiles("${check_atomic_source}" STD_ATOMIC_LINKS_WITHOUT_LIBATOMIC) - if(STD_ATOMIC_LINKS_WITHOUT_LIBATOMIC) - return() - endif() - - check_cxx_source_links_with_libs(atomic "${check_atomic_source}" STD_ATOMIC_NEEDS_LINK_TO_LIBATOMIC) - if(STD_ATOMIC_NEEDS_LINK_TO_LIBATOMIC) - target_link_libraries(${target} INTERFACE atomic) - else() - message(FATAL_ERROR "Cannot figure out how to use std::atomic.") + if(NOT STD_ATOMIC_LINKS_WITHOUT_LIBATOMIC) + include(CheckSourceCompilesAndLinks) + check_cxx_source_compiles_with_flags("${check_atomic_source}" STD_ATOMIC_NEEDS_LINK_TO_LIBATOMIC + LINK_LIBRARIES atomic + ) + if(STD_ATOMIC_NEEDS_LINK_TO_LIBATOMIC) + target_link_libraries(${target} INTERFACE atomic) + else() + message(FATAL_ERROR "Cannot figure out how to use std::atomic.") + endif() endif() endfunction() From ea929c0848e2d95a71439e1b3aa0cf350e12bc73 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 20 Feb 2025 12:39:20 +0000 Subject: [PATCH 5/6] scripted-diff: Rename CMake helper module -BEGIN VERIFY SCRIPT- git mv cmake/module/CheckSourceCompilesAndLinks.cmake cmake/module/CheckSourceCompilesWithFlags.cmake sed -i 's|\|CheckSourceCompilesWithFlags|g' $(git grep -l 'CheckSourceCompilesAndLinks') -END VERIFY SCRIPT- --- CMakeLists.txt | 2 +- cmake/crc32c.cmake | 2 +- cmake/introspection.cmake | 2 +- cmake/minisketch.cmake | 2 +- ...pilesAndLinks.cmake => CheckSourceCompilesWithFlags.cmake} | 0 cmake/module/TestAppendRequiredLibraries.cmake | 4 ++-- 6 files changed, 6 insertions(+), 6 deletions(-) rename cmake/module/{CheckSourceCompilesAndLinks.cmake => CheckSourceCompilesWithFlags.cmake} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 185ed4ed711..5945d38c44a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -386,7 +386,7 @@ endif() target_link_options(sanitize_interface INTERFACE ${SANITIZER_LDFLAGS}) if(BUILD_FUZZ_BINARY) - include(CheckSourceCompilesAndLinks) + include(CheckSourceCompilesWithFlags) check_cxx_source_compiles_with_flags(" #include #include diff --git a/cmake/crc32c.cmake b/cmake/crc32c.cmake index ec54e864c04..096ff792e40 100644 --- a/cmake/crc32c.cmake +++ b/cmake/crc32c.cmake @@ -7,7 +7,7 @@ # buildsystem. include(CheckCXXSourceCompiles) -include(CheckSourceCompilesAndLinks) +include(CheckSourceCompilesWithFlags) # Check for __builtin_prefetch support in the compiler. check_cxx_source_compiles(" diff --git a/cmake/introspection.cmake b/cmake/introspection.cmake index ec756207e21..d4ed4866b9c 100644 --- a/cmake/introspection.cmake +++ b/cmake/introspection.cmake @@ -160,7 +160,7 @@ check_cxx_source_compiles(" ) if(NOT MSVC) - include(CheckSourceCompilesAndLinks) + include(CheckSourceCompilesWithFlags) # Check for SSE4.1 intrinsics. set(SSE41_CXXFLAGS -msse4.1) diff --git a/cmake/minisketch.cmake b/cmake/minisketch.cmake index 6feffa7d3a7..102097aacb4 100644 --- a/cmake/minisketch.cmake +++ b/cmake/minisketch.cmake @@ -2,7 +2,7 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or https://opensource.org/license/mit/. -include(CheckSourceCompilesAndLinks) +include(CheckSourceCompilesWithFlags) # Check for clmul instructions support. if(MSVC) diff --git a/cmake/module/CheckSourceCompilesAndLinks.cmake b/cmake/module/CheckSourceCompilesWithFlags.cmake similarity index 100% rename from cmake/module/CheckSourceCompilesAndLinks.cmake rename to cmake/module/CheckSourceCompilesWithFlags.cmake diff --git a/cmake/module/TestAppendRequiredLibraries.cmake b/cmake/module/TestAppendRequiredLibraries.cmake index cb403f1e16d..e15c2b9934d 100644 --- a/cmake/module/TestAppendRequiredLibraries.cmake +++ b/cmake/module/TestAppendRequiredLibraries.cmake @@ -28,7 +28,7 @@ function(test_append_socket_library target) include(CheckCXXSourceCompiles) check_cxx_source_compiles("${check_socket_source}" IFADDR_LINKS_WITHOUT_LIBSOCKET) if(NOT IFADDR_LINKS_WITHOUT_LIBSOCKET) - include(CheckSourceCompilesAndLinks) + include(CheckSourceCompilesWithFlags) check_cxx_source_compiles_with_flags("${check_socket_source}" IFADDR_NEEDS_LINK_TO_LIBSOCKET LINK_LIBRARIES socket ) @@ -83,7 +83,7 @@ function(test_append_atomic_library target) include(CheckCXXSourceCompiles) check_cxx_source_compiles("${check_atomic_source}" STD_ATOMIC_LINKS_WITHOUT_LIBATOMIC) if(NOT STD_ATOMIC_LINKS_WITHOUT_LIBATOMIC) - include(CheckSourceCompilesAndLinks) + include(CheckSourceCompilesWithFlags) check_cxx_source_compiles_with_flags("${check_atomic_source}" STD_ATOMIC_NEEDS_LINK_TO_LIBATOMIC LINK_LIBRARIES atomic ) From 2c4b229c906de6250500d3af2b44808e90b9ce0b Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 20 Feb 2025 12:41:44 +0000 Subject: [PATCH 6/6] 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. --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5945d38c44a..e637079de51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -386,6 +386,7 @@ endif() target_link_options(sanitize_interface INTERFACE ${SANITIZER_LDFLAGS}) if(BUILD_FUZZ_BINARY) + target_link_libraries(core_interface INTERFACE ${FUZZ_LIBS}) include(CheckSourceCompilesWithFlags) check_cxx_source_compiles_with_flags(" #include @@ -394,6 +395,7 @@ if(BUILD_FUZZ_BINARY) // No main() function. " FUZZ_BINARY_LINKS_WITHOUT_MAIN_FUNCTION LDFLAGS ${SANITIZER_LDFLAGS} + LINK_LIBRARIES ${FUZZ_LIBS} ) endif()