[CMake] CMake 2.6 + Intel Visual Fortran 10 with "/MD" flag?

Alan W. Irwin irwin at beluga.phys.uvic.ca
Fri May 30 12:12:27 EDT 2008


On 2008-05-30 18:00+0200 Maik Beckmann wrote:

> Am Freitag 30 Mai 2008 17:41:21 schrieb Kelly (KT) Thompson:
>> Hi,
>>
>> I am having trouble writing CMakeLists.txt for a Fortran (Intel Visual
>> Fortran 10) project that needs to use the link flags "/libs:dll
>> /threads" (alternate "/MD").  I am generating a "Visual Studio 8 2005"
>> project.  I have reduced the problem to a "hello world" F90 code:
>>
>> program main
>>   print *, "hello"
>> end program main
>>
>> My CMakeLists is here:
>>
>> cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
>> project( hello )
>> enable_language( Fortran )
>> set( CMAKE_Fortran_FLAGS_DEBUG "/libs:dll /threads /dbglibs" )
>> add_executable( main main.f90 )
>> set_target_properties( main PROPERTIES LINKER_LANGUAGE Fortran )
>>
>> In MSVC, the F90 compile line turns into
>>
>> ifort /nologo /fpp /DCMAKE_INTDIR=\"Debug\" /module:".\Debug"
>> /object:"main.dir\Debug\\" /libs:static /threads /c  /W1 /libs:dll
>> /threads /dbglibs /Qvc8 /Qlocation,link,"C:\Program Files\Microsoft
>> Visual Studio 8\VC\bin" "C:\...\main.f90"
>>
>> It looks like my custom flags "/libs:dll /threads /dbglibs" are in the
>> right place, but there are conflicting flags "/libs:static" also.
>>
>> Question: How do I remove the "libs:static" flag from the compile line?
>
> The flags pushed in by cmake are are in
> - Modules/Platform/Windows-ifort.cmake
> If you take a look you'll see their is no libs:static (ifort's ways to
> say /MT) at all.  Did you set FFLAGS which contains this flag?

You might also be the victim of a wrong flag set by a previous (stale)
build. Make sure you do your build in an initially empty build directory
which is separate from your pristine (no generated files from prior
in-source builds) source tree.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list