<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Great, now it works!<br>My CMakeLists.txt now looks like this:<br><br>cmake_minimum_required(VERSION 2.4)<br>project(hi CXX&nbsp; Fortran)<br><br>ADD_LIBRARY(hello SHARED hello.f90)<br>SET(TEST_SRCS test.cxx)<br><br>ADD_EXECUTABLE(hi ${TEST_SRCS})<br>TARGET_LINK_LIBRARIES(hi hello)<br>SET_TARGET_PROPERTIES(hi PROPERTIES LINKER_LANGUAGE CXX)<br><br>Thanks a lot for your help!<br>Greetings,<br>Natalie<br><br>&gt; Date: Wed, 10 Jun 2009 06:59:33 -0700<br>&gt; From: denis_scherbakov@yahoo.com<br>&gt; Subject: Re: [CMake] FW: building a mixed language programm with CMake<br>&gt; To: cmake@cmake.org; nataliehapp@hotmail.com<br>&gt; <br>&gt; <br>&gt; &gt; $ nm test.o<br>&gt; &gt; U __gxx_personality_v0<br>&gt; &gt; U hello1_<br>&gt; &gt; 0000000000000000 T main<br>&gt; &gt; $ nm hello.o<br>&gt; &gt; U _gfortran_st_write<br>&gt; &gt; U _gfortran_st_write_done<br>&gt; &gt; U _gfortran_transfer_character<br>&gt; &gt; 0000000000000000 T hello1_<br>&gt; <br>&gt; So you're calling Fortran from C.<br>&gt; <br>&gt; &gt; /usr/bin/gfortran&nbsp;&nbsp; -fPIC&nbsp;<br>&gt; &gt; CMakeFiles/hi.dir/hello.o&nbsp; -o hi -rdynamic -lgfortran <br>&gt; <br>&gt; The problem is that CMake decides to use gfortran as a linker, not gcc,<br>&gt; because we specified that this is a Fortran project and forgot about C++.<br>&gt; So the solution is:<br>&gt; <br>&gt; # To indicate that this is mixed language project<br>&gt; PROJECT(TEST CXX Fortran)<br>&gt; # To explicitly specify that your MAIN is C++'s main.<br>&gt; SET_TARGET_PROPERTIES(test PROPERTIES LINKER_LANGUAGE CXX)<br>&gt; <br>&gt; "set_target_props" without "project" will not work.<br>&gt; <br>&gt; Denis<br>&gt; <br>&gt; <br>&gt;       <br><br /><hr />Tus elecciones hablan por ti. <a href='http://www.descubrewindowslive.com/' target='_new'>¡Conoce quién eres realmente!</a></body>
</html>