[llvm] Initial changes for llvm shared library build using explicit visibility annotations (PR #96630)

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 21:07:08 PDT 2024


================
@@ -815,22 +815,36 @@ endif()
 
 if(MSVC)
   option(LLVM_BUILD_LLVM_C_DYLIB "Build LLVM-C.dll (Windows only)" ON)
-  # Set this variable to OFF here so it can't be set with a command-line
-  # argument.
-  set (LLVM_LINK_LLVM_DYLIB OFF)
+  if(NOT LLVM_BUILD_LLVM_DYLIB_VIS)
+    # Set this variable to OFF here so it can't be set with a command-line
+    # argument.
+    set (LLVM_LINK_LLVM_DYLIB OFF)
+  endif()
   if (BUILD_SHARED_LIBS)
     message(FATAL_ERROR "BUILD_SHARED_LIBS options is not supported on Windows.")
   endif()
-else()
-  option(LLVM_LINK_LLVM_DYLIB "Link tools against the libllvm dynamic library" OFF)
+ else()
   option(LLVM_BUILD_LLVM_C_DYLIB "Build libllvm-c re-export library (Darwin only)" OFF)
+endif()
+
+if(NOT MSVC OR LLVM_BUILD_LLVM_DYLIB_VIS)
+  option(LLVM_LINK_LLVM_DYLIB "Link tools against the libllvm dynamic library" OFF)
----------------
petrhosek wrote:

I'd use https://cmake.org/cmake/help/latest/module/CMakeDependentOption.html.

https://github.com/llvm/llvm-project/pull/96630


More information about the llvm-commits mailing list