> $ nm test.o
> U __gxx_personality_v0
> U hello1_
> 0000000000000000 T main
> $ nm hello.o
> U _gfortran_st_write
> U _gfortran_st_write_done
> U _gfortran_transfer_character
> 0000000000000000 T hello1_
So you're calling Fortran from C.
> /usr/bin/gfortran -fPIC
> CMakeFiles/hi.dir/hello.o -o hi -rdynamic -lgfortran
The problem is that CMake decides to use gfortran as a linker, not gcc,
because we specified that this is a Fortran project and forgot about C++.
So the solution is:
# To indicate that this is mixed language project
PROJECT(TEST CXX Fortran)
# To explicitly specify that your MAIN is C++'s main.
SET_TARGET_PROPERTIES(test PROPERTIES LINKER_LANGUAGE CXX)
"set_target_props" without "project" will not work.
Denis
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake