From a80caec19bf0f82de3cbb85f378c925663ffa648 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 16 Oct 2018 08:56:46 +0200 Subject: [PATCH] cmake: Disable deprecation warnings for old known_hosts API Signed-off-by: Andreas Schneider --- CompilerChecks.cmake | 6 ++++++ src/CMakeLists.txt | 6 ++++++ tests/client/CMakeLists.txt | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/CompilerChecks.cmake b/CompilerChecks.cmake index 3b36cc6c..8112fce7 100644 --- a/CompilerChecks.cmake +++ b/CompilerChecks.cmake @@ -93,6 +93,8 @@ if (UNIX) add_c_compiler_flag("-Wno-error=tautological-compare" SUPPORTED_COMPILER_FLAGS) endif() + add_c_compiler_flag("-Wno-deprecated-declarations" DEPRECATION_COMPILER_FLAGS) + # Unset CMAKE_REQUIRED_FLAGS unset(CMAKE_REQUIRED_FLAGS) endif() @@ -112,3 +114,7 @@ endif() set(DEFAULT_C_COMPILE_FLAGS ${SUPPORTED_COMPILER_FLAGS} CACHE INTERNAL "Default C Compiler Flags" FORCE) set(DEFAULT_LINK_FLAGS ${SUPPORTED_LINKER_FLAGS} CACHE INTERNAL "Default C Linker Flags" FORCE) + +if (DEPRECATION_COMPILER_FLAGS) + set(DEFAULT_C_NO_DEPRECATION_FLAGS ${DEPRECATION_COMPILER_FLAGS} CACHE INTERNAL "Default no deprecation flags" FORCE) +endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 849919c3..21e94488 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -164,6 +164,12 @@ set(libssh_SRCS chachapoly.c ) +if (DEFAULT_C_NO_DEPRECATION_FLAGS) + set_source_files_properties(known_hosts.c + PROPERTIES + COMPILE_FLAGS ${DEFAULT_C_NO_DEPRECATION_FLAGS}) +endif() + if (CMAKE_USE_PTHREADS_INIT) set(libssh_SRCS ${libssh_SRCS} diff --git a/tests/client/CMakeLists.txt b/tests/client/CMakeLists.txt index b55dfb28..ad82a3e1 100644 --- a/tests/client/CMakeLists.txt +++ b/tests/client/CMakeLists.txt @@ -14,6 +14,11 @@ set(LIBSSH_CLIENT_TESTS torture_session torture_request_env) +if (DEFAULT_C_NO_DEPRECATION_FLAGS) + set_source_files_properties(torture_knownhosts.c + PROPERTIES + COMPILE_FLAGS ${DEFAULT_C_NO_DEPRECATION_FLAGS}) +endif() if (WITH_SFTP) if (WITH_BENCHMARKS) set(SFTP_BENCHMARK_TESTS