Skip to content

Commit 80f2807

Browse files
committed
simplify compile option syntax
1 parent d7605d9 commit 80f2807

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

cmake/compilers.cmake

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@ endif()
1313
# --- compiler options
1414
# we left off "-std=f2018" type flags as they tend to issue false warnings
1515

16+
if(CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
1617
add_compile_options(
17-
$<$<C_COMPILER_ID:Intel,IntelLLVM>:$<IF:$<BOOL:${WIN32}>,/QxHost,-xHost>>
18-
"$<$<COMPILE_LANG_AND_ID:Fortran,Intel,IntelLLVM>:-warn;-heap-arrays>"
19-
"$<$<AND:$<COMPILE_LANG_AND_ID:Fortran,Intel,IntelLLVM>,$<CONFIG:Debug,RelWithDebInfo>>:-traceback;-check;-debug>"
20-
"$<$<COMPILE_LANG_AND_ID:Fortran,GNU>:-mtune=native;-Wall;-fimplicit-none>"
21-
"$<$<AND:$<COMPILE_LANG_AND_ID:Fortran,GNU>,$<CONFIG:Debug,RelWithDebInfo>>:-Wextra;-fcheck=all;-Werror=array-bounds>"
22-
"$<$<AND:$<COMPILE_LANG_AND_ID:Fortran,GNU>,$<CONFIG:Release>>:-fno-backtrace;-Wno-maybe-uninitialized>"
23-
"$<$<AND:$<COMPILE_LANG_AND_ID:Fortran,GNU>,$<CONFIG:RelWithDebInfo>>:-Wno-maybe-uninitialized>"
18+
$<IF:$<BOOL:${WIN32}>,/QxHost,-xHost>
19+
"$<$<COMPILE_LANGUAGE:Fortran>:-warn;-heap-arrays>"
20+
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug,RelWithDebInfo>>:-traceback;-check;-debug>"
2421
)
22+
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
23+
add_compile_options(
24+
"$<$<COMPILE_LANGUAGE:Fortran>:-mtune=native;-Wall;-fimplicit-none>"
25+
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug,RelWithDebInfo>>:-Wextra;-fcheck=all;-Werror=array-bounds>"
26+
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Release>>:-fno-backtrace;-Wno-maybe-uninitialized>"
27+
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:RelWithDebInfo>>:-Wno-maybe-uninitialized>"
28+
)
29+
endif()

cmake/options.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
option(autobuild "auto-build HDF5 if missing/broken" on)
2+
3+
option(ENABLE_COVERAGE "Code coverage tests")
24
option(dev "developer mode")
35

46
option(matlab "check HDF5 file writes with Matlab" off)
57
option(concepts "conceptual testing, for devs only" off)
68

7-
option(zlib_legacy "use unmaintained ZLIB 1.x")
9+
option(zlib_legacy "use old ZLIB 1.x")
810

911
set(CMAKE_EXPORT_COMPILE_COMMANDS true)
1012

0 commit comments

Comments
 (0)