Skip to content

Commit 3477ffc

Browse files
committed
generator compiler options
1 parent f9564b4 commit 3477ffc

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

cmake/compilers.cmake

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ endif()
1212

1313
# --- compiler options
1414

15-
if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
16-
# this helps show the options are/aren't conflicting between C and Fortran
17-
# at build time
18-
string(APPEND CMAKE_Fortran_FLAGS " -fimplicit-none")
19-
add_compile_options(-Wextra -Wall)
20-
endif()
15+
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>"
2121

22+
)
2223

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

0 commit comments

Comments
 (0)