Try running cmake from the the Intel Visual Fortran Command Prompt. This will create a local environment where all of the compilers are readily available (cl and ifort). <br><br>cmake c:\mysourcecode -G"NMake Makefiles"<br>
<br>-kt<br><br><div class="gmail_quote">On Thu, Oct 15, 2009 at 6:08 AM, Sebas <span dir="ltr"><<a href="mailto:spaseba@gmail.com">spaseba@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
With CMake 2.8 rc3 i have next error (don't pass el test file in the beginning):<br><br>Check for working Fortran compiler: ifort
<p style="margin: 0px; text-indent: 0px;">Check for working Fortran compiler: ifort -- works</p>
<p style="margin: 0px; text-indent: 0px;">Detecting Fortran compiler ABI info</p>
<p style="margin: 0px; text-indent: 0px;">Detecting Fortran compiler ABI info - done</p>
<p style="margin: 0px; text-indent: 0px;">Checking whether ifort supports Fortran 90</p>
<p style="margin: 0px; text-indent: 0px;">Checking whether ifort supports Fortran 90 -- yes</p>
<p style="margin: 0px; text-indent: 0px;">Check for working C compiler: cl</p>
<p style="margin: 0px; text-indent: 0px;"><span style="color: rgb(255, 0, 0);">CMake Error: This should not have happen. If you see this message, you are probably using a broken CMakeLists.txt file or a problematic release of CMake</span></p>
<p style="margin: 0px; text-indent: 0px;"><span style="color: rgb(255, 0, 0);">CMake Error: Could not find cmake module file:C:/DocSebastian/Trabajos/Pruebas_Cmake/Visual Studio 2008/CMakeFiles/CMakeRCCompiler.cmake</span></p>
<p style="margin: 0px; text-indent: 0px;"><span style="color: rgb(255, 0, 0);">CMake Error: Internal CMake error, TryCompile configure of cmake failed</span></p>
<p style="margin: 0px; text-indent: 0px;">Check for working C compiler: cl -- broken</p>
<p style="margin: 0px; text-indent: 0px;"><span style="color: rgb(255, 0, 0);">CMake Error at C:/Archivos de programa/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:50 (MESSAGE):</span></p>
<p style="margin: 0px; text-indent: 0px;"><span style="color: rgb(255, 0, 0);"> The C compiler "cl" is not able to compile a simple test program.</span></p>
<p style="margin: 0px; text-indent: 0px;"><span style="color: rgb(255, 0, 0);"> It fails with the following output:</span></p>
<p style="margin: 0px; text-indent: 0px;"><span style="color: rgb(255, 0, 0);"> </span></p>
<p style="margin: 0px; text-indent: 0px;"><span style="color: rgb(255, 0, 0);"> </span></p>
<p style="margin: 0px; text-indent: 0px;"><span style="color: rgb(255, 0, 0);"> CMake will not be able to correctly generate this project.</span></p>
<p style="margin: 0px; text-indent: 0px;"><span style="color: rgb(255, 0, 0);">Call Stack (most recent call first):</span></p>
<p style="margin: 0px; text-indent: 0px;"><span style="color: rgb(255, 0, 0);"> CMakeLists.txt:10 (PROJECT)</span></p>
<p style="margin: 0px; text-indent: 0px;">Configuring incomplete, errors occurred!</p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;">
Sebastian<br></p><div><div></div><div class="h5"><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;"><br></p><br><br><div class="gmail_quote">
On Tue, Oct 13, 2009 at 7:06 PM, Clinton Stimpson <span dir="ltr"><<a href="mailto:clinton@elemtech.com" target="_blank">clinton@elemtech.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Oh, do you have a Release/Debug link issue with this?<br>
Does the patch in this bug report help:<br>
<a href="http://public.kitware.com/Bug/view.php?id=8744" target="_blank">http://public.kitware.com/Bug/view.php?id=8744</a><br>
<br>
Clint<br>
<div><div></div><div><br>
On Tuesday 13 October 2009 03:56:13 pm Sebas wrote:<br>
> Thanks Kelly by your explication, I learn a lot. With incorporating<br>
> "PROPERTIES LINKER_LANGUAGE Fortran" work, without add other thing that<br>
> "/NODEFAULTLIB:MSVCRTD.lib" (may be is it related with /MD and /MT?).<br>
> For mayor understand, CLibrary in ProgramFortran Directory is for interface<br>
> of fortran to CLibrary2 y CPPLibrary2. They are extern librarys that if<br>
> posible not modified (SuperLU, tetgen, etc), for it "extern "C"" is<br>
> incorporated in CPPLibrary.<br>
> In Linux i have to use "TARGET_LINK_LIBRARIES( FortranProgram CLibrary<br>
> stdc++ )" for link. Why?<br>
> I attach second example if someone want see it.<br>
><br>
> Bill, create I bug report o not?, with the first example.<br>
> With 2.8 rc3 don't work in windows (don't compile test file).<br>
><br>
> Thanks.<br>
><br>
> Sebastian<br>
><br>
> On Fri, Oct 9, 2009 at 7:05 PM, Kelly (KT) Thompson<br>
<<a href="mailto:kt@transpireinc.com" target="_blank">kt@transpireinc.com</a>>wrote:<br>
> > On Fri, Oct 9, 2009 at 12:49 PM, Bill Hoffman<br>
<<a href="mailto:bill.hoffman@kitware.com" target="_blank">bill.hoffman@kitware.com</a>>wrote:<br>
> >> Kelly (KT) Thompson wrote:<br>
> >><br>
> >> On Fri, Oct 9, 2009 at 6:15 AM, Sebas <<a href="mailto:spaseba@gmail.com" target="_blank">spaseba@gmail.com</a> <mailto:<br>
> >>> <a href="mailto:spaseba@gmail.com" target="_blank">spaseba@gmail.com</a>>> wrote:<br>
> >>><br>
> >>> I send a example where happen explained before ( I have similar<br>
> >>> struct in my Program). I include too the VS2008 project generate by<br>
> >>> cmake. In the Fortran Project be can seen that use /W3 /Zm1000 /GR<br>
> >>> /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>
> >>><br>
> >>><br>
> >>> Sebastian,<br>
> >>><br>
> >>> You are mixing C, C++ and Fortran sources in a single project. This<br>
> >>> does not work well in general and particularly in CMake. I was able to<br>
> >>> restructure your sample code so that it will build with NMake Makefile<br>
> >>> (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<br>
> >>> library. The CMakeLists.txt has the project name CPPLibrary2.<br>
> >>><br>
> >>> 2. each C library is built only from C sources. The CMakeLists.txt<br>
> >>> files are given the project name CLibrary and CLibrary2.<br>
> >>><br>
> >>> 3. the Fortran is also isolated into a single directory and the local<br>
> >>> CMakeLists.txt file only deals with the Fortran.<br>
> >>><br>
> >>> 4. CMake needs help knowing how to build mixed language targets that<br>
> >>> must be compiled with the Fortran compiler. In the Fortran<br>
> >>> 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<br>
> >>> same type of runtime libraries (/MT or /MD). The default Fortran build<br>
> >>> 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++<br>
> >>> function as extern "C" to avoid name mangling issues. The Fortran also<br>
> >>> expects the C++ symbol name to be all caps. You can use Fortran's<br>
> >>> ISO_C_BINDING to get around this platform issue.<br>
> >>><br>
> >>> There are many changes required to your sample build so I decided that<br>
> >>> a zip file would be the best way to return the project to you.<br>
> >>><br>
> >>> Thanks for the work around. However, this should work a bit smoother,<br>
> >><br>
> >> Sebastian can you create a bug report and attach your example?<br>
> >><br>
> >> Thanks.<br>
> >><br>
> >> -Bill<br>
> ><br>
> > Bill,<br>
> ><br>
> > It is my understanding that each CMake target must be 'language pure"<br>
> > The following example will work (and is less complex). This example<br>
> > assumes that all sources are in a single directory (see below). Because<br>
> > Sebastian had separate directories for each language, I assumed that was<br>
> > important for his build setup and tried to be faithful to that layout.<br>
> ><br>
> > I think the key feature that was missing from his original setup was:<br>
> ><br>
> > set_target_properties( FortranProgram PROPERTIES LINKER_LANGUAGE<br>
> > Fortran )<br>
> ><br>
> > Without that that statement, CMake will build FortranProgram.obj<br>
> > correctly, but then try to generate the .exe by calling the MSVC linker<br>
> > (using the link flags for C).<br>
> ><br>
> > -kt<br>
> ><br>
> > ## Single directory equivalent CMakeLists.txt:<br>
> ><br>
> > CMAKE_MINIMUM_REQUIRED(VERSION 2.6)<br>
> > PROJECT( FortranProgram C CXX Fortran )<br>
> ><br>
> > # Find local headers<br>
> > INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR} )<br>
> ><br>
> > # Library CLibrary2<br>
> > ADD_LIBRARY( CLibrary2 CLibrary2.c )<br>
> ><br>
> > # Library CPPLibrary<br>
> > ADD_LIBRARY( CPPLibrary2 CPPLibrary2.cpp )<br>
> ><br>
> > # Library: CLibrary<br>
> > ADD_LIBRARY( CLibrary CLibrary.c )<br>
> > TARGET_LINK_LIBRARIES( CLibrary CLibrary2 CPPLibrary2 )<br>
> ><br>
> > # Fortran<br>
> > ADD_EXECUTABLE( FortranProgramExe FortranProgram.f90 )<br>
> > TARGET_LINK_LIBRARIES( FortranProgramExe CLibrary CLibrary2 CPPLibrary2 )<br>
> ><br>
> > set(CMAKE_Fortran_FLAGS_DEBUG "/Od /DDEBUG /MDd" )<br>
> > set(CMAKE_Fortran_FLAGS_RELEASE "/O2 /Ob2 /DNDEBUG /MD" )<br>
> > set(CMAKE_Fortran_FLAGS_MINSIZEREL "/Os /DNDEBUG /MD" )<br>
> > set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "/O2 /Ob2 /DDEBUG /MD" )<br>
> ><br>
> > IF( MSVC_IDE )<br>
> > set_target_properties( FortranProgramExe<br>
> > PROPERTIES<br>
> > LINKER_LANGUAGE Fortran<br>
> > LINK_FLAGS "/SUBSYSTEM:CONSOLE"<br>
> > OUTPUT_NAME FortranProgram<br>
> > )<br>
> > ELSEIF( WIN32 )<br>
> > set_target_properties( FortranProgramExe<br>
> > PROPERTIES<br>
> > LINKER_LANGUAGE Fortran<br>
> > OUTPUT_NAME FortranProgram<br>
> > )<br>
> > ENDIF()<br>
<br>
</div></div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</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>
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>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br>
</div></div><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</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>
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>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br>