| ... | @@ -10,6 +10,7 @@ | ... | @@ -10,6 +10,7 @@ |
| 10 | | 10 | |
| 11 | | 11 | |
| 12 | if(ZIG_USE_LLVM_CONFIG) | 12 | if(ZIG_USE_LLVM_CONFIG) |
| | 13 | set(LLVM_CONFIG_ERROR_MESSAGES "") |
| 13 | while(1) | 14 | while(1) |
| 14 | unset(LLVM_CONFIG_EXE CACHE) | 15 | unset(LLVM_CONFIG_EXE CACHE) |
| 15 | find_program(LLVM_CONFIG_EXE | 16 | find_program(LLVM_CONFIG_EXE |
| ... | @@ -21,7 +22,8 @@ if(ZIG_USE_LLVM_CONFIG) | ... | @@ -21,7 +22,8 @@ if(ZIG_USE_LLVM_CONFIG) |
| 21 | "C:/Libraries/llvm-14.0.0/bin") | 22 | "C:/Libraries/llvm-14.0.0/bin") |
| 22 | | 23 | |
| 23 | if ("${LLVM_CONFIG_EXE}" STREQUAL "LLVM_CONFIG_EXE-NOTFOUND") | 24 | if ("${LLVM_CONFIG_EXE}" STREQUAL "LLVM_CONFIG_EXE-NOTFOUND") |
| 24 | if (DEFINED LLVM_CONFIG_ERROR_MESSAGE) | 25 | if (NOT LLVM_CONFIG_ERROR_MESSAGES STREQUAL "") |
| | 26 | list(JOIN LLVM_CONFIG_ERROR_MESSAGES "\n" LLVM_CONFIG_ERROR_MESSAGE) |
| 25 | message(FATAL_ERROR ${LLVM_CONFIG_ERROR_MESSAGE}) | 27 | message(FATAL_ERROR ${LLVM_CONFIG_ERROR_MESSAGE}) |
| 26 | else() | 28 | else() |
| 27 | message(FATAL_ERROR "unable to find llvm-config") | 29 | message(FATAL_ERROR "unable to find llvm-config") |
| ... | @@ -37,7 +39,7 @@ if(ZIG_USE_LLVM_CONFIG) | ... | @@ -37,7 +39,7 @@ if(ZIG_USE_LLVM_CONFIG) |
| 37 | get_filename_component(LLVM_CONFIG_DIR "${LLVM_CONFIG_EXE}" DIRECTORY) | 39 | get_filename_component(LLVM_CONFIG_DIR "${LLVM_CONFIG_EXE}" DIRECTORY) |
| 38 | if("${LLVM_CONFIG_VERSION}" VERSION_LESS 14 OR "${LLVM_CONFIG_VERSION}" VERSION_EQUAL 15 OR "${LLVM_CONFIG_VERSION}" VERSION_GREATER 15) | 40 | if("${LLVM_CONFIG_VERSION}" VERSION_LESS 14 OR "${LLVM_CONFIG_VERSION}" VERSION_EQUAL 15 OR "${LLVM_CONFIG_VERSION}" VERSION_GREATER 15) |
| 39 | # Save the error message, in case this is the last llvm-config we find | 41 | # Save the error message, in case this is the last llvm-config we find |
| 40 | set(LLVM_CONFIG_ERROR_MESSAGE "expected LLVM 14.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}") | 42 | list(APPEND LLVM_CONFIG_ERROR_MESSAGES "expected LLVM 14.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}") |
| 41 | | 43 | |
| 42 | # Ignore this directory and try the search again | 44 | # Ignore this directory and try the search again |
| 43 | list(APPEND CMAKE_IGNORE_PATH "${LLVM_CONFIG_DIR}") | 45 | list(APPEND CMAKE_IGNORE_PATH "${LLVM_CONFIG_DIR}") |
| ... | @@ -61,9 +63,9 @@ if(ZIG_USE_LLVM_CONFIG) | ... | @@ -61,9 +63,9 @@ if(ZIG_USE_LLVM_CONFIG) |
| 61 | if (LLVM_CONFIG_ERROR) | 63 | if (LLVM_CONFIG_ERROR) |
| 62 | # Save the error message, in case this is the last llvm-config we find | 64 | # Save the error message, in case this is the last llvm-config we find |
| 63 | if (ZIG_SHARED_LLVM) | 65 | if (ZIG_SHARED_LLVM) |
| 64 | set(LLVM_CONFIG_ERROR_MESSAGE "LLVM 14.x found at ${LLVM_CONFIG_EXE} does not support linking as a shared library") | 66 | list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 14.x found at ${LLVM_CONFIG_EXE} does not support linking as a shared library") |
| 65 | else() | 67 | else() |
| 66 | set(LLVM_CONFIG_ERROR_MESSAGE "LLVM 14.x found at ${LLVM_CONFIG_EXE} does not support linking as a static library") | 68 | list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 14.x found at ${LLVM_CONFIG_EXE} does not support linking as a static library") |
| 67 | endif() | 69 | endif() |
| 68 | | 70 | |
| 69 | # Ignore this directory and try the search again | 71 | # Ignore this directory and try the search again |
| ... | @@ -81,7 +83,7 @@ if(ZIG_USE_LLVM_CONFIG) | ... | @@ -81,7 +83,7 @@ if(ZIG_USE_LLVM_CONFIG) |
| 81 | list (FIND LLVM_TARGETS_BUILT "${TARGET_NAME}" _index) | 83 | list (FIND LLVM_TARGETS_BUILT "${TARGET_NAME}" _index) |
| 82 | if (${_index} EQUAL -1) | 84 | if (${_index} EQUAL -1) |
| 83 | # Save the error message, in case this is the last llvm-config we find | 85 | # Save the error message, in case this is the last llvm-config we find |
| 84 | set(LLVM_CONFIG_ERROR_MESSAGE "LLVM (according to ${LLVM_CONFIG_EXE}) is missing target ${TARGET_NAME}. Zig requires LLVM to be built with all default targets enabled.") | 86 | list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM (according to ${LLVM_CONFIG_EXE}) is missing target ${TARGET_NAME}. Zig requires LLVM to be built with all default targets enabled.") |
| 85 | | 87 | |
| 86 | # Ignore this directory and try the search again | 88 | # Ignore this directory and try the search again |
| 87 | list(APPEND CMAKE_IGNORE_PATH "${LLVM_CONFIG_DIR}") | 89 | list(APPEND CMAKE_IGNORE_PATH "${LLVM_CONFIG_DIR}") |