<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
I have a fortran code that I'm compiling twice to generate two libraries. There is a USE statement inside a preprocessor conditional. It looks like cmake is not picking up the dependency because of it. The code in question is
<div>
<div><br>
</div>
<div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo; "> <span style="color: rgb(187, 44, 162); ">SUBROUTINE</span> calc_fbal(bsubu, bsubv)</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo; "> <font color="#bb2ca2">...</font></div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo; "> <span style="color: rgb(187, 44, 162); ">USE</span> realspace, ONLY: wint, phip</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(0, 132, 0); ">
#ifdef _ANIMEC</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo; "> <span style="color: rgb(39, 42, 216); ">1</span> ,pperp, ppar, onembc, sigma_an,</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo; "> <span style="color: rgb(39, 42, 216); ">2</span> pp<span style="color: rgb(39, 42, 216); ">1</span>, pp<span style="color: rgb(39, 42, 216); ">2</span>, pp<span style="color: rgb(39, 42, 216); ">3</span></div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo; "> <span style="color: rgb(187, 44, 162); ">USE</span> vforces, gsqrt => azmn_o</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(0, 132, 0); ">
#endif</div>
</div>
<div><br>
</div>
<div>When I try to compile this, I get an error</div>
<div><br>
</div>
<div>
<div><font face="Menlo" style="font-size: 11px; ">[ 39%] Building Fortran object VMEC2000/CMakeFiles/animec.dir/Sources/General/fbal.f.o</font></div>
<div><font face="Menlo" style="font-size: 11px; ">/trunk/VMEC2000/Sources/General/fbal.f:22.72:</font></div>
<div><font face="Menlo" style="font-size: 11px; "><br>
</font></div>
<div><font face="Menlo" style="font-size: 11px; "> USE vforces, gsqrt => azmn_o </font></div>
<div><font face="Menlo" style="font-size: 11px; "> 1</font></div>
<div><font face="Menlo" style="font-size: 11px; ">Fatal Error: Can't open module file 'vforces.mod' for reading at (1): No such file or directory</font></div>
</div>
<div><br>
</div>
<div>I'm defining _ANIMEC using the line</div>
<div><br>
</div>
<div><font face="Menlo"><span style="font-size: 11px; ">set_target_properties (animec PROPERTIES COMPILE_FLAGS "${BUILD_FLAGS} -D_ANIMEC")</span></font></div>
<div><br>
</div>
</div>
<div>because I only what it defined for this specific target only. Is there a better way define _ANIMEC so that it correctly finds the dependency?</div>
<div><br>
</div>
<div>Mark</div>
</body>
</html>