MantisBT - CMake
View Issue Details
0013932CMakeCMakepublic2013-02-18 11:572013-07-01 09:38
Neil Carlson 
Brad King 
normalmajoralways
closedfixed 
Intel x86_64LinuxFedora 17
CMake 2.8.10.2 
CMake 2.8.11CMake 2.8.11 
0013932: Invalid PIC option being passed to the NAG Fortran compiler
When building a shared library from Fortran source, the invalid option "-fPIC" is being passed to the NAG Fortran compiler. The correct option is "-PIC". The compiler version is 5.3.1.
Here's a sample CMakeLists.txt file. myfun.F90 is file with arbitrary Fortran source.

project(dll)
enable_language(Fortran)
add_library(mylib SHARED myfun.F90)
Adding the line
  set(CMAKE_Fortran_COMPILE_OPTIONS_PIC "-PIC")
to the end of Modules/Compiler/NAG-Fortran.cmake has the desired effect of getting the proper option passed to the compiler, and everything apparently works. Whether this is the correct solution is another question.
No tags attached.
Issue History
2013-02-18 11:57Neil CarlsonNew Issue
2013-02-18 13:14Brad KingNote Added: 0032336
2013-02-18 13:14Brad KingAssigned To => Brad King
2013-02-18 13:14Brad KingStatusnew => resolved
2013-02-18 13:14Brad KingResolutionopen => fixed
2013-02-18 13:14Brad KingFixed in Version => CMake 2.8.11
2013-02-18 13:14Brad KingTarget Version => CMake 2.8.11
2013-07-01 09:38Robert MaynardNote Added: 0033429
2013-07-01 09:38Robert MaynardStatusresolved => closed

Notes
(0032336)
Brad King   
2013-02-18 13:14   
Yes, that is the correct fix. Patch applied:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c26ac223 [^]

Thanks!
(0033429)
Robert Maynard   
2013-07-01 09:38   
Closing resolved issues that have not been updated in more than 4 months.