September 2018
Intermediate to advanced
606 pages
14h 32m
English
Since we configure and build the code on a host environment (in this case, GNU/Linux or macOS) that is different than the target environment (Windows), we need to provide CMake with information about the target environment which we have encoded in the toolchain.cmake file (https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling).
First and foremost, we provide the name of the target operating system:
set(CMAKE_SYSTEM_NAME Windows)
Then, we specify the compiler(s), for instance:
set(CMAKE_C_COMPILER i686-w64-mingw32-gcc)set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)set(CMAKE_Fortran_COMPILER i686-w64-mingw32-gfortran)
In this simple example, we did not have to detect any libraries or header files but, ...
Read now
Unlock full access