We were linking all the clang objects and shared libraries into
libclang-cpp.so, which was causing the command line options to be
registered twice.
Details
- Reviewers
beanz mgorny - Commits
- rGe2c0c70101ae: [cmake] Fix clang builds with BUILD_SHARED=ON and CLANG_LINK_CLANG_DYLIB=ON
rGebcf25ea8100: [cmake] Fix clang builds with BUILD_SHARED=ON and CLANG_LINK_CLANG_DYLIB=ON
rG3e429b691ec8: [cmake] Fix clang builds with BUILD_SHARED=ON and CLANG_LINK_CLANG_DYLIB=ON
rGdf839cfda09d: [cmake] Fix clang builds with BUILD_SHARED=ON and CLANG_LINK_CLANG_DYLIB=ON
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Got me a while to understand what you're saying. It's all high magic but looks reasonable enough.
After thinking about this more, do we want to even try to support the BUILD_SHARED=ON + CLANG_LINK_CLANG_DYLIB=ON configuration? We don't support this in llvm.
Actually, even if we don't support this in clang, we still need to fix this. Otherwise libclang-cpp.so will not be useable at all when clang has been built with BUILD_SHARED=ON .
Ping. This bug is preventing upstream projects from using libclang-cpp.so, since building with -DENABLE_SHARED=ON is still common.
Well, it looks correct to me. Not sure if it's the best approach but it can be refined in the future.
Rewrite patch to use cmake features available with cmake >= 3.4. The previous
version used a 3.6 feature: list(FILTER ...)
Unit tests: pass. 62114 tests passed, 0 failed and 808 were skipped.
clang-tidy: pass.
clang-format: pass.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml
clang/tools/clang-shlib/CMakeLists.txt | ||
---|---|---|
28 | Any reason not to use if(${lib} MATCHES ...)? https://cmake.org/cmake/help/v3.0/command/if.html Not sure if ${} is needed, I get always confused by that. |
clang/tools/clang-shlib/CMakeLists.txt | ||
---|---|---|
28 | Thanks for the tip, I updated the patch to use this. |
Any reason not to use if(${lib} MATCHES ...)?
https://cmake.org/cmake/help/v3.0/command/if.html
Not sure if ${} is needed, I get always confused by that.