Skip to content

Commit 60328e3

Browse files
committed
clearer compiler options
1 parent 94ac689 commit 60328e3

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

cmake/compilers.cmake

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,21 @@ endif()
1212

1313
# --- compiler options
1414

15+
if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
16+
add_compile_options(-mtune=native -Wall -Wextra
17+
"$<$<COMPILE_LANGUAGE:Fortran>:-fimplicit-none>"
18+
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Release>>:-fno-backtrace;-Wno-maybe-uninitialized>"
19+
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:RelWithDebInfo>>:-Wno-maybe-uninitialized>"
20+
)
21+
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
1522
add_compile_options(
16-
"$<$<COMPILE_LANG_AND_ID:C,GNU>:-mtune=native;-Wall;-Wextra>"
17-
"$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-mtune=native;-Wall;-Wextra>"
18-
"$<$<COMPILE_LANG_AND_ID:Fortran,GNU>:-mtune=native;-Wall;-Wextra;-fimplicit-none>"
19-
"$<$<AND:$<COMPILE_LANG_AND_ID:Fortran,GNU>,$<CONFIG:Release>>:-fno-backtrace;-Wno-maybe-uninitialized>"
20-
"$<$<AND:$<COMPILE_LANG_AND_ID:Fortran,GNU>,$<CONFIG:RelWithDebInfo>>:-Wno-maybe-uninitialized>"
21-
"$<$<COMPILE_LANG_AND_ID:Fortran,Intel,IntelLLVM>:-warn>"
22-
"$<$<COMPILE_LANG_AND_ID:C,Intel,IntelLLVM>:$<IF:$<BOOL:${WIN32}>,/W3,-w2>>"
23-
"$<$<COMPILE_LANG_AND_ID:CXX,Intel,IntelLLVM>:$<IF:$<BOOL:${WIN32}>,/W3,-w2>>"
23+
$<IF:$<BOOL:${WIN32}>,/QxHost,-xHost>
24+
"$<$<COMPILE_LANGUAGE:Fortran>:-warn>"
25+
"$<$<COMPILE_LANGUAGE:C>:$<IF:$<BOOL:${WIN32}>,/W3,-w2>>"
26+
"$<$<COMPILE_LANGUAGE:CXX>:$<IF:$<BOOL:${WIN32}>,/W3,-w2>>"
27+
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug,RelWithDebInfo>>:-traceback;-check;-debug>"
2428
)
29+
endif()
2530

2631
if(NOT EXISTS ${PROJECT_BINARY_DIR}/.gitignore)
2732
file(WRITE ${PROJECT_BINARY_DIR}/.gitignore "*")

0 commit comments

Comments
 (0)