Skip to content

Commit a56239b

Browse files
committed
cmake: Tell CMake that our Fortran sources are in fixed format
CMake will automatically generate the proper flag to tell each compiler that our sources use fixed format. Drop our manual use of `-qfixed` for the XL Fortran compiler because it breaks CMake's FortranCInterface detection (which uses free-format sources).
1 parent dba6115 commit a56239b

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

CMAKE/CheckLAPACKCompilerFlags.cmake

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@ elseif( (CMAKE_Fortran_COMPILER_ID STREQUAL "VisualAge" ) OR # CMake 2.6
4444
set( FPE_EXIT TRUE )
4545
endif()
4646

47-
if( NOT ("${CMAKE_Fortran_FLAGS}" MATCHES "-qfixed") )
48-
message( STATUS "Enabling fixed format F90/F95 with -qfixed" )
49-
set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qfixed"
50-
CACHE STRING "Flags for Fortran compiler." FORCE )
51-
endif()
52-
5347
# HP Fortran
5448
elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "HP" )
5549
if( "${CMAKE_Fortran_FLAGS}" MATCHES "\\+fp_exception" )

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ set(CMAKE_MODULE_PATH "${LAPACK_SOURCE_DIR}/CMAKE" ${CMAKE_MODULE_PATH})
1616
# Export all symbols on Windows when building shared libraries
1717
SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
1818

19+
# Tell CMake that our Fortran sources are written in fixed format.
20+
set(CMAKE_Fortran_FORMAT FIXED)
21+
1922
# Set a default build type if none was specified
2023
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
2124
message(STATUS "Setting build type to 'Release' as none was specified.")

0 commit comments

Comments
 (0)