summaryrefslogtreecommitdiffstats
path: root/config/cmake/HDFCompilerFlags.cmake
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-03-27 22:10:38 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-03-27 22:10:53 (GMT)
commit0da53027d995b7ea670394b13bbe09c95e90b73d (patch)
tree34eb9c93c1618c3f51df8a9d9663294b1c0d6c82 /config/cmake/HDFCompilerFlags.cmake
parentc66ce89383773a6e8b9f02fa17fd0fb2698fbf14 (diff)
downloadhdf5-0da53027d995b7ea670394b13bbe09c95e90b73d.zip
hdf5-0da53027d995b7ea670394b13bbe09c95e90b73d.tar.gz
hdf5-0da53027d995b7ea670394b13bbe09c95e90b73d.tar.bz2
TRILAB-192 add comparable clang flags
Diffstat (limited to 'config/cmake/HDFCompilerFlags.cmake')
-rw-r--r--config/cmake/HDFCompilerFlags.cmake14
1 files changed, 11 insertions, 3 deletions
diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake
index 5faffc2..03c6936 100644
--- a/config/cmake/HDFCompilerFlags.cmake
+++ b/config/cmake/HDFCompilerFlags.cmake
@@ -105,7 +105,7 @@ endif ()
# CDash is configured to only allow 3000 warnings, so
# break into groups (from the config/gnu-flags file)
#-----------------------------------------------------------------------------
-if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC)
+if (NOT MSVC)
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
list (APPEND HDF5_CMAKE_C_FLAGS "-erroff=%none -DBSD_COMP")
else ()
@@ -137,6 +137,12 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC)
# gcc automatically inlines based on the optimization level
# this is just a failsafe
list (APPEND H5_CFLAGS0 "-finline-functions")
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general")
+ message (STATUS "CMAKE_C_FLAGS_GENERAL=${HDF5_CMAKE_C_FLAGS}")
+ ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/error-general")
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "PGI")
+ list (APPEND HDF5_CMAKE_C_FLAGS "-Minform=inform")
endif ()
endif ()
@@ -151,10 +157,14 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC)
list (APPEND H5_CFLAGS0 "-Winline -Wreorder -Wport -Wstrict-aliasing")
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
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")
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")
endif ()
endif ()
@@ -265,8 +275,6 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC)
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0)
ADD_H5_FLAGS (H5_CFLAGS4 "${HDF5_SOURCE_DIR}/config/gnu-warnings/9")
endif ()
-elseif (CMAKE_C_COMPILER_ID STREQUAL "PGI")
- list (APPEND HDF5_CMAKE_C_FLAGS "-Minform=inform")
endif ()
#-----------------------------------------------------------------------------