From fe254ea309f7e95f492d8c8e706c73267082b5a3 Mon Sep 17 00:00:00 2001 From: Michael Dusan Date: Sun, 24 Nov 2019 15:29:43 -0500 Subject: [PATCH] stage1: avoid building empty memory_profiling.cpp During build an empty .o on macOS/Xcode emits warning: ranlib: file: zig_cpp/libcompiler.a(memory_profiling.cpp.o) has no symbols ranlib: file: zig_cpp/libcompiler.a(memory_profiling.cpp.o) has no symbols --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 132f9ff57..b40f360bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -438,6 +438,10 @@ set(ZIG_MAIN_SRC "${CMAKE_SOURCE_DIR}/src/main.cpp") # This is our shim which will be replaced by libuserland written in Zig. set(ZIG0_SHIM_SRC "${CMAKE_SOURCE_DIR}/src/userland.cpp") +if(ZIG_ENABLE_MEM_PROFILE) + set(ZIG_SOURCES_MEM_PROFILE "${CMAKE_SOURCE_DIR}/src/memory_profiling.cpp") +endif() + set(ZIG_SOURCES "${CMAKE_SOURCE_DIR}/src/analyze.cpp" "${CMAKE_SOURCE_DIR}/src/ast_render.cpp" @@ -456,7 +460,6 @@ set(ZIG_SOURCES "${CMAKE_SOURCE_DIR}/src/ir_print.cpp" "${CMAKE_SOURCE_DIR}/src/libc_installation.cpp" "${CMAKE_SOURCE_DIR}/src/link.cpp" - "${CMAKE_SOURCE_DIR}/src/memory_profiling.cpp" "${CMAKE_SOURCE_DIR}/src/os.cpp" "${CMAKE_SOURCE_DIR}/src/parser.cpp" "${CMAKE_SOURCE_DIR}/src/range_set.cpp" @@ -464,6 +467,7 @@ set(ZIG_SOURCES "${CMAKE_SOURCE_DIR}/src/tokenizer.cpp" "${CMAKE_SOURCE_DIR}/src/translate_c.cpp" "${CMAKE_SOURCE_DIR}/src/util.cpp" + "${ZIG_SOURCES_MEM_PROFILE}" ) set(OPTIMIZED_C_SOURCES "${CMAKE_SOURCE_DIR}/src/blake2b.c"