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

Kelly (KT) Thompson kt at transpireinc.com
Fri May 30 11:41:21 EDT 2008


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?

Thanks for you advice.

-kt


More information about the CMake mailing list