[CMake] set ranlib/ar in toolchain file

Yngve Inntjore Levinsen yngve.levinsen at gmail.com
Wed Jul 4 10:03:04 EDT 2012


Hi,

I try to set up my toolchain file for building Windows executables in a Linux 
environment. I started with the example from 
http://www.cmake.org/Wiki/CmakeMingw

The only thing I noticed was that I needed to use "ar" and "ranlib" from MinGW 
as well, for creating the archives. I can do this by manually editing the file 
CMakeFiles/CMakeCXXCompiler.cmake after cmake has run. Code compiles 
successfully.

I then tried to add the following two lines to the toolchain file:
SET(CMAKE_AR i486-mingw32-ar)
SET(CMAKE_RANLIB i486-mingw32-ranlib)

(yes, the prefix for my MinGW install is different from the example)

Sadly, that makes the initial compiler test fail. For fortran it actually 
still works, but the test fails for c and c++. I have tried to search for a 
while without finding out what I do wrong. Please tell me. Or ask if something 
is unclear.

Thanks!

Cheers,
Yngve


More information about the CMake mailing list