summaryrefslogtreecommitdiffstats
path: root/config/cmake
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2020-05-18 19:28:51 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2020-05-18 19:28:51 (GMT)
commitfcd87d2569ca4d8396c7db4eddb46cab04010abf (patch)
treefdd61c5aeeaf2ba4cf440177ef6d34f46d19741c /config/cmake
parent820363aa6d4e1dd1705237ee16cbf19f7649a4a0 (diff)
downloadhdf5-fcd87d2569ca4d8396c7db4eddb46cab04010abf.zip
hdf5-fcd87d2569ca4d8396c7db4eddb46cab04010abf.tar.gz
hdf5-fcd87d2569ca4d8396c7db4eddb46cab04010abf.tar.bz2
Revise gnu-*flags and cmake/HDF*CompilerFlags.cmake files to add warning
flags for GCC compilers version 4.8 and above. Removed files from gnu-warnings that only apply to versions < 4.8. Consolidated warnings from versions < 4.8 that apply to versions >= 4.8 into the 4.8 warnings files.
Diffstat (limited to 'config/cmake')
-rw-r--r--config/cmake/HDFCXXCompilerFlags.cmake84
-rw-r--r--config/cmake/HDFCompilerFlags.cmake74
-rw-r--r--config/cmake/HDFFortranCompilerFlags.cmake19
3 files changed, 11 insertions, 166 deletions
diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake
index 4bc646a..02bf5cd 100644
--- a/config/cmake/HDFCXXCompilerFlags.cmake
+++ b/config/cmake/HDFCXXCompilerFlags.cmake
@@ -86,9 +86,8 @@ if (NOT MSVC)
endif()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED
- AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2)
- # autotools adds the C flags with the CXX flags for g++ compiler
- # versions 4.2 and above.
+ AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
+ # add the general CXX flags for g++ compiler versions 4.8 and above.
ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-general")
ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-general")
endif ()
@@ -127,84 +126,9 @@ if (NOT MSVC)
if (CMAKE_CXX_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_CXX_COMPILER_VERSION VERSION_LESS 5.0 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2)
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
# autotools always add the C flags with the CXX flags
- ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.last")
- endif ()
-
- # Append warning flags for gcc 4.2-4.3
- # autotools always add the C flags with the CXX flags
- if (CMAKE_C_COMPILER_VERSION VERSION_LESS_EQUAL 4.3 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2)
- ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.3")
- endif ()
-
- # Append warning flags for gcc 4.2-4.4
- # autotools always add the C flags with the CXX flags
- if (CMAKE_C_COMPILER_VERSION VERSION_LESS_EQUAL 4.4 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2)
- ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.4")
- endif ()
-
- # Append warning flags that only gcc 4.3+ knows about
- # autotools always add the C flags with the CXX flags
- if (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.3 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2)
- ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.3")
- endif()
-
- # Append more extra warning flags that only gcc 4.4+ know about
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
- # autotools always add the C flags with the CXX flags
- ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.4")
- endif ()
-
- # Append more extra warning flags that only gcc 4.5+ know about
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.5)
- # autotools always add the C flags with the CXX flags
- ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.5")
- if (HDF5_ENABLE_DEV_WARNINGS)
- # autotools always add the C flags with the CXX flags
- #ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.5")
- else ()
- # autotools always add the C flags with the CXX flags
- #ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.5")
- endif ()
- endif ()
-
- # Append more extra warning flags that only gcc 4.6 and less know about
- if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2)
- # autotools always add the C flags with the CXX flags
- ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.6")
- endif ()
-
- # Append more extra warning flags that only gcc 4.5-4.6 know about
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.5 AND CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
- # autotools always add the C flags with the CXX flags
- ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.5-4.6")
- endif ()
-
- # Append more extra warning flags that only gcc 4.6+ know about
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
- # autotools always add the C flags with the CXX flags
- ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.6")
- if (HDF5_ENABLE_DEV_WARNINGS)
- # autotools always add the C flags with the CXX flags
- ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.6")
- else ()
- # autotools always add the C flags with the CXX flags
- ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.6")
- endif ()
- endif ()
-
- # Append more extra warning flags that only gcc 4.7+ know about
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
- # autotools always add the C flags with the CXX flags
- ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.7")
- if (HDF5_ENABLE_DEV_WARNINGS)
- # autotools always add the C flags with the CXX flags
- ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.7")
- else ()
- # autotools always add the C flags with the CXX flags
- ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.7")
- endif ()
+ ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last")
endif ()
# Append more extra warning flags that only gcc 4.8+ know about
diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake
index 6dbaa64..cd4ab48 100644
--- a/config/cmake/HDFCompilerFlags.cmake
+++ b/config/cmake/HDFCompilerFlags.cmake
@@ -93,11 +93,9 @@ if (NOT MSVC)
list (APPEND H5_CFLAGS0 "-Wsign-compare -Wtrigraphs -Wwrite-strings")
endif()
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
- # 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")
- endif ()
+ # Add general CFlags for GCC versions 4.8 and above
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
+ 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 ()
# gcc automatically inlines based on the optimization level
@@ -121,13 +119,13 @@ if (NOT MSVC)
message (STATUS "....HDF5 developer group warnings are enabled")
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
list (APPEND H5_CFLAGS0 "-Winline -Wreorder -Wport -Wstrict-aliasing")
- elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general")
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general")
endif ()
else ()
- if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general")
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general")
@@ -138,68 +136,8 @@ 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 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 (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 ()
-
- # Append more extra warning flags that only gcc 4.5+ know about
- if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5)
- ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.5")
- if (HDF5_ENABLE_DEV_WARNINGS)
- ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.5")
- else ()
- ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.5")
- endif ()
- 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 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 ()
-
- # Append more extra warning flags that only gcc 4.5-4.6 know about
- if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5 AND CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
- ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.5-4.6")
- endif ()
-
- # Append more extra warning flags that only gcc 4.6+ know about
- if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
- ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.6")
- if (HDF5_ENABLE_DEV_WARNINGS)
- ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.6")
- else ()
- ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.6")
- endif ()
- endif ()
-
- # Append more extra warning flags that only gcc 4.7+ know about
- if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
- ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.7")
- if (HDF5_ENABLE_DEV_WARNINGS)
- ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.7")
- else ()
- ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.7")
- endif ()
+ if (CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
+ ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last")
endif ()
# Append more extra warning flags that only gcc 4.8+ know about
diff --git a/config/cmake/HDFFortranCompilerFlags.cmake b/config/cmake/HDFFortranCompilerFlags.cmake
index 495a0ca..15edaa8 100644
--- a/config/cmake/HDFFortranCompilerFlags.cmake
+++ b/config/cmake/HDFFortranCompilerFlags.cmake
@@ -67,23 +67,6 @@ if (NOT MSVC)
message (STATUS "HDF5_CMAKE_Fortran_FLAGS=${HDF5_CMAKE_Fortran_FLAGS}")
if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
- # Append warning flags that only gcc 4.4+ knows about
- ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-4.4")
-
- # Append more extra warning flags that only gcc 4.5+ know about
- if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.5)
- ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-4.5")
- endif ()
-
- # Append more extra warning flags that only gcc 4.6+ know about
- #if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.6)
- # ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-4.6")
- #endif ()
-
- # Append more extra warning flags that only gcc 4.7+ know about
- if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.7)
- ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-4.7")
- endif ()
# Append more extra warning flags that only gcc 4.8+ know about
if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.8)
@@ -95,7 +78,7 @@ if (NOT MSVC)
# ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-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_Fortran_COMPILER_VERSION VERSION_LESS 5.0)
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-5")
endif ()