<div dir="ltr"><div><div><div>You're not giving the DLL micro_linMatl_l any source files, so there's nothing to build. You need to list at least one source file in the add_library() call. You mentioned a main subroutine in your first e-mail; the file containing the main subroutine should be listed in the add_library(SHARED) call.<br><br>Your use of ${EXTRA_LIBS} in that command is strange - from what I can tell, it only contains a directory name, which should definitely not be listed.<br><br></div>include_directories() controls the compiler switch which specifies paths to look for include files. If you have a CMakeLists.txt file in Modules and want to process that, you need add_subdirectory().<br><br></div>You should probably look at some CMake tutorials or example simple CMake files to get better hang of how individual CMake commands work and interoperate.<br><br></div>Petr<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 25, 2015 at 2:21 PM, Doron Klepach <span dir="ltr"><<a href="mailto:klepachd@gmail.com" target="_blank">klepachd@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hello Petr,<br><br></div>Thank you for the quick reply. At this point I am not getting any errors, but nothing happens when I build the sln in Visual Studio -> no dll is created.<br></div>Here is the main CMake code:<br><br><span style="color:rgb(0,0,255)">cmake_minimum_required (VERSION 3.1)<br>project (micro_linMatl_I)<br>enable_language (Fortran)<br><br># The version number.<br>set (micro_linMatl_I_VERSION_MAJOR 4)<br>set (micro_linMatl_I_VERSION_MINOR 0)<br><br>#include all the required modules from the folder "Modules" <br>include_directories ("${PROJECT_SOURCE_DIR}/Modules")<br>set (EXTRA_LIBS ${EXTRA_LIBS} Modules)<br><br>ADD_Library(micro_linMatl_I SHARED ${EXTRA_LIBS})<br>SET_TARGET_PROPERTIES(micro_linMatl_I PROPERTIES LINKER_LANGUAGE Fortran)<br>target_link_libraries (micro_linMatl_I  ${EXTRA_LIBS})<br></span><br></div>and here is the one in the folder "Modules"<br><br><span style="color:rgb(0,0,255)">add_library(Modules mod1.F90 mod2.F90 ...)</span><span class=""><br><br>Thank you for your help,<br></span></div><span class="HOEnZb"><font color="#888888">Doron<br></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 25, 2015 at 3:07 PM, Petr Kmoch <span dir="ltr"><<a href="mailto:petr.kmoch@gmail.com" target="_blank">petr.kmoch@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi Doron,<br><br></div>it would be helpful if you provided the error you're getting from add_library(), and also showed the exact CMake code you used.<br><br></div>Petr<br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Wed, Feb 25, 2015 at 1:57 PM, Doron Klepach <span dir="ltr"><<a href="mailto:klepachd@gmail.com" target="_blank">klepachd@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><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>add</span>_<span>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" target="_blank">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>
<br></div></div>--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>