CMake doesn't link the actual object to the resulting dll

Rather than manually implementing all that logic for working out whether you need to export the class symbols or not, I recommend you consider using the GenerateExportHeader module instead. It makes handling these things very straightforward and has the added benefit of broad platform/compiler support too. You can get a good introduction to this from the first part of my CppCon talk from last year:

In your case, I think you’ll find that BLINKER_API is not being defined to what you expect when building your library. The logic for the preprocessor paths that would define it all rely on either _BLINKER_BUILD_DLL or BLINKER_DLL being defined, but I don’t see either of those being defined in your CMake source. Again, the GenerateExportHeader module takes care of that aspect for you too, so take a look at that and it should simplify this for you considerably.

2 Likes