From f502d9f7fbab50f167bcd8bbf02a4f86c7bd8c13 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 7 Apr 2020 09:52:09 -0500 Subject: TRILAB-192 - merge changes from develop Single source, config files, for warnings for both autotools and CMake. Update CMake libraries, tools, tests to use correct flags. --- CMakeLists.txt | 2 + MANIFEST | 14 +- c++/src/CMakeLists.txt | 8 +- c++/test/CMakeLists.txt | 1 + config/cmake/CTestCustom.cmake | 11 +- config/cmake/HDFCXXCompilerFlags.cmake | 326 +++++++++++ config/cmake/HDFCompilerFlags.cmake | 88 +-- config/cmake/HDFFortranCompilerFlags.cmake | 142 +++++ config/cmake/libhdf5.settings.cmake.in | 2 +- config/gnu-cxxflags | 887 ++++++----------------------- config/gnu-fflags | 164 ++++-- config/gnu-flags | 52 +- config/gnu-warnings/cxx-general | 19 + config/gnu-warnings/gfort-4.4 | 2 + config/gnu-warnings/gfort-4.5 | 1 + config/gnu-warnings/gfort-4.7 | 2 + config/gnu-warnings/gfort-4.8 | 5 + config/gnu-warnings/gfort-5 | 1 + config/gnu-warnings/gfort-6 | 1 + config/gnu-warnings/gfort-8 | 1 + config/gnu-warnings/gfort-general | 12 + config/intel-fflags | 27 +- config/intel-flags | 32 +- config/intel-warnings-general | 10 - config/intel-warnings/general | 2 + config/intel-warnings/ifort-general | 1 + fortran/examples/CMakeLists.txt | 103 ++-- fortran/src/CMakeLists.txt | 110 ++-- fortran/test/CMakeLists.txt | 201 ++----- fortran/testpar/CMakeLists.txt | 12 +- hl/c++/src/CMakeLists.txt | 12 +- hl/c++/test/CMakeLists.txt | 1 + hl/fortran/examples/CMakeLists.txt | 28 +- hl/fortran/src/CMakeLists.txt | 64 +-- hl/fortran/test/CMakeLists.txt | 29 +- hl/src/CMakeLists.txt | 12 +- hl/test/CMakeLists.txt | 4 + hl/tools/gif2h5/CMakeLists.txt | 4 + hl/tools/h5watch/CMakeLists.txt | 5 + java/src/jni/CMakeLists.txt | 4 +- release_docs/RELEASE.txt | 8 +- src/CMakeLists.txt | 8 +- test/CMakeLists.txt | 15 +- testpar/CMakeLists.txt | 2 + tools/lib/CMakeLists.txt | 8 +- tools/libtest/CMakeLists.txt | 1 + tools/src/h5diff/CMakeLists.txt | 2 + 47 files changed, 1178 insertions(+), 1268 deletions(-) create mode 100644 config/cmake/HDFCXXCompilerFlags.cmake create mode 100644 config/cmake/HDFFortranCompilerFlags.cmake create mode 100644 config/gnu-warnings/cxx-general create mode 100644 config/gnu-warnings/gfort-4.4 create mode 100644 config/gnu-warnings/gfort-4.5 create mode 100644 config/gnu-warnings/gfort-4.7 create mode 100644 config/gnu-warnings/gfort-4.8 create mode 100644 config/gnu-warnings/gfort-5 create mode 100644 config/gnu-warnings/gfort-6 create mode 100644 config/gnu-warnings/gfort-8 create mode 100644 config/gnu-warnings/gfort-general delete mode 100644 config/intel-warnings-general create mode 100644 config/intel-warnings/general create mode 100644 config/intel-warnings/ifort-general diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e83ca7..a4aa60c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -930,6 +930,7 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for include (${HDF_RESOURCES_EXT_DIR}/HDFUseFortran.cmake) message (STATUS "Fortran compiler ID is ${CMAKE_Fortran_COMPILER_ID}") + include (${HDF_RESOURCES_DIR}/HDFFortranCompilerFlags.cmake) include (${HDF_RESOURCES_DIR}/HDF5UseFortran.cmake) set (LINK_Fortran_LIBS ${LINK_LIBS}) @@ -971,6 +972,7 @@ if (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") endif () include (${HDF_RESOURCES_EXT_DIR}/HDFUseCXX.cmake) + include (${HDF_RESOURCES_DIR}/HDFCXXCompilerFlags.cmake) if (CMAKE_NO_STD_NAMESPACE) set (H5_NO_STD 1) diff --git a/MANIFEST b/MANIFEST index dc9552b..0e1a2d8 100644 --- a/MANIFEST +++ b/MANIFEST @@ -163,6 +163,7 @@ ./config/gnu-warnings/7 ./config/gnu-warnings/8 ./config/gnu-warnings/9 +./config/gnu-warnings/cxx-general ./config/gnu-warnings/developer-4.5 ./config/gnu-warnings/developer-4.6 ./config/gnu-warnings/developer-4.7 @@ -174,13 +175,22 @@ ./config/gnu-warnings/error-8 ./config/gnu-warnings/error-general ./config/gnu-warnings/general +./config/gnu-warnings/gfort-general +./config/gnu-warnings/gfort-4.4 +./config/gnu-warnings/gfort-4.5 +./config/gnu-warnings/gfort-4.7 +./config/gnu-warnings/gfort-4.8 +./config/gnu-warnings/gfort-5 +./config/gnu-warnings/gfort-6 +./config/gnu-warnings/gfort-8 ./config/gnu-warnings/no-developer-4.5 ./config/gnu-warnings/no-developer-4.6 ./config/gnu-warnings/no-developer-4.7 ./config/gnu-warnings/no-developer-4.8 ./config/gnu-warnings/no-developer-8 ./config/gnu-warnings/no-developer-general -./config/intel-warnings-general +./config/intel-warnings/ifort-general +./config/intel-warnings/general ./config/site-specific/BlankForm @@ -3299,6 +3309,8 @@ ./config/cmake/hdf5-config.cmake.in ./config/cmake/hdf5-config-version.cmake.in ./config/cmake/HDFCompilerFlags.cmake +./config/cmake/HDFCXXCompilerFlags.cmake +./config/cmake/HDFFortranCompilerFlags.cmake ./config/cmake/HDF5_Process_Flex_Files.cmake ./config/cmake/HDF5Macros.cmake ./config/cmake/HDF5UseFortran.cmake diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index fa15c9e..058f457 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -90,9 +90,7 @@ if (NOT ONLY_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) - target_compile_options(${HDF5_CPP_LIB_TARGET} - PRIVATE "${HDF5_CMAKE_CXX_FLAGS}" - ) + target_compile_options(${HDF5_CPP_LIB_TARGET} PRIVATE "${HDF5_CMAKE_CXX_FLAGS}") target_compile_definitions(${HDF5_CPP_LIB_TARGET} PRIVATE $<$:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings ) @@ -110,9 +108,7 @@ if (BUILD_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) - target_compile_options(${HDF5_CPP_LIBSH_TARGET} - PRIVATE "${HDF5_CMAKE_CXX_FLAGS}" - ) + target_compile_options(${HDF5_CPP_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_CXX_FLAGS}") target_compile_definitions(${HDF5_CPP_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" PRIVATE $<$:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index 29534a7..ca2295e 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -39,6 +39,7 @@ configure_file (${HDF5_CPP_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @O add_executable (cpp_testhdf5 ${CPP_TEST_SOURCES} ) target_include_directories (cpp_testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_compile_options(cpp_testhdf5 PRIVATE "${HDF5_CMAKE_CXX_FLAGS}") target_compile_definitions(cpp_testhdf5 PRIVATE $<$:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings ) diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake index d1c6d84..534f139 100644 --- a/config/cmake/CTestCustom.cmake +++ b/config/cmake/CTestCustom.cmake @@ -18,23 +18,18 @@ set (CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 50000) set (CTEST_CUSTOM_WARNING_EXCEPTION ${CTEST_CUSTOM_WARNING_EXCEPTION} -# "H5detect.c.[0-9]+.[ \t]*:[ \t]*warning C4090:" -# "H5detect.c.[0-9]+.[ \t]*:[ \t]*warning:[ \t]*passing argument" -# "H5detect.c[0-9 \t:]*warning:[ \t]*passing argument" "note.*expected.*void.*but argument is of type.*volatile" -# "H5Tconv.c[0-9 \t:]*warning:[ \t]*comparison is always false due to limited range of data type" -# "H5Ztrans.c.[0-9]+.[ \t]*:[ \t]*warning C4244" "src.ZLIB.*:[ \t]*warning" "warning LNK4197:.*ZLIB-prefix" "src.SZIP.*:[ \t]*warning" # "POSIX name for this item is deprecated" "disabling jobserver mode" "config.cmake.xlatefile.c" -# "warning.*implicit declaration of function" "warning.*unknown pragma" "warning.*unrecognized .pragma" -# "note: expanded from macro" -# "fpp:[ \t]*warning:[ \t]*cannot remove H5_DEBUG_API - not a predefined macro" + "note: expanded from macro" + # HDDFFV-11074 + "This directive is not standard" ) set (CTEST_CUSTOM_MEMCHECK_IGNORE diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake new file mode 100644 index 0000000..bf22886 --- /dev/null +++ b/config/cmake/HDFCXXCompilerFlags.cmake @@ -0,0 +1,326 @@ +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# +set(CMAKE_CXX_STANDARD 98) +set(CMAKE_CXX_STANDARD_REQUIRED TRUE) +set(CMAKE_CXX_EXTENSIONS OFF) + +macro (ADD_H5_FLAGS h5_flag_var infile) + file (STRINGS ${infile} TEST_FLAG_STREAM) + #message (STATUS "TEST_FLAG_STREAM=${TEST_FLAG_STREAM}") + list (LENGTH TEST_FLAG_STREAM len_flag) + if (len_flag GREATER 0) + math (EXPR _FP_LEN "${len_flag} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET TEST_FLAG_STREAM ${line} str_flag) + string (REGEX REPLACE "^#.*" "" str_flag "${str_flag}") + #message (STATUS "str_flag=${str_flag}") + if (str_flag) + list (APPEND ${h5_flag_var} "${str_flag}") + endif () + endforeach () + endif () + #message (STATUS "h5_flag_var=${${h5_flag_var}}") +endmacro () + +set (CMAKE_CXX_FLAGS "${CMAKE_CXX_SANITIZER_FLAGS} ${CMAKE_CXX_FLAGS}") +message (STATUS "Warnings Configuration: CXX default: ${CMAKE_CXX_FLAGS}") +#----------------------------------------------------------------------------- +# Compiler specific flags : Shouldn't there be compiler tests for these +#----------------------------------------------------------------------------- +if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) + set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}") + if (${HDF_CFG_NAME} MATCHES "Debug") + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ftrapv -fno-common") + endif () + else () + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstdarg-opt") + endif () + endif () +endif () + +#----------------------------------------------------------------------------- +# Option to allow the user to disable compiler warnings +#----------------------------------------------------------------------------- +if (HDF5_DISABLE_COMPILER_WARNINGS) + message (STATUS "....Compiler warnings are suppressed") + # MSVC uses /w to suppress warnings. It also complains if another + # warning level is given, so remove it. + if (MSVC) + set (HDF5_WARNINGS_BLOCKED 1) + 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} /W0") + endif () + endif () + if (WIN32) + add_definitions (-D_CRT_SECURE_NO_WARNINGS) + endif () + + # Most compilers use -w to suppress warnings. + if (NOT HDF5_WARNINGS_BLOCKED) + if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w") + endif () + endif () +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) + if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") + list (APPEND HDF5_CMAKE_CXX_FLAGS "-erroff=%none -DBSD_COMP") + else () + # General flags + # + # Note that some of the flags listed here really should be developer + # flags (listed in a separate variable, below) but we put them here + # because they are not raised by the current code and we'd like to + # know if they do start showing up. + # + # 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_CXX_COMPILER_ID STREQUAL "Intel") + ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/general") + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0) + list (APPEND H5_CXXFLAGS0 "-Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow") + list (APPEND H5_CXXFLAGS0 "-Wsign-compare -Wtrigraphs -Wwrite-strings") + endif() + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) + ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-general") + endif () + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general") + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "PGI") + list (APPEND HDF5_CMAKE_CXX_FLAGS "-Minform=inform") + endif () + message (STATUS "CMAKE_CXX_FLAGS_GENERAL=${HDF5_CMAKE_CXX_FLAGS}") + endif () + + #----------------------------------------------------------------------------- + # Option to allow the user to enable developer warnings + # Developer warnings (suggestions from gcc, not code problems) + #----------------------------------------------------------------------------- + #if (HDF5_ENABLE_DEV_WARNINGS) + # message (STATUS "....HDF5 developer group warnings are enabled") + # if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + # list (APPEND H5_CXXFLAGS0 "-Winline -Wreorder -Wport -Wstrict-aliasing") + # elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") + # elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + # ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general") + # endif () + #else () + # if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") + # elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + # ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general") + # endif () + #endif () + + + #if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # # Append warning flags that only gcc 4.3+ knows about + # ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.3") + + # # Append more extra warning flags that only gcc 4.4+ know about + # if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) + # ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.4") + # endif () + #endif () + + # Append more extra warning flags that only gcc 4.5+ know about + #if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.5) + # ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.5") + # if (HDF5_ENABLE_DEV_WARNINGS) + # ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.5") + # else () + # ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.5") + # endif () + #endif () +else () + list (APPEND HDF5_CMAKE_CXX_FLAGS "/EHsc") +endif () + +#----------------------------------------------------------------------------- +# Option to allow the user to enable all warnings +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_ALL_WARNINGS) + message (STATUS "....All Warnings are enabled") + if (MSVC) + if (HDF5_ENABLE_DEV_WARNINGS) + if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/Wall /wd4668") + endif () + else () + if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3") + endif () + endif () + else () + if (CMAKE_COMPILER_IS_GNUCC) + if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) + list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS0} ${H5_CXXFLAGS1} ${H5_CXXFLAGS2} ${H5_CXXFLAGS3} ${H5_CXXFLAGS4}) + endif () + endif () + endif () +endif () + +#----------------------------------------------------------------------------- +# Option to allow the user to enable warnings by groups +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_GROUPZERO_WARNINGS) + message (STATUS "....Group Zero warnings are enabled") + if (MSVC) + if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) + 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) + if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) + list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS0}) + endif () + endif () + endif () +endif () + +#----------------------------------------------------------------------------- +# Option to allow the user to enable warnings by groups +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_GROUPONE_WARNINGS) + message (STATUS "....Group One warnings are enabled") + if (MSVC) + if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/W2") + endif () + else () + if (CMAKE_COMPILER_IS_GNUCC) + if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) + list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS1}) + endif () + endif () + endif () +endif () + +#----------------------------------------------------------------------------- +# Option to allow the user to enable warnings by groups +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_GROUPTWO_WARNINGS) + message (STATUS "....Group Two warnings are enabled") + if (MSVC) + if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3") + endif () + else () + if (CMAKE_COMPILER_IS_GNUCC) + if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) + list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS2}) + endif () + endif () + endif () +endif () + +#----------------------------------------------------------------------------- +# Option to allow the user to enable warnings by groups +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_GROUPTHREE_WARNINGS) + message (STATUS "....Group Three warnings are enabled") + if (MSVC) + if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/W4") + endif () + else () + if (CMAKE_COMPILER_IS_GNUCC) + if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) + list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS3}) + endif () + endif () + endif () +endif () + +#----------------------------------------------------------------------------- +# Option to allow the user to enable warnings by groups +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_GROUPFOUR_WARNINGS) + message (STATUS "....Group Four warnings are enabled") + if (NOT MSVC) + if (CMAKE_COMPILER_IS_GNUCC) + if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) + list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CFLAGS4}) + endif () + endif () + endif () +endif () + +#----------------------------------------------------------------------------- +# This is in here to help some of the GCC based IDES like Eclipse +# and code blocks parse the compiler errors and warnings better. +#----------------------------------------------------------------------------- +if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0") +endif () + +#----------------------------------------------------------------------------- +# Option for --enable-symbols +# This option will force/override the default setting for all configurations +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_SYMBOLS MATCHES "YES") + if(CMAKE_CXX_COMPILER_LOADED) + if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") + endif () + endif () +elseif (HDF5_ENABLE_SYMBOLS MATCHES "NO") + if(CMAKE_CXX_COMPILER_LOADED) + if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wl,-s") + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s") + endif () + endif () +endif () + +#----------------------------------------------------------------------------- +# Option for --enable-profiling +# This option will force/override the default setting for all configurations +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_PROFILING) + if(CMAKE_CXX_COMPILER_LOADED) + list (APPEND HDF5_CMAKE_CXX_FLAGS "${PROFILE_CXXFLAGS}") + endif () +endif () + +#----------------------------------------------------------------------------- +# Option for --enable-optimization +# This option will force/override the default setting for all configurations +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_OPTIMIZATION) + if(CMAKE_CXX_COMPILER_LOADED) + list (APPEND HDF5_CMAKE_CXX_FLAGS "${OPTIMIZE_CXXFLAGS}") + endif () +endif () diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 03c6936..b255e22 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -49,18 +49,6 @@ if (CMAKE_COMPILER_IS_GNUCC) endif () endif () endif () -if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}") - if (${HDF_CFG_NAME} MATCHES "Debug") - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ftrapv -fno-common") - endif () - else () - if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstdarg-opt") - endif () - endif () -endif () #----------------------------------------------------------------------------- # Option to allow the user to disable compiler warnings @@ -74,10 +62,6 @@ if (HDF5_DISABLE_COMPILER_WARNINGS) set (HDF5_WARNINGS_BLOCKED 1) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W0") - 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} /W0") - endif () endif () if (WIN32) add_definitions (-D_CRT_SECURE_NO_WARNINGS) @@ -91,9 +75,6 @@ if (HDF5_DISABLE_COMPILER_WARNINGS) # Most compilers use -w to suppress warnings. if (NOT HDF5_WARNINGS_BLOCKED) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") - if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w") - endif () endif () endif () @@ -119,8 +100,7 @@ if (NOT MSVC) # 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 (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings-general") - message (STATUS "CMAKE_C_FLAGS_GENERAL=${HDF5_CMAKE_C_FLAGS}") + ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/general") 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") @@ -132,18 +112,17 @@ if (NOT MSVC) endif() elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") 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 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 () + message (STATUS "CMAKE_C_FLAGS_GENERAL=${HDF5_CMAKE_C_FLAGS}") endif () #----------------------------------------------------------------------------- @@ -287,17 +266,9 @@ if (HDF5_ENABLE_ALL_WARNINGS) if (HDF5_ENABLE_DEV_WARNINGS) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") 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}") - list (APPEND HDF5_CMAKE_CXX_FLAGS "/Wall /wd4668") - endif () else () string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${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}") - list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3") - endif () endif () else () if (CMAKE_COMPILER_IS_GNUCC) @@ -315,10 +286,6 @@ if (HDF5_ENABLE_GROUPZERO_WARNINGS) if (MSVC) 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]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") - list (APPEND HDF5_CMAKE_CXX_FLAGS "/W1") - endif () else () if (CMAKE_COMPILER_IS_GNUCC) list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS0}) @@ -335,12 +302,10 @@ if (HDF5_ENABLE_GROUPONE_WARNINGS) if (MSVC) 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]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") - list (APPEND HDF5_CMAKE_CXX_FLAGS "/W2") - endif () else () - list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS1}) + if (CMAKE_COMPILER_IS_GNUCC) + list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS1}) + endif () endif () endif () @@ -353,12 +318,10 @@ if (HDF5_ENABLE_GROUPTWO_WARNINGS) if (MSVC) 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]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") - list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3") - endif () else () - list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS2}) + if (CMAKE_COMPILER_IS_GNUCC) + list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS2}) + endif () endif () endif () @@ -371,12 +334,10 @@ if (HDF5_ENABLE_GROUPTHREE_WARNINGS) if (MSVC) 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]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") - list (APPEND HDF5_CMAKE_CXX_FLAGS "/W4") - endif () else () - list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS3}) + if (CMAKE_COMPILER_IS_GNUCC) + list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS3}) + endif () endif () endif () @@ -387,7 +348,9 @@ 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) - list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS4}) + if (CMAKE_COMPILER_IS_GNUCC) + list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS4}) + endif () endif () endif () @@ -398,9 +361,6 @@ endif () if (CMAKE_COMPILER_IS_GNUCC) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0") endif () -if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0") -endif () #----------------------------------------------------------------------------- # Option for --enable-asserts @@ -430,26 +390,12 @@ if (HDF5_ENABLE_SYMBOLS MATCHES "YES") elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fno-omit-frame-pointer") endif () - if(CMAKE_CXX_COMPILER_LOADED) - if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") - endif () - endif () elseif (HDF5_ENABLE_SYMBOLS MATCHES "NO") if (CMAKE_C_COMPILER_ID STREQUAL "Intel") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-s") elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s") endif () - if(CMAKE_CXX_COMPILER_LOADED) - if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wl,-s") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s") - endif () - endif () endif () MARK_AS_ADVANCED (HDF5_ENABLE_SYMBOLS) @@ -460,9 +406,6 @@ MARK_AS_ADVANCED (HDF5_ENABLE_SYMBOLS) option (HDF5_ENABLE_PROFILING "Enable profiling flags independently from the build mode." OFF) if (HDF5_ENABLE_PROFILING) list (APPEND HDF5_CMAKE_C_FLAGS "${PROFILE_CFLAGS}") - if(CMAKE_CXX_COMPILER_LOADED) - list (APPEND HDF5_CMAKE_CXX_FLAGS "${PROFILE_CXXFLAGS}") - endif () endif () MARK_AS_ADVANCED (HDF5_ENABLE_PROFILING) @@ -473,8 +416,5 @@ MARK_AS_ADVANCED (HDF5_ENABLE_PROFILING) option (HDF5_ENABLE_OPTIMIZATION "Enable optimization flags/settings independently from the build mode" OFF) if (HDF5_ENABLE_OPTIMIZATION) list (APPEND HDF5_CMAKE_C_FLAGS "${OPTIMIZE_CFLAGS}") - if(CMAKE_CXX_COMPILER_LOADED) - list (APPEND HDF5_CMAKE_CXX_FLAGS "${OPTIMIZE_CXXFLAGS}") - endif () endif () MARK_AS_ADVANCED (HDF5_ENABLE_OPTIMIZATION) diff --git a/config/cmake/HDFFortranCompilerFlags.cmake b/config/cmake/HDFFortranCompilerFlags.cmake new file mode 100644 index 0000000..f31eba5 --- /dev/null +++ b/config/cmake/HDFFortranCompilerFlags.cmake @@ -0,0 +1,142 @@ +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# + +macro (ADD_H5_FFLAGS h5_fflag_var infile) + file (STRINGS ${infile} TEST_FLAG_STREAM) + #message (STATUS "TEST_FLAG_STREAM=${TEST_FLAG_STREAM}") + list (LENGTH TEST_FLAG_STREAM len_flag) + if (len_flag GREATER 0) + math (EXPR _FP_LEN "${len_flag} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET TEST_FLAG_STREAM ${line} str_flag) + string (REGEX REPLACE "^#.*" "" str_flag "${str_flag}") + #message (STATUS "str_flag=${str_flag}") + if (str_flag) + list (APPEND ${h5_fflag_var} "${str_flag}") + endif () + endforeach () + endif () + #message (STATUS "h5_fflag_var=${${h5_fflag_var}}") +endmacro () + +message (STATUS "Warnings Configuration: default Fortran: ${CMAKE_Fortran_FLAGS}") + +#----------------------------------------------------------------------------- +# Option to allow the user to disable compiler warnings +#----------------------------------------------------------------------------- +if (HDF5_DISABLE_COMPILER_WARNINGS) + message (STATUS "....Compiler warnings are suppressed") + # MSVC uses /w to suppress warnings. It also complains if another + # warning level is given, so remove it. + if (MSVC) + set (HDF5_WARNINGS_BLOCKED 1) + if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") + set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} /warn:none") + endif () + endif () + if (WIN32) + add_definitions (-D_CRT_SECURE_NO_WARNINGS) + endif () + # Borland uses -w- to suppress warnings. + if (BORLAND) + set (HDF5_WARNINGS_BLOCKED 1) + set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -w-") + endif () + + # Most compilers use -w to suppress warnings. + if (NOT HDF5_WARNINGS_BLOCKED) + set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -w") + endif () +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) + # General flags + if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") + ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/ifort-general") + list (APPEND HDF5_CMAKE_Fortran_FLAGS "-stand:f03" "-free") + elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") + ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-general") + list (APPEND HDF5_CMAKE_Fortran_FLAGS "-ffree-form" "-std=f2008" "-fimplicit-none") + elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "PGI") + list (APPEND HDF5_CMAKE_Fortran_FLAGS "-Mfreeform" "-Mdclchk" "-Mstandard" "-Mallocatable=03") + endif () + 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") + endif () + + # Append more extra warning flags that only gcc 4.5+ know about + if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND 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 (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND 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 (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND 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 (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.8) + ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-4.8") + endif () + + # Append more extra warning flags that only gcc 4.9+ know about + #if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.9) + # 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 + if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND 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 () + + # Append more extra warning flags that only gcc 6.x+ know about + if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 6.0) + ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-6") + endif () + + # Append more extra warning flags that only gcc 7.x+ know about + #if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0) + # ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-7") + #endif () + + # Append more extra warning flags that only gcc 8.x+ know about + if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 8.0) + ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-8") + endif () + + # Append more extra warning flags that only gcc 9.x+ know about + #if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 9.0) + # ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-9") + #endif () +else () + if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") + #ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/win-ifort-general") + list (APPEND HDF5_CMAKE_Fortran_FLAGS "/warn:all" "/stand:f03" "/free") + endif () +endif () + diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index 292eaca..e9a8395 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -46,7 +46,7 @@ Languages: Fortran: @HDF5_BUILD_FORTRAN@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @CMAKE_Fortran_COMPILER@ @CMAKE_Fortran_COMPILER_VERSION@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Flags: @CMAKE_Fortran_FLAGS@ -@BUILD_FORTRAN_CONDITIONAL_TRUE@ H5 Fortran Flags: @H5_FCFLAGS@ +@BUILD_FORTRAN_CONDITIONAL_TRUE@ H5 Fortran Flags: @HDF5_CMAKE_Fortran_FLAGS@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ AM Fortran Flags: @AM_FCFLAGS@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ Shared Fortran Library: @H5_ENABLE_SHARED_LIB@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ Static Fortran Library: @H5_ENABLE_STATIC_LIB@ diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index e0f2999..9ae38f6 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -1,4 +1,4 @@ -# -*- shell-script -*- +# -*- shell-script -*- # # Copyright by The HDF Group. # Copyright by the Board of Trustees of the University of Illinois. @@ -17,33 +17,65 @@ # if the compiler is not GNU; otherwise `cxx_flags_set' is set to `yes' # +# +# For now, do not promote any warnings to errors. +# +PROMOTE_ERRORS_DFLT=no + +# +# This filter rewrites -Werror= as -W, in that way demoting warnings +# promoted to errors back to warnings, if PROMOTE_ERRORS is no. +# +demote_errors() +{ + if [ ${PROMOTE_ERRORS:-${PROMOTE_ERRORS_DFLT}} = no ]; then + sed 's,-Werror=,-W,g' + else + cat + fi +} + +# +# Prepend `$srcdir/config/gnu-warnings/` to the filename suffix(es) given as +# subroutine argument(s), remove comments starting with # and ending +# at EOL, replace spans of whitespace (including newlines) with spaces, +# and re-emit the file(s) thus filtered on the standard output stream. +# +load_gnu_arguments() +{ + set -- $(for arg; do + sed 's,#.*$,,' $srcdir/config/gnu-warnings/${arg} | demote_errors + done) + IFS=' ' echo "$*" +} + # Get the compiler version in a way that works for g++ # unless a compiler version is already known # # cxx_vendor: The compiler name: g++ # cxx_version: Version number: 2.91.60, 2.7.2.1 # -if test X = "X$cxx_flags_set"; then +if test "X-" = "X-$cxx_flags_set"; then # PathScale compiler spits out gcc version string too. Need to # filter it out. # icc beginning with version 12 includes a "gcc version compatiblilty" - # string, causing the gcc H5_CFLAGS to be erroneously added. The line + # string, causing the gcc H5_CXXFLAGS to be erroneously added. The line # "grep -v 'icc version'" causes the discarding of any output - # containing 'icc version'. The cc_version for icc is correctly determined + # containing 'icc version'. The cxx_version for icc is correctly determined # and flags added in the intel-flags script. cxx_version="`$CXX $CXXFLAGS $H5_CXXFLAGS -v 2>&1 | grep -v 'PathScale' |\ - grep -v 'icc version' |\ + grep -v '^icc.*version' |\ grep 'gcc version' | sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`" cxx_vendor=`echo $cxx_version |sed 's/\([a-z]*\).*/\1/'` cxx_version=`echo $cxx_version |sed 's/[-a-z]//g'` if test X = "X$cxx_vendor" -a X != "X$cxx_version"; then - cxx_vendor=g++ + cxx_vendor=g++ fi if test "-" != "$cxx_vendor-$cxx_version"; then - echo "compiler '$CXX' is GNU $cxx_vendor-$cxx_version" + echo "compiler '$CXX' is GNU $cxx_vendor-$cxx_version" fi - # Some version numbers + # Get the compiler version numbers cxx_vers_major=`echo $cxx_version | cut -f1 -d.` cxx_vers_minor=`echo $cxx_version | cut -f2 -d.` cxx_vers_patch=`echo $cxx_version | cut -f3 -d.` @@ -53,10 +85,12 @@ if test X = "X$cxx_flags_set"; then cxx_vers_all=`expr $cxx_vers_major '*' 1000000 + $cxx_vers_minor '*' 1000 + $cxx_vers_patch` fi -# Common g++ flags for various situations -case "$cxx_vendor-$cxx_version" in - g++*) - # Architecture-specific flags +if test "X-g++" = "X-$cxx_vendor"; then + + ############################### + # Architecture-specific flags # + ############################### + arch= case "$host_os-$host_cpu" in # FreeBSD sets the information from "uname -m" to the general machine @@ -84,742 +118,197 @@ case "$cxx_vendor-$cxx_version" in ;; esac - # Host-specific flags - case "`hostname`" in - sleipnir.ncsa.uiuc.edu) - arch="$arch -pipe" - ;; - esac - - # General (copied from H5_CFLAGS) - H5_CXXFLAGS="$H5_CXXFLAGS $arch -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wredundant-decls -Winline" - # C++-specific - H5_CXXFLAGS="$H5_CXXFLAGS -Wsign-promo -Woverloaded-virtual -Wold-style-cast -Weffc++ -Wreorder -Wnon-virtual-dtor -Wctor-dtor-privacy -Wabi" + H5_CXXFLAGS="$H5_CXXFLAGS $arch + + ############## + # Production # + ############## - # Production # NDEBUG is handled explicitly by the configure script - case "$cxx_vendor-$cxx_version" in - g++-[34].*) + if test $cxx_vers_major -le 4; then PROD_CXXFLAGS= - ;; - g++-[56].*) + else PROD_CXXFLAGS="-fstdarg-opt" - ;; - *) - PROD_CXXFLAGS="-finline-functions" - ;; - esac + fi + + ######### + # Debug # + ######### - # Debug # NDEBUG is handled explicitly by the configure script - # -g is hanled by the symbols flags - case "$cxx_vendor-$cxx_version" in - g++-[56].*) - DEBUG_CXXFLAGS="-ftrapv -fno-common" - ;; - *) + # -g is handled by the symbols flags + if test $cxx_vers_major -le 4; then DEBUG_CXXFLAGS= - ;; - esac + else + DEBUG_CXXFLAGS="-ftrapv -fno-common" + fi + + ########### + # Symbols # + ########### - # Symbols NO_SYMBOLS_CXXFLAGS="-s" SYMBOLS_CXXFLAGS="-g" - # Profile + ############# + # Profiling # + ############# + PROFILE_CXXFLAGS="-pg" - # Optimization - case "$cxx_vendor-$cxx_version" in - g++-[34].*) + ################ + # Optimization # + ################ + + if test $cxx_vers_major -le 4; then HIGH_OPT_CXXFLAGS="-O3" DEBUG_OPT_CXXFLAGS= - ;; - g++-[56].*) + else HIGH_OPT_CXXFLAGS="-O3" DEBUG_OPT_CXXFLAGS="-Og" - ;; - *) - HIGH_OPT_CXXFLAGS="-O" - DEBUG_OPT_CXXFLAGS= - ;; - esac + fi NO_OPT_CXXFLAGS="-O0" - # Flags are set - cxx_flags_set=yes - ;; -esac - -# Version-specific g++ flags -# -# Please follow the pattern below by adding new versions at the top, copying -# the information from the previous version and adding modifications to that. -case "$cxx_vendor-$cxx_version" in - -# Closer to the g++ 5.2 release, we should check for additional flags to -# include and break it out into it's own section, like the other versions -# below. -QAK - g++-[56]*) + ############ + # Warnings # + ############ - # Append warning flags from gcc-3* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" +# First load the C warnings then add CXX warnings (if needed) - # Append warning flags from gcc-3.2* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + ########### + # General # + ########### - # Enable more format checking flags, beyond the basic -Wformat included - # in -Wall - H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments general)" + H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_gnu_arguments error-general)" + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments cxx-general)" + #H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_gnu_arguments error-cxx-general)" - # The "unreachable code" flag generates many spurious C++ warnings. - # We'll disable it for now. - #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + ###################### + # Developer warnings # + ###################### - # Append warning flags from gcc-3.3* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + NO_DEVELOPER_WARNING_CXXFLAGS=$(load_gnu_arguments no-developer-general) + DEVELOPER_WARNING_CXXFLAGS=$(load_gnu_arguments developer-general) - # Append warning flags from gcc-3.4* case - H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + ####################### + # gcc 4 special cases # + ####################### - # Replace old -W flag with new -Wextra flag - H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" - - # Append more extra warning flags that only gcc 4.0+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" - - # Append more extra warning flags that only gcc 4.1+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" - - # Append more extra warning flags that only gcc 4.2+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" - - # Append more extra warning flags that only gcc 4.3+ know about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" - - # Append more extra warning flags that only gcc 4.4+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append more extra warning flags that only gcc 4.5+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow=5" - - # Append more extra warning flags that only gcc 4.6+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" - - # Append more extra warning flags that only gcc 4.7+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" - - # Append more extra warning flags that only gcc 4.8+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wsuggest-attribute=format" + # GCC 4.2 through 4.6 + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 6; then + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.2-4.6)" + fi - # Append more extra warning flags that only gcc 4.9+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wdate-time -Wopenmp-simd" + # GCC 4.2 through 4.3 + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 3; then + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.2-4.3)" + fi - # (There was no release of gcc 5.0) + # GCC 4.5 through 4.6 + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 6; then + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.5-4.6)" + fi - # Append more extra warning flags that only gcc 5.1+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Warray-bounds=2" - ;; + # GCC 4.2 through 4.4 + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -a $cc_vers_major -eq 4 -a $cc_vers_minor -le 4; then + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.2-4.4)" + fi - g++-4.9*) - # Append warning flags + # GCC 4.2 through the end of GCC 4 series + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2; then + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.2-4.last)" + fi - # Append warning flags from gcc-3* case - # (don't use -Wpadded flag for normal builds, many of the warnings its - # issuing can't be fixed and they are making it hard to detect other, - # more important warnings) - #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" - H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + ############################# + # Version-specific warnings # + ############################# - # Append warning flags from gcc-3.2* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + # gcc >= 4.3 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 3; then + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.3)" + fi - # Enable more format checking flags, beyond the basic -Wformat included - # in -Wall - H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + # gcc >= 4.4 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 4; then + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.4)" + fi - # The "unreachable code" flag generates many spurious C++ warnings. - # We'll disable it for now. - #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + # gcc >= 4.5 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5; then + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.5)" + DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gcc_arguments developer-4.5)" + NO_DEVELOPER_WARNING_CXXFLAGS="$NO_DEVELOPER_WARNING_CXXFLAGS $(load_gcc_arguments no-developer-4.5)" + fi - # Append warning flags from gcc 3.3* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + # gcc >= 4.6 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 6; then + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.6)" + DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gcc_arguments developer-4.6)" + NO_DEVELOPER_WARNING_CXXFLAGS="$NO_DEVELOPER_WARNING_CXXFLAGS $(load_gcc_arguments no-developer-4.6)" + fi - # Append warning flags from gcc 3.4* case - H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + # gcc >= 4.7 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 7; then + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.7)" + DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gcc_arguments developer-4.7)" + NO_DEVELOPER_WARNING_CXXFLAGS="$NO_DEVELOPER_WARNING_CXXFLAGS $(load_gcc_arguments no-developer-4.7)" + fi - # Replace old -W flag with new -Wextra flag - H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + # gcc >= 4.8 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 8; then + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.8)" + DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gcc_arguments developer-4.8)" + NO_DEVELOPER_WARNING_CXXFLAGS="$NO_DEVELOPER_WARNING_CXXFLAGS $(load_gcc_arguments no-developer-4.8)" + fi - # Append more extra warning flags that only gcc 4.0+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + # gcc >= 4.9 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 9; then + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.9)" + fi - # Append more extra warning flags that only gcc 4.1+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + # gcc >= 5 + if test $cc_vers_major -ge 5; then + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 5)" + H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_gnu_arguments error-5)" + fi - # Append more extra warning flags that only gcc 4.2+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + # gcc >= 6 + if test $cc_vers_major -ge 6; then + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 6)" + fi - # Append more extra warning flags that only gcc 4.3+ know about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + # gcc >= 7 + if test $cc_vers_major -ge 7; then + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 7)" + DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gcc_arguments developer-7)" + fi - # Append more extra warning flags that only gcc 4.4+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + # gcc 8 + if test $cc_vers_major -ge 8; then + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 8)" + H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_gnu_arguments error-8)" + DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gcc_arguments developer-8)" + NO_DEVELOPER_WARNING_CXXFLAGS="$NO_DEVELOPER_WARNING_CXXFLAGS $(load_gcc_arguments no-developer-8)" + fi - # Append more extra warning flags that only gcc 4.5+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow=5" + # gcc 9 + if test $cc_vers_major -ge 9; then + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 9)" + fi - # Append more extra warning flags that only gcc 4.6+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" + ################# + # Flags are set # + ################# + cxx_flags_set=yes +fi - # Append more extra warning flags that only gcc 4.7+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" +# Version-specific g++ flags - # Append more extra warning flags that only gcc 4.8+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wsuggest-attribute=format" # Append more extra warning flags that only gcc 4.9+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wdate-time -Wopenmp-simd" - ;; - - g++-4.8*) - # Append warning flags - - # Append warning flags from gcc-3* case - # (don't use -Wpadded flag for normal builds, many of the warnings its - # issuing can't be fixed and they are making it hard to detect other, - # more important warnings) - #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" - H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" - - # Append warning flags from gcc-3.2* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" - - # Enable more format checking flags, beyond the basic -Wformat included - # in -Wall - H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" - - # The "unreachable code" flag generates many spurious C++ warnings. - # We'll disable it for now. - #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" - - # Append warning flags from gcc-3.3* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" - - # Append warning flags from gcc-3.4* case - H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" - - # Replace old -W flag with new -Wextra flag - H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" - - # Append more extra warning flags that only gcc 4.0+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" - - # Append more extra warning flags that only gcc 4.1+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" - - # Append more extra warning flags that only gcc 4.2+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" - - # Append more extra warning flags that only gcc 4.3+ know about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" - - # Append more extra warning flags that only gcc 4.4+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append more extra warning flags that only gcc 4.5+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow=5" - - # Append more extra warning flags that only gcc 4.6+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" - - # Append more extra warning flags that only gcc 4.7+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" - - # Append more extra warning flags that only gcc 4.8+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wsuggest-attribute=format" - ;; - - g++-4.7*) - # Append warning flags - # Append warning flags from gcc-3* case - # (don't use -Wpadded flag for normal builds, many of the warnings its - # issuing can't be fixed and they are making it hard to detect other, - # more important warnings) - #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" - H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" - - # Append warning flags from gcc-3.2* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" - - # Enable more format checking flags, beyond the basic -Wformat included - # in -Wall - H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" - - # The "unreachable code" flag generates many spurious C++ warnings. - # We'll disable it for now. - #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" - - # Append warning flags from gcc-3.3* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" - - # Append warning flags from gcc-3.4* case - H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" - - # Replace old -W flag with new -Wextra flag - H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" - - # Append more extra warning flags that only gcc 4.0+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" - - # Append more extra warning flags that only gcc 4.1+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" - - # Append more extra warning flags that only gcc 4.2+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" - - # Append more extra warning flags that only gcc 4.3+ know about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" - - # Append more extra warning flags that only gcc 4.4+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append more extra warning flags that only gcc 4.5+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow=5" - - # Append more extra warning flags that only gcc 4.6+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" - - # Append more extra warning flags that only gcc 4.7+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" - ;; - - g++-4.6*) - # Disable warnings about using 'long long' type - H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" - - # Append warning flags from gcc-3* case - # (don't use -Wpadded flag for normal builds, many of the warnings its - # issuing can't be fixed and they are making it hard to detect other, - # more important warnings) - #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" - H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" - - # Append warning flags from gcc-3.2* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" - - # Enable more format checking flags, beyond the basic -Wformat included - # in -Wall - H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" - - # The "unreachable code" flag generates many spurious C++ warnings. - # We'll disable it for now. - #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" - - # Append warning flags from gcc-3.3* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" - - # Append warning flags from gcc-3.4* case - H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" - - # Replace old -W flag with new -Wextra flag - H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" - - # Append more extra warning flags that only gcc 4.0+ knows about - H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" - - # Append more extra warning flags that only gcc 4.1+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" - - # Append more extra warning flags that only gcc 4.2+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" - - # Append more extra warning flags that only gcc 4.3+ know about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" - - # Append more extra warning flags that only gcc 4.4+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append more extra warning flags that only gcc 4.5+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-aliasing -Wstrict-overflow=5" - - # Append more extra warning flags that only gcc 4.6+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" - ;; - - g++-4.5*) - # Disable warnings about using 'long long' type - H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" - - # Append warning flags from gcc-3* case - # (don't use -Wpadded flag for normal builds, many of the warnings its - # issuing can't be fixed and they are making it hard to detect other, - # more important warnings) - #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" - H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" - - # Append warning flags from gcc-3.2* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" - - # Enable more format checking flags, beyond the basic -Wformat included - # in -Wall - H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" - - # The "unreachable code" flag generates many spurious C++ warnings. - # We'll disable it for now. - #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" - - # Append warning flags from gcc-3.3* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" - - # Append warning flags from gcc-3.4* case - H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" - - # Replace old -W flag with new -Wextra flag - H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" - - # Append more extra warning flags that only gcc4.0+ knows about - H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" - - # Append more extra warning flags that only gcc 4.1+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" - - # Append more extra warning flags that only gcc 4.2+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" - - # Append more extra warning flags that only gcc 4.3+ know about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" - - # Append more extra warning flags that only gcc 4.4+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append more extra warning flags that only gcc 4.5+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-aliasing -Wstrict-overflow=5" - ;; - - g++-4.4*) - # Disable warnings about using 'long long' type - H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" - - # Append warning flags from gcc-3* case - # (don't use -Wpadded flag for normal builds, many of the warnings its - # issuing can't be fixed and they are making it hard to detect other, - # more important warnings) - #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" - H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" - - # Append warning flags from gcc-3.2* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" - - # Enable more format checking flags, beyond the basic -Wformat included - # in -Wall - H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" - - # The "unreachable code" flag generates many spurious C++ warnings. - # We'll disable it for now. - #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" - - # Append warning flags from gcc-3.3* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" - - # Append warning flags from gcc-3.4* case - H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" - - # Replace old -W flag with new -Wextra flag - H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" - - # Append more extra warning flags that only gcc 4.0+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" - - # Append more extra warning flags that only gcc 4.1+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" - - # Append more extra warning flags that only gcc 4.2+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" - - # Append more extra warning flags that only gcc 4.3+ know about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" - - # Append more extra warning flags that only gcc 4.4+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - ;; - - g++-4.3*) - # Disable warnings about using 'long long' type - H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" - - # Append warning flags from gcc-3* case - # (don't use -Wpadded flag for normal builds, many of the warnings its - # issuing can't be fixed and they are making it hard to detect other, - # more important warnings) - #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" - H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" - - # Append warning flags from gcc-3.2* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" - - # Enable more format checking flags, beyond the basic -Wformat included - # in -Wall - H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" - - # The "unreachable code" flag generates many spurious C++ warnings. - # We'll disable it for now. - #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" - - # Append warning flags from gcc-3.3* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" - - # Append warning flags from gcc-3.4* case - H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" - - # Replace old -W flag with new -Wextra flag - H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" - - # Append more extra warning flags that only gcc 4.0+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" - - # Append more extra warning flags that only gcc 4.1+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations -Wvolatile-register-var" - - # Append more extra warning flags that only gcc 4.2+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" - - # Append more extra warning flags that only gcc 4.3+ know about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wvla" - ;; - - g++-4.2*) - # Disable warnings about using 'long long' type - H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" - - # Append warning flags from gcc-3* case - # (don't use -Wpadded flag for normal builds, many of the warnings its - # issuing can't be fixed and they are making it hard to detect other, - # more important warnings) - #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" - H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" - - # Append warning flags from gcc-3.2* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" - - # Enable more format checking flags, beyond the basic -Wformat included - # in -Wall - H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" - - # The "unreachable code" flag generates many spurious C++ warnings. - # We'll disable it for now. - #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" - - # Append warning flags from gcc-3.3* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" - - # Append warning flags from gcc-3.4* case - H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" - - # Replace old -W flag with new -Wextra flag - H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" - - # Append more extra warning flags that only gcc 4.0+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" - - # Append more extra warning flags that only gcc 4.1+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations -Wvolatile-register-var" - - # Append more extra warning flags that only gcc 4.2+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" - ;; - - g++-4.1.*) - # Disable warnings about using 'long long' type - H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" - - # Append warning flags from gcc-3* case - # (don't use -Wpadded flag for normal builds, many of the warnings its - # issuing can't be fixed and they are making it hard to detect other, - # more important warnings) - #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" - H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" - - # Append warning flags from gcc-3.2* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" - - # Enable more format checking flags, beyond the basic -Wformat included - # in -Wall - H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" - - # The "unreachable code" flag generates many spurious C++ warnings. - # We'll disable it for now. - #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" - - # Append warning flags from gcc-3.3* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" - - # Append warning flags from gcc-3.4* case - H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" - - # Replace old -W flag with new -Wextra flag - H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" - - # Append more extra warning flags that only gcc 4.0+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" - - # Append more extra warning flags that only gcc 4.1+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations -Wvolatile-register-var" - ;; - - g++-4.0*) - # Disable warnings about using 'long long' type - H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" - - # Append warning flags from gcc-3* case - # (don't use -Wpadded flag for normal builds, many of the warnings its - # issuing can't be fixed and they are making it hard to detect other, - # more important warnings) - #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" - H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" - - # Append warning flags from gcc-3.2* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" - - # The "format=2" warning generates too many warnings about valid - # usage in the library. - #CXXFLAGS="$CXXFLAGS -Wformat=2" - - # The "unreachable code" flag generates many spurious C++ warnings. - # We'll disable it for now. - #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" - - # Append warning flags from gcc-3.3* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" - - # Append warning flags from gcc-3.4* case - H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" - - # Replace old -W flag with new -Wextra flag - H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" - - # Append more extra warning flags that only gcc 4.0+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" - ;; - - g++-3.4*) - # Disable warnings about using 'long long' type - H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" - - # Append warning flags from gcc-3* case - # (don't use -Wpadded flag for normal builds, many of the warnings its - # issuing can't be fixed and they are making it hard to detect other, - # more important warnings) - #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" - H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" - - # Append warning flags from gcc-3.2* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" - - # The "format=2" warning generates too many warnings about valid - # usage in the library. - #CXXFLAGS="$CXXFLAGS -Wformat=2" - - # The "unreachable code" flag generates many spurious C++ warnings. - # We'll disable it for now. - #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" - - # Append warning flags from gcc-3.3* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" - - # Append more extra warning flags that only gcc3.4+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" - - # Replace old -W flag with new -Wextra flag - H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" - ;; - - g++-3.3*) - # Disable warnings about using 'long long' type - H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" - - # Append warning flags from gcc-3* case - # (don't use -Wpadded flag for normal builds, many of the warnings its - # issuing can't be fixed and they are making it hard to detect other, - # more important warnings) - #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" - H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" - - # Append warning flags from gcc-3.2* case - H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" - - # The "format=2" warning generates too many warnings about valid - # usage in the library. - #CXXFLAGS="$CXXFLAGS -Wformat=2" - - # The "unreachable code" flag generates many spurious C++ warnings. - # We'll disable it for now. - #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" - - # Append more extra warning flags that only gcc3.3+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" - ;; - - g++-3.2*) - # Disable warnings about using 'long long' type - H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" - - # Append warning flags from gcc-3* case - # (don't use -Wpadded flag for normal builds, many of the warnings its - # issuing can't be fixed and they are making it hard to detect other, - # more important warnings) - #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" - H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" - - # Append more extra warning flags that only gcc3.2+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" - - # The "format=2" warning generates too many warnings about valid - # usage in the library. - #CXXFLAGS="$CXXFLAGS -Wformat=2" - - # The "unreachable code" flag generates many spurious C++ warnings. - # We'll disable it for now. - #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" - ;; - - g++-3*) - # Disable warnings about using 'long long' type - H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" - - # Append some extra warning flags that only gcc3+ know about - # (don't use -Wpadded flag for normal builds, many of the warnings its - # issuing can't be fixed and they are making it hard to detect other, - # more important warnings) - #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" - H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" - ;; -esac + -Wopenmp-simd" # Clear cxx info if no flags set if test "X$cxx_flags_set" = "X"; then diff --git a/config/gnu-fflags b/config/gnu-fflags index 6b5e6a1..2859158 100644 --- a/config/gnu-fflags +++ b/config/gnu-fflags @@ -1,4 +1,4 @@ -# -*- shell-script -*- +# -*- shell-script -*- # # Copyright by The HDF Group. # Copyright by the Board of Trustees of the University of Illinois. @@ -17,6 +17,20 @@ # if the compiler is not GNU; otherwise `f9x_flags_set' is set to `yes' # +# +# Prepend `$srcdir/config/gnu-warnings/` to the filename suffix(es) given as +# subroutine argument(s), remove comments starting with # and ending +# at EOL, replace spans of whitespace (including newlines) with spaces, +# and re-emit the file(s) thus filtered on the standard output stream. +# +load_gnu_arguments() +{ + set -- $(for arg; do + sed 's,#.*$,,' $srcdir/config/gnu-warnings/${arg} | demote_errors + done) + IFS=' ' echo "$*" +} + # Get the compiler version in a way that works for GNU fortran # gfortran unless a compiler version is already known # @@ -25,9 +39,8 @@ # if test X = "X$f9x_flags_set"; then f9x_version="`$FC $FCFLAGS $H5_FCFLAGS -v 2>&1 |grep 'gcc version' |\ - sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`" + sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`" if test X != "X$f9x_version"; then -# is_mpi="`$FC $FCFLAGS $H5_FCFLAGS -help 2>&1 |grep 'link MPI'`" f9x_vendor=`echo $f9x_version |sed 's/\([a-z]*\).*/\1/'` f9x_version=`echo $f9x_version |sed 's/[-a-z]//g'` if test X = "X$f9x_vendor" -a X != "X$f9x_version"; then @@ -37,24 +50,36 @@ if test X = "X$f9x_flags_set"; then echo "compiler '$FC' is GNU $f9x_vendor-$f9x_version" fi - # Some version numbers + # Get the compiler version numbers f9x_vers_major=`echo $f9x_version | cut -f1 -d.` f9x_vers_minor=`echo $f9x_version | cut -f2 -d.` f9x_vers_patch=`echo $f9x_version | cut -f3 -d.` test -n "$f9x_vers_major" || f9x_vers_major=0 test -n "$f9x_vers_minor" || f9x_vers_minor=0 test -n "$f9x_vers_patch" || f9x_vers_patch=0 - f9x_vers_all=`expr $f9x_vers_major '*' 1000000 + $f9x_vers_minor '*' 1000 + $f9x_vers_patch` fi fi -# Common GNU flags for various situations if test "X-gfortran" = "X-$f9x_vendor"; then - # Insert section about version specific problems from gnu-flags here, if - # necessary. + + FC_BASENAME=gfortran + F9XSUFFIXFLAG="" + FSEARCH_DIRS="" + + # Need Fortran 2008 support for storage_size() in gcc 4.6 on + # (2008ts in some versions) + if test $f9x_vers_major -ge 8; then + H5_FCFLAGS="$H5_FCFLAGS -std=f2008" + elif test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 6; then + H5_FCFLAGS="$H5_FCFLAGS -std=f2008ts" + fi + + + ############################### + # Architecture-specific flags # + ############################### arch= - # Architecture-specific flags # Nothing currently. (Uncomment code below and modify to add any) #case "$host_os-$host_cpu" in # *-i686) @@ -62,43 +87,112 @@ if test "X-gfortran" = "X-$f9x_vendor"; then # ;; #esac - # Host-specific flags - # Nothing currently. (Uncomment code below and modify to add any) - #case "`hostname`" in - # sleipnir.ncsa.uiuc.edu) - # arch="$arch -pipe" - # ;; - #esac - - # General - FC_BASENAME=gfortran - F9XSUFFIXFLAG="" - FSEARCH_DIRS="" - H5_FCFLAGS="$H5_FCFLAGS -pedantic -Wall -Wextra -Wunderflow -Wimplicit-interface -Wsurprising" + H5_FCFLAGS="$H5_FCFLAGS $arch" - # Turn off warnings for passing non-ANSI types to BIND(). - # We pass a lot of hid_t, etc. types so this generates a LOT of spurious warnings. - H5_FCFLAGS="$H5_FCFLAGS -Wno-c-binding-type" + ############## + # Production # + ############## - # Production PROD_FCFLAGS= - # Debug - DEBUG_FCFLAGS="-fbounds-check" + ######### + # Debug # + ######### + + if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 5; then + DEBUG_FCFLAGS="-fcheck=all" + else + DEBUG_FCFLAGS="-fbounds-check" + fi + + ########### + # Symbols # + ########### - # Symbols - SYMBOLS_FCFLAGS="-g" NO_SYMBOLS_FCFLAGS="-s" + SYMBOLS_FCFLAGS="-g" + + ############# + # Profiling # + ############# - # Profiling PROFILE_FCFLAGS="-pg" - # Optimization - HIGH_OPT_FCFLAGS="-O2" - DEBUG_OPT_FCFLAGS="-O0" + ################ + # Optimization # + ################ + + if test $f9x_vers_major -le 4; then + HIGH_OPT_FCFLAGS="-O3" + DEBUG_OPT_FCFLAGS= + else + HIGH_OPT_FCFLAGS="-O3" + DEBUG_OPT_FCFLAGS="-Og" + fi NO_OPT_FCFLAGS="-O0" - # Flags are set + ############ + # Warnings # + ############ + + ########### + # General # + ########### + + H5_FCFLAGS="$H5_CFLAGS $(load_gnu_arguments gfort-general)" + + ############################# + # Version-specific warnings # + ############################# + + # gfortran 4.3 (nothing new) + + # gfortran >= 4.4 + if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 4; then + H5_FCFLAGS="$H5_FCFLAGS $(load_gnu_arguments gfort-4.4)" + fi + + # gfortran >= 4.5 + if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 5; then + H5_FCFLAGS="$H5_FCFLAGS $(load_gnu_arguments gfort-4.5)" + fi + + # gfortran 4.6 (nothing new) + + # gfortran >= 4.7 + if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 7; then + H5_FCFLAGS="$H5_FCFLAGS $(load_gnu_arguments gfort-4.7)" + fi + + # gfortran >= 4.8 + if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 8; then + H5_FCFLAGS="$H5_FCFLAGS $(load_gnu_arguments gfort-4.8)" + fi + + # gfortran 4.9 (nothing new) + + # gfortran >= 5 + if test $f9x_vers_major -ge 5; then + H5_FCFLAGS="$H5_FCFLAGS $(load_gnu_arguments gfort-5)" + fi + + # gfortran >= 6 + if test $f9x_vers_major -ge 6; then + H5_FCFLAGS="$H5_FCFLAGS $(load_gnu_arguments gfort-6)" + fi + + # gfortran 7 (nothing new) + + # gfortran >= 8 + if test $f9x_vers_major -ge 8; then + H5_FCFLAGS="$H5_FCFLAGS $(load_gnu_arguments gfort-8)" + fi + + # gfortran 9 (nothing new) + + ################# + # Flags are set # + ################# f9x_flags_set=yes fi diff --git a/config/gnu-flags b/config/gnu-flags index ca0e1b4..c2904fe 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -36,12 +36,12 @@ demote_errors() } # -# Prepend `$srcdir/config/gnu-` to the filename suffix(es) given as +# Prepend `$srcdir/config/gnu-warnings/` to the filename suffix(es) given as # subroutine argument(s), remove comments starting with # and ending # at EOL, replace spans of whitespace (including newlines) with spaces, # and re-emit the file(s) thus filtered on the standard output stream. # -load_gcc_arguments() +load_gnu_arguments() { set -- $(for arg; do sed 's,#.*$,,' $srcdir/config/gnu-warnings/${arg} | demote_errors @@ -49,7 +49,6 @@ load_gcc_arguments() IFS=' ' echo "$*" } - # Get the compiler version in a way that works for gcc # unless a compiler version is already known # @@ -189,15 +188,15 @@ if test "X-gcc" = "X-$cc_vendor"; then # General # ########### - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments general)" - H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments error-general)" + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments general)" + H5_ECFLAGS="$H5_ECFLAGS $(load_gnu_arguments error-general)" ###################### # Developer warnings # ###################### - NO_DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments no-developer-general) - DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments developer-general) + NO_DEVELOPER_WARNING_CFLAGS=$(load_gnu_arguments no-developer-general) + DEVELOPER_WARNING_CFLAGS=$(load_gnu_arguments developer-general) ####################### # gcc 4 special cases # @@ -205,27 +204,27 @@ if test "X-gcc" = "X-$cc_vendor"; then # GCC 4.2 through 4.6 if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 6; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.6)" + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 4.2-4.6)" fi # GCC 4.2 through 4.3 if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 3; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.3)" + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 4.2-4.3)" fi # GCC 4.5 through 4.6 if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 6; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.5-4.6)" + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 4.5-4.6)" fi # GCC 4.2 through 4.4 if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -a $cc_vers_major -eq 4 -a $cc_vers_minor -le 4; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.4)" + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 4.2-4.4)" fi # GCC 4.2 through the end of GCC 4 series if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.last)" + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 4.2-4.last)" fi ############################# @@ -234,75 +233,75 @@ if test "X-gcc" = "X-$cc_vendor"; then # gcc >= 4.3 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 3; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.3)" + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 4.3)" fi # gcc >= 4.4 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 4; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.4)" + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 4.4)" fi # gcc >= 4.5 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.5)" + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 4.5)" DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.5)" NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-4.5)" fi # gcc >= 4.6 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 6; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.6)" + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 4.6)" DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.6)" NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-4.6)" fi # gcc >= 4.7 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 7; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.7)" + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 4.7)" DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.7)" NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-4.7)" fi # gcc >= 4.8 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 8; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.8)" + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 4.8)" DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.8)" NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-4.8)" fi # gcc >= 4.9 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 9; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.9)" + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 4.9)" fi # gcc >= 5 if test $cc_vers_major -ge 5; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 5)" - H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments error-5)" + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 5)" + H5_ECFLAGS="$H5_ECFLAGS $(load_gnu_arguments error-5)" fi # gcc >= 6 if test $cc_vers_major -ge 6; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 6)" + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 6)" fi # gcc >= 7 if test $cc_vers_major -ge 7; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 7)" + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 7)" DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-7)" fi # gcc 8 if test $cc_vers_major -ge 8; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 8)" - H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments error-8)" + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 8)" + H5_ECFLAGS="$H5_ECFLAGS $(load_gnu_arguments error-8)" DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-8)" NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-8)" fi # gcc 9 if test $cc_vers_major -ge 9; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 9)" + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 9)" fi ################# @@ -316,3 +315,4 @@ if test "X$cc_flags_set" = "X"; then cc_vendor= cc_version= fi + diff --git a/config/gnu-warnings/cxx-general b/config/gnu-warnings/cxx-general new file mode 100644 index 0000000..ee7ee22 --- /dev/null +++ b/config/gnu-warnings/cxx-general @@ -0,0 +1,19 @@ +# Note that some of the flags listed here really should be developer +# flags (listed in separate files, gnu-warnings-developer*) but we put +# them here because they are not raised by the current code and we'd like to +# know if they do start showing up. +# +# 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 from the +# environment variable at configure time. +-Wabi +-Wctor-dtor-privacy +-Weffc++ +##-Wendif-labels +-Wnon-virtual-dtor +-Wold-style-cast +-Woverloaded-virtual +-Wreorder +-Wsign-promo +##-Wunreachable-code +##-Wvariadic-macros diff --git a/config/gnu-warnings/gfort-4.4 b/config/gnu-warnings/gfort-4.4 new file mode 100644 index 0000000..59fe9a2 --- /dev/null +++ b/config/gnu-warnings/gfort-4.4 @@ -0,0 +1,2 @@ +-Warray-temporaries +-Wintrinsics-std \ No newline at end of file diff --git a/config/gnu-warnings/gfort-4.5 b/config/gnu-warnings/gfort-4.5 new file mode 100644 index 0000000..4490d4e --- /dev/null +++ b/config/gnu-warnings/gfort-4.5 @@ -0,0 +1 @@ +-Wimplicit-procedure diff --git a/config/gnu-warnings/gfort-4.7 b/config/gnu-warnings/gfort-4.7 new file mode 100644 index 0000000..a7532bb --- /dev/null +++ b/config/gnu-warnings/gfort-4.7 @@ -0,0 +1,2 @@ +-Wreal-q-constant +-Wfunction-elimination diff --git a/config/gnu-warnings/gfort-4.8 b/config/gnu-warnings/gfort-4.8 new file mode 100644 index 0000000..1b96a51 --- /dev/null +++ b/config/gnu-warnings/gfort-4.8 @@ -0,0 +1,5 @@ +-Wrealloc-lhs +-Wrealloc-lhs-all +# Turn off warnings for passing non-ANSI types to BIND(). +# We pass a lot of hid_t, etc. types so this generates a LOT of spurious warnings. +-Wno-c-binding-type diff --git a/config/gnu-warnings/gfort-5 b/config/gnu-warnings/gfort-5 new file mode 100644 index 0000000..c5d3850 --- /dev/null +++ b/config/gnu-warnings/gfort-5 @@ -0,0 +1 @@ +-Wuse-without-only diff --git a/config/gnu-warnings/gfort-6 b/config/gnu-warnings/gfort-6 new file mode 100644 index 0000000..f70466c --- /dev/null +++ b/config/gnu-warnings/gfort-6 @@ -0,0 +1 @@ +-Winteger-division diff --git a/config/gnu-warnings/gfort-8 b/config/gnu-warnings/gfort-8 new file mode 100644 index 0000000..5097365 --- /dev/null +++ b/config/gnu-warnings/gfort-8 @@ -0,0 +1 @@ +-Wfrontend-loop-interchange diff --git a/config/gnu-warnings/gfort-general b/config/gnu-warnings/gfort-general new file mode 100644 index 0000000..4028316 --- /dev/null +++ b/config/gnu-warnings/gfort-general @@ -0,0 +1,12 @@ +# Note that some of the flags listed here really should be developer +# flags (listed in separate files, gnu-warnings-developer*) but we put +# them here because they are not raised by the current code and we'd like to +# know if they do start showing up. +-Waliasing +-Wall +-Wcharacter-truncation +-Wextra +-Wimplicit-interface +-Wsurprising +-Wunderflow +-pedantic diff --git a/config/intel-fflags b/config/intel-fflags index 8b1110e..ed7ee52 100644 --- a/config/intel-fflags +++ b/config/intel-fflags @@ -1,4 +1,4 @@ -# -*- shell-script -*- +# -*- shell-script -*- # # Copyright by The HDF Group. # Copyright by the Board of Trustees of the University of Illinois. @@ -17,6 +17,20 @@ # if the compiler is not Intel; otherwise `f9x_flags_set' is set to `yes' # +# +# Prepend `$srcdir/config/intel-warnings/` to the filename suffix(es) given as +# subroutine argument(s), remove comments starting with # and ending +# at EOL, replace spans of whitespace (including newlines) with spaces, +# and re-emit the file(s) thus filtered on the standard output stream. +# +load_intel_arguments() +{ + set -- $(for arg; do + sed 's,#.*$,,' $srcdir/config/intel-warnings/${arg} + done) + IFS=' ' echo "$*" +} + # Get the compiler version in a way that works for ifort # ifort unless a compiler version is already known # @@ -44,8 +58,8 @@ fi # Common Intel flags for various situations if test "X-ifort" = "X-$f9x_vendor"; then - # Insert section about version specific problems from gnu-flags here, if - # necessary. + # Insert section about version specific problems from compiler flags here, + # if necessary. arch= # Architecture-specific flags @@ -68,7 +82,8 @@ if test "X-ifort" = "X-$f9x_vendor"; then FC_BASENAME=ifort F9XSUFFIXFLAG="" FSEARCH_DIRS="" - H5_FCFLAGS="$H5_FCFLAGS" + H5_FCFLAGS="$H5_FCFLAGS -stand:f03 -free" + H5_FCFLAGS="$H5_FCFLAGS $(load_intel_arguments ifort-general)" # Production PROD_FCFLAGS= @@ -89,7 +104,9 @@ if test "X-ifort" = "X-$f9x_vendor"; then DEBUG_OPT_FCFLAGS= NO_OPT_FCFLAGS= - # Flags are set + ################# + # Flags are set # + ################# f9x_flags_set=yes fi diff --git a/config/intel-flags b/config/intel-flags index 6b4e406..100e68a 100644 --- a/config/intel-flags +++ b/config/intel-flags @@ -18,7 +18,7 @@ # # -# Prepend `$srcdir/config/intel-` to the filename suffix(es) given as +# Prepend `$srcdir/config/intel-warnings/` to the filename suffix(es) given as # subroutine argument(s), remove comments starting with # and ending # at EOL, replace spans of whitespace (including newlines) with spaces, # and re-emit the file(s) thus filtered on the standard output stream. @@ -26,7 +26,7 @@ load_intel_arguments() { set -- $(for arg; do - sed 's,#.*$,,' $srcdir/config/intel-${arg} + sed 's,#.*$,,' $srcdir/config/intel-warnings/${arg} done) IFS=' ' echo "$*" } @@ -81,7 +81,6 @@ if test "X-icc" = "X-$cc_vendor"; then # General # Default to C99 standard. H5_CFLAGS="$H5_CFLAGS $arch -std=c99" - H5_CFLAGS="$H5_CFLAGS $(load_intel_arguments warnings-general)" # Production PROD_CFLAGS= @@ -103,16 +102,20 @@ if test "X-icc" = "X-$cc_vendor"; then DEBUG_OPT_CFLAGS="-O0" NO_OPT_CFLAGS="-O0" - # Flags are set - cc_flags_set=yes + ############ + # Warnings # + ############ -fi + ########### + # General # + ########### + + H5_CFLAGS="$H5_CFLAGS $(load_intel_arguments general)" + + ############################# + # Version-specific warnings # + ############################# -# Version specific ICC flags -# -# Please follow the pattern below by adding new versions at the top, copying -# the information from the previous version and adding modifications to that. -# The default at the bottom will apply if no earlier version matches. case "$cc_vendor-$cc_version" in icc-1[5-6]*) H5_CFLAGS="$H5_CFLAGS -Wcomment -Wdeprecated -Wextra-tokens -Wformat -Wformat-security -Wmain -Wmissing-declarations -Wmissing-prototypes -Wp64 -Wpointer-arith -Wreturn-type -Wshadow -Wstrict-prototypes -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunused-function -Wunused-variable -Wwrite-strings" @@ -128,6 +131,13 @@ case "$cc_vendor-$cc_version" in ;; esac + ################# + # Flags are set # + ################# + cc_flags_set=yes + +fi + # Clear cc info if no flags set if test "X-$cc_flags_set" = "X-"; then cc_vendor= diff --git a/config/intel-warnings-general b/config/intel-warnings-general deleted file mode 100644 index f4ed24c..0000000 --- a/config/intel-warnings-general +++ /dev/null @@ -1,10 +0,0 @@ -# Note that some of the flags listed here really should be developer -# flags (listed in separate files, gnu-warnings-developer*) but we put -# them here because they are not raised by the current code and we'd like to -# know if they do start showing up. -# -# 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 from the -# environment variable at configure time. --Wall --Wcheck \ No newline at end of file diff --git a/config/intel-warnings/general b/config/intel-warnings/general new file mode 100644 index 0000000..d0b2e25 --- /dev/null +++ b/config/intel-warnings/general @@ -0,0 +1,2 @@ +-Wall +-Wcheck \ No newline at end of file diff --git a/config/intel-warnings/ifort-general b/config/intel-warnings/ifort-general new file mode 100644 index 0000000..a9da0e5 --- /dev/null +++ b/config/intel-warnings/ifort-general @@ -0,0 +1 @@ +-warn:all diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index aa702ff..02a71c3 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -35,28 +35,22 @@ set (F2003_examples foreach (example ${examples}) add_executable (f90_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_compile_options(f90_ex_${example} - PRIVATE - $<$:${WIN_COMPILE_FLAGS}> - ) -# set_property(TARGET f90_ex_${example} APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET f90_ex_${example} APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) + target_compile_options(f90_ex_${example} PRIVATE $<$:${WIN_COMPILE_FLAGS}>) +# set_property(TARGET f90_ex_${example} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) +# set_property(TARGET f90_ex_${example} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) if(MSVC) set_property(TARGET f90_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() if (NOT BUILD_SHARED_LIBS) target_include_directories (f90_ex_${example} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" - ) - target_link_libraries (f90_ex_${example} - PRIVATE - ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + "${CMAKE_Fortran_MODULE_DIRECTORY}/static" + "${HDF5_SRC_DIR}" + "${HDF5_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}/static" ) + target_link_libraries (f90_ex_${example} PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran @@ -65,12 +59,13 @@ foreach (example ${examples}) else () target_include_directories (f90_ex_${example} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" - ) - target_link_libraries (f90_ex_${example} - PRIVATE - ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared" + "${HDF5_SRC_DIR}" + "${HDF5_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}/shared" ) + target_link_libraries (f90_ex_${example} PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran @@ -81,28 +76,22 @@ endforeach () foreach (example ${F2003_examples}) add_executable (f03_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_compile_options(f03_ex_${example} - PRIVATE - $<$:${WIN_COMPILE_FLAGS}> - ) -# set_property(TARGET f03_ex_${example} APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET f03_ex_${example} APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) + target_compile_options(f03_ex_${example} PRIVATE $<$:${WIN_COMPILE_FLAGS}>) +# set_property(TARGET f03_ex_${example} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) +# set_property(TARGET f03_ex_${example} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) if(MSVC) set_property(TARGET f03_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() if (NOT ONLY_SHARED_LIBS) target_include_directories (f03_ex_${example} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" - ) - target_link_libraries (f03_ex_${example} - PRIVATE - ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + "${CMAKE_Fortran_MODULE_DIRECTORY}/static" + "${HDF5_SRC_DIR}" + "${HDF5_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}/static" ) + target_link_libraries (f03_ex_${example} PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (f03_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 @@ -111,12 +100,13 @@ foreach (example ${F2003_examples}) else () target_include_directories (f03_ex_${example} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" - ) - target_link_libraries (f03_ex_${example} - PRIVATE - ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared" + "${HDF5_SRC_DIR}" + "${HDF5_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}/shared" ) + target_link_libraries (f03_ex_${example} PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (f03_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 @@ -127,27 +117,26 @@ endforeach () if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) add_executable (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) - target_compile_options(f90_ex_ph5example - PRIVATE - $<$:${WIN_COMPILE_FLAGS}> - ) -# set_property(TARGET f90_ex_ph5example APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET f90_ex_ph5example APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) + target_compile_options(f90_ex_ph5example PRIVATE $<$:${WIN_COMPILE_FLAGS}>) +# set_property(TARGET f90_ex_ph5example APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) +# set_property(TARGET f90_ex_ph5example APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) if(MSVC) set_property(TARGET f90_ex_ph5example PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() if (NOT ONLY_SHARED_LIBS) target_include_directories (f90_ex_ph5example PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_Fortran_INCLUDE_DIRS}>" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static" + "${HDF5_SRC_DIR}" + "${HDF5_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}/static" + "$<$:${MPI_Fortran_INCLUDE_DIRS}>" ) target_link_libraries (f90_ex_ph5example PRIVATE - ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + ${HDF5_F90_LIB_TARGET} + ${HDF5_LIB_TARGET} $<$:${MPI_Fortran_LIBRARIES}> ) set_target_properties (f90_ex_ph5example PROPERTIES @@ -158,11 +147,17 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) else () target_include_directories (f90_ex_ph5example PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$:${MPI_Fortran_INCLUDE_DIRS}>" + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared" + "${HDF5_SRC_DIR}" + "${HDF5_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}/shared" + "$<$:${MPI_Fortran_INCLUDE_DIRS}>" ) target_link_libraries (f90_ex_ph5example PRIVATE - ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + ${HDF5_F90_LIBSH_TARGET} + ${HDF5_LIBSH_TARGET} $<$:${MPI_Fortran_LIBRARIES}> ) set_target_properties (f90_ex_ph5example PROPERTIES diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 6372ac2..3a37278 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -40,22 +40,14 @@ set (Fortran_COMPILER_ID CMAKE_Fortran_COMPILER_ID) #----------------------------------------------------------------------------- add_executable (H5_buildiface ${HDF5_F90_SRC_SOURCE_DIR}/H5_buildiface.F90) -target_include_directories (H5_buildiface - PRIVATE - "${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}" -) +target_include_directories (H5_buildiface PRIVATE "${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}") #if (BUILD_SHARED_LIBS) -# target_compile_definitions(H5_buildiface -# PRIVATE -# $<$:/MT> -# ) +# target_compile_definitions(H5_buildiface PRIVATE $<$:/MT>) #endif () if(MSVC) set_property(TARGET H5_buildiface PROPERTY COMPILE_FLAGS "/MT") endif() -#set_property(TARGET H5_buildiface APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -#) +#set_property(TARGET H5_buildiface APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) if(MSVC) set_property(TARGET H5_buildiface PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE") endif() @@ -80,13 +72,25 @@ add_executable (H5match_types ${HDF5_F90_SRC_SOURCE_DIR}/H5match_types.c ) target_include_directories (H5match_types PRIVATE "${HDF5_BINARY_DIR};${HDF5_SRC_DIR};${HDF5_F90_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + +add_custom_command ( + OUTPUT ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h + ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ + WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} + DEPENDS H5match_types +) + if (NOT ONLY_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5f90i_gen.h" "${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h" + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5fortran_types.F90" "${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90" WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static - DEPENDS H5match_types + DEPENDS ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ) set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h PROPERTIES GENERATED TRUE) set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 PROPERTIES GENERATED TRUE) @@ -95,9 +99,12 @@ if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5f90i_gen.h" "${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h" + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5fortran_types.F90" "${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90" WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared - DEPENDS H5match_types + DEPENDS ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ) set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h PROPERTIES GENERATED TRUE) set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 PROPERTIES GENERATED TRUE) @@ -141,6 +148,7 @@ if (NOT ONLY_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) + target_compile_options(${HDF5_F90_C_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (${HDF5_F90_C_LIB_TARGET} STATIC) target_link_libraries (${HDF5_F90_C_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIB_TARGET}") @@ -158,9 +166,8 @@ if (BUILD_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) - target_compile_definitions(${HDF5_F90_C_LIBSH_TARGET} - PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" - ) + target_compile_options(${HDF5_F90_C_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + target_compile_definitions(${HDF5_F90_C_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB") TARGET_C_PROPERTIES (${HDF5_F90_C_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_F90_C_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIBSH_TARGET}") @@ -180,12 +187,20 @@ set (f90_F_GEN_SOURCES ${HDF5_F90_SRC_SOURCE_DIR}/H5Dff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Pff.F90 ) +add_custom_command ( + OUTPUT ${HDF5_F90_BINARY_DIR}/H5_gen.F90 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ + WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} + DEPENDS ${f90_F_GEN_SOURCES} + COMMENT "Generating the H5_gen.F90 file" +) if (NOT ONLY_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5_gen.F90" "${HDF5_F90_BINARY_DIR}/static/H5_gen.F90" WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static - DEPENDS ${f90_F_GEN_SOURCES} + DEPENDS ${HDF5_F90_BINARY_DIR}/H5_gen.F90 COMMENT "Generating the H5_gen.F90 file" ) add_custom_target (H5gen ALL @@ -197,9 +212,10 @@ endif () if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5_gen.F90" "${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90" WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared - DEPENDS ${f90_F_GEN_SOURCES} + DEPENDS ${HDF5_F90_BINARY_DIR}/H5_gen.F90 COMMENT "Generating the H5_gen.F90 shared file" ) add_custom_target (H5genSH ALL @@ -263,29 +279,23 @@ endif () if (NOT ONLY_SHARED_LIBS) add_library (${HDF5_F90_LIB_TARGET} STATIC ${f90_F_SOURCES}) target_include_directories (${HDF5_F90_LIB_TARGET} - PRIVATE - "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};$<$:${MPI_Fortran_INCLUDE_DIRS}>" - INTERFACE - "$/include/static>" + PRIVATE "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};$<$:${MPI_Fortran_INCLUDE_DIRS}>" + INTERFACE "$/include/static>" ) + target_compile_options(${HDF5_F90_LIB_TARGET} PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}") target_compile_definitions(${HDF5_F90_LIB_TARGET} PRIVATE $<$:HDF5F90_WINDOWS> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (${HDF5_F90_LIB_TARGET} - PUBLIC - ${HDF5_F90_C_LIB_TARGET} + PUBLIC ${HDF5_F90_C_LIB_TARGET} PRIVATE ${LINK_Fortran_LIBS} $<$:${MPI_Fortran_LIBRARIES}> ) -# set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) +# set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) +# set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) if(MSVC) set_property(TARGET ${HDF5_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() @@ -303,36 +313,24 @@ endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_LIBSH_TARGET} SHARED ${f90_F_SOURCES_SHARED}) target_include_directories (${HDF5_F90_LIBSH_TARGET} - PRIVATE - "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};$<$:${MPI_Fortran_INCLUDE_DIRS}>" - INTERFACE - "$/include/shared>" + PRIVATE "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};$<$:${MPI_Fortran_INCLUDE_DIRS}>" + INTERFACE "$/include/shared>" ) + target_compile_options(${HDF5_F90_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}") target_compile_definitions(${HDF5_F90_LIBSH_TARGET} - PUBLIC - "H5_BUILT_AS_DYNAMIC_LIB" + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" PRIVATE $<$:BUILD_HDF5_DLL;HDF5F90_WINDOWS> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (${HDF5_F90_LIBSH_TARGET} - PUBLIC - ${HDF5_F90_C_LIBSH_TARGET} - PRIVATE - ${LINK_Fortran_LIBS} $<$:${MPI_Fortran_LIBRARIES}> + PUBLIC ${HDF5_F90_C_LIBSH_TARGET} + PRIVATE ${LINK_Fortran_LIBS} $<$:${MPI_Fortran_LIBRARIES}> ) -# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) -# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:"-DLL"> -# ) -# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:"-DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def"> -# ) +# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) +# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) +# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-DLL">) +# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def">) if(MSVC) set_property(TARGET ${HDF5_F90_LIBSH_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS} /DLL /DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def") endif() diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 17d912f..1dcb4ec 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -13,8 +13,7 @@ target_include_directories (H5_test_buildiface ) #if (BUILD_SHARED_LIBS) # target_compile_definitions(H5_test_buildiface -# PRIVATE -# $<$:/MT> +# PRIVATE $<$:/MT> # ) #endif () if(MSVC) @@ -49,6 +48,7 @@ if (NOT BUILD_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) + target_compile_options(${HDF5_F90_C_TEST_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC) target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} PRIVATE ${HDF5_F90_C_LIB_TARGET} @@ -65,9 +65,8 @@ else () PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) - target_compile_definitions(${HDF5_F90_C_TEST_LIBSH_TARGET} - PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" - ) + target_compile_options(${HDF5_F90_C_TEST_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + target_compile_definitions(${HDF5_F90_C_TEST_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB") TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_F90_C_TEST_LIBSH_TARGET} PRIVATE ${HDF5_F90_C_LIBSH_TARGET} @@ -129,26 +128,18 @@ endif () if (NOT BUILD_SHARED_LIBS) add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC ${HDF5_F90_TF_SOURCES}) target_include_directories (${HDF5_F90_TEST_LIB_TARGET} - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" - INTERFACE - "$/include/static>" + PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + INTERFACE "$/include/static>" ) + target_compile_options(${HDF5_F90_TEST_LIB_TARGET} PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}") target_compile_definitions(${HDF5_F90_TEST_LIB_TARGET} PRIVATE $<$:HDF5F90_WINDOWS> $<$:${WIN_COMPILE_FLAGS}> ) - target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} - PUBLIC - ${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - ) -# set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) + target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} PUBLIC ${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}) +# set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) +# set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) if(MSVC) set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() @@ -162,31 +153,20 @@ if (NOT BUILD_SHARED_LIBS) else () add_library (${HDF5_F90_TEST_LIBSH_TARGET} SHARED ${HDF5_F90_TF_SOURCES_SHARED}) target_include_directories (${HDF5_F90_TEST_LIBSH_TARGET} - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" - INTERFACE - "$/include/shared>" + PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + INTERFACE "$/include/shared>" ) + target_compile_options(${HDF5_F90_TEST_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}") target_compile_definitions(${HDF5_F90_TEST_LIBSH_TARGET} - PUBLIC - "H5_BUILT_AS_DYNAMIC_LIB" + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" PRIVATE $<$:BUILD_HDF5_TEST_DLL;HDF5F90_WINDOWS> $<$:${WIN_COMPILE_FLAGS}> ) - target_link_libraries (${HDF5_F90_TEST_LIBSH_TARGET} - PUBLIC - ${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} - ) -# set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) -# set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:"-DLL"> -# ) + target_link_libraries (${HDF5_F90_TEST_LIBSH_TARGET} PUBLIC ${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +# set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) +# set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) +# set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-DLL">) if(MSVC) set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS} -DLL") endif() @@ -223,26 +203,17 @@ add_executable (testhdf5_fortran ) target_compile_options(testhdf5_fortran PRIVATE + "${HDF5_CMAKE_Fortran_FLAGS}" $<$:${WIN_COMPILE_FLAGS}> ) -#set_property(TARGET testhdf5_fortran APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -#) -#set_property(TARGET testhdf5_fortran APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -#) +#set_property(TARGET testhdf5_fortran APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) +#set_property(TARGET testhdf5_fortran APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) if(MSVC) set_property(TARGET testhdf5_fortran PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() if (NOT BUILD_SHARED_LIBS) - target_include_directories (testhdf5_fortran - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" - ) - target_link_libraries (testhdf5_fortran - PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> - ) + target_include_directories (testhdf5_fortran PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") + target_link_libraries (testhdf5_fortran PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib>) set_target_properties (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -250,14 +221,8 @@ if (NOT BUILD_SHARED_LIBS) ) add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET}) else () - target_include_directories (testhdf5_fortran - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" - ) - target_link_libraries (testhdf5_fortran - PRIVATE - ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> - ) + target_include_directories (testhdf5_fortran PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared") + target_link_libraries (testhdf5_fortran PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib>) set_target_properties (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -277,26 +242,17 @@ add_executable (testhdf5_fortran_1_8 ) target_compile_options(testhdf5_fortran_1_8 PRIVATE + "${HDF5_CMAKE_Fortran_FLAGS}" $<$:${WIN_COMPILE_FLAGS}> ) -#set_property(TARGET testhdf5_fortran_1_8 APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -#) -#set_property(TARGET testhdf5_fortran_1_8 APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -#) +#set_property(TARGET testhdf5_fortran_1_8 APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) +#set_property(TARGET testhdf5_fortran_1_8 APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) if(MSVC) set_property(TARGET testhdf5_fortran_1_8 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() if (NOT BUILD_SHARED_LIBS) - target_include_directories (testhdf5_fortran_1_8 - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" - ) - target_link_libraries (testhdf5_fortran_1_8 - PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> - ) + target_include_directories (testhdf5_fortran_1_8 PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") + target_link_libraries (testhdf5_fortran_1_8 PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib>) set_target_properties (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -304,14 +260,8 @@ if (NOT BUILD_SHARED_LIBS) ) add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET}) else () - target_include_directories (testhdf5_fortran_1_8 - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" - ) - target_link_libraries (testhdf5_fortran_1_8 - PRIVATE - ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> - ) + target_include_directories (testhdf5_fortran_1_8 PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared") + target_link_libraries (testhdf5_fortran_1_8 PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib>) set_target_properties (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -333,26 +283,17 @@ add_executable (fortranlib_test_F03 ) target_compile_options(fortranlib_test_F03 PRIVATE + "${HDF5_CMAKE_Fortran_FLAGS}" $<$:${WIN_COMPILE_FLAGS}> ) -#set_property(TARGET fortranlib_test_F03 APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -#) -#set_property(TARGET fortranlib_test_F03 APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -#) +#set_property(TARGET fortranlib_test_F03 APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) +#set_property(TARGET fortranlib_test_F03 APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) if(MSVC) set_property(TARGET fortranlib_test_F03 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() if (NOT BUILD_SHARED_LIBS) - target_include_directories (fortranlib_test_F03 - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" - ) - target_link_libraries (fortranlib_test_F03 - PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> - ) + target_include_directories (fortranlib_test_F03 PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") + target_link_libraries (fortranlib_test_F03 PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib>) set_target_properties (fortranlib_test_F03 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -360,14 +301,8 @@ if (NOT BUILD_SHARED_LIBS) ) add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET}) else () - target_include_directories (fortranlib_test_F03 - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" - ) - target_link_libraries (fortranlib_test_F03 - PRIVATE - ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> - ) + target_include_directories (fortranlib_test_F03 PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared") + target_link_libraries (fortranlib_test_F03 PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib>) set_target_properties (fortranlib_test_F03 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -380,26 +315,17 @@ endif () add_executable (fflush1 fflush1.F90) target_compile_options(fflush1 PRIVATE + "${HDF5_CMAKE_Fortran_FLAGS}" $<$:${WIN_COMPILE_FLAGS}> ) -#set_property(TARGET fflush1 APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -#) -#set_property(TARGET fflush1 APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -#) +#set_property(TARGET fflush1 APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) +#set_property(TARGET fflush1 APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) if(MSVC) set_property(TARGET fflush1 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() if (NOT BUILD_SHARED_LIBS) - target_include_directories (fflush1 - PRIVATE - ${CMAKE_Fortran_MODULE_DIRECTORY}/static - ) - target_link_libraries (fflush1 - PRIVATE - ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> - ) + target_include_directories (fflush1 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) + target_link_libraries (fflush1 PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib>) set_target_properties (fflush1 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -407,14 +333,8 @@ if (NOT BUILD_SHARED_LIBS) ) add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET}) else () - target_include_directories (fflush1 - PRIVATE - ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - ) - target_link_libraries (fflush1 - PRIVATE - ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> - ) + target_include_directories (fflush1 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) + target_link_libraries (fflush1 PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib>) set_target_properties (fflush1 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -427,26 +347,17 @@ endif () add_executable (fflush2 fflush2.F90) target_compile_options (fflush2 PRIVATE + "${HDF5_CMAKE_Fortran_FLAGS}" $<$:${WIN_COMPILE_FLAGS}> ) -#set_property(TARGET fflush2 APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -#) -#set_property(TARGET fflush2 APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -#) +#set_property(TARGET fflush2 APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) +#set_property(TARGET fflush2 APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) if(MSVC) set_property(TARGET fflush2 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() if (NOT BUILD_SHARED_LIBS) - target_include_directories (fflush2 - PRIVATE - ${CMAKE_Fortran_MODULE_DIRECTORY}/static - ) - target_link_libraries (fflush2 - PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> - ) + target_include_directories (fflush2 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) + target_link_libraries (fflush2 PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib>) set_target_properties (fflush2 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -454,14 +365,8 @@ if (NOT BUILD_SHARED_LIBS) ) add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET}) else () - target_include_directories (fflush2 - PRIVATE - ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - ) - target_link_libraries (fflush2 - PRIVATE - ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> - ) + target_include_directories (fflush2 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) + target_link_libraries (fflush2 PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib>) set_target_properties (fflush2 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index 5c80fd6..12489528 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -22,11 +22,11 @@ add_executable (parallel_test mdset.f90 ) target_include_directories (parallel_test - PRIVATE - ${TESTPAR_INCLUDES} + PRIVATE ${TESTPAR_INCLUDES} ) target_compile_options(parallel_test PRIVATE + "${HDF5_CMAKE_Fortran_FLAGS}" $<$:${WIN_COMPILE_FLAGS}> ) if (NOT BUILD_SHARED_LIBS) @@ -53,12 +53,8 @@ else () ) endif () -#set_property(TARGET parallel_test APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -#) -#set_property(TARGET parallel_test APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -#) +#set_property(TARGET parallel_test APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) +#set_property(TARGET parallel_test APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) if(MSVC) set_property(TARGET parallel_test PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index 01c8126..fbabc86 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -14,9 +14,7 @@ if (NOT ONLY_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) - target_compile_options(${HDF5_HL_CPP_LIB_TARGET} - PRIVATE "${HDF5_CMAKE_CXX_FLAGS}" - ) + target_compile_options(${HDF5_HL_CPP_LIB_TARGET} PRIVATE "${HDF5_CMAKE_CXX_FLAGS}") TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} STATIC) target_link_libraries (${HDF5_HL_CPP_LIB_TARGET} PUBLIC ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIB_TARGET}") @@ -31,12 +29,8 @@ if (BUILD_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) - target_compile_options(${HDF5_HL_CPP_LIBSH_TARGET} - PRIVATE "${HDF5_CMAKE_CXX_FLAGS}" - ) - target_compile_definitions(${HDF5_HL_CPP_LIBSH_TARGET} - PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" - ) + target_compile_options(${HDF5_HL_CPP_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_CXX_FLAGS}") + target_compile_definitions(${HDF5_HL_CPP_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB") TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_HL_CPP_LIBSH_TARGET} PUBLIC ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIBSH_TARGET}") diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt index 9bf32ef..5c224a8 100644 --- a/hl/c++/test/CMakeLists.txt +++ b/hl/c++/test/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required (VERSION 3.12) project (HDF5_HL_CPP_TEST CXX) add_executable (hl_ptableTest ${HDF5_HL_CPP_TEST_SOURCE_DIR}/ptableTest.cpp) +target_compile_options(hl_ptableTest PRIVATE "${HDF5_CMAKE_CXX_FLAGS}") target_include_directories (hl_ptableTest PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (hl_ptableTest STATIC) diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index 265d8db..e6411c1 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -12,38 +12,22 @@ foreach (example ${examples}) PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) -# set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) +# set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) +# set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) if(MSVC) set_property(TARGET hl_f90_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() if (NOT BUILD_SHARED_LIBS) - target_include_directories (hl_f90_ex_${example} - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" - ) - target_link_libraries (hl_f90_ex_${example} - PRIVATE - ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - ) + target_include_directories (hl_f90_ex_${example} PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") + target_link_libraries (hl_f90_ex_${example} PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) else () - target_include_directories (hl_f90_ex_${example} - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" - ) - target_link_libraries (hl_f90_ex_${example} - PRIVATE - ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} - ) + target_include_directories (hl_f90_ex_${example} PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") + target_link_libraries (hl_f90_ex_${example} PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/hl/fortran diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index d4979ba..71b9380 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -62,6 +62,7 @@ if (NOT ONLY_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) + target_compile_options(${HDF5_HL_F90_C_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} STATIC) target_link_libraries (${HDF5_HL_F90_C_LIB_TARGET} PUBLIC ${HDF5_F90_C_LIB_TARGET} ${HDF5_HL_LIB_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIB_TARGET}") @@ -78,9 +79,8 @@ if (BUILD_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) - target_compile_definitions(${HDF5_LIBSH_TARGET} - PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" - ) + target_compile_options(${HDF5_HL_F90_C_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + target_compile_definitions(${HDF5_HL_F90_C_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB") TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_HL_F90_C_LIBSH_TARGET} PUBLIC ${HDF5_F90_C_LIBSH_TARGET} ${HDF5_HL_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIBSH_TARGET}") @@ -161,27 +161,17 @@ endif () if (NOT ONLY_SHARED_LIBS) add_library (${HDF5_HL_F90_LIB_TARGET} STATIC ${HDF5_HL_F90_F_SOURCES}) target_include_directories (${HDF5_HL_F90_LIB_TARGET} - PRIVATE - "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;$<$:${MPI_Fortran_INCLUDE_DIRS}>" - INTERFACE - "$/include/static>" + PRIVATE "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;$<$:${MPI_Fortran_INCLUDE_DIRS}>" + INTERFACE "$/include/static>" ) + target_compile_options(${HDF5_HL_F90_LIB_TARGET} PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}") target_compile_definitions(${HDF5_HL_F90_LIB_TARGET} - PUBLIC - $<$:HDF5F90_WINDOWS> - PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + PUBLIC $<$:HDF5F90_WINDOWS> + PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) - target_link_libraries (${HDF5_HL_F90_LIB_TARGET} - PUBLIC - ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET} - ) -# set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) + target_link_libraries (${HDF5_HL_F90_LIB_TARGET} PUBLIC ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) +# set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) +# set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) if(MSVC) set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() @@ -198,36 +188,24 @@ endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_F90_LIBSH_TARGET} SHARED ${HDF5_HL_F90_F_SOURCES_SHARED}) target_include_directories (${HDF5_HL_F90_LIBSH_TARGET} - PRIVATE - "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/shared;$<$:${MPI_Fortran_INCLUDE_DIRS}>" - INTERFACE - "$/include/shared>" + PRIVATE "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/shared;$<$:${MPI_Fortran_INCLUDE_DIRS}>" + INTERFACE "$/include/shared>" ) + target_compile_options(${HDF5_HL_F90_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}") target_compile_definitions(${HDF5_HL_F90_LIBSH_TARGET} - PUBLIC - "H5_BUILT_AS_DYNAMIC_LIB" + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" PRIVATE $<$:BUILD_HDF5_HL_DLL;HDF5F90_WINDOWS> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (${HDF5_HL_F90_LIBSH_TARGET} - PUBLIC - ${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} - PRIVATE - ${LINK_Fortran_LIBS} + PUBLIC ${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} + PRIVATE ${LINK_Fortran_LIBS} ) -# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) -# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:"-DLL"> -# ) -# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:"-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def"> -# ) +# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) +# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) +# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-DLL">) +# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$:"-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def">) if(MSVC) set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS} -DLL -DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def") endif() diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 269cefb..e2872ac 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -15,40 +15,25 @@ macro (ADD_H5_FORTRAN_EXE file) add_executable (hl_f90_${file} ${file}.F90) target_compile_options(hl_f90_${file} PRIVATE + "${HDF5_CMAKE_Fortran_FLAGS}" $<$:${WIN_COMPILE_FLAGS}> ) -# set_property(TARGET hl_f90_${file} APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET hl_f90_${file} APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) +# set_property(TARGET hl_f90_${file} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE">) +# set_property(TARGET hl_f90_${file} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}>) if(MSVC) set_property(TARGET hl_f90_${file} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() if (NOT BUILD_SHARED_LIBS) - target_include_directories (hl_f90_${file} - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" - ) - target_link_libraries (hl_f90_${file} - PRIVATE - ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} - ) + target_include_directories (hl_f90_${file} PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") + target_link_libraries (hl_f90_${file} PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET}) set_target_properties (hl_f90_${file} PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) else () - target_include_directories (hl_f90_${file} - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" - ) - target_link_libraries (hl_f90_${file} - PRIVATE - ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} - ) + target_include_directories (hl_f90_${file} PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") + target_link_libraries (hl_f90_${file} PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET}) set_target_properties (hl_f90_${file} PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 7975a1a..c4ddf19 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -38,9 +38,7 @@ if (NOT ONLY_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) - target_compile_options(${HDF5_HL_LIB_TARGET} - PRIVATE "${HDF5_CMAKE_C_FLAGS}" - ) + target_compile_options(${HDF5_HL_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC) target_link_libraries (${HDF5_HL_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} STATIC 0) @@ -55,12 +53,8 @@ if (BUILD_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) - target_compile_options(${HDF5_HL_LIBSH_TARGET} - PRIVATE "${HDF5_CMAKE_C_FLAGS}" - ) - target_compile_definitions(${HDF5_HL_LIBSH_TARGET} - PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" - ) + target_compile_options(${HDF5_HL_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + target_compile_definitions(${HDF5_HL_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB") TARGET_C_PROPERTIES (${HDF5_HL_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_HL_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_HL_LIBSH_TARGET} ${HDF5_HL_LIB_NAME} SHARED "HL") diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index 43fc312..6349bb3 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -19,6 +19,7 @@ configure_file (${HDF5_HL_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ON # -------------------------------------------------------------------- macro (HL_ADD_EXE hl_name) add_executable (hl_${hl_name} ${hl_name}.c) + target_compile_options(hl_${hl_name} PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (hl_${hl_name} STATIC) @@ -49,6 +50,7 @@ HL_ADD_EXE (test_h5do_compat) # test_packet has two source files add_executable (hl_test_packet test_packet.c test_packet_vlen.c) +target_compile_options(hl_test_packet PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (hl_test_packet PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (hl_test_packet STATIC) @@ -73,6 +75,7 @@ set_target_properties (hl_test_packet PROPERTIES FOLDER test/hl) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (hl_gen_test_ds gen_test_ds.c) + target_compile_options(hl_gen_test_ds PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (hl_gen_test_ds PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (hl_gen_test_ds STATIC) target_link_libraries (hl_gen_test_ds PRIVATE @@ -83,6 +86,7 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) set_target_properties (hl_gen_test_ds PROPERTIES FOLDER test/hl/gen) add_executable (hl_gen_test_ld gen_test_ld.c) + target_compile_options(hl_gen_test_ld PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (hl_gen_test_ld PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (hl_gen_test_ld STATIC) target_link_libraries (hl_gen_test_ld PRIVATE diff --git a/hl/tools/gif2h5/CMakeLists.txt b/hl/tools/gif2h5/CMakeLists.txt index cc2ba68..0b895a3 100644 --- a/hl/tools/gif2h5/CMakeLists.txt +++ b/hl/tools/gif2h5/CMakeLists.txt @@ -16,6 +16,7 @@ set (GIF2H5_SOURCES #-- Add gif2hdf5 program if (NOT ONLY_SHARED_LIBS) add_executable (gif2h5 ${GIF2H5_SOURCES}) + target_compile_options(gif2h5 PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (gif2h5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (gif2h5 STATIC) target_link_libraries (gif2h5 PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) @@ -28,6 +29,7 @@ endif () if (BUILD_SHARED_LIBS) add_executable (gif2h5-shared ${GIF2H5_SOURCES}) + target_compile_options(gif2h5-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (gif2h5-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (gif2h5-shared SHARED) target_link_libraries (gif2h5-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET}) @@ -45,6 +47,7 @@ set (hdf2gif_SOURCES ) if (NOT ONLY_SHARED_LIBS) add_executable (h52gif ${hdf2gif_SOURCES}) + target_compile_options(h52gif PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (h52gif PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h52gif STATIC) target_link_libraries (h52gif PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) @@ -57,6 +60,7 @@ endif () if (BUILD_SHARED_LIBS) add_executable (h52gif-shared ${hdf2gif_SOURCES}) + target_compile_options(h52gif-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (h52gif-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h52gif-shared SHARED) target_link_libraries (h52gif-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} PRIVATE ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET}) diff --git a/hl/tools/h5watch/CMakeLists.txt b/hl/tools/h5watch/CMakeLists.txt index 9329c97..c5ad976 100644 --- a/hl/tools/h5watch/CMakeLists.txt +++ b/hl/tools/h5watch/CMakeLists.txt @@ -11,6 +11,7 @@ set (H5WATCH_SOURCES #-- Add h5watch program if (NOT ONLY_SHARED_LIBS) add_executable (h5watch ${H5WATCH_SOURCES}) + target_compile_options(h5watch PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (h5watch PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5watch STATIC) target_link_libraries (h5watch PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) @@ -19,6 +20,7 @@ if (NOT ONLY_SHARED_LIBS) endif () if (BUILD_SHARED_LIBS) add_executable (h5watch-shared ${H5WATCH_SOURCES}) + target_compile_options(h5watch-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (h5watch-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5watch-shared SHARED) target_link_libraries (h5watch-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET}) @@ -32,6 +34,7 @@ if (BUILD_TESTING AND HDF5_TEST_SWMR AND HDF5_TEST_SERIAL) ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/swmr_check_compat_vfd.c ) add_executable (hl_swmr_check_compat_vfd ${hl_swmr_check_compat_vfd_SOURCES}) + target_compile_options(hl_swmr_check_compat_vfd PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (hl_swmr_check_compat_vfd PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT ONLY_SHARED_LIBS) TARGET_C_PROPERTIES (hl_swmr_check_compat_vfd STATIC) @@ -47,6 +50,7 @@ if (BUILD_TESTING AND HDF5_TEST_SWMR AND HDF5_TEST_SERIAL) ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/extend_dset.c ) add_executable (extend_dset ${extend_dset_SOURCES}) + target_compile_options(extend_dset PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (extend_dset PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT ONLY_SHARED_LIBS) TARGET_C_PROPERTIES (extend_dset STATIC) @@ -58,6 +62,7 @@ if (BUILD_TESTING AND HDF5_TEST_SWMR AND HDF5_TEST_SERIAL) set_target_properties (extend_dset PROPERTIES FOLDER tools/hl) add_executable (h5watchgentest ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/h5watchgentest.c) + target_compile_options(h5watchgentest PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (h5watchgentest PRIVATE "${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT ONLY_SHARED_LIBS) TARGET_C_PROPERTIES (h5watchgentest STATIC) diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt index 9440eef..a5b2d96 100644 --- a/java/src/jni/CMakeLists.txt +++ b/java/src/jni/CMakeLists.txt @@ -77,9 +77,7 @@ add_library (${HDF5_JAVA_JNI_LIB_TARGET} SHARED ${HDF5_JAVA_JNI_CSRCS} ${HDF5_JA target_include_directories (${HDF5_JAVA_JNI_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_JAVA_JNI_SOURCE_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" ) -target_compile_options(${HDF5_JAVA_JNI_LIB_TARGET} - PRIVATE "${HDF5_CMAKE_C_FLAGS}" -) +target_compile_options(${HDF5_JAVA_JNI_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED) target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) set_target_properties (${HDF5_JAVA_JNI_LIB_TARGET} PROPERTIES FOLDER libraries/jni) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 7d00304..492f08d 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -56,11 +56,13 @@ New Features - Both build systems use same set of warnings flags - GNU C warnings flags were moved to files in a config sub-folder - named gnu-warnings. Flags that only are available for a specific + GNU C, C++ and gfortran warnings flags were moved to files in a config + sub-folder named gnu-warnings. Flags that only are available for a specific version of the compiler are in files named with that version. Clang C warnings flags were moved to files in a config sub-folder named clang-warnings. + Intel C, Fortran warnings flags were moved to files in a config sub-folder + named intel-warnings. There are flags in named "error-xxx" files with warnings that may be promoted to errors. Some source files may still need fixes. @@ -69,7 +71,7 @@ New Features that are chosen by the CMake option:HDF5_ENABLE_DEV_WARNINGS or the configure option:--enable-developer-warnings. - In addition, CMake no longer applies these warnings for tests and examples. + In addition, CMake no longer applies these warnings for examples. (ADB - 2020/03/24, TRILAB-192) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 664eb2d..3ed9f99 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1075,9 +1075,7 @@ if (NOT ONLY_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) - target_compile_options(${HDF5_LIB_TARGET} - PRIVATE "${HDF5_CMAKE_C_FLAGS}" - ) + target_compile_options(${HDF5_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_compile_definitions(${HDF5_LIB_TARGET} PUBLIC ${HDF_EXTRA_C_FLAGS} @@ -1114,9 +1112,7 @@ if (BUILD_SHARED_LIBS) PUBLIC "$<$:${HDFS_INCLUDE_DIR}>" INTERFACE "$/include>" ) - target_compile_options(${HDF5_LIBSH_TARGET} - PRIVATE "${HDF5_CMAKE_C_FLAGS}" - ) + target_compile_options(${HDF5_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_compile_definitions(${HDF5_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0e5e904..323656f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -32,6 +32,7 @@ if (NOT ONLY_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) + target_compile_options(${HDF5_TEST_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC) target_link_libraries (${HDF5_TEST_LIB_TARGET} PUBLIC ${LINK_LIBS} ${HDF5_LIB_TARGET} @@ -50,9 +51,8 @@ if (BUILD_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) - target_compile_definitions(${HDF5_TEST_LIBSH_TARGET} - PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" - ) + target_compile_options(${HDF5_TEST_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + target_compile_definitions(${HDF5_TEST_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB") TARGET_C_PROPERTIES (${HDF5_TEST_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PUBLIC ${LINK_LIBS} ${HDF5_LIBSH_TARGET} @@ -253,6 +253,7 @@ set (H5_TESTS macro (ADD_H5_EXE file) add_executable (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c) target_include_directories (${file} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(${file} PRIVATE "${HDF5_CMAKE_C_FLAGS}") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${file} STATIC) target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIB_TARGET}) @@ -282,6 +283,7 @@ endforeach () ######### Also special handling of link libs ############# #-- Adding test for direct_chunk add_executable (direct_chunk ${HDF5_TEST_SOURCE_DIR}/direct_chunk.c) +target_compile_options(direct_chunk PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (direct_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (direct_chunk STATIC) @@ -296,6 +298,7 @@ set_target_properties (direct_chunk PROPERTIES FOLDER test) ######### Special handling for multiple sources ############# #-- Adding test for testhdf5 add_executable (testhdf5 ${testhdf5_SOURCES}) +target_compile_options(testhdf5 PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (testhdf5 STATIC) @@ -308,6 +311,7 @@ set_target_properties (testhdf5 PROPERTIES FOLDER test) #-- Adding test for cache_image add_executable (cache_image ${cache_image_SOURCES}) +target_compile_options(cache_image PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (cache_image PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (cache_image STATIC) @@ -320,6 +324,7 @@ set_target_properties (cache_image PROPERTIES FOLDER test) #-- Adding test for ttsafe add_executable (ttsafe ${ttsafe_SOURCES}) +target_compile_options(ttsafe PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (ttsafe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (ttsafe STATIC) @@ -403,6 +408,7 @@ endforeach () # This has to be copied to the test directory for execve() to find it # and it can't be renamed (i.e., no -shared). add_executable (accum_swmr_reader ${HDF5_TEST_SOURCE_DIR}/accum_swmr_reader.c) +target_compile_options(accum_swmr_reader PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (accum_swmr_reader PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (accum_swmr_reader STATIC) @@ -432,6 +438,7 @@ endif () ############################################################################## set (use_append_chunk_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_chunk.c ${HDF5_TEST_SOURCE_DIR}/use_common.c) add_executable (use_append_chunk ${use_append_chunk_SOURCES}) +target_compile_options(use_append_chunk PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (use_append_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (use_append_chunk STATIC) @@ -444,6 +451,7 @@ set_target_properties (use_append_chunk PROPERTIES FOLDER test) set (use_append_mchunks_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_mchunks.c ${HDF5_TEST_SOURCE_DIR}/use_common.c) add_executable (use_append_mchunks ${use_append_mchunks_SOURCES}) +target_compile_options(use_append_mchunks PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (use_append_mchunks PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (use_append_mchunks STATIC) @@ -456,6 +464,7 @@ set_target_properties (use_append_mchunks PROPERTIES FOLDER test) set (use_disable_mdc_flushes_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_disable_mdc_flushes.c) add_executable (use_disable_mdc_flushes ${use_disable_mdc_flushes_SOURCES}) +target_compile_options(use_disable_mdc_flushes PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (use_disable_mdc_flushes PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (use_disable_mdc_flushes STATIC) diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index ee3b6fd..dba9e68 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -22,6 +22,7 @@ set (testphdf5_SOURCES #-- Adding test for testhdf5 add_executable (testphdf5 ${testphdf5_SOURCES}) +target_compile_options(testphdf5 PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (testphdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" ) @@ -40,6 +41,7 @@ set_target_properties (testphdf5 PROPERTIES FOLDER test/par) MACRO (ADD_H5P_EXE file) add_executable (${file} ${HDF5_TEST_PAR_SOURCE_DIR}/${file}.c) + target_compile_options(${file} PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (${file} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" ) diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index 306c033..ff9ca43 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -38,9 +38,7 @@ if (NOT ONLY_SHARED_LIBS) PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) - target_compile_options(${HDF5_TOOLS_LIB_TARGET} - PRIVATE "${HDF5_CMAKE_C_FLAGS}" - ) + target_compile_options(${HDF5_TOOLS_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") #target_compile_definitions(${HDF5_TOOLS_LIB_TARGET} PRIVATE H5_TOOLS_DEBUG) #target_compile_definitions(${HDF5_TOOLS_LIB_TARGET} PRIVATE H5DIFF_DEBUG) TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} STATIC) @@ -60,9 +58,7 @@ if (BUILD_SHARED_LIBS) PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) - target_compile_options(${HDF5_TOOLS_LIBSH_TARGET} - PRIVATE "${HDF5_CMAKE_C_FLAGS}" - ) + target_compile_options(${HDF5_TOOLS_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_compile_definitions(${HDF5_TOOLS_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" #PRIVATE H5_TOOLS_DEBUG diff --git a/tools/libtest/CMakeLists.txt b/tools/libtest/CMakeLists.txt index 7246e66..3e0f671 100644 --- a/tools/libtest/CMakeLists.txt +++ b/tools/libtest/CMakeLists.txt @@ -5,6 +5,7 @@ project (HDF5_TOOLS_LIBTEST C) # Add the h5tools_utils test executables #----------------------------------------------------------------------------- add_executable (h5tools_test_utils ${HDF5_TOOLS_LIBTEST_SOURCE_DIR}/h5tools_test_utils.c) +target_compile_options(h5tools_test_utils PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories(h5tools_test_utils PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT ONLY_SHARED_LIBS) TARGET_C_PROPERTIES (h5tools_test_utils STATIC) diff --git a/tools/src/h5diff/CMakeLists.txt b/tools/src/h5diff/CMakeLists.txt index eec7246..4087ab4 100644 --- a/tools/src/h5diff/CMakeLists.txt +++ b/tools/src/h5diff/CMakeLists.txt @@ -42,6 +42,7 @@ if (H5_HAVE_PARALLEL) ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c ) target_include_directories (ph5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(ph5diff PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (ph5diff STATIC) target_link_libraries (ph5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:${MPI_C_LIBRARIES}>") set_target_properties (ph5diff PROPERTIES FOLDER tools) @@ -54,6 +55,7 @@ if (H5_HAVE_PARALLEL) ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c ) target_include_directories (ph5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(ph5diff-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (ph5diff-shared SHARED) target_link_libraries (ph5diff-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$:${MPI_C_LIBRARIES}>") set_target_properties (ph5diff-shared PROPERTIES FOLDER tools) -- cgit v0.12