Open SamuelMarks opened 1 year ago
That would be that PR https://github.com/mesonbuild/meson/pull/10199
Neither of those two issues are related to the cmake module in question.
But also, the cmake module in question takes several parameters to select the exact macro names used, and then it templates those into a statically determinable *.h
file whose only inputs are:
-fvisibility=hidden
Nothing is project-specific, and both checks in question can be better done via preprocessor macros. It's actually far more common for projects to do it that way:
#if defined _WIN32 || defined __CYGWIN__
then:
__declspec(dllexport)
__declspec(dllimport)
#elif defined __GNUC__ && __GNUC__ >= 4
__attribute__((visibility("default")))
#elif defined __SUNPRO_C
__global
In practice you don't care about SunPro C.
Incidentally, as I recall cmake gets the "using non-Windows compilers and building statically" case incorrect.
@eli-schwartz I suppose I could manually write out that header file with all the different targets I care about, which in my case is: Windows:
Linux, macOS, *BSD, SunOS:
My main fear is that I don't cover enough platforms so that when CMake gets a contrib, e.g., for LCC, I don't automatically gain support for their visibility syntax.
I would not worry about that since the cmake module is approximately as stable as a thing that never changes.
Also because unix compilers have more or less converged on the GNU syntax (e.g. sunpro supports both now) and all Windows compilers support the MSVC syntax for compatibility (and because if you're going to compile code with a Windows compiler and then include its headers from an MSVC cl.exe project, you must support whatever cl.exe supports).
Ok it's a little verbose but I created this by merging the generated header from MSVC and gcc (Linux), and your SunPro C hint: https://github.com/SamuelMarks/cmocka/blob/msvc2005/pregen/cmocka_export.h
Not sure if it'd still be a good idea for meson to support this…
Relevant:
What's the equivalent of this in Meson?