webmproject / sjpeg

SimpleJPEG: simple jpeg encoder
Apache License 2.0
72 stars 13 forks source link

cmake: fix target name collision with other cpufeatures library #117

Closed madebr closed 1 year ago

madebr commented 1 year ago

When using a vendored sjpeg, the cpufeatures target clashes with other cpufeatures targets. Avoid this by adding a -sjpeg suffix.

This happens when building SDL_image with vendored libraries. SDL_image has support for libjxl, which uses sjpeg as a 3rd party library. (libwebp also provides a cpufeatures target)

jzern commented 1 year ago

Out of curiosity, how are the targets imported in this case, via include_directories()?

madebr commented 1 year ago

In SDL_image, we add the vendored libraries using add_subdirectory. Here, libjxl is included No ExternalProject is used. Perhaps we should?

jzern commented 1 year ago

In SDL_image, we add the vendored libraries using add_subdirectory.

Thanks, I realized after posting I meant that one rather than include_directories. I have the same change for libwebp.

Here, libjxl is included No ExternalProject is used. Perhaps we should?

I haven't used this one; I've seen FetchContent. For installed libraries find_library can work and give namespaced targets, but I don't think that applies here.

madebr commented 1 year ago

Thanks for taking care of webp. I applied a very similar patch to our slightly patched fork.

Yeah, our build systems supports both system libraries and vendored libraries. It's there for those old-school Windows developers refusing to use a package manager. Though, it's useful now while I am creating Android prefab packages for the SDL libraries.