#Generate and install a cmake toolchain file for OpenWatcom 8086 #as share/openwatcom-toolchain.txt containing absolute paths for the compiler, #librarian and linker found via find_program(). This allows us to install a #crosscompiler, librarian and linker, and then use the toolchain file #generated here to crosscompile other OSD packages. cmake_minimum_required(VERSION 3.6.3) #The generated toolchain file depends on CMAKE_TRY_COMPILE_TARGET_TYPE project (openwatcom-toolchain) #Default values used by the configure step. #You can override these with cmake -DTOOLCHAIN_COMPILER_TARGET etc. set (TOOLCHAIN_SYSTEM_NAME Windows CACHE STRING "Value for CMAKE_SYSTEM_NAME") set (TOOLCHAIN_SYSTEM_VERSION 6.22 CACHE STRING "Value for CMAKE_SYSTEM_VERSION") set (TOOLCHAIN_SYSTEM_PROCESSOR x86 CACHE STRING "Value for CMAKE_SYSTEM_PROCESSOR") #Locate the launcher scripts for the Openwatcom compiler, linker and librarian. #This toolchain file will configure cmake to launch them via small launcher #scripts which will set some environment variables first. find_program (TOOLCHAIN_C_EXECUTABLE wcl-launcher.cmd) find_program (TOOLCHAIN_LINKER_EXECUTABLE wlink-launcher.cmd) find_program (TOOLCHAIN_AR_EXECUTABLE wlib-launcher.cmd) if (TOOLCHAIN_C_EXECUTABLE) message (STATUS "Toolchain will launch the OpenWatcom compiler via " ${TOOLCHAIN_C_EXECUTABLE}) else() message (FATAL_ERROR "Could not find OpenWatcom compiler") endif() if (TOOLCHAIN_LINKER_EXECUTABLE) message (STATUS "Toolchain may use linker " ${TOOLCHAIN_LINKER_EXECUTABLE}) else() message (FATAL_ERROR "Could not find linker " ${TOOLCHAIN_LINKER}) endif() if (TOOLCHAIN_AR_EXECUTABLE) message (STATUS "Toolchain will use librarian " ${TOOLCHAIN_AR_EXECUTABLE}) else() message (FATAL_ERROR "Could not find the wlib librarian" ) endif() #Generate toolchain file openwatcom-toolchain.txt which contains absolute #filenames for the compiler, librarian and linker launch scripts as given by #the following variables: #TOOLCHAIN_C_EXECUTABLE #TOOLCHAIN_AR_EXECUTABLE #TOOLCHAIN_LINKER_EXECUTABLE. configure_file (${CMAKE_CURRENT_LIST_DIR}/toolchain-template.txt ${CMAKE_BINARY_DIR}/openwatcom-toolchain.txt) install (FILES ${CMAKE_BINARY_DIR}/openwatcom-toolchain.txt DESTINATION share)