[CMake] [MinGW64] cmake can't validate cxx and fortran compilers.
Sisyphus
sisyphus1 at optusnet.com.au
Fri Jul 9 06:58:57 EDT 2010
----- Original Message -----
From: "David Cole" <david.cole at kitware.com>
To: "Sisyphus" <sisyphus1 at optusnet.com.au>
Cc: "cmake" <cmake at cmake.org>
Sent: Thursday, July 08, 2010 8:38 PM
Subject: Re: [CMake] [MinGW64] cmake can't validate cxx and fortran
compilers.
> If you need to specify compilers that are not picked up by default, use
> environment variables to do so.
>
> See this FAQ entry:
> http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_use_a_different_compiler.3F
>
> Prefer the first method -- does it work if you set FC?
The construct provided in the "first method" example doesn't work on MS
Windows (in the cmd.exe shell, at least):
C:\_64\comp\plplot-5.9.6\staticbuild3>CC=x86_64-w64-mingw32-gcc
CXX=x86_64-w64-mingw32-g++ cmake -G "MinGW Makefiles" ..
'CC' is not recognized as an internal or external command, operable program
or batch file.
But setting the relevant environment variables before running cmake *does*
work beautifully:
############################################
C:\>set CC=x86_64-w64-mingw32-gcc
C:\>set CXX=x86_64-w64-mingw32-g++
C:\>set FC=x86_64-w64-mingw32-gfortran
C:\>cd \_64\comp\plplot-5.9.6\staticbuild3
C:\_64\comp\plplot-5.9.6\staticbuild3>cmake -G "MinGW
Makefiles" -DBUILD_SHARED_LIBS=OFF -DBUILD_TEST=ON -DCMAKE_INSTALL_PREFIX=install
..
[snip - works fine, reporting that f77, cxx and f95 language bindings have
been enabled]
C:\_64\comp\plplot-5.9.6\staticbuild3>mingw32-make
[snip - also works fine, building the C, C++, F77 and F95 examples, as well
as the desired libraries]
C:\_64\comp\plplot-5.9.6\staticbuild3>mingw32-make install
[snip - no problems with this, either]
############################################
I had first tried:
set AR=x86_64-w64-mingw32-ar
but that didn't work - so I resorted to
'-DCMAKE_AR:FILEPATH=x86_64-w64-mingw32-ar' in the 'cmake' command (which
did work as desired). Is there some way to use a different 'ar' via an
environment variable setting ? (It would be convenient if there were such an
option, but I can't complain if there isn't.)
Thanks very much David. (The FAQ is now bookmarked :-)
Cheers,
Rob
More information about the CMake
mailing list