<div dir="ltr"><div><div><div><div><div><div><div>Hello there,<br><br></div>I am new to CMake and I am trying to convert a project to work with CMake.<br><br></div>As a part of the process I need to create a DLL from a FORTRAN code.<br><br></div>Here are some details:<br></div>*The code works on Visual Studio and creates the DLL as required.<br><br></div>*The main subroutine looks like this:<br><br><span style="color:rgb(0,0,255)">subroutine sub1(var1,var2 ...)<br><br>!DEC$ ATTRIBUTES DLLEXPORT      :: sub1<br><br>...<br><br></span></div><span style="color:rgb(0,0,255)">ens subroutine sub1</span><br><br></div>* I looked at the CMake command<br><pre><span style="color:rgb(0,0,255)"><span class="">add</span>_<span class="">library</span>(<name> [STATIC | SHARED | MODULE]
            [EXCLUDE_FROM_ALL]
            source1 [source2 ...])</span><br></pre><pre><font><span style="font-family:arial,helvetica,sans-serif">and tried the SHARED option, but that did not work, giving an error.<br><br></span></font></pre><pre><font><span style="font-family:arial,helvetica,sans-serif">* I looked at several sources for help, including <br><a href="http://www.kitware.com/blog/home/post/231">http://www.kitware.com/blog/home/post/231</a><br></span></font></pre><pre><font><span style="font-family:arial,helvetica,sans-serif">but I was not able to figure out how to create the DLL (the link to the example is not working)<br><br></span></font></pre><pre><font><span style="font-family:arial,helvetica,sans-serif">I would appreciate a simple example that shows how to do this.<br><br></span></font></pre><pre><font><span style="font-family:arial,helvetica,sans-serif">Thank you for your help,<br></span></font></pre><pre><font><span style="font-family:arial,helvetica,sans-serif">Doron<br></span></font></pre><br></div>