set(TINY_CONVMEM_MCPC_ROOT "${PROJECT_SOURCE_DIR}/third_party/mcpc") if(NOT EXISTS "${TINY_CONVMEM_MCPC_ROOT}/mcpc/mcpc.h") message(FATAL_ERROR "The vendored mcpc fork is missing from third_party/mcpc" ) endif() # The upstream CMake target at the imported revision is incomplete. This source # list defines the project-maintained vendored fork build. set(TINY_CONVMEM_MCPC_SOURCES "${TINY_CONVMEM_MCPC_ROOT}/src/alloc.c" "${TINY_CONVMEM_MCPC_ROOT}/src/log.c" "${TINY_CONVMEM_MCPC_ROOT}/src/errcode.c" "${TINY_CONVMEM_MCPC_ROOT}/src/anydata.c" "${TINY_CONVMEM_MCPC_ROOT}/src/tool.c" "${TINY_CONVMEM_MCPC_ROOT}/src/rsc.c" "${TINY_CONVMEM_MCPC_ROOT}/src/prmpt.c" "${TINY_CONVMEM_MCPC_ROOT}/src/server.c" "${TINY_CONVMEM_MCPC_ROOT}/src/retbuf.c" "${TINY_CONVMEM_MCPC_ROOT}/src/ucbr.c" "${TINY_CONVMEM_MCPC_ROOT}/src/complt.c" "${TINY_CONVMEM_MCPC_ROOT}/src/serlz.c" "${TINY_CONVMEM_MCPC_ROOT}/src/mjson.c" ) add_library(mcpc STATIC ${TINY_CONVMEM_MCPC_SOURCES}) add_library(mcpc::mcpc ALIAS mcpc) target_include_directories(mcpc SYSTEM PUBLIC "${TINY_CONVMEM_MCPC_ROOT}" PRIVATE "${TINY_CONVMEM_MCPC_ROOT}/src" ) target_compile_features(mcpc PUBLIC c_std_17) if(MSVC) # These compatibility definitions affect mcpc's public headers as well as # its implementation, so consumers must compile with the same view. target_compile_definitions(mcpc PUBLIC is_win=1 is_wincl=1 MCPC_C23PTCH_KW1 MCPC_C23PTCH_CKD1 MCPC_C23PTCH_UCHAR1 MCPC_C23GIVUP_FIXENUM ) target_compile_options(mcpc PRIVATE /utf-8) target_link_libraries(mcpc PUBLIC ws2_32) else() message(WARNING "Only Windows/MSVC is currently verified. Other toolchains are future work." ) endif()