[CMake] Fortran+CXX project with CMake 2.2.2

Karl Merkley karl at elemtech.com
Wed Nov 9 19:27:14 EST 2005


I am running the Darwin 2.2.2 version downloaded from www.cmake.org.

I have a simple CMakeLists.txt where I want to combine C++ and FORTRAN.

PROJECT(add_fortran FORTRAN)
ADD_EXECUTABLE(add_fortran main.cpp testf1.f)

When I execute cmake I get the following errors.

CMake Error: Error required internal CMake variable not set, cmake may  
be not be built correctly.
Missing variable is:
CMAKE_FORTRAN_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may  
be not be built correctly.
Missing variable is:
CMAKE_FORTRAN_COMPILER
-- Check for working Fortran compiler: g77
CMake Error: Unknown extension ".f" for file  
"/Users/kgmerk/projects/cmake_fortran/build/CMakeTmp/ 
testFortranCompiler.f".  TRY_COMPILE only works for enabled languages.
Currently enabled languages are: FORTRAN
See PROJECT command for help enabling other languages.
-- Check for working Fortran compiler: g77 -- broken
The Fortran compiler "g77" is not able to compile a simple test program.
It fails with the following output:


CMake will not be able to correctly generate this project.
CMake Error: CMAKE_FORTRAN_COMPILER not set, after EnableLanguage
-- Configuring done

I defined the the two missing variables in my CMakeCache.txt file and I  
still end up with .f being an unknown extension.

Any ideas?

      Thanks,
            Karl



More information about the CMake mailing list