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

Reply via email to