diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-02-15 20:56:52 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-02-15 20:56:52 -0700 |
| commit | 984e7d6cc79df0a1dec4cc9ae37e899376a5f641 (patch) | |
| tree | 47dd9effd4306cc8f9dad277e08fe00267ac506a /CMakeLists.txt | |
| parent | f580c7fa4330a0c181226060d2e778285fa38dc0 (diff) | |
| download | zig-984e7d6cc79df0a1dec4cc9ae37e899376a5f641.tar.gz zig-984e7d6cc79df0a1dec4cc9ae37e899376a5f641.zip | |
first pass at linking on macos
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index fdd23c4016..206e5e2da2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,6 +144,27 @@ set(ZIG_STD_SRC "${CMAKE_SOURCE_DIR}/std/math.zig" ) + +set(ZIG_HOST_LINK_VERSION) +if (APPLE) + set(LD_V_OUTPUT) + execute_process( + COMMAND sh -c "${CMAKE_LINKER} -v 2>&1 | head -1" + RESULT_VARIABLE HAD_ERROR + OUTPUT_VARIABLE LD_V_OUTPUT + ) + if (NOT HAD_ERROR) + if ("${LD_V_OUTPUT}" MATCHES ".*ld64-([0-9.]+).*") + string(REGEX REPLACE ".*ld64-([0-9.]+).*" "\\1" ZIG_HOST_LINK_VERSION ${LD_V_OUTPUT}) + elseif ("${LD_V_OUTPUT}" MATCHES "[^0-9]*([0-9.]+).*") + string(REGEX REPLACE "[^0-9]*([0-9.]+).*" "\\1" ZIG_HOST_LINK_VERSION ${LD_V_OUTPUT}) + endif() + else() + message(FATAL_ERROR "${CMAKE_LINKER} failed with status ${HAD_ERROR}") + endif() +endif() + + set(C_HEADERS_DEST "lib/zig/include") set(ZIG_STD_DEST "lib/zig/std") set(CONFIGURE_OUT_FILE "${CMAKE_BINARY_DIR}/config.h") |
