<div class="gmail_quote">On Fri, Oct 9, 2009 at 6:15 AM, Sebas <span dir="ltr"><<a href="mailto:spaseba@gmail.com">spaseba@gmail.com</a>></span> wrote:<br><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I send a example where happen explained before ( I have similar struct
in my Program). I include too the VS2008 project generate by cmake. In
the Fortran Project be can seen that use /W3 /Zm1000 /GR /RTC1 /TP
Flags that don't work with ifort.<br>
I use CMake 2.8 rc2 (but happen same in 2.6 and 2.7)<br><br>Thanks.<br><br>Sebastian<br></blockquote></div><br>Sebastian,<br><br>You are mixing C, C++ and Fortran sources in a single project. This
does not work well in general and particularly in CMake. I was able to
restructure your sample code so that it will build with NMake Makefile
(Visual Studio 2008 SP1 and Intel Visual Fortran 11).<br>
<br>
Key points:<br>
<br>1. all C++ code goes into a single directory and
produces a single library. The CMakeLists.txt has the project name
CPPLibrary2.<br>
<br>2. each C library is built only from C sources. The CMakeLists.txt files are given the project name
CLibrary and CLibrary2.<br>
<br>3. the Fortran is also isolated into a single
directory and the local CMakeLists.txt file only deals with the
Fortran.<br><br>4. CMake needs help knowing how to build mixed language targets that
must be compiled with the Fortran compiler. In the Fortran
CMakeLists.txt I had to set_target properties for LINKER_LANGUAGE.<br>
<br>
5. When mixing C and Fortran on the Windows platform you must use the
same type of runtime libraries (/MT or /MD). The default Fortran build
uses /MT, so I had to set these to /MD (Fortran_FLAGS)<br>
<br>
6. When interfacing C++ and Fortran code, you must mark the C++
function as extern "C" to avoid name mangling issues. The Fortran also
expects the C++ symbol name to be all caps. You can use Fortran's
ISO_C_BINDING to get around this platform issue.<br>
<br>
There are many changes required to your sample build so I decided
that a zip file would be the best way to return the project to you.<br>
<br>
-kt<br>
<br>
<br>