Files
datastore/cmake/generate_export_header.h.in
Alexey MilovidovandClaude Opus 4.7 37decbbacf Replace generate_export_header with a probe-free helper
CMake's stock `generate_export_header` runs `try_compile` checks for hidden
visibility and `__attribute__((__deprecated__))`. Build-time CMake checks
were forbidden in this PR, so the configure step in `Build (arm_tidy)` failed:

    CMake Error at cmake/block_build_time_checks.cmake:29 (message):
      Forbidden CMake command 'try_compile' was called.
    Call Stack:
      .../GenerateExportHeader.cmake:515 (check_compiler_flag)
      .../GenerateExportHeader.cmake:693 (_test_compiler_hidden_visibility)
      contrib/mongo-cxx-driver-cmake/CMakeLists.txt:89 (generate_export_header)

`cmake/generate_export_header.cmake` now provides
`clickhouse_generate_export_header`, a drop-in replacement that emits the
export header by `configure_file`-substituting `cmake/generate_export_header.h.in`.
The Clang-specific bits (`__attribute__((visibility(...)))`,
`__attribute__((__deprecated__))`) are statically known from `cmake/tools.cmake`,
matching the behaviour CMake's macro produces after probing.

`contrib/mongo-cxx-driver-cmake/CMakeLists.txt` is the only consumer.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=103980&sha=00781f6570fdedd0a1c5837e3b2f221383a776ae&name_0=PR&name_1=Build%20%28arm_tidy%29
PR: https://github.com/ClickHouse/ClickHouse/pull/103980

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-05-04 07:54:57 +00:00

38 lines
967 B
C

#ifndef @INCLUDE_GUARD_NAME@
#define @INCLUDE_GUARD_NAME@
#ifdef @STATIC_DEFINE@
# define @EXPORT_MACRO_NAME@
# define @NO_EXPORT_MACRO_NAME@
#else
# ifndef @EXPORT_MACRO_NAME@
# ifdef @EXPORT_IMPORT_CONDITION@
/* We are building this library */
# define @EXPORT_MACRO_NAME@ @DEFINE_EXPORT@
# else
/* We are using this library */
# define @EXPORT_MACRO_NAME@ @DEFINE_IMPORT@
# endif
# endif
# ifndef @NO_EXPORT_MACRO_NAME@
# define @NO_EXPORT_MACRO_NAME@ @DEFINE_NO_EXPORT@
# endif
#endif
#ifndef @DEPRECATED_MACRO_NAME@
# define @DEPRECATED_MACRO_NAME@ __attribute__((__deprecated__))
#endif
#ifndef @DEPRECATED_MACRO_NAME@_EXPORT
# define @DEPRECATED_MACRO_NAME@_EXPORT @EXPORT_MACRO_NAME@ @DEPRECATED_MACRO_NAME@
#endif
#ifndef @DEPRECATED_MACRO_NAME@_NO_EXPORT
# define @DEPRECATED_MACRO_NAME@_NO_EXPORT @NO_EXPORT_MACRO_NAME@ @DEPRECATED_MACRO_NAME@
#endif
@CUSTOM_CONTENT@
#endif /* @INCLUDE_GUARD_NAME@ */