35
35
)
36
36
endif ()
37
37
38
+
38
39
if (CMAKE_VERSION VERSION_GREATER 3.2.3 )
39
40
# Detect Fortran compiler version directly
40
41
if (gfortran_compiler AND (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER 5.0.0 ))
@@ -44,6 +45,17 @@ if (CMAKE_VERSION VERSION_GREATER 3.2.3)
44
45
set (opencoarrays_aware_compiler false )
45
46
add_definitions (-DPREFIX_NAME=_caf_extensions_ )
46
47
endif ()
48
+ if (gfortran_compiler AND (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5.4 ))
49
+ # GCC patch to fix issue accepted for 5.4 release
50
+ # See https://github.com/sourceryinstitute/opencoarrays/issues/28 and
51
+ # https://groups.google.com/forum/#!msg/opencoarrays/RZOwwYTqG80/46S9eL696dgJ
52
+ message ( STATUS "Disabling optimization flags due to GCC < 5.4 bug" )
53
+ set (CMAKE_Fortran_FLAGS_RELEASE -O0
54
+ CACHE STRING "Flags used by the compiler during release builds." FORCE )
55
+ set (CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -O0"
56
+ CACHE STRING "Flags used by the compiler during release builds with debug info" FORCE )
57
+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -O0" )
58
+ endif ()
47
59
else ()
48
60
# Use the C compiler version as a proxy for the Fortran compiler version (won't work with NAG)
49
61
if (gfortran_compiler AND (CMAKE_C_COMPILER_VERSION VERSION_GREATER 5.0.0 ))
@@ -53,6 +65,17 @@ else()
53
65
set (opencoarrays_aware_compiler false )
54
66
add_definitions (-DPREFIX_NAME=_caf_extensions_ )
55
67
endif ()
68
+ if (gfortran_compiler AND (CMAKE_C_COMPILER_VERSION VERSION_LESS 5.4 ))
69
+ # GCC patch to fix issue accepted for the 5.4 release
70
+ # See https://github.com/sourceryinstitute/opencoarrays/issues/28 and
71
+ # https://groups.google.com/forum/#!msg/opencoarrays/RZOwwYTqG80/46S9eL696dgJ
72
+ message ( STATUS "Disabling optimization flags due to GCC < 5.4 bug" )
73
+ set (CMAKE_Fortran_FLAGS_RELEASE -O0
74
+ CACHE STRING "Flags used by the compiler during release builds." FORCE )
75
+ set (CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -O0"
76
+ CACHE STRING "Flags used by the compiler during release builds with debug info" FORCE )
77
+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -O0" )
78
+ endif ()
56
79
endif ()
57
80
58
81
0 commit comments