[CMake] FindThreads and Fortran

Alexander Neundorf a.neundorf-work at gmx.net
Thu Jul 17 17:19:45 EDT 2008


On Thursday 17 July 2008, Alin M Elena wrote:
> Hi,
>
> I try to determine the correct -lpthread against which I link in a Fortran
> project. (http://code.google.com/p/tdtbuj)
> using only
> find_package(Threads)
> leads to an error
> -- Looking for include files CMAKE_HAVE_PTHREAD_H
> CMake Error: Unknown extension ".c" for file

FindThreads.cmake does the following:
 CHECK_INCLUDE_FILES("pthread.h" CMAKE_HAVE_PTHREAD_H)

This requires a working C compiler. I think most Find-modules for libraries 
expect to find the library for use with C/C++. How much trouble is it for you 
to require a C compiler on the machines where your app will be built ?
There is probably good reason why for the header is checked. Maybe not on all 
systems there is a separate libpthread.so, but the  header must be always 
there.
Ok, one could also do a FIND_FILE() for pthread.h. This wouldn't test whether 
it actually works. I don't know how important such a check actually is.
You could try it on your installation and let us know how it works.

Alex


More information about the CMake mailing list