| author | |
| committer | |
| log | 4e9894cfc4c8e2e1d3e01aa2e3400b295b0ee2df |
| tree | efc59febac4df5fb139b180ac4e8347b00f8fbe7 |
| parent | cc650abf09d98ff241cc28b50b2519a9c4919dd0 |
Previously, there was an option ZIG_PREFER_LLVM_CONFIG which would
override the default of not using llvm-config when cross compiling.
That option is now removed in favor of the more powerful
ZIG_USE_LLVM_CONFIG which defaults to OFF for cross compiling and ON for
native compilation. The option overrides the default.
This will be used in zig-bootstrap to improve support for native builds.2 files changed, 7 insertions(+), 2 deletions(-)
CMakeLists.txt+6-1| ... | ... | @@ -87,10 +87,15 @@ option(ZIG_TEST_COVERAGE "Build Zig with test coverage instrumentation" OFF) |
| 87 | 87 | set(ZIG_TARGET_TRIPLE "native" CACHE STRING "arch-os-abi to output binaries for") |
| 88 | 88 | set(ZIG_TARGET_MCPU "baseline" CACHE STRING "-mcpu parameter to output binaries for") |
| 89 | 89 | set(ZIG_EXECUTABLE "" CACHE STRING "(when cross compiling) path to already-built zig binary") |
| 90 | set(ZIG_PREFER_LLVM_CONFIG off CACHE BOOL "(when cross compiling) use llvm-config to find target llvm dependencies if needed") | |
| 91 | 90 | set(ZIG_SINGLE_THREADED off CACHE BOOL "limit the zig compiler to use only 1 thread") |
| 92 | 91 | set(ZIG_OMIT_STAGE2 off CACHE BOOL "omit the stage2 backend from stage1") |
| 93 | 92 | |
| 93 | if("${ZIG_TARGET_TRIPLE}" STREQUAL "native") | |
| 94 | set(ZIG_USE_LLVM_CONFIG ON CACHE BOOL "use llvm-config to find LLVM libraries") | |
| 95 | else() | |
| 96 | set(ZIG_USE_LLVM_CONFIG OFF CACHE BOOL "use llvm-config to find LLVM libraries") | |
| 97 | endif() | |
| 98 | ||
| 94 | 99 | find_package(llvm) |
| 95 | 100 | find_package(clang) |
| 96 | 101 | find_package(lld) |
cmake/Findllvm.cmake+1-1| ... | ... | @@ -63,7 +63,7 @@ if(ZIG_PREFER_CLANG_CPP_DYLIB) |
| 63 | 63 | if("${LLVM_CONFIG_VERSION}" VERSION_GREATER 12) |
| 64 | 64 | message(FATAL_ERROR "expected LLVM 11.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}") |
| 65 | 65 | endif() |
| 66 | elseif(("${ZIG_TARGET_TRIPLE}" STREQUAL "native") OR ZIG_PREFER_LLVM_CONFIG) | |
| 66 | elseif(ZIG_USE_LLVM_CONFIG) | |
| 67 | 67 | find_program(LLVM_CONFIG_EXE |
| 68 | 68 | NAMES llvm-config-11 llvm-config-11.0 llvm-config110 llvm-config11 llvm-config |
| 69 | 69 | PATHS |