<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 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>> Date: Wed, 10 Jun 2009 06:59:33 -0700<br>> From: denis_scherbakov@yahoo.com<br>> Subject: Re: [CMake] FW: building a mixed language programm with CMake<br>> To: cmake@cmake.org; nataliehapp@hotmail.com<br>> <br>> <br>> > $ nm test.o<br>> > U __gxx_personality_v0<br>> > U hello1_<br>> > 0000000000000000 T main<br>> > $ nm hello.o<br>> > U _gfortran_st_write<br>> > U _gfortran_st_write_done<br>> > U _gfortran_transfer_character<br>> > 0000000000000000 T hello1_<br>> <br>> So you're calling Fortran from C.<br>> <br>> > /usr/bin/gfortran -fPIC <br>> > CMakeFiles/hi.dir/hello.o -o hi -rdynamic -lgfortran <br>> <br>> The problem is that CMake decides to use gfortran as a linker, not gcc,<br>> because we specified that this is a Fortran project and forgot about C++.<br>> So the solution is:<br>> <br>> # To indicate that this is mixed language project<br>> PROJECT(TEST CXX Fortran)<br>> # To explicitly specify that your MAIN is C++'s main.<br>> SET_TARGET_PROPERTIES(test PROPERTIES LINKER_LANGUAGE CXX)<br>> <br>> "set_target_props" without "project" will not work.<br>> <br>> Denis<br>> <br>> <br>> <br><br /><hr />Tus elecciones hablan por ti. <a href='http://www.descubrewindowslive.com/' target='_new'>¡Conoce quién eres realmente!</a></body>
</html>