set(CMAKE_SYSTEM_NAME DOS)
set(CMAKE_SYSTEM_PROCESSOR i386)

set(CMAKE_C_COMPILER wcl386)
set(CMAKE_CXX_COMPILER wcl386)
set(CMAKE_AR wlib)

set(CMAKE_C_COMPILER_TARGET dos)
set(CMAKE_CXX_COMPILER_TARGET dos)

set(CMAKE_C_FLAGS_INIT "-bt=dos -ox -oe=200 -zp4 -fpi87")

set(CMAKE_EXE_LINKER_FLAGS
    "system dos4g option stack=65536 library clib3r library math387r"
    CACHE STRING "" FORCE)

set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)

set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib" CACHE STRING "" FORCE)
