MantisBT - CMake
View Issue Details
0007079CMakeCMakepublic2008-05-22 02:332016-06-10 14:30
Arjen A. Markus 
Bill Hoffman 
normalminoralways
closedmoved 
CMake-2-6 
 
0007079: Interference between Fortran compiler (g95) and C compiler (MSVC) under Windows
When using the combination of Fortran and C in a project, it may happen that
the identification of the Fortran compiler interferes with the proper settings
for the C compiler.

This is exemplified by the following small CMakeLists.txt file:

project(g95_msvc)

set(PACKAGE g95_msvc)

include(CMakeDetermineFortranCompiler)
enable_language(Fortran)


set(g95_msvc_LIB_SRCS
simple.c
)

add_library(g95_msvc ${g95_msvc_LIB_SRCS})

The environment in which CMake is run should include both the
g95 compiler and the MSVC compiler.

CMake will proceed without any problem, but the generated makefiles
reveal:
The C library to be generated is called "libg85_msvc.a", whereas
if you leave out the requirement for Fortran, then it is called
"g95_msvc.lib"

In a (much) more elaborate project this resulted in the linker (MSVC)
complaining about unknown flags like L\lib when building DLLs from
C sources and g95 complaining about options like STACK:1000000.

The cause seems to be, as reported by Brad King, that the variables
that specify what extensions should be used etc, are independent of the
programming language.

Conclusion:
The combination of Fortran and C compilers with different expectations
on file names and style of options leads to unusable makefiles.

Solving this problem is non-trivial as it will interfere with the
present flexibility of users changing such variables as
CMAKE_EXE_LINKER_FLAGS - these might have to become language-dependent.
No tags attached.
Issue History
2008-05-22 02:33Arjen A. MarkusNew Issue
2008-08-19 15:57Bill HoffmanStatusnew => assigned
2008-08-19 15:57Bill HoffmanAssigned To => Bill Hoffman
2016-06-10 14:27Kitware RobotNote Added: 0041428
2016-06-10 14:27Kitware RobotStatusassigned => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0041428)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.