diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-03-24 21:45:12 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-03-24 21:45:12 (GMT) |
commit | 1505fa14987c46ee4a698cd272cdaa62d8399ef8 (patch) | |
tree | 8067fb1064dc8d823ff9c62b91196a9b28be567e /config/cmake/HDFCompilerFlags.cmake | |
parent | 77bac54352a61bcd746df9c848e905ae559330df (diff) | |
download | hdf5-1505fa14987c46ee4a698cd272cdaa62d8399ef8.zip hdf5-1505fa14987c46ee4a698cd272cdaa62d8399ef8.tar.gz hdf5-1505fa14987c46ee4a698cd272cdaa62d8399ef8.tar.bz2 |
TRILAB-192 restrict extensive warnings to libraries
Diffstat (limited to 'config/cmake/HDFCompilerFlags.cmake')
-rw-r--r-- | config/cmake/HDFCompilerFlags.cmake | 190 |
1 files changed, 80 insertions, 110 deletions
diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 31ba748..5faffc2 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -23,7 +23,7 @@ macro (ADD_H5_FLAGS h5_flag_var infile) string (REGEX REPLACE "^#.*" "" str_flag "${str_flag}") #message (STATUS "str_flag=${str_flag}") if (str_flag) - set (${h5_flag_var} "${${h5_flag_var}} ${str_flag}") + list (APPEND ${h5_flag_var} "${str_flag}") endif () endforeach () endif () @@ -98,12 +98,16 @@ if (HDF5_DISABLE_COMPILER_WARNINGS) endif () #----------------------------------------------------------------------------- +# HDF5 library compile options +#----------------------------------------------------------------------------- + +#----------------------------------------------------------------------------- # 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 (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -erroff=%none -DBSD_COMP") + list (APPEND HDF5_CMAKE_C_FLAGS "-erroff=%none -DBSD_COMP") else () # General flags # @@ -115,28 +119,24 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) # NOTE: Don't add -Wpadded here since we can't/won't fix the (many) # warnings that are emitted. If you need it, add it at configure time. if (CMAKE_C_COMPILER_ID STREQUAL "Intel") - ADD_H5_FLAGS (CMAKE_C_FLAGS_GENERAL "${HDF5_SOURCE_DIR}/config/intel-warnings-general") - message (STATUS "CMAKE_C_FLAGS_GENERAL=${CMAKE_C_FLAGS_GENERAL}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_GENERAL}") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wcomment -Wdeprecated -Wmain -Wmissing-declarations -Wmissing-prototypes -Wp64 -Wpointer-arith") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wreturn-type -Wstrict-prototypes -Wuninitialized") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wunknown-pragmas -Wunused-function -Wunused-variable") + ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings-general") + message (STATUS "CMAKE_C_FLAGS_GENERAL=${HDF5_CMAKE_C_FLAGS}") + list (APPEND H5_CFLAGS0 "-Wcomment -Wdeprecated -Wmain -Wmissing-declarations -Wmissing-prototypes -Wp64 -Wpointer-arith") + list (APPEND H5_CFLAGS0 "-Wreturn-type -Wstrict-prototypes -Wuninitialized") + list (APPEND H5_CFLAGS0 "-Wunknown-pragmas -Wunused-function -Wunused-variable") # this is just a failsafe - set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions") + list (APPEND H5_CFLAGS0 "-finline-functions") if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0) - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wsign-compare -Wtrigraphs -Wwrite-strings") + list (APPEND H5_CFLAGS0 "-Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow") + list (APPEND H5_CFLAGS0 "-Wsign-compare -Wtrigraphs -Wwrite-strings") endif() elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") - ADD_H5_FLAGS (CMAKE_C_FLAGS_GENERAL "${HDF5_SOURCE_DIR}/config/gnu-warnings/general") - message (STATUS "CMAKE_C_FLAGS_GENERAL=${CMAKE_C_FLAGS_GENERAL}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_GENERAL}") - ADD_H5_FLAGS (CMAKE_C_FLAGS_ERROR_GENERAL "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general") - set (H5_CFLAGS0 "${H5_CFLAGS0} ${CMAKE_C_FLAGS_ERROR_GENERAL}") + ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/general") + message (STATUS "CMAKE_C_FLAGS_GENERAL=${HDF5_CMAKE_C_FLAGS}") + ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general") # gcc automatically inlines based on the optimization level # this is just a failsafe - set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions") - message (STATUS "H5_CFLAGS0=${H5_CFLAGS0}") + list (APPEND H5_CFLAGS0 "-finline-functions") endif () endif () @@ -148,155 +148,125 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) if (HDF5_ENABLE_DEV_WARNINGS) message (STATUS "....HDF5 developer group warnings are enabled") if (CMAKE_C_COMPILER_ID STREQUAL "Intel") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Winline -Wreorder -Wport -Wstrict-aliasing") + list (APPEND H5_CFLAGS0 "-Winline -Wreorder -Wport -Wstrict-aliasing") elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") - ADD_H5_FLAGS (CMAKE_C_FLAGS_DEV_GENERAL "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") - set (H5_CFLAGS0 "${H5_CFLAGS0} ${CMAKE_C_FLAGS_DEV_GENERAL}") + ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") endif () else () if (CMAKE_C_COMPILER_ID STREQUAL "GNU") - ADD_H5_FLAGS (CMAKE_C_FLAGS_NO_DEV_GENERAL "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") - set (H5_CFLAGS0 "${H5_CFLAGS0} ${CMAKE_C_FLAGS_NO_DEV_GENERAL}") + ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") endif () endif () if (CMAKE_C_COMPILER_ID STREQUAL "GNU") # Append warning flags that only gcc 4.3+ knows about - ADD_H5_FLAGS (CMAKE_C_FLAGS_4_3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.3") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_4_3}") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.3") # # 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) - ADD_H5_FLAGS (CMAKE_C_FLAGS_4_LAST "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.last") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_4_LAST}") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.last") 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 (CMAKE_C_FLAGS_4_4 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.4") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_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 (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5) - ADD_H5_FLAGS (CMAKE_C_FLAGS_4_5 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.5") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_4_5}") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.5") if (HDF5_ENABLE_DEV_WARNINGS) - ADD_H5_FLAGS (CMAKE_C_FLAGS_DEV_4_5 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.5") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_DEV_4_5}") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.5") else () - ADD_H5_FLAGS (CMAKE_C_FLAGS_NO_DEV_4_5 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.5") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_NO_DEV_4_5}") + 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_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) - ADD_H5_FLAGS (CMAKE_C_FLAGS_4_2_4_6 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.6") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_4_2_4_6}") + 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 (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5 AND CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) - ADD_H5_FLAGS (CMAKE_C_FLAGS_4_5_4_6 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.5-4.6") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_4_5_4_6}") + 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 (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) - ADD_H5_FLAGS (CMAKE_C_FLAGS_4_6 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.6") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_4_6}") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.6") if (HDF5_ENABLE_DEV_WARNINGS) - ADD_H5_FLAGS (CMAKE_C_FLAGS_DEV_4_6 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.6") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_DEV_4_6}") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.6") else () - ADD_H5_FLAGS (CMAKE_C_FLAGS_NO_DEV_4_6 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.6") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_NO_DEV_4_6}") + 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 (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) - ADD_H5_FLAGS (CMAKE_C_FLAGS_4_7 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.7") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_4_7}") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.7") if (HDF5_ENABLE_DEV_WARNINGS) - ADD_H5_FLAGS (CMAKE_C_FLAGS_DEV_4_7 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.7") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_DEV_4_7}") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.7") else () - ADD_H5_FLAGS (CMAKE_C_FLAGS_NO_DEV_4_7 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.7") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_NO_DEV_4_7}") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.7") endif () endif () # Append more extra warning flags that only gcc 4.8+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8) - ADD_H5_FLAGS (CMAKE_C_FLAGS_4_8 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_4_8}") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8") if (HDF5_ENABLE_DEV_WARNINGS) - ADD_H5_FLAGS (CMAKE_C_FLAGS_DEV_4_8 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_DEV_4_8}") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8") else () - ADD_H5_FLAGS (CMAKE_C_FLAGS_NO_DEV_4_8 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_NO_DEV_4_8}") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8") endif () endif () # Append more extra warning flags that only gcc 4.9+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) - ADD_H5_FLAGS (CMAKE_C_FLAGS_4_9 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_4_9}") + 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 if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) - ADD_H5_FLAGS (CMAKE_C_FLAGS_5 "${HDF5_SOURCE_DIR}/config/gnu-warnings/5") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_5}") - ADD_H5_FLAGS (CMAKE_C_FLAGS_ERROR_5 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_ERROR_5}") + 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") endif () # Append more extra warning flags that only gcc 6.x+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) - ADD_H5_FLAGS (CMAKE_C_FLAGS_6 "${HDF5_SOURCE_DIR}/config/gnu-warnings/6") - set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_6}") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/6") endif () # Append more extra warning flags that only gcc 7.x+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0) - ADD_H5_FLAGS (CMAKE_C_FLAGS_7 "${HDF5_SOURCE_DIR}/config/gnu-warnings/7") - set (H5_CFLAGS2 "${H5_CFLAGS2} ${CMAKE_C_FLAGS_7}") + ADD_H5_FLAGS (H5_CFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/7") if (HDF5_ENABLE_DEV_WARNINGS) - ADD_H5_FLAGS (CMAKE_C_FLAGS_DEV_7 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7") - set (H5_CFLAGS2 "${H5_CFLAGS2} ${CMAKE_C_FLAGS_DEV_7}") + ADD_H5_FLAGS (H5_CFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7") #else () - # ADD_H5_FLAGS (CMAKE_C_FLAGS_NO_DEV_7 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7") - # set (H5_CFLAGS2 "${H5_CFLAGS2} ${CMAKE_C_FLAGS_NO_DEV_7}") + # ADD_H5_FLAGS (H5_CFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7") endif () endif () # Append more extra warning flags that only gcc 8.x+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0) - ADD_H5_FLAGS (CMAKE_C_FLAGS_8 "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") - set (H5_CFLAGS3 "${H5_CFLAGS3} ${CMAKE_C_FLAGS_8}") + ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") if (HDF5_ENABLE_DEV_WARNINGS) - ADD_H5_FLAGS (CMAKE_C_FLAGS_DEV_8 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") - set (H5_CFLAGS3 "${H5_CFLAGS3} ${CMAKE_C_FLAGS_DEV_8}") + ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") else () - ADD_H5_FLAGS (CMAKE_C_FLAGS_NO_DEV_8 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8") - set (H5_CFLAGS3 "${H5_CFLAGS3} ${CMAKE_C_FLAGS_NO_DEV_8}") + ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8") endif () endif () # Append more extra warning flags that only gcc 9.x+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0) - ADD_H5_FLAGS (CMAKE_C_FLAGS_9 "${HDF5_SOURCE_DIR}/config/gnu-warnings/9") - set (H5_CFLAGS4 "${H5_CFLAGS4} ${CMAKE_C_FLAGS_9}") + ADD_H5_FLAGS (H5_CFLAGS4 "${HDF5_SOURCE_DIR}/config/gnu-warnings/9") endif () elseif (CMAKE_C_COMPILER_ID STREQUAL "PGI") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Minform=inform") + list (APPEND HDF5_CMAKE_C_FLAGS "-Minform=inform") endif () #----------------------------------------------------------------------------- @@ -308,22 +278,22 @@ if (HDF5_ENABLE_ALL_WARNINGS) if (MSVC) if (HDF5_ENABLE_DEV_WARNINGS) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Wall /wd4668") + list (APPEND HDF5_CMAKE_C_FLAGS "/Wall /wd4668") if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall /wd4668") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/Wall /wd4668") endif () else () string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") + list (APPEND HDF5_CMAKE_C_FLAGS "/W3") if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3") endif () endif () else () if (CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS0} ${H5_CFLAGS1} ${H5_CFLAGS2} ${H5_CFLAGS3} ${H5_CFLAGS4}") + list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS0} ${H5_CFLAGS1} ${H5_CFLAGS2} ${H5_CFLAGS3} ${H5_CFLAGS4}) endif () endif () endif () @@ -335,15 +305,15 @@ option (HDF5_ENABLE_GROUPZERO_WARNINGS "Enable group zero warnings" OFF) if (HDF5_ENABLE_GROUPZERO_WARNINGS) message (STATUS "....Group Zero warnings are enabled") if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W1") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}") + list (APPEND HDF5_CMAKE_C_FLAGS "/W1") if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W1") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/W1") endif () else () if (CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS0}") + list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS0}) endif () endif () endif () @@ -355,14 +325,14 @@ option (HDF5_ENABLE_GROUPONE_WARNINGS "Enable group one warnings" OFF) if (HDF5_ENABLE_GROUPONE_WARNINGS) message (STATUS "....Group One warnings are enabled") if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W2") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}") + list (APPEND HDF5_CMAKE_C_FLAGS "/W2") if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W2") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/W2") endif () else () - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS1}") + list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS1}) endif () endif () @@ -373,14 +343,14 @@ option (HDF5_ENABLE_GROUPTWO_WARNINGS "Enable group two warnings" OFF) if (HDF5_ENABLE_GROUPTWO_WARNINGS) message (STATUS "....Group Two warnings are enabled") if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}") + list (APPEND HDF5_CMAKE_C_FLAGS "/W3") if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3") endif () else () - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS2}") + list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS2}) endif () endif () @@ -391,14 +361,14 @@ option (HDF5_ENABLE_GROUPTHREE_WARNINGS "Enable group three warnings" OFF) if (HDF5_ENABLE_GROUPTHREE_WARNINGS) message (STATUS "....Group Three warnings are enabled") if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}") + list (APPEND HDF5_CMAKE_C_FLAGS "/W4") if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/W4") endif () else () - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS3}") + list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS3}) endif () endif () @@ -409,7 +379,7 @@ option (HDF5_ENABLE_GROUPFOUR_WARNINGS "Enable group four warnings" OFF) if (HDF5_ENABLE_GROUPFOUR_WARNINGS) message (STATUS "....Group Four warnings are enabled") if (NOT MSVC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS4}") + list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS4}) endif () endif () @@ -481,9 +451,9 @@ MARK_AS_ADVANCED (HDF5_ENABLE_SYMBOLS) #----------------------------------------------------------------------------- option (HDF5_ENABLE_PROFILING "Enable profiling flags independently from the build mode." OFF) if (HDF5_ENABLE_PROFILING) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PROFILE_CFLAGS}") + list (APPEND HDF5_CMAKE_C_FLAGS "${PROFILE_CFLAGS}") if(CMAKE_CXX_COMPILER_LOADED) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PROFILE_CXXFLAGS}") + list (APPEND HDF5_CMAKE_CXX_FLAGS "${PROFILE_CXXFLAGS}") endif () endif () MARK_AS_ADVANCED (HDF5_ENABLE_PROFILING) @@ -494,9 +464,9 @@ MARK_AS_ADVANCED (HDF5_ENABLE_PROFILING) #----------------------------------------------------------------------------- option (HDF5_ENABLE_OPTIMIZATION "Enable optimization flags/settings independently from the build mode" OFF) if (HDF5_ENABLE_OPTIMIZATION) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPTIMIZE_CFLAGS}") + list (APPEND HDF5_CMAKE_C_FLAGS "${OPTIMIZE_CFLAGS}") if(CMAKE_CXX_COMPILER_LOADED) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPTIMIZE_CXXFLAGS}") + list (APPEND HDF5_CMAKE_CXX_FLAGS "${OPTIMIZE_CXXFLAGS}") endif () endif () MARK_AS_ADVANCED (HDF5_ENABLE_OPTIMIZATION) |