[CMake] CMake not searching Fortran source suffixes

Robert Haines rhaines at manchester.ac.uk
Tue Jul 8 09:14:47 EDT 2008


Hi all,

I wonder if anyone can help with this that I've got stuck on.

I'm building a mixed C and Fortran project that builds libraries and  
then some example applications. When building the example apps, to  
make everything more generic and reusable I do this (like in VTK with  
its Rendering, etc subdirectories I think):

set(EXAMPLE app_name)

add_executable(${EXAMPLE} ${EXAMPLE})

where the source file it needs to compile is app_name.c

So far so good as CMake finds app_name.c by searching through a list  
of known source file suffixes to complete the filename.

But when building the Fortran examples I get an error:

CMAke Error: Cannot find source file
"/source/path/and/filename" for target "filename"

Tried extensions .c .C .c++ .cc .... etc and so on.

When I turn on Fortran in my project a file called  
"CMakeFortranCompiler.cmake" is created which lists the possible  
Fortran extensions in a variable called  
CMAKE_Fortran_SOURCE_FILE_EXTENSIONS but these it seems aren't added  
to the list CMake uses to search with.

Is this a bug? Can I add them to the search list myself? I've looked  
in vain for a variable where the search list might be stored and  
therefore appended to.

This is with 2.4.8 and 2.6.0.

Thanks for any help/pointers,
Rob



More information about the CMake mailing list