aaronpuchert created this revision. aaronpuchert added reviewers: akyrtzi, beanz, tstellar. Herald added subscribers: cfe-commits, arphaman, dexonsmith, mgorny. Herald added a project: clang. aaronpuchert added inline comments.
================ Comment at: clang/tools/libclang/CMakeLists.txt:115 +clang_target_link_libraries(libclang + PRIVATE + ${CLANG_LIB_DEPS} ---------------- This might not be correct for static builds, I think we need `INTERFACE` here. Without these changes an application can't link both libclang and clang-shlib ("clang-cpp") at the same time, because otherwise some flags are registered twice. This was observable in c-index-test with the flag "-limited-coverage-experimental" from lib/CodeGen/CodeGenModule.cpp. This also further reduces the installation size of Clang. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D67321 Files: clang/tools/c-index-test/CMakeLists.txt clang/tools/libclang/CMakeLists.txt Index: clang/tools/libclang/CMakeLists.txt =================================================================== --- clang/tools/libclang/CMakeLists.txt +++ clang/tools/libclang/CMakeLists.txt @@ -33,7 +33,7 @@ ../../include/clang-c/Index.h ) -set(LIBS +set(CLANG_LIB_DEPS clangAST clangBasic clangDriver @@ -46,7 +46,7 @@ ) if (CLANG_ENABLE_ARCMT) - list(APPEND LIBS clangARCMigrate) + list(APPEND CLANG_LIB_DEPS clangARCMigrate) endif () if (TARGET clangTidyPlugin) @@ -111,6 +111,11 @@ Support ) +clang_target_link_libraries(libclang + PRIVATE + ${CLANG_LIB_DEPS} + ) + if(ENABLE_SHARED) if(WIN32) set_target_properties(libclang Index: clang/tools/c-index-test/CMakeLists.txt =================================================================== --- clang/tools/c-index-test/CMakeLists.txt +++ clang/tools/c-index-test/CMakeLists.txt @@ -25,6 +25,9 @@ target_link_libraries(c-index-test PRIVATE libclang + ) + clang_target_link_libraries(c-index-test + PRIVATE clangAST clangBasic clangCodeGen
Index: clang/tools/libclang/CMakeLists.txt =================================================================== --- clang/tools/libclang/CMakeLists.txt +++ clang/tools/libclang/CMakeLists.txt @@ -33,7 +33,7 @@ ../../include/clang-c/Index.h ) -set(LIBS +set(CLANG_LIB_DEPS clangAST clangBasic clangDriver @@ -46,7 +46,7 @@ ) if (CLANG_ENABLE_ARCMT) - list(APPEND LIBS clangARCMigrate) + list(APPEND CLANG_LIB_DEPS clangARCMigrate) endif () if (TARGET clangTidyPlugin) @@ -111,6 +111,11 @@ Support ) +clang_target_link_libraries(libclang + PRIVATE + ${CLANG_LIB_DEPS} + ) + if(ENABLE_SHARED) if(WIN32) set_target_properties(libclang Index: clang/tools/c-index-test/CMakeLists.txt =================================================================== --- clang/tools/c-index-test/CMakeLists.txt +++ clang/tools/c-index-test/CMakeLists.txt @@ -25,6 +25,9 @@ target_link_libraries(c-index-test PRIVATE libclang + ) + clang_target_link_libraries(c-index-test + PRIVATE clangAST clangBasic clangCodeGen
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits