aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-04-10 01:25:15 -0400
committerAndrew Kelley <andrew@ziglang.org>2020-04-10 01:25:15 -0400
commite857190dab2f1575dc3092f91bfb7fca5583b996 (patch)
tree3d7a195693e79d55dfabc8632a34b6427d09b193
parentaaf99371b22e816a4162391d799b9d22bba21120 (diff)
downloadzig-e857190dab2f1575dc3092f91bfb7fca5583b996.tar.gz
zig-e857190dab2f1575dc3092f91bfb7fca5583b996.zip
put the previous commit behind cmake option ZIG_PREFER_CLANG_CPP_DYLIB
Without this, building from source caused: CommandLine Error: Option 'mc-relax-all' registered more than once! LLVM ERROR: inconsistency in registered CommandLine options This is due to LLVM static libs compiled in multiple times. But without the LLVM static libs on the linker line, it caused undefined symbol linker errors. So our hands are tied. Homebrew users will have to specify `-DZIG_PREFER_CLANG_CPP_DYLIB`.
-rw-r--r--CMakeLists.txt1
-rw-r--r--cmake/Findclang.cmake2
2 files changed, 2 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 66015fe692..279156c93c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,6 +46,7 @@ message("Configuring zig version ${ZIG_VERSION}")
set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not compatible with glibc)")
set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries")
set(ZIG_ENABLE_MEM_PROFILE off CACHE BOOL "Activate memory usage instrumentation")
+set(ZIG_PREFER_CLANG_CPP_DYLIB off CACHE BOOL "Try to link against -lclang-cpp")
if(ZIG_STATIC)
set(ZIG_STATIC_LLVM "on")
diff --git a/cmake/Findclang.cmake b/cmake/Findclang.cmake
index 28ecc5f557..c556455d1c 100644
--- a/cmake/Findclang.cmake
+++ b/cmake/Findclang.cmake
@@ -17,7 +17,7 @@ find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h
/mingw64/include
)
-if(NOT ZIG_STATIC_LLVM)
+if(ZIG_PREFER_CLANG_CPP_DYLIB)
find_library(CLANG_CPP_DYLIB
NAMES
clang-cpp-10.0