[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    Re: [CMake] how to link intel fortran libraries static
From:       Michael Wild <themiwi () gmail ! com>
Date:       2009-01-22 7:39:43
Message-ID: 4BDDEA98-742D-441B-BD61-203B170291A2 () gmail ! com
[Download RAW message or body]


On 21. Jan, 2009, at 19:05, Roland Krause wrote:

> Greetings,
> I'm working on CMake support for a very large Fortran code. We are  
> linking nearly everything static, especially the Intel Fortran  
> libraries but I can't seem to find the flag to do this in the CMake  
> documentation (looked at CMake-2.6.x online). I've found  
> SET(CMAKE_DL_LIBS "dl") in the Modules/Platform/Linux-ifort.cmake.  
> Is that it?
>


No, CMAKE_DL_LIBS is for libdl, the dynamic linker (i.e. "plugin"  
loading). You need to pass the -static-intel flag to the compiler  
during linking. You can to that either using the LINK_FLAGS target  
property (but then make very sure that you're really using an intel  
compiler in you CMakeLists.txt) or set the CMAKE_XXX_LINKER_FLAGS in  
the cache (where XXX is one of EXE, SHARED or MODULE).

This worked for me:

project(test Fortran)

add_executable( test test.f90 )

# test whether this is an intel compiler, then use -static-intel when  
linking
if( CMAKE_Fortran_COMPILER_ID STREQUAL Intel )
   set_target_properties( test PROPERTIES LINK_FLAGS -static-intel )
endif( CMAKE_Fortran_COMPILER_ID STREQUAL Intel )



> Thanks for any pointers.
>
> Roland

HTH

Michael
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic