[CMake] Cross-platform build under Windows targeting Linux
Matthew Woehlke
matthew.woehlke at kitware.com
Mon Jun 10 15:06:57 EDT 2013
On 2013-06-10 04:52, setareh S wrote:
> Now, I want to build my code for Linux platform(GNU/Linux) on a Win32
> platform. I tried doing the above procedure using CMake combined with
> Cygwin and using gcc and g++ as compilers. It built fine, created
> makefiles, and when I issued "make" in Cygwin terminal, the generated
> makefiles were "made". Now I have got an executable which I was hoping
> would run on Linux platform. But on Linux I get the error: bash cannot
> execute binary file.
>
> Using command file executablename, I realized the executable which is made
> by the above procedure is of type PE32 which is only for Windows.
Are the compilers you are using cross-compilers, or the ones that came
with cygwin? The normal cygwin gcc/g++ compilers target cygwin on win32
and are not cross-compilers.
--
Matthew
More information about the CMake
mailing list