Discussion:
[CMake] Mixed Fortran and C++ projects in Visual Studio with Intel Fortran Compiler
Marcus Sindermann
2010-06-25 08:24:02 UTC
Permalink
Hi!

We have a problem on Windows with Visual Studio projects and the Intel Fortran 11.1 compiler.
We have a project the contains Fortran sources and links a static C++ library. So in Visual Studio this project is a Fortran project. With update 38
of the Fortran compiler this was working without any problems because the normal Visual Studio linker (link.exe) was used.
Now we want to use update 65 of the Fortran compiler. This update enforces Visual Studio to use the Intel Fortran xilink for linking Fortran projects.
But with this linker it isn't possible to link the static C++ library to the Fortran project.

It would be possible to change the library structure, so that the Fortran project only contains the Fortran sources. But we try do avoid this.
We also tried to set the LINKER_LANGUAGE target property to C++, but this doesn't change anything. Still the same Visual Studio projects are generated.

So is there any way in cmake to enforce Visual Studio to use link.exe instead of xilink.exe?

Bye
Marcus
Andreas Mohr
2010-06-25 15:19:00 UTC
Permalink
Post by Marcus Sindermann
So is there any way in cmake to enforce Visual Studio to use link.exe instead of xilink.exe?
grep -i LINK /usr/share/cmake-2.8/Modules/Platform/*|less

yields a ton of link-related CMake variables during platform setup,
thus something like CMAKE_LINKER should hopefully still be tweakable
post-platform-setup and do the right thing.

For linker flags, perhaps
CMAKE_EXE_LINKER_FLAGS
CMAKE_SHARED_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS
would be useful (but since you primarily want to change the linker binary
perhaps you won't need these).

OTOH your issue might be the split between Fortran and C++ components,
in which case even CMAKE_LINKER might fail to help in all cases
(in that case perhaps there's a target-specific property to set
which defines the linker to use for the target).

HTH,

Andreas Mohr
Brad King
2010-06-25 15:53:54 UTC
Permalink
Post by Andreas Mohr
Post by Marcus Sindermann
So is there any way in cmake to enforce Visual Studio to use link.exe instead of xilink.exe?
grep -i LINK /usr/share/cmake-2.8/Modules/Platform/*|less
yields a ton of link-related CMake variables during platform setup,
thus something like CMAKE_LINKER should hopefully still be tweakable
post-platform-setup and do the right thing.
Those are used by the Makefile generators. Once the VS project file
is generated the IDE does its own thing.

-Brad
Brad King
2010-06-25 15:53:49 UTC
Permalink
Post by Marcus Sindermann
Now we want to use update 65 of the Fortran compiler. This update
enforces Visual Studio to use the Intel Fortran xilink for linking
Fortran projects.
CMake just generates the .vfproj file and then VS is responsible for
the actual build. If the Fortran plugin is choosing to use xilink
I do not know if there is much CMake can do about it.

Can you modify the project file through the IDE by hand to chose the
linker you want?

-Brad
Brad King
2010-06-25 18:42:41 UTC
Permalink
Post by Brad King
Can you modify the project file through the IDE by hand to chose the
linker you want?
s/chose/choose/

To be more clear, if it is possible to modify the project in the IDE
by hand to change the linker, then we can teach CMake to generate the
project file accordingly. If it is not possible to do by hand then
I do not think CMake can do it either.

-Brad

Loading...