[CMake] set ranlib/ar in toolchain file

Eric Noulard eric.noulard at gmail.com
Thu Jul 5 11:10:05 EDT 2012


2012/7/5 Yngve Inntjore Levinsen <yngve.levinsen at gmail.com>:
> Hi Eric,
>
>
>
> On Thursday 5. July 2012 10.22.17, Eric Noulard wrote:
>
>> Which ranlib/ar was discovered by CMake?
>
> /usr/bin/ar and /usr/bin/ranlib. I need it to discover the ones with the
> mingw prefix.

OK.

>> You did not give us the exact command line you use with the output
>
>> given by the cmake run.
>
> The command I use for cmake is simply cmake -DCMAKE_TOOLCHAIN_FILE=<file>
> <sourcepath>. For better understanding what I do wrong, I attach both the
> now working toolchain file I have, and the non-working one.
>
>
>
> With the non-working one I get the following grep result afterwards:

[...]


>> I can ensure you that on my box the provided toolchain works and
>> discover a coherent set of mingw compiler and tools (include ar/ranlib)
>> there must be something specific in your case.
>
> OK, perhaps I use different cmake version? I have 2.8.8 installed.

I was using git master but I tried with pristine 2.8.8 and it works for me...


> $ uname -a
>
> Linux PCBE13951 3.4.3-1-CHAKRA #1 SMP PREEMPT Mon Jun 18 17:39:58 UTC 2012
> x86_64 GNU/Linux

Almost the same for me (64 bits Linux Debian Wheezy).

I may have a wild guess, does your project enable Fortran language first?

that is in your main CMakeList.txt do you have

project(Whatever Fortran)

...

enable_language(C)
enable_language(CXX)
...

if it is the case could try enabling C language first?
i.e.
project(Whatever C)
...
enable_language(Fortran)
enable_language(CXX)


It looks like CMakeDetermineFortranCompiler.cmake may not setup
_CMAKE_TOOLCHAIN_PREFIX as C and C++ does.



-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list