[CMake] FortranCInterface_VERIFY problem on Mac

tog guillaume.alleon at gmail.com
Tue Apr 12 12:49:50 EDT 2011


Hi,

I am quite new to CMake. I want to use it for compiling an application
mixing C & Fortran.

I have narrowed down a CMake file to this:

PROJECT(dummy)

# Set the minimum version of cmake required to 2.6
CMAKE_MINIMUM_REQUIRED( VERSION 2.6 )

ENABLE_LANGUAGE(Fortran)

INCLUDE(FortranCInterface)
FortranCInterface_VERIFY(CXX)
FortranCInterface_HEADER(FC.h MACRO_NAMESPACE "FC_")

and get the following error on my Mac.

Darwin obelix 10.7.0 Darwin Kernel Version 10.7.0: Sat Jan 29 15:16:10
PST 2011; root:xnu-1504.9.37~1/RELEASE_X86_64 x86_64

Any idea what I am doing wrong ?

Thanks
Guillaume

...
     Linking CXX executable VerifyFortranC
     "/Applications/CMake 2.8-4.app/Contents/bin/cmake" -E
cmake_link_script CMakeFiles/VerifyFortranC.dir/link.txt --verbose=1
     /usr/bin/c++    -Wl,-search_paths_first
-Wl,-headerpad_max_install_names
CMakeFiles/VerifyFortranC.dir/main.c.o
CMakeFiles/VerifyFortranC.dir/VerifyC.c.o
 CMakeFiles/VerifyFortranC.dir/VerifyFortran.f.o
CMakeFiles/VerifyFortranC.dir/VerifyCXX.cxx.o  -o VerifyFortranC
-lgfortranbegin -lgfortran
     ld: warning: in CMakeFiles/VerifyFortranC.dir/VerifyFortran.f.o,
file was built for i386 which is not the architecture being linked
(x86_64)
     Undefined symbols:
       "_VerifyFortran", referenced from:
           _main in main.c.o
     ld: symbol(s) not found
     collect2: ld returned 1 exit status
     make[2]: *** [VerifyFortranC] Error 1
     make[1]: *** [CMakeFiles/VerifyFortranC.dir/all] Error 2
     make: *** [all] Error 2

 Call Stack (most recent call first):
   CMakeLists.txt:9 (FortranCInterface_VERIFY)

-- 
PGP KeyID: 2048R/EA31CFC9  subkeys.pgp.net


More information about the CMake mailing list