Adds libatomic to libraries to link against if the compiler requires it.
Details
Diff Detail
- Repository
- R37 Krita
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
With cases like this it's usually preferred to do feature detection instead of checking for specific versions.
You should add a check with CMake to test whether a simple test program can be compiled with/without linking libatomic, or use an existing CheckAtomic.cmake from an appropriate source.
Following Alvin, I don't think there's any CheckAtomic.cmake written yet, so I'll make a new one.
Turns out there is a CheckAtomic.cmake already created, in the LLVM project. I don't know how to handle licensing, I've never done it before, so I included the license in the file copied over from LLVM.
libs/image/CMakeLists.txt | ||
---|---|---|
338 | It is standard for all clang versions to require linking against atomic if it's used. |
Oh hey I noticed this patch was reverted, can I get some pointers to where it failed so I can fix it up?
Aw, zut, for some reason my comment didn't get posted. I had to revert it because of https://bugs.kde.org/show_bug.cgi?id=399953. The patch broke building with clang on macOS and freebsd on KDE's jenkins.
cmake now checks if neither atomic nor atomic64 is compilable without linking in atomics, tested out on FreeBSD, should work on MacOS.
Alright so this patch was long overdue to be fixed, considering how simple the fix turned out to be.
I've tested it out on FreeBSD under KVM and it compiled just fine.
I haven't yet ran all tests, I'll send another message when I deem the patch ready to merge.