idk
idk copied to clipboard
Fixing Windows builds when using `target_link_libraries()`
The current cmake configuration for ztd.idk
is not header-only, it produces a library from the files in the source directory.
This is a problem, because the API linkage flag that api.h
expects to see (ZTD_DLL
) isn't set by the build system, so the library is built without exporting any symbols. This makes the library unlinkable on Windows.
This is all fixable, but I need to know the intent. The docs refer to idk
as header only and it appears to work entirely in header-only mode. So should we just not compile these files? Should we create two targets, one for header only and one that compiles and links the library correctly?
Once I know what the intent is I can handle fixing up the cmake stuff.
It's not meant to be header-only anymore. I've got to fix that in the docs.
It should only turn on ZTD_DLL
and other build-related macros if it detects the CMake property for building a shared library is on the target.
Pushed a fix, should work? Maybe. I should probably add tests for each platform that use BUILD_SHARED_LIBS=ON and one with it off, to see what happens...
I'll check it out in a bit, but at a glance this should work.