Skip to content

Commit

Permalink
simplify compile option syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Nov 21, 2021
1 parent f69cffd commit 82f6d8e
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions cmake/compilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@ endif()
# --- compiler options
# we left off "-std=f2018" type flags as they tend to issue false warnings

if(CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
add_compile_options(
$<$<C_COMPILER_ID:Intel,IntelLLVM>:$<IF:$<BOOL:${WIN32}>,/QxHost,-xHost>>
"$<$<COMPILE_LANG_AND_ID:Fortran,Intel,IntelLLVM>:-warn;-heap-arrays>"
"$<$<AND:$<COMPILE_LANG_AND_ID:Fortran,Intel,IntelLLVM>,$<CONFIG:Debug,RelWithDebInfo>>:-traceback;-check;-debug>"
"$<$<COMPILE_LANG_AND_ID:Fortran,GNU>:-mtune=native;-Wall;-fimplicit-none>"
"$<$<AND:$<COMPILE_LANG_AND_ID:Fortran,GNU>,$<CONFIG:Debug,RelWithDebInfo>>:-Wextra;-fcheck=all;-Werror=array-bounds>"
"$<$<AND:$<COMPILE_LANG_AND_ID:Fortran,GNU>,$<CONFIG:Release>>:-fno-backtrace;-Wno-maybe-uninitialized>"
"$<$<AND:$<COMPILE_LANG_AND_ID:Fortran,GNU>,$<CONFIG:RelWithDebInfo>>:-Wno-maybe-uninitialized>"
$<IF:$<BOOL:${WIN32}>,/QxHost,-xHost>
"$<$<COMPILE_LANGUAGE:Fortran>:-warn;-heap-arrays>"
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug,RelWithDebInfo>>:-traceback;-check;-debug>"
)
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
add_compile_options(
"$<$<COMPILE_LANGUAGE:Fortran>:-mtune=native;-Wall;-fimplicit-none>"
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug,RelWithDebInfo>>:-Wextra;-fcheck=all;-Werror=array-bounds>"
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Release>>:-fno-backtrace;-Wno-maybe-uninitialized>"
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:RelWithDebInfo>>:-Wno-maybe-uninitialized>"
)
endif()

0 comments on commit 82f6d8e

Please sign in to comment.