Closed nightmareci closed 2 months ago
This is a CMake quirk you're encountering.
We do enable_language(CXX)
in our cmake script.
This sets the LINKER_LANGUAGE
property of the SDL_image targets to CXX
.
For some reason CMake needs enable_language(CXX)
at the same (or higher) level when using any target that uses c++.
I cannot immediately find an issue at CMake's issue tracker.
This minimal CMake project reproduces your issue:
I'm closing this issue. Let's hope a future CMake release fixes this.
I'm working on a project where I want to CMake-consume (via
FetchContent
), build, and statically link all the dependencies (SDL, all the satellite libraries) for distributed release builds. Enabling JPEG XL breaks the build though, as it needs C++, and C++ doesn't get enabled properly in this setup, so the build output throws a bunch of C++ linking errors. For now, adding anenable_language(CXX)
gets it working, but that doesn't really seem correct, I don't think a CMake project (mine) consuming another (SDL_image) should have to do that, if my project's code doesn't include any C++. So, somehow, C++ needs to get enabled so the final statically linked executable can get the C++ code linked in.I've encountered this bug with both SDL2 and SDL3.