[CMake] Using xilink

ycollette.nospam at free.fr ycollette.nospam at free.fr
Mon Nov 22 10:42:37 EST 2010


I have tried to launch cmake from the visual studio console and from a fresh dos console in which I set the paths to intel fortran bin directory and the result is that cmake doesn't detect xilink.
In the first case (visual console), cmake detect the visual linker.
In the second case (dos console with path set to intel compiler), cmake cannot detect a linker.

YC

----- Mail Original -----
De: "ycollette nospam" <ycollette.nospam at free.fr>
À: cmake at cmake.org
Envoyé: Lundi 22 Novembre 2010 16h02:22 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne
Objet: Re: [CMake] Using xilink


Hello,

I have added  set_property(TARGET Arc3D PROPERTY INTERPROCEDURAL_OPTIMIZATION 1) in my CMakeLists.txt.
I have removed the include(CMakeDetermineFortranCompiler) from my CMakeLists.txt.

Now, the intel fortran compiler is still correctly detected, but it seems that the microsoft visual linker is still used.
I have printed the variable CMAKE_LINKER and it's still set to:

-- CMAKE_LINKER           = C:/Program Files (x86)/Microsoft Visual Studio 8/VC/bin/link.exe

YC

On 11/22/2010 08:34 AM, Michael Wild wrote:
> On 11/22/2010 07:56 AM, ycollette.nospam at free.fr wrote:
>> I have a fortran project and I use the fortran intel compiler under windows XP 64 bits with cmake 2.8.2.
>> I added include(CMakeDetermineFortranCompiler) in my project and the intel fortran compiler is correctly detected.
> 
> Don't include CMakeDetermineFortranCompiler.cmake directly. That is an
> internal file. Ether use ENABLE_LANGUAGE(Fortran) instead, or list
> Fortran as one of the languages in your PROJECT call.

Correct.

>> But the intel linker is not correctly detected. Only the microsoft linker is detected. But to be able tu use the IPO option, using the xilink compiler is a necessity.
>> How can I force my project to use xilink instead of microsoft linker ?

Don't pass "-ipo" directly.  Instead, set the INTERPROCEDURAL_OPTIMIZATION
property on your target:

  http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_tgt:INTERPROCEDURAL_OPTIMIZATION

CMake will pass -ipo and use xilink as necessary.

Use code like

  set_property(TARGET myexe PROPERTY INTERPROCEDURAL_OPTIMIZATION 1)

to enable IPO for the "myexe" target or perhaps

  set_property(DIRECTORY PROPERTY INTERPROCEDURAL_OPTIMIZATION 1)

to enable IPO for all targets.

-Brad
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list