summaryrefslogtreecommitdiffstats
path: root/config/cmake/HDFCompilerFlags.cmake
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2020-04-22 14:43:15 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2020-04-22 14:43:15 (GMT)
commit5a010aace9d205a6b859aadb0081de1c3a7a59e0 (patch)
treee2a6630cf3bbf489d1e25e73327f108b9f6cc5a4 /config/cmake/HDFCompilerFlags.cmake
parent5c87b06d9d101306ff7ac956ff34798c539ca3fc (diff)
downloadhdf5-5a010aace9d205a6b859aadb0081de1c3a7a59e0.zip
hdf5-5a010aace9d205a6b859aadb0081de1c3a7a59e0.tar.gz
hdf5-5a010aace9d205a6b859aadb0081de1c3a7a59e0.tar.bz2
Address PR suggestions and add overlooked GCC compiler version flags.
Diffstat (limited to 'config/cmake/HDFCompilerFlags.cmake')
-rw-r--r--config/cmake/HDFCompilerFlags.cmake27
1 files changed, 19 insertions, 8 deletions
diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake
index a40b525..124f63c 100644
--- a/config/cmake/HDFCompilerFlags.cmake
+++ b/config/cmake/HDFCompilerFlags.cmake
@@ -111,8 +111,8 @@ if (NOT MSVC)
list (APPEND H5_CFLAGS0 "-Wsign-compare -Wtrigraphs -Wwrite-strings")
endif()
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
- # Add general CFlags except for older versions that are no longer supported
- if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.2)
+ # Add general CFlags for GCC versions 4.2 and above
+ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2)
ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/general")
ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general")
endif ()
@@ -154,19 +154,29 @@ if (NOT MSVC)
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
# Technically, variable-length arrays are part of the C99 standard, but
# we should approach them a bit cautiously... Only needed for gcc 4.X
- if (CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0 AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.2)
+ if (CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2)
ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.last")
endif ()
+
+ # Append warning flags for gcc 4.2-4.3
+ if (CMAKE_C_COMPILER_VERSION VERSION_LESS_EQUAL 4.3 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2)
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.3")
+ endif ()
+
+ # Append warning flags for gcc 4.2-4.4
+ if (CMAKE_C_COMPILER_VERSION VERSION_LESS_EQUAL 4.4 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2)
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.4")
+ endif ()
+
# Append warning flags that only gcc 4.3+ knows about
- if (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.3 AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.2)
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.3)
ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.3")
endif ()
-
# Append more extra warning flags that only gcc 4.4+ know about
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.4")
- endif ()
+ endif (
# Append more extra warning flags that only gcc 4.5+ know about
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5)
@@ -179,7 +189,7 @@ if (NOT MSVC)
endif ()
# Append more extra warning flags that only gcc 4.6 and less know about
- if (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7 AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.2)
+ if (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2)
ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.6")
endif ()
@@ -223,7 +233,7 @@ if (NOT MSVC)
ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9")
endif ()
- # Append more extra warning flags that only gcc 5.1+ know about
+ # Append more extra warning flags that only gcc 5.x+ know about
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/5")
ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5")
@@ -247,6 +257,7 @@ if (NOT MSVC)
# Append more extra warning flags that only gcc 8.x+ know about
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0)
ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/8")
+ ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8")
if (HDF5_ENABLE_DEV_WARNINGS)
ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8")
else ()