Skip to content

Commit 9a1e6ac

Browse files
committed
-Wall not on release builds
Have seen compiler bugs triggered on other projects e.g. gcc 15.1
1 parent 4f204b1 commit 9a1e6ac

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cmake/compilers.cmake

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ HAVE_IEEE_ARITH
1414
if(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU|^Intel")
1515
add_compile_options(
1616
"$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Debug>>:-Wextra>"
17-
"$<$<COMPILE_LANGUAGE:C>:-Wall;-Werror=implicit-function-declaration>"
17+
"$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Debug,RelWithDebInfo>>:-Wall>"
18+
"$<$<COMPILE_LANGUAGE:C>:-Werror=implicit-function-declaration>"
1819
)
1920
elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
2021
add_compile_options("$<$<COMPILE_LANGUAGE:C>:/W3>")
@@ -32,7 +33,7 @@ endif()
3233
if(CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
3334

3435
add_compile_options(
35-
"$<$<COMPILE_LANGUAGE:Fortran>:-warn>"
36+
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug,RelWithDebInfo>>:-warn>"
3637
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-traceback;-check;-debug>"
3738
)
3839

@@ -45,7 +46,8 @@ endif()
4546
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
4647

4748
add_compile_options(
48-
"$<$<COMPILE_LANGUAGE:Fortran>:-Wall;-fimplicit-none;-Wno-maybe-uninitialized>"
49+
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug,RelWithDebInfo>>:-Wall>"
50+
"$<$<COMPILE_LANGUAGE:Fortran>:-fimplicit-none;-Wno-maybe-uninitialized>"
4951
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-Wextra;-fcheck=all;-Werror=array-bounds>"
5052
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Release>>:-fno-backtrace>"
5153
)

0 commit comments

Comments
 (0)