[CMake] ifort link with -static-intel

Bill Hoffman bill.hoffman at kitware.com
Wed Mar 25 08:52:27 EDT 2009


Benne, Kyle wrote:
> Hello All,
> 
> I have been experimenting with CMake to compile a large Fortran
project with the Intel Fortran compiler ifort. I am having trouble
getting the executable to link with the static intel libraries, because
CMake is adding the linker flag "i_dynamic" and it is overriding my
--static-intel option.
> 
> I believe the i_dynamic flag is coming from
SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-i_dynamic") in the
Linux-Intel-Fortran module. In fact when I set
CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS to an empty string in my
CMakeLists file, everything works as I expect. I have one ADD_EXECUTABLE
statement in my project. There are no libraries so why am I getting the
i_dynamic flag?
> 
I think that flag is used so that the executable can link to shared 
libraries.  It maybe the wrong flag.  What is missing is a feature in 
CMake to ask for a static executable.  Right now, you have to do hacks 
like what you are doing to create static only executables.   Feel free 
to create a feature request for static linked executables.

-Bill


More information about the CMake mailing list