Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support GenerateExportHeader #6088

Open
star-hengxing opened this issue Jan 17, 2025 · 1 comment
Open

Support GenerateExportHeader #6088

star-hengxing opened this issue Jan 17, 2025 · 1 comment

Comments

@star-hengxing
Copy link
Contributor

Is your feature request related to a problem? Please describe.

https://cmake.org/cmake/help/latest/module/GenerateExportHeader.html

Describe the solution you'd like

N/A

Describe alternatives you've considered

No response

Additional context

No response

@waruqi
Copy link
Member

waruqi commented Jan 23, 2025

试了下,就为了生成这个?这玩意自己按需定义下,也没几行代码 = =

$ cat include/my_lib_export.h

#ifndef MY_LIB_EXPORT_H
#define MY_LIB_EXPORT_H

#ifdef MY_LIB_STATIC_DEFINE
#  define MY_LIB_EXPORT
#  define MY_LIB_NO_EXPORT
#else
#  ifndef MY_LIB_EXPORT
#    ifdef my_lib_EXPORTS
        /* We are building this library */
#      define MY_LIB_EXPORT __attribute__((visibility("default")))
#    else
        /* We are using this library */
#      define MY_LIB_EXPORT __attribute__((visibility("default")))
#    endif
#  endif

#  ifndef MY_LIB_NO_EXPORT
#    define MY_LIB_NO_EXPORT __attribute__((visibility("hidden")))
#  endif
#endif

#ifndef MY_LIB_DEPRECATED
#  define MY_LIB_DEPRECATED __attribute__ ((__deprecated__))
#endif

#ifndef MY_LIB_DEPRECATED_EXPORT
#  define MY_LIB_DEPRECATED_EXPORT MY_LIB_EXPORT MY_LIB_DEPRECATED
#endif

#ifndef MY_LIB_DEPRECATED_NO_EXPORT
#  define MY_LIB_DEPRECATED_NO_EXPORT MY_LIB_NO_EXPORT MY_LIB_DEPRECATED
#endif

#if 0 /* DEFINE_NO_DEPRECATED */
#  ifndef MY_LIB_NO_DEPRECATED
#    define MY_LIB_NO_DEPRECATED
#  endif
#endif

#endif /* MY_LIB_EXPORT_H */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants