# #POSIX runtime environment. #Allows us to run programs that require a POSIX API. #Does not by itself allow us to build such programs. #Building POSIX programs requires posix-dev as well. #NOTE: The following requires 64 bit Windows. #Should not be a problem in the year 2018. # if (WIN32) #On Windows, we rely on MSYS2 to provide a toolchain which can build #applications that rely on the POSIX API. This is done in such a way that #the resulting applications run on Windows using the MSYS2.DLL POSIX emulation #layer. set (UNPACKED_ROOT "${CMAKE_INSTALL_PREFIX}/msys64") ExternalProject_Add ( posix-runtime PREFIX ${CMAKE_INSTALL_PREFIX} BUILD_IN_SOURCE 1 URL https://sourceforge.net/projects/msys2/files/Base/x86_64/msys2-base-x86_64-20180531.tar.xz URL_MD5 29ce9b77a0fb8452d1a34858c977852f #Unpack to this directory SOURCE_DIR ${UNPACKED_ROOT} #To make sense of the alchemy below, see https://github.com/msys2/msys2/wiki/MSYS2-installation CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env MSYSTEM=MSYS2 CHERE_INVOKING=1 ${UNPACKED_ROOT}/usr/bin/bash.exe --login -c "exit 0" #Update the package database and then install development tools #See https://github.com/Alexpux/MSYS2-packages/issues/148 for which packages we install BUILD_COMMAND ${CMAKE_COMMAND} -E env MSYSTEM=MSYS2 CHERE_INVOKING=1 ${UNPACKED_ROOT}/usr/bin/bash.exe --login -c "pacman -Suu --noconfirm" #Install a small batch file ${CMAKE_INSTALL_PREFIX}/bin/posix.cmd which we #will use to start a bash shell that can run configure/make INSTALL_COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX= -P ${CMAKE_CURRENT_LIST_DIR}/install.cmake ) set (POSIX_ROOT "${UNPACKED_ROOT}" PARENT_SCOPE) set (POSIX_CMD "${CMAKE_INSTALL_PREFIX}/bin/posix.cmd" PARENT_SCOPE) endif (WIN32) if (UNIX) set (POSIX_ROOT "/" PARENT_SCOPE) #UNIX systems have a builtin bash shell, so there is no need to install anything. set (POSIX_CMD "" PARENT_SCOPE) #Define an empty posix-runtime project so that dependencies on a posix runtime can be #specified indendently of WIN32 or UNIX. ExternalProject_Add ( posix-runtime BUILD_IN_SOURCE 1 DOWNLOAD_COMMAND "" CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" ) endif (UNIX)