[PATCH] D104168: CMake: allow overriding CMAKE_CXX_VISIBILITY_PRESET

Igor Sugak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 11 18:32:32 PDT 2021


sugak created this revision.
sugak added reviewers: tstellar, hans.
Herald added subscribers: hiraditya, mgorny.
sugak requested review of this revision.
Herald added a project: LLVM.

This allows overriding the `CMAKE_CXX_VISIBILITY_PRESET` on the command line. For example, setting the value to `default` lets PIC LLVM static libraries be converted to DSOs, without the need to rebuild LLVM with BUILD_SHARED_LIBS=ON.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104168

Files:
  llvm/lib/Target/CMakeLists.txt


Index: llvm/lib/Target/CMakeLists.txt
===================================================================
--- llvm/lib/Target/CMakeLists.txt
+++ llvm/lib/Target/CMakeLists.txt
@@ -21,7 +21,8 @@
 
 # When building shared objects for each target there are some internal APIs
 # that are used across shared objects which we can't hide.
-if (NOT BUILD_SHARED_LIBS AND NOT APPLE)
+if (NOT BUILD_SHARED_LIBS AND NOT APPLE AND
+    NOT DEFINED CMAKE_CXX_VISIBILITY_PRESET)
   # Set default visibility to hidden, so we don't export all the Target classes
   # in libLLVM.so.
   set(CMAKE_CXX_VISIBILITY_PRESET hidden)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104168.351614.patch
Type: text/x-patch
Size: 610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210612/5e4ed7a6/attachment.bin>


More information about the llvm-commits mailing list