Commit Graph

1 Commits

Author SHA1 Message Date
Azat Khuzhin
c3f3078884 Sanitize thirdparty libraries for public flags
Public flags, especially -Wxx (i.e. -Wno-XX) can hide some warnings,
that had been added in the main cmake rules of ClickHouse.

This patch had been tested manually with the following patch:

    ```patch
    diff --git a/contrib/jemalloc-cmake/CMakeLists.txt b/contrib/jemalloc-cmake/CMakeLists.txt
    index d5ea69d4926..7e79fba0c16 100644
    --- a/contrib/jemalloc-cmake/CMakeLists.txt
    +++ b/contrib/jemalloc-cmake/CMakeLists.txt
    @@ -158,6 +158,7 @@ target_include_directories(_jemalloc SYSTEM PRIVATE
         "${CMAKE_CURRENT_BINARY_DIR}/${JEMALLOC_INCLUDE_PREFIX}/jemalloc/internal")

     target_compile_definitions(_jemalloc PRIVATE -DJEMALLOC_NO_PRIVATE_NAMESPACE)
    +target_compile_options(_jemalloc INTERFACE -Wno-error) # also PUBLIC had been checked

     if (CMAKE_BUILD_TYPE_UC STREQUAL "DEBUG")
         target_compile_definitions(_jemalloc PRIVATE
    ```

And cmake gave:

    CMake Error at cmake/sanitize_targets.cmake:69 (message):
      _jemalloc set INTERFACE_COMPILE_OPTIONS to -Wno-error.  This is forbidden.
    Call Stack (most recent call first):
      cmake/sanitize_targets.cmake:79 (sanitize_interface_flags)
      CMakeLists.txt:595 (include)

Fixes: #12447
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-16 07:20:24 +01:00