MantisBT - CMake
View Issue Details
0008345CMakeCMakepublic2009-01-05 09:542015-07-08 08:57
trigger-debian 
 
normalmajoralways
closedduplicate 
CMake-2-6 
 
0008345: enable_language(fortran optional) fails if no fortran compiler is installed
"enable_language(fortran optional)" on Debian without an installed fortran compiler results in

-- The Fortran compiler identification is unknown
CMake Error at /usr/share/cmake-2.6/Modules/CMakeFortranInformation.cmake:6 (GET_FILENAME_COMPONENT):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):

and a terminated configure step.
No tags attached.
related to 0010227closed  OPTIONAL option for enable_language(FORTRAN) 
related to 0009220closed Kitware Robot enable_language(.... OPTIONAL) signature does not work correctly 
Issue History
2009-01-05 09:54trigger-debianNew Issue
2009-01-05 09:56trigger-debianNote Added: 0014466
2009-01-07 14:26Bill HoffmanStatusnew => assigned
2009-01-07 14:26Bill HoffmanAssigned To => Bill Hoffman
2009-08-22 23:07Greg SharpNote Added: 0017182
2009-08-22 23:11Greg SharpNote Edited: 0017182
2012-05-18 10:14sleskeNote Added: 0029508
2012-05-18 10:36sleskeNote Added: 0029509
2012-07-02 14:27sleskeNote Edited: 0029509bug_revision_view_page.php?bugnote_id=29509#r719
2012-10-15 11:32David ColeRelationship addedrelated to 0010227
2012-10-15 11:32David ColeRelationship addedrelated to 0009220
2014-09-10 16:52sleskeNote Added: 0036779
2014-09-10 16:52sleskeNote Edited: 0029509bug_revision_view_page.php?bugnote_id=29509#r1567
2014-09-10 18:30sleskeNote Added: 0036780
2015-02-06 14:10Brad KingNote Added: 0037939
2015-02-06 14:10Brad KingAssigned ToBill Hoffman =>
2015-02-06 14:10Brad KingStatusassigned => resolved
2015-02-06 14:10Brad KingResolutionopen => duplicate
2015-07-08 08:57Robert MaynardNote Added: 0039044
2015-07-08 08:57Robert MaynardStatusresolved => closed

Notes
(0014466)
trigger-debian   
2009-01-05 09:56   
Oh, and if i remember correctly this also also happens in Windows with the MSVC project generators.
(0017182)
Greg Sharp   
2009-08-22 23:07   
(edited on: 2009-08-22 23:11)
I have created a workaround for this problem. It is attached to ticket 0009220 as language_support_v2.cmake

Here is a cmake file which reproduces the problem:

project(test NONE)
cmake_minimum_required(VERSION 2.6.0)
enable_language(Fortran OPTIONAL)

Note: you have to run cmake twice to reproduce the problem. After you run the first time, CMAKE_Fortran_COMPILER is added to the CMakeCache with NULL value (no fortran compiler installed), which triggers the exception.

(0029508)
sleske   
2012-05-18 10:14   
Like issue 0009220, this problem is not specific to Fortran. It also occurs for C and CXX (at least).
(0029509)
sleske   
2012-05-18 10:36   
(edited on: 2014-09-10 16:52)
Also, it should be noted that this bug, together with bug 0009220, mean that the "OPTIONAL" flag for enable_language is completely broken - at least I can think of no case where it actually works without a workaround.

Maybe a note could be added to the docs for enable_language explaining that the "OPTIONAL" feature does not currently work.

(0036779)
sleske   
2014-09-10 16:52   
I cannot reproduce the problem with the testcase from comment 2 using cmake 2.8.12.2 (on Debian).
I can still reproduce the problem with cmake 2.6.4, so it looks like this bug has been fixed :-).

Can someone close this bug (I'm not authorized)?
(0036780)
sleske   
2014-09-10 18:30   
In case it helps, I ran the testcase with different CMake versions (always running "cmake .. ; make"). Results:

2.6.4, 2.8.2, 2.8.9:
error as describe in this bug

2.8.10, 2.8.11:
"make" re-runs the complete CMake run, but then the build works (this looks like the problem described in bug 9220 )

2.8.12.2:
fixed (CMake finishes without errors, "make" does nothing as expected)
(0037939)
Brad King   
2015-02-06 14:10   
Resolving as duplicate of 0009220. Even though this one came first, there is more discussion in that one.
(0039044)
Robert Maynard   
2015-07-08 08:57   
Closing resolved issues that have not been updated in more than 4 months.