Skip to content

Instantly share code, notes, and snippets.

@badlogic
Created December 18, 2022 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save badlogic/e536462e9b7138ac7a8e6eb778e54378 to your computer and use it in GitHub Desktop.
Save badlogic/e536462e9b7138ac7a8e6eb778e54378 to your computer and use it in GitHub Desktop.
A CMake toolchain file for DJGPP
set (CMAKE_SYSTEM_NAME linux-djgpp)
set (DJGPP TRUE)
#
# CMake toolchain file for DJGPP. Usage:
#
# 1. Download and extract DGJPP
# 2. Place this file into the root folder of DJGPP
# 3. When configuring your CMake project, specify the toolchain file like this:
#
# cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/djgpp/toolchain-djgpp.cmake ...
#
# specify the cross compiler
set (CMAKE_C_COMPILER ${CMAKE_CURRENT_LIST_DIR}/bin/i586-pc-msdosdjgpp-gcc)
set (CMAKE_CXX_COMPILER ${CMAKE_CURRENT_LIST_DIR}/bin/i586-pc-msdosdjgpp-g++)
# where is the target environment
set (CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_LIST_DIR})
# search for programs in the build host directories
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
# add sys-include dir to c/c++ flags by default. ides using
# compile-commands.json can't otherwise find includes.
set (CMAKE_C_FLAGS -I${CMAKE_CURRENT_LIST_DIR}/i586-pc-msdosdjgpp/sys-include/)
set (CMAKE_CXX_FLAGS -I${CMAKE_CURRENT_LIST_DIR}/i586-pc-msdosdjgpp/sys-include/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment