[CMake] WIN32 vs CMAKE_HOST_WIN32

Eric Noulard eric.noulard at gmail.com
Mon Mar 26 17:51:58 EDT 2012


2012/3/26 Eric Noulard <eric.noulard at gmail.com>:
> 2012/3/26 Robert Dailey <rcdailey.lists at gmail.com>:
>> Ever since I started using CMake, I always assumed that the WIN32 variable
>> represented what system CMake is currently running on. Looking more
>> carefully at the documentation, however, it seems this describes what system
>> CMake is generating for. Could someone explain this a bit better? What would
>> be an example of when WIN32 would be true but I'm not actually on Windows?
>
> When you cross-compile Windows binaries on a Linux host.
> see:
> http://www.cmake.org/Wiki/CMake_Cross_Compiling
> http://www.cmake.org/Wiki/CmakeMingw

If you want to give it a try on a sample project you can try this one:
https://github.com/TheErk/CMake-tutorial/tree/master/examples


It may be cross-compiled on a Linux host with mingw cross-compiler installed.

try:
$ mkdir build-win32
$ cd build-win32
$ cmake -DCMAKE_TOOLCHAIN_FILE=../totally-free/Toolchain-cross-mingw32-linux.cmake
../totally-free/


More information about the CMake mailing list