[CMake] Interference between MSVC and g95
Brad King
brad.king at kitware.com
Fri May 16 18:24:03 EDT 2008
Arjen Markus wrote:
> Brad King wrote:
>> Arjen Markus wrote:
>>
>>> It means that a combination of MSVC and g95 in one project is
>>> impossible.
>>
>> I think the problem is that the platform files for GNU and MSVC tools
>> are both getting loaded but they have been written assuming they are
>> always separate (which is the case in C-and C++-only projects). Please
>> send me a tarball containing the entire build tree of your toy project
>> that reproduces the problem.
>>
> I will do that as soon as possible.
Nevermind, I managed to get a similar cl/gfortran environment setup.
I've been able to reproduce the problem with this code:
cmake_minimum_required(VERSION 2.6)
project(FOO C Fortran)
add_executable(hello hello.c)
add_executable(helloF hello.f)
The Fortran executable tries to link with MSVC flags. The bug is that
the MSVC tool set uses some variables that are not language-specific to
configure linking flags. Then these flags end up getting used to link
Fortran too. You can work around the problem with this code:
string(REGEX REPLACE "<LINK_FLAGS>" "" CMAKE_Fortran_LINK_EXECUTABLE
"${CMAKE_Fortran_LINK_EXECUTABLE}")
which tells CMake to not use the linker flags. Meanwhile, please submit
a bug report here:
http://www.cmake.org/Bug
and send me the bug number.
Thanks,
-Brad
More information about the CMake
mailing list