[CMake] gfortran
Javier Gonzalez
javierggt at yahoo.com
Thu Jan 24 04:16:24 EST 2008
Bill Hoffman wrote:
> Javier Gonzalez wrote:
>
>>>
>> I did it and it works (I removed the link just in case):
>>
>> bash-3.2$ ls
>> hello.f90
>> bash-3.2$ cat hello.f90
>> PROGRAM HelloWorld
>> WRITE(*,*) "Hello World!"
>> END PROGRAM
>> bash-3.2$ gfortran -o hello hello.f90
>> bash-3.2$ ./hello
>> Hello World!
>> bash-3.2$
>>
> OK, next step same program in CMake.
> CMakeLists.txt
> project(hello Fortran)
> add_executable(hello hello.f90)
>
> cmake .
> make VERBOSE=1
>
>
> What do you get? What is different about the link line?
>
> -Bill
>
That worked. The compile lines were:
/usr/bin/f95 -o CMakeFiles/hello.dir/hello.o -c
/home/jgonzalez/cmake-test/hello.f90
/usr/bin/f95 -fPIC "CMakeFiles/hello.dir/hello.o" -o hello -rdynamic
Now, I don't compile any fortran code as part of my project but link to
a library that was compiled using gfortran. Apparently, to link I then
need to add the gfortran library which is the one I'm having trouble with.
Javier
More information about the CMake
mailing list