[CMake] Unable to set CMAKE_Fortran_COMPILER on Mac OS X 10.8.3

William Clodius wclodius at los-alamos.net
Wed Mar 27 21:48:56 EDT 2013


I have been developing Fortran 2003 code on a Mac system. Because Xcode comes with a very old version of gcc its Fortran compiler has poor support for newer versions of Fortran, so I have been using newer versions of gcc installed using Mac Fink, and run from either the terminal application, or the X-Windows application (now XQuartz). I have been using Cmake to set up the build process using Unix makefiles. Until recently I had been doing development on an older 15" MacBook Pro, with latest version of OS X compatible with that system, I believe OS X 10.7.4(?). Cmake was doing a reasonable job on that system. I recently upgraded to a MacBook Pro with retina display, with OS X 10.8.3. (2.4 GHz Intel Core i7, 8GB 1600 MHz DDR3) I then transferred my data files and settings (but not applications) from my older system to the newer one, using Time Capsule. I then installed the replacement applications upgrading to gcc/gfortran 4.8 from 4.7.3, X Windows to XQuartz, Xcode (4.5?) to 4.6.1, and CMake 2.8-10 (.0?) to 2.8-10.2. In the current setup I cannot seem to change the CMAKE_Fortran_COMPILER (testing suggests I have trouble changing the C and C++ compilers as well) from an invalid setting. I have tried using both the command line interface (in both the Terminal and XQuartz applications) and the CMake visual interface application.

On the command line I tried running in wizard mode using the advanced option (bash-3.2$ cake -i ./). Trying to set CMAKE_Fortran_COMPILER to /sw/bin/gfortran where Fink installed gfortran 4.8 upon completion I get the message

CMake Error: your Fortran compiler: "/usr/local/gfortran/bin/gfortran" was not found.   Please set CMAKE_Fortran_COMPILER to a valid compiler path or name.
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_Fortran_COMPILER= /sw/bin/gfortran



CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_COMMAND
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_COMMAND
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
.
.
.


If I delete the cache and rerun (bash-3.2$ cake -i ./) I get the same message. I get different but closely related messages from the windowing (graphical) interface to CMake. It seems to always want to default to the native (Xcode) compilers. If I set the C, C++, and Fortran compilers to the fink downloaded gcc 4.8 versions in /sw/bin, configure tells me:

 Configuring incomplete, errors occurred!
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_C_COMPILER= /sw/bin/gcc-fsf-4.8
CMAKE_CXX_COMPILER= /sw/bin/g++-fsf-4.8
CMAKE_Fortran_COMPILER= /sw/bin/gfortran-fsf-4.8

If I delete the cache and run configure, I am back to square 1. If I don't delete the cache and run generate I get

 CMake Error: your Fortran compiler: "/usr/local/bin/gfortran" was not found.   Please set CMAKE_Fortran_COMPILER to a valid compiler path or name.
Configuring incomplete, errors occurred!
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_C_COMPILER= /sw/bin/gcc-fsf-4.8
CMAKE_CXX_COMPILER= /sw/bin/g++-fsf-4.8
CMAKE_Fortran_COMPILER= /sw/bin/gfortran-fsf-4.8

Generating done

Any suggestions?


More information about the CMake mailing list