Skip to content

Commit 8ae4466

Browse files
committed
[cmake] lldb: Turn of clang visibility macros if not CLANG_LINK_CLANG_DYLIB
This change mirrors https://github.com/llvm/llvm-project/pull/108276/files#diff-4dd645a8b76bb3886a505258a8c2e598aeddea770e7b0a2b51689124a5ea6e9a.
1 parent 8f10bf3 commit 8ae4466

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lldb/cmake/modules/AddLLDB.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,19 @@ function(add_lldb_library name)
9292
${pass_NO_INSTALL_RPATH}
9393
)
9494

95+
if(MSVC AND NOT CLANG_LINK_CLANG_DYLIB)
96+
# Make sure all consumers also turn off visibility macros so the're not
97+
# trying to dllimport symbols.
98+
target_compile_definitions(${name} PUBLIC CLANG_BUILD_STATIC)
99+
if(TARGET "obj.${name}")
100+
target_compile_definitions("obj.${name}" PUBLIC CLANG_BUILD_STATIC)
101+
endif()
102+
elseif(NOT PARAM_SHARED AND NOT PARAM_STATIC)
103+
# lldb component libraries linked in to clang-cpp are declared without
104+
# SHARED or STATIC.
105+
target_compile_definitions("obj.${name}" PUBLIC CLANG_EXPORTS)
106+
endif()
107+
95108
if(CLANG_LINK_CLANG_DYLIB)
96109
target_link_libraries(${name} PRIVATE clang-cpp)
97110
else()

0 commit comments

Comments
 (0)