authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-04-10 01:25:15-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-04-10 01:25:15-04:00
loge857190dab2f1575dc3092f91bfb7fca5583b996
tree3d7a195693e79d55dfabc8632a34b6427d09b193
parentaaf99371b22e816a4162391d799b9d22bba21120

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`.

2 files changed, 2 insertions(+), 1 deletions(-)

CMakeLists.txt+1
...@@ -46,6 +46,7 @@ message("Configuring zig version ${ZIG_VERSION}")...@@ -46,6 +46,7 @@ message("Configuring zig version ${ZIG_VERSION}")
46set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not compatible with glibc)")46set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not compatible with glibc)")
47set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries")47set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries")
48set(ZIG_ENABLE_MEM_PROFILE off CACHE BOOL "Activate memory usage instrumentation")48set(ZIG_ENABLE_MEM_PROFILE off CACHE BOOL "Activate memory usage instrumentation")
49set(ZIG_PREFER_CLANG_CPP_DYLIB off CACHE BOOL "Try to link against -lclang-cpp")
4950
50if(ZIG_STATIC)51if(ZIG_STATIC)
51 set(ZIG_STATIC_LLVM "on")52 set(ZIG_STATIC_LLVM "on")
cmake/Findclang.cmake+1-1
...@@ -17,7 +17,7 @@ find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h...@@ -17,7 +17,7 @@ find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h
17 /mingw64/include17 /mingw64/include
18)18)
1919
20if(NOT ZIG_STATIC_LLVM)20if(ZIG_PREFER_CLANG_CPP_DYLIB)
21 find_library(CLANG_CPP_DYLIB21 find_library(CLANG_CPP_DYLIB
22 NAMES22 NAMES
23 clang-cpp-10.023 clang-cpp-10.0