cmake_minimum_required(VERSION 3.10)
project(
    breakpad
    LANGUAGES CXX
              C
              ASM)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_library(
    breakpad-common STATIC
    src/third_party/miniz/miniz.c
    src/common/linux/breakpad_getcontext.S
    src/common/dwarf_range_list_handler.cc
    src/common/stabs_to_module.cc
    src/common/language.cc
    src/common/path_helper.cc
    # src/common/windows/guid_string.cc
    # src/common/windows/symbol_collector_client.cc
    # src/common/windows/string_utils.cc
    # src/common/windows/omap.cc
    # src/common/windows/pe_util.cc
    # src/common/windows/dia_util.cc
    # src/common/windows/sym_upload_v2_protocol.cc
    # src/common/windows/pe_source_line_writer.cc
    # src/common/windows/pdb_source_line_writer.cc
    # src/common/windows/http_upload.cc
    src/common/convert_UTF.cc
    # src/common/solaris/dump_symbols.cc
    # src/common/solaris/file_id.cc
    # src/common/solaris/guid_creator.cc
    src/common/test_assembler.cc
    src/common/long_string_dictionary.cc
    src/common/md5.cc
    src/common/dwarf_cu_to_module.cc
    src/common/dwarf_line_to_module.cc
    src/common/linux/elfutils.cc
    src/common/linux/synth_elf.cc
    src/common/linux/symbol_collector_client.cc
    src/common/linux/linux_libc_support.cc
    src/common/linux/memory_mapped_file.cc
    src/common/linux/crc32.cc
    src/common/linux/scoped_tmpfile.cc
    src/common/linux/elf_core_dump.cc
    src/common/linux/dump_symbols.cc
    src/common/linux/file_id.cc
    src/common/linux/guid_creator.cc
    src/common/linux/scoped_pipe.cc
    src/common/linux/safe_readlink.cc
    src/common/linux/google_crashdump_uploader.cc
    src/common/linux/libcurl_wrapper.cc
    src/common/linux/elf_symbols_to_module.cc
    src/common/linux/http_upload.cc
    src/common/linux/symbol_upload.cc
    src/common/module.cc
    src/common/simple_string_dictionary.cc
    src/common/dwarf/cfi_assembler.cc
    src/common/dwarf/elf_reader.cc
    src/common/dwarf/bytereader.cc
    src/common/dwarf/functioninfo.cc
    src/common/dwarf/dwarf2diehandler.cc
    src/common/dwarf/dwarf2reader.cc
    # src/common/mac/launch_reporter.cc
    # src/common/mac/macho_utilities.cc
    # src/common/mac/arch_utilities.cc
    # src/common/mac/file_id.cc
    # src/common/mac/string_utilities.cc
    # src/common/mac/macho_reader.cc
    # src/common/mac/macho_id.cc
    # src/common/mac/bootstrap_compat.cc
    # src/common/mac/macho_walker.cc
    # src/common/mac/dump_syms.cc
    src/common/string_conversion.cc
    src/common/dwarf_cfi_to_module.cc
    src/common/stabs_reader.cc)

add_library(
    breakpad
    SHARED
    # src/client/windows/crash_generation/minidump_generator.cc
    # src/client/windows/crash_generation/crash_generation_server.cc
    # src/client/windows/crash_generation/client_info.cc
    # src/client/windows/crash_generation/crash_generation_client.cc
    # src/client/windows/sender/crash_report_sender.cc
    # src/client/windows/handler/exception_handler.cc
    # src/client/solaris/handler/minidump_generator.cc
    # src/client/solaris/handler/exception_handler.cc
    # src/client/solaris/handler/solaris_lwp.cc
    # src/client/ios/exception_handler_no_mach.cc
    src/client/linux/log/log.cc
    src/client/linux/dump_writer_common/ucontext_reader.cc
    src/client/linux/dump_writer_common/thread_info.cc
    src/client/linux/minidump_writer/linux_ptrace_dumper.cc
    src/client/linux/minidump_writer/minidump_writer.cc
    src/client/linux/minidump_writer/linux_dumper.cc
    src/client/linux/minidump_writer/linux_core_dumper.cc
    src/client/linux/minidump_writer/pe_file.cc
    src/client/linux/microdump_writer/microdump_writer.cc
    src/client/linux/crash_generation/crash_generation_server.cc
    src/client/linux/crash_generation/crash_generation_client.cc
    # src/client/linux/sender/google_crash_report_sender.cc
    src/client/linux/handler/minidump_descriptor.cc
    src/client/linux/handler/exception_handler.cc
    # src/client/mac/crash_generation/crash_generation_server.cc
    # src/client/mac/crash_generation/crash_generation_client.cc
    # src/client/mac/handler/minidump_generator.cc
    # src/client/mac/handler/dynamic_images.cc
    # src/client/mac/handler/protected_memory_allocator.cc
    # src/client/mac/handler/breakpad_nlist_64.cc
    # src/client/mac/handler/exception_handler.cc
    src/client/minidump_file_writer.cc)

target_include_directories(breakpad-common PUBLIC src/)
find_package(Threads REQUIRED)
target_link_libraries(breakpad-common PRIVATE Threads::Threads)

target_include_directories(breakpad PUBLIC src/)
target_link_libraries(breakpad PRIVATE breakpad-common)
