mirror of
https://github.com/libssh2/libssh2.git
synced 2025-07-29 13:01:14 +03:00
- cmake: add support to build ossfuzz. Enable with `-DBUILD_OSSFUZZ=ON`. Also supports `-DLIB_FUZZING_ENGINE=` like autotools does. - check for `__clang__` when suppressing warnings in source. Necessary for clang-cl, which set `__clang__`, but doesn't set `__GNU__`. - cmake: optimize out 4 picky warning option detections with gcc. - cmake: bring `-pedantic-error`, `-Wall` use closer to curl's. - cmake: set `-Wno-language-extension-token` for clang-cl. - cmake: escape only the necessary `-W` options for clang-cl. - cmake: apply picky warnings to C++. - cmake: replace `unset(VAR)` with `set(VAR "")` for init. - cmake: prefer dash-style MSVC options. - cmake: simplify `MATCHES` expression. - cmake: formatting/whitespace. - ci/GHA: bump `actions/upload-artifact` to v4 Closes #1524
25 lines
978 B
CMake
25 lines
978 B
CMake
# Copyright (C) Viktor Szakats
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
enable_language(CXX)
|
|
|
|
add_library(standaloneengine STATIC "standaloneengine.cc")
|
|
target_include_directories(standaloneengine PRIVATE
|
|
"${PROJECT_SOURCE_DIR}/include")
|
|
set_target_properties(standaloneengine PROPERTIES UNITY_BUILD OFF)
|
|
|
|
add_executable(ssh2_client_fuzzer "ssh2_client_fuzzer.cc" "testinput.h")
|
|
target_include_directories(ssh2_client_fuzzer PRIVATE
|
|
"${PROJECT_SOURCE_DIR}/include")
|
|
if(LIB_FUZZING_ENGINE)
|
|
if(LIB_FUZZING_ENGINE STREQUAL "-fsanitize=fuzzer") # FIXME: compiler-specific
|
|
set_target_properties(ssh2_client_fuzzer PROPERTIES LINK_FLAGS "${LIB_FUZZING_ENGINE}")
|
|
else()
|
|
target_link_libraries(ssh2_client_fuzzer ${LIB_FUZZING_ENGINE})
|
|
endif()
|
|
else()
|
|
target_link_libraries(ssh2_client_fuzzer standaloneengine)
|
|
endif()
|
|
target_link_libraries(ssh2_client_fuzzer ${LIB_STATIC} ${LIBSSH2_LIBS_SOCKET})
|
|
set_target_properties(ssh2_client_fuzzer PROPERTIES UNITY_BUILD OFF)
|