CMake issueshttps://gitlab.kitware.com/cmake/cmake/-/issues2018-02-20T16:28:56-05:00https://gitlab.kitware.com/cmake/cmake/-/issues/16236Bad option -fPIE for NAG Fortran2018-02-20T16:28:56-05:00Neil Carlsonneil.n.carlson@gmail.comBad option -fPIE for NAG FortranWith set(CMAKE_POSITION_INDEPENDENT_CODE True) the flag -fPIE is being passed to the NAG Fortran compiler for source files that get linked into an executable. The compiler doesn't recognize this flag and exits with an error.
The NAG...With set(CMAKE_POSITION_INDEPENDENT_CODE True) the flag -fPIE is being passed to the NAG Fortran compiler for source files that get linked into an executable. The compiler doesn't recognize this flag and exits with an error.
The NAG compiler doesn't have any notion of "PIE". its flag for PIC is -PIC. If that is an adequate substitute (I don't understand what the practical difference is), then adding
set(CMAKE_Fortran_COMPILE_OPTIONS_PIE "-PIC")
to the bottom of NAG-Fortran.cmake appears to work fine. Alternatively, because the compiler actually generates C code that it then compiles using the underlying system C compiler, it is possible on Linux, where it uses gcc, to use -fPIE by instead adding
set(CMAKE_Fortran_COMPILE_OPTIONS_PIE "-Wc,-fPIE")
But this will probably not be the same on other platforms that the NAG compiler is available for, so probably not a good choice.3.7.0Brad KingBrad King