[CMake] CMake cross-compilation best practices

Romain CHANU romainchanu at gmail.com
Mon Nov 30 06:34:43 EST 2009


Hi,

Thank you for your answer.

I want to compile on both Linux and Windows with the same CMakeLists.txt. I
will have a look to the different variables.

Cheers,

Romain

2009/11/30 Johannes Stallkamp <johannes.stallkamp at rub.de>

> Hello Romain,
>
> Romain CHANU schrieb:
> > If I need to compile a library on both Linux and Windows, the best
> > CMake practice would be to write toolchain files for Linux and
> > Windows (cf. http://www.cmake.org/Wiki/CMake_Cross_Compiling)
> >
> > Is that correct?
> Do you really want to cross-compile (i.e. build your Linux library on
> Windows or vice versa) or do you just want to be able to compile your
> platform-independent library natively on Linux or Windows but with the
> same CMakeLists.txt ?
> In the latter case, just go for it. Basically, your Windows
> CMakeLists.txt should work just fine on Linux and vice versa. You
> might need to adjust some paths if you use some 3rd party libraries or
> use some compiler specific additional options. But you can implement
> that just fine within the same CMakeLists.txt using IF( MSVC ) ....
> ENDIF() (or other compiler/system-variables, see
> http://www.itk.org/Wiki/CMake_Useful_Variables )
>
> HTH
> Johannes
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091130/e0d44ccd/attachment.htm>


More information about the CMake mailing list