Open Sebanisu opened 2 years ago
C header only libraries with implementation macro are evil.
Regarding your suggestion:
Pros:
Cons:
Actually, I've implemented this logic in cgltf
recipe, but I don't know whether it was a good idea.
I think the default could be the current behavior so not to break anyone's code. I think having the recipe options could be nice to have.
The stb recipe is added via
target_include_libraries(... stb::stb ...)
I was thinking maybe we should have static libraries added for the implimentations.
Where the library defined just includes the header after the
#define
or usetarget_compile_definitions
. Then we can just add that to our includetarget_include_libraries(... stb::stb_main stb::image stb::image_write ...)
and these libraries could have public includes ofstb::stb
example cmake:
example cpp file:
I used this in my project. I was getting a compiler error after enabling precompiled headers. So I used this small static library to offload the building of the implementation.