mirror of
https://github.com/HDFGroup/hdf5.git
synced 2026-09-25 04:09:44 +03:00
Split out compiler flags into specific compiler files (#4974)
* Split CMake HDFCompileFlags into specific compiler files * Separate out CXX Flags * Add Fortran compiler specific files * Merge in #4816 changes and close #4816 * fix hanging endif --------- Co-authored-by: Larry Knox <lrknox@hdfgroup.org>
This commit is contained in:
co-authored by
Larry Knox
parent
0439876eeb
commit
6122828198
@@ -106,7 +106,7 @@ jobs:
|
||||
- name: Run ctest (Linux_coverage)
|
||||
run: |
|
||||
cd "${{ runner.workspace }}/hdf5"
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH_COV,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Debug -VV -O hdf5.log
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=${{ github.event.repository.full_name }}_COV,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Debug -VV -O hdf5.log
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
|
||||
@@ -206,7 +206,7 @@ jobs:
|
||||
- name: Run ctest (Linux_Leak)
|
||||
run: |
|
||||
cd "${{ runner.workspace }}/hdf5"
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH-LEAK,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Debug -VV -O hdf5.log
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=${{ github.event.repository.full_name }}-LEAK,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Debug -VV -O hdf5.log
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
|
||||
@@ -306,7 +306,7 @@ jobs:
|
||||
- name: Run ctest (Linux_Address)
|
||||
run: |
|
||||
cd "${{ runner.workspace }}/hdf5"
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH-ADDR,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Debug -VV -O hdf5.log
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=${{ github.event.repository.full_name }}-ADDR,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Debug -VV -O hdf5.log
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
|
||||
@@ -406,7 +406,7 @@ jobs:
|
||||
- name: Run ctest (Linux_UndefinedBehavior)
|
||||
run: |
|
||||
cd "${{ runner.workspace }}/hdf5"
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH-UNDEF,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Debug -VV -O hdf5.log
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=${{ github.event.repository.full_name }}-UNDEF,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Debug -VV -O hdf5.log
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ jobs:
|
||||
- name: Run ctest script (Windows)
|
||||
run: |
|
||||
cd "${{ runner.workspace }}/hdf5"
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=VS202264,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf5.log
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=${{ github.event.repository.full_name }},LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=VS202264,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf5.log
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
|
||||
@@ -200,7 +200,7 @@ jobs:
|
||||
- name: Run ctest (Linux)
|
||||
run: |
|
||||
cd "${{ runner.workspace }}/hdf5"
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH-GCC,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf5.log
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=${{ github.event.repository.full_name }}-GCC,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf5.log
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
|
||||
@@ -302,7 +302,7 @@ jobs:
|
||||
id: run-ctest
|
||||
run: |
|
||||
cd "${{ runner.workspace }}/hdf5"
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH-Clang,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf5.log
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=${{ github.event.repository.full_name }}-Clang,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf5.log
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
|
||||
@@ -387,7 +387,7 @@ jobs:
|
||||
- name: Run ctest (Linux S3)
|
||||
run: |
|
||||
cd "${{ runner.workspace }}/hdf5"
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH-S3,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf5.log
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=${{ github.event.repository.full_name }}-S3,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf5.log
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
|
||||
@@ -493,7 +493,7 @@ jobs:
|
||||
CXX: ${{ steps.setup-fortran.outputs.cc }}
|
||||
run: |
|
||||
cd "${{ runner.workspace }}/hdf5"
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH-Intel,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=VS202264,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf5.log
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=${{ github.event.repository.full_name }}-Intel,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=VS202264,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf5.log
|
||||
shell: pwsh
|
||||
continue-on-error: true
|
||||
|
||||
@@ -588,7 +588,7 @@ jobs:
|
||||
CXX: ${{ steps.setup-fortran.outputs.cxx }}
|
||||
run: |
|
||||
cd "${{ runner.workspace }}/hdf5"
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH-Intel,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf5.log
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=${{ github.event.repository.full_name }}-Intel,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf5.log
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
|
||||
@@ -682,7 +682,7 @@ jobs:
|
||||
- name: Run ctest (Linux_clang)
|
||||
run: |
|
||||
cd "${{ runner.workspace }}/hdf5"
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH-Clang,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf5.log
|
||||
ctest -S HDF5config.cmake,CTEST_SITE_EXT=${{ github.event.repository.full_name }}-Clang,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf5.log
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
|
||||
|
||||
+2
-2
@@ -1133,7 +1133,7 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for
|
||||
option (HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF)
|
||||
if (HDF5_BUILD_FORTRAN)
|
||||
message (VERBOSE "Fortran compiler ID is ${CMAKE_Fortran_COMPILER_ID}")
|
||||
include (${HDF_RESOURCES_DIR}/HDFFortranCompilerFlags.cmake)
|
||||
include (${HDF_RESOURCES_DIR}/HDFCompilerFortranFlags.cmake)
|
||||
include (${HDF_RESOURCES_DIR}/HDF5UseFortran.cmake)
|
||||
set (LINK_Fortran_LIBS ${LINK_LIBS})
|
||||
|
||||
@@ -1193,7 +1193,7 @@ if (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
include (${HDF_RESOURCES_DIR}/HDFCXXCompilerFlags.cmake)
|
||||
include (${HDF_RESOURCES_DIR}/HDFCompilerCXXFlags.cmake)
|
||||
|
||||
add_subdirectory (c++)
|
||||
if (HDF5_BUILD_HL_LIB)
|
||||
|
||||
@@ -1,362 +0,0 @@
|
||||
#
|
||||
# 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 LICENSE file, which can be found at the root of the source code
|
||||
# distribution tree, or in https://www.hdfgroup.org/licenses.
|
||||
# If you do not have access to either file, you may request a copy from
|
||||
# help@hdfgroup.org.
|
||||
#
|
||||
ENABLE_LANGUAGE (CXX)
|
||||
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
|
||||
set (CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_SANITIZER_FLAGS} ${CMAKE_CXX_FLAGS}")
|
||||
message (VERBOSE "Warnings Configuration: CXX default: ${CMAKE_CXX_FLAGS}")
|
||||
#-----------------------------------------------------------------------------
|
||||
# Compiler specific flags : Shouldn't there be compiler tests for these
|
||||
#-----------------------------------------------------------------------------
|
||||
if (WIN32 AND (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" OR CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM"))
|
||||
set (_INTEL_WINDOWS 1)
|
||||
endif ()
|
||||
|
||||
if (WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang" AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
|
||||
set (_CLANG_MSVC_WINDOWS 1)
|
||||
endif()
|
||||
|
||||
# MSVC 14.28 enables C5105, but the Windows SDK 10.0.18362.0 triggers it.
|
||||
if ((_CLANG_MSVC_WINDOWS OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") AND CMAKE_CXX_COMPILER_LOADED)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.28)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd5105")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro AND CMAKE_CXX_COMPILER_LOADED)
|
||||
if (NOT DEFINED CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION)
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
|
||||
if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD EQUAL 98)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03")
|
||||
endif ()
|
||||
else ()
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=stlport4")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC" AND CMAKE_CXX_COMPILER_LOADED)
|
||||
if (NOT DEFINED CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION)
|
||||
if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD EQUAL 11)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C11_STANDARD_COMPILE_OPTION}")
|
||||
endif ()
|
||||
endif ()
|
||||
if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Minform=warn")
|
||||
if (NOT ${HDF_CFG_NAME} MATCHES "RelWithDebInfo")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s")
|
||||
endif ()
|
||||
else ()
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Mbounds -gopt -g")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_LOADED)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}")
|
||||
if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer")
|
||||
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 ()
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
|
||||
if (HDF5_ENABLE_BUILD_DIAGS)
|
||||
message (STATUS "... default color and URL extended diagnostic messages enabled")
|
||||
else ()
|
||||
message (STATUS "... disable color and URL extended diagnostic messages")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-urls=never -fno-diagnostics-color")
|
||||
endif ()
|
||||
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_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_CXX_COMPILER_LOADED)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# HDF5 library compile options - to be made available to all targets
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
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")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/win-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/general")
|
||||
endif()
|
||||
if (NOT _INTEL_WINDOWS)
|
||||
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0)
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/15")
|
||||
endif()
|
||||
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0)
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/18")
|
||||
endif()
|
||||
endif()
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_LOADED
|
||||
AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
|
||||
# add the general CXX flags for g++ compiler versions 4.8 and above.
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-general")
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-general")
|
||||
endif ()
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/win-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/general")
|
||||
endif()
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang")
|
||||
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 (VERBOSE "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")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/win-developer-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/developer-general")
|
||||
endif()
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general")
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/win-developer-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/developer-general")
|
||||
endif()
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang")
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general")
|
||||
endif ()
|
||||
else ()
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general")
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang")
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
# Technically, variable-length arrays are part of the C99 standard, but
|
||||
# we should approach them a bit cautiously... Only needed for gcc 4.X
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 4.8+ knows about
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-4.8")
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-developer-4.8")
|
||||
else ()
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-cxx-developer-4.8")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 4.9+ knows about
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-4.9")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 5.1+ knows about
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
|
||||
# autotools always add the C flags with the CXX flags
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-5")
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-5")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 6.x+ knows about
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/6")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 7.x+ knows about
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXxFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/7")
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7")
|
||||
#else ()
|
||||
# ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 8.x+ knows about
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/8")
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8")
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8")
|
||||
else ()
|
||||
# autotools always add the C flags with the CXX flags
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 9.x+ knows about
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-9")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 9.3+ knows about
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.3)
|
||||
# do not use C warnings, gnu-warnings 9.3, no cxx warnings
|
||||
# ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9.3")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 10.x+ knows about
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-10")
|
||||
#else ()
|
||||
# ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-10")
|
||||
endif ()
|
||||
endif ()
|
||||
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_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_CXX_COMPILER_LOADED)
|
||||
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3" "/wd4100" "/wd4706" "/wd4127")
|
||||
endif ()
|
||||
endif ()
|
||||
else ()
|
||||
if (CMAKE_CXX_COMPILER_LOADED)
|
||||
list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS})
|
||||
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_CXX_COMPILER_ID STREQUAL "GNU" 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" AND NOT _INTEL_WINDOWS)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
|
||||
elseif (CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" AND NOT _INTEL_WINDOWS)
|
||||
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" AND NOT _INTEL_WINDOWS)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-s")
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM" AND NOT _INTEL_WINDOWS)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_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 ()
|
||||
@@ -0,0 +1,52 @@
|
||||
#
|
||||
# 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://www.hdfgroup.org/licenses.
|
||||
# If you do not have access to either file, you may request a copy from
|
||||
# help@hdfgroup.org.
|
||||
#
|
||||
|
||||
###############################################################################
|
||||
# This file included from HDFCompilerFlags.cmake with
|
||||
# if (CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang")
|
||||
###############################################################################
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Compiler specific flags
|
||||
#-----------------------------------------------------------------------------
|
||||
if (WIN32 AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
|
||||
set (_CLANG_MSVC_WINDOWS 1)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# HDF5 library compile options - to be made available to all targets
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
||||
# 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.
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general")
|
||||
message (VERBOSE "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 CXX developer group warnings are enabled")
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general")
|
||||
endif ()
|
||||
@@ -0,0 +1,73 @@
|
||||
#
|
||||
# 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://www.hdfgroup.org/licenses.
|
||||
# If you do not have access to either file, you may request a copy from
|
||||
# help@hdfgroup.org.
|
||||
#
|
||||
|
||||
###############################################################################
|
||||
# This file included from HDFCompilerFlags.cmake with
|
||||
# if (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang")
|
||||
###############################################################################
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Compiler specific flags
|
||||
#-----------------------------------------------------------------------------
|
||||
if (WIN32 AND "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
|
||||
set (_CLANG_MSVC_WINDOWS 1)
|
||||
if("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Xlinker -stack:20000000")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# Disable deprecation warnings for standard C functions.
|
||||
# really only needed for newer versions of VS, but should
|
||||
# not hurt other versions, and this will work into the
|
||||
# future
|
||||
if (MSVC OR _CLANG_MSVC_WINDOWS)
|
||||
add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# HDF5 library compile options - to be made available to all targets
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
||||
# 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.
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general")
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/error-general")
|
||||
message (VERBOSE "CMAKE_C_FLAGS_GENERAL=${HDF5_CMAKE_C_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")
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general")
|
||||
|
||||
# Turn on -Winline warnings now only for non-Debug and
|
||||
# non-Developer builds. For at least GNU compilers this
|
||||
# flag appears to conflict specifically with the -Og
|
||||
# optimization flag and will produce warnings about functions
|
||||
# not being considered for inlining
|
||||
if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer")
|
||||
list (APPEND H5_CFLAGS "-Winline")
|
||||
endif ()
|
||||
else ()
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general")
|
||||
endif ()
|
||||
@@ -0,0 +1,162 @@
|
||||
#
|
||||
# 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://www.hdfgroup.org/licenses.
|
||||
# If you do not have access to either file, you may request a copy from
|
||||
# help@hdfgroup.org.
|
||||
#
|
||||
ENABLE_LANGUAGE (CXX)
|
||||
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
|
||||
set (CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_SANITIZER_FLAGS} ${CMAKE_CXX_FLAGS}")
|
||||
message (VERBOSE "Warnings Configuration: CXX default: ${CMAKE_CXX_FLAGS}")
|
||||
#-----------------------------------------------------------------------------
|
||||
# Compiler specific flags
|
||||
#-----------------------------------------------------------------------------
|
||||
# MSVC 14.28 enables C5105, but the Windows SDK 10.0.18362.0 triggers it.
|
||||
if ((_CLANG_MSVC_WINDOWS OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") AND CMAKE_CXX_COMPILER_LOADED)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.28)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd5105")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro AND CMAKE_CXX_COMPILER_LOADED)
|
||||
if (NOT DEFINED CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION)
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
|
||||
if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD EQUAL 98)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03")
|
||||
endif ()
|
||||
else ()
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=stlport4")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to allow the user to disable compiler warnings
|
||||
#-----------------------------------------------------------------------------
|
||||
if (CMAKE_CXX_COMPILER_LOADED)
|
||||
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)
|
||||
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0")
|
||||
endif ()
|
||||
if (WIN32)
|
||||
add_definitions (-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif ()
|
||||
|
||||
# Most compilers use -w to suppress warnings.
|
||||
if (NOT HDF5_WARNINGS_BLOCKED)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "NVHPC" )
|
||||
include (${HDF_RESOURCES_DIR}/HDFNvhpcCXXFlags.cmake)
|
||||
endif ()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
include (${HDF_RESOURCES_DIR}/HDFGnuCXXFlags.cmake)
|
||||
endif ()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
||||
include (${HDF_RESOURCES_DIR}/HDFIntelCXXFlags.cmake)
|
||||
endif ()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
include (${HDF_RESOURCES_DIR}/HDFMsvcCXXFlags.cmake)
|
||||
endif ()
|
||||
|
||||
#because this will match other compilers with clang in the name this should be checked last
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang")
|
||||
include (${HDF_RESOURCES_DIR}/HDFClangCXXFlags.cmake)
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# HDF5 library compile options - to be made available to all targets
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
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 "PGI")
|
||||
list (APPEND HDF5_CMAKE_CXX_FLAGS "-Minform=inform")
|
||||
endif ()
|
||||
message (VERBOSE "CMAKE_CXX_FLAGS_GENERAL=${HDF5_CMAKE_CXX_FLAGS}")
|
||||
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)
|
||||
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
list (APPEND HDF5_CMAKE_CXX_FLAGS "/Wall" "/wd4668")
|
||||
else ()
|
||||
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3" "/wd4100" "/wd4706" "/wd4127")
|
||||
endif ()
|
||||
else ()
|
||||
list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS})
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option for --enable-profiling
|
||||
# This option will force/override the default setting for all configurations
|
||||
#-----------------------------------------------------------------------------
|
||||
if (HDF5_ENABLE_PROFILING)
|
||||
list (APPEND HDF5_CMAKE_CXX_FLAGS "${PROFILE_CXXFLAGS}")
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option for --enable-optimization
|
||||
# This option will force/override the default setting for all configurations
|
||||
#-----------------------------------------------------------------------------
|
||||
if (HDF5_ENABLE_OPTIMIZATION)
|
||||
list (APPEND HDF5_CMAKE_CXX_FLAGS "${OPTIMIZE_CXXFLAGS}")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# The build mode flags are not added to CMAKE_CXX_FLAGS, so create a separate
|
||||
# variable for them so they can be written out to libhdf5.settings and
|
||||
# H5build_settings.c
|
||||
#-----------------------------------------------------------------------------
|
||||
if ("${HDF_CFG_NAME}" STREQUAL "Debug")
|
||||
set (HDF5_BUILD_MODE_CXX_FLAGS "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
elseif ("${HDF_CFG_NAME}" STREQUAL "Developer")
|
||||
set (HDF5_BUILD_MODE_CXX_FLAGS "${CMAKE_CXX_FLAGS_DEVELOPER}")
|
||||
elseif ("${HDF_CFG_NAME}" STREQUAL "Release")
|
||||
set (HDF5_BUILD_MODE_CXX_FLAGS "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
elseif ("${HDF_CFG_NAME}" STREQUAL "MinSizeRel")
|
||||
set (HDF5_BUILD_MODE_CXX_FLAGS "${CMAKE_CXX_FLAGS_MINSIZEREL}")
|
||||
elseif ("${HDF_CFG_NAME}" STREQUAL "RelWithDebInfo")
|
||||
set (HDF5_BUILD_MODE_CXX_FLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
else ()
|
||||
set (HDF5_BUILD_MODE_CXX_FLAGS "")
|
||||
endif ()
|
||||
@@ -16,77 +16,17 @@ set (CMAKE_C_FLAGS "${CMAKE_C11_STANDARD_COMPILE_OPTION} ${CMAKE_C_FLAGS}")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_SANITIZER_FLAGS} ${CMAKE_C_FLAGS}")
|
||||
message (VERBOSE "Warnings Configuration: C default: ${CMAKE_C_FLAGS}")
|
||||
#-----------------------------------------------------------------------------
|
||||
# Compiler specific flags : Shouldn't there be compiler tests for these
|
||||
# Compiler specific flags
|
||||
#-----------------------------------------------------------------------------
|
||||
if (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "Intel" OR CMAKE_C_COMPILER_ID MATCHES "IntelLLVM"))
|
||||
set (_INTEL_WINDOWS 1)
|
||||
endif ()
|
||||
|
||||
if (WIN32 AND CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" AND "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
|
||||
set (_CLANG_MSVC_WINDOWS 1)
|
||||
endif ()
|
||||
|
||||
# Disable deprecation warnings for standard C functions.
|
||||
# really only needed for newer versions of VS, but should
|
||||
# not hurt other versions, and this will work into the
|
||||
# future
|
||||
if (MSVC OR _INTEL_WINDOWS OR _CLANG_MSVC_WINDOWS)
|
||||
add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
endif ()
|
||||
|
||||
if (MSVC)
|
||||
add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stack:10000000")
|
||||
endif ()
|
||||
|
||||
# MSVC 14.28 enables C5105, but the Windows SDK 10.0.18362.0 triggers it.
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 19.28)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -wd5105")
|
||||
endif ()
|
||||
|
||||
if(_CLANG_MSVC_WINDOWS AND "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Xlinker -stack:20000000")
|
||||
endif()
|
||||
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "NVHPC" )
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Minform=warn")
|
||||
if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer")
|
||||
if (NOT ${HDF_CFG_NAME} MATCHES "RelWithDebInfo")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s")
|
||||
endif ()
|
||||
else ()
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Mbounds -gopt")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}")
|
||||
if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer")
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ftrapv -fno-common")
|
||||
endif ()
|
||||
else ()
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0 AND
|
||||
NOT CMAKE_C_CLANG_TIDY)
|
||||
# `clang-tidy` does not understand -fstdarg-opt
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstdarg-opt")
|
||||
endif ()
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 10.0)
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to allow the user to enable build extended diagnostics
|
||||
#
|
||||
# This should NOT be on by default as it can cause process issues.
|
||||
#-----------------------------------------------------------------------------
|
||||
option (HDF5_ENABLE_BUILD_DIAGS "Enable color and URL extended diagnostic messages" OFF)
|
||||
mark_as_advanced (HDF5_ENABLE_BUILD_DIAGS)
|
||||
if (HDF5_ENABLE_BUILD_DIAGS)
|
||||
message (STATUS "... default color and URL extended diagnostic messages enabled")
|
||||
else ()
|
||||
message (STATUS "... disable color and URL extended diagnostic messages")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-urls=never -fno-diagnostics-color")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to allow the user to disable compiler warnings
|
||||
@@ -116,6 +56,27 @@ if (HDF5_DISABLE_COMPILER_WARNINGS)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (CMAKE_C_COMPILER_ID MATCHES "NVHPC" )
|
||||
include (${HDF_RESOURCES_DIR}/HDFNvhpcFlags.cmake)
|
||||
endif ()
|
||||
|
||||
if (CMAKE_C_COMPILER_ID MATCHES "GNU")
|
||||
include (${HDF_RESOURCES_DIR}/HDFGnuFlags.cmake)
|
||||
endif ()
|
||||
|
||||
if (CMAKE_C_COMPILER_ID MATCHES "Intel")
|
||||
include (${HDF_RESOURCES_DIR}/HDFIntelFlags.cmake)
|
||||
endif ()
|
||||
|
||||
if (CMAKE_C_COMPILER_ID MATCHES "MSVC")
|
||||
include (${HDF_RESOURCES_DIR}/HDFMsvcFlags.cmake)
|
||||
endif ()
|
||||
|
||||
#because this will match other compilers with clang in the name this should be checked last
|
||||
if (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang")
|
||||
include (${HDF_RESOURCES_DIR}/HDFClangFlags.cmake)
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# HDF5 library compile options - to be made available to all targets
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -144,43 +105,7 @@ else ()
|
||||
#
|
||||
# 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")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/win-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/general")
|
||||
endif()
|
||||
if (NOT _INTEL_WINDOWS)
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/15")
|
||||
endif ()
|
||||
# this is just a failsafe
|
||||
list (APPEND H5_CFLAGS "-finline-functions")
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/18")
|
||||
endif ()
|
||||
endif ()
|
||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
# Add general CFlags for GCC versions 4.8 and above
|
||||
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/general")
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general")
|
||||
endif ()
|
||||
# gcc automatically inlines based on the optimization level
|
||||
# this is just a failsafe
|
||||
list (APPEND H5_CFLAGS "-finline-functions")
|
||||
elseif (CMAKE_C_COMPILER_ID MATCHES "IntelLLVM")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/win-general")
|
||||
else ()
|
||||
# this is just a failsafe
|
||||
list (APPEND H5_CFLAGS "-finline-functions")
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/general")
|
||||
endif ()
|
||||
elseif (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang")
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general")
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/error-general")
|
||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "PGI")
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "PGI")
|
||||
list (APPEND HDF5_CMAKE_C_FLAGS "-Minform=inform")
|
||||
endif ()
|
||||
message (VERBOSE "CMAKE_C_FLAGS_GENERAL=${HDF5_CMAKE_C_FLAGS}")
|
||||
@@ -195,134 +120,6 @@ if (${HDF_CFG_NAME} MATCHES "Developer")
|
||||
# Developer build modes should always have these types of warnings enabled
|
||||
set (HDF5_ENABLE_DEV_WARNINGS ON CACHE BOOL "Enable HDF5 developer group warnings" FORCE)
|
||||
endif ()
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
message (STATUS "....HDF5 developer group warnings are enabled")
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/win-developer-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/developer-general")
|
||||
endif ()
|
||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general")
|
||||
elseif (CMAKE_C_COMPILER_ID MATCHES "IntelLLVM")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/win-developer-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/developer-general")
|
||||
endif ()
|
||||
elseif (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang")
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general")
|
||||
endif ()
|
||||
|
||||
# Turn on -Winline warnings now only for non-Debug and
|
||||
# non-Developer builds. For at least GNU compilers this
|
||||
# flag appears to conflict specifically with the -Og
|
||||
# optimization flag and will produce warnings about functions
|
||||
# not being considered for inlining
|
||||
if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer")
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
list (APPEND H5_CFLAGS "-Winline")
|
||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND NOT _INTEL_WINDOWS)
|
||||
list (APPEND H5_CFLAGS "-Winline")
|
||||
elseif (CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" AND NOT _INTEL_WINDOWS)
|
||||
list (APPEND H5_CFLAGS "-Winline")
|
||||
elseif (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang")
|
||||
list (APPEND H5_CFLAGS "-Winline")
|
||||
endif ()
|
||||
endif ()
|
||||
else ()
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general")
|
||||
elseif (CMAKE_C_COMPILER_ID MATCHES "[Cc]lang")
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
# Technically, variable-length arrays are part of the C99 standard, but
|
||||
# we should approach them a bit cautiously... Only needed for gcc 4.X
|
||||
if (CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 4.8+ knows about
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8")
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8")
|
||||
else ()
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 4.9+ knows about
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 5.x+ knows about
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/5")
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 6.x+ knows about
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/6")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 7.x+ knows about
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/7")
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-7")
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7")
|
||||
#else ()
|
||||
# ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 8.x+ knows about
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/8")
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8")
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8")
|
||||
else ()
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 9.x+ knows about
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 9.3+ knows about
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.3)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9.3")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 10.x+ knows about
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 10.0)
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-10")
|
||||
#else ()
|
||||
# ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-10")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 12.x+ knows about
|
||||
# or which should only be enabled for gcc 12.x+
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0)
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-12")
|
||||
#else ()
|
||||
# ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-12")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to allow the user to enable debug output
|
||||
@@ -363,14 +160,6 @@ if (HDF5_ENABLE_ALL_WARNINGS)
|
||||
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_C_COMPILER_ID STREQUAL "GNU")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0")
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option for --enable-asserts
|
||||
# By default, CMake adds NDEBUG to CMAKE_${lang}_FLAGS for Release build types
|
||||
@@ -393,19 +182,6 @@ MARK_AS_ADVANCED (HDF5_ENABLE_ASSERTS)
|
||||
#option (HDF5_ENABLE_SYMBOLS "Add debug symbols to the library independent of the build mode and optimization level." OFF)
|
||||
set (HDF5_ENABLE_SYMBOLS "OFF" CACHE STRING "Add debug symbols to the library independent of the build mode and optimization level (OFF NO YES)")
|
||||
set_property (CACHE HDF5_ENABLE_SYMBOLS PROPERTY STRINGS OFF NO YES)
|
||||
if (HDF5_ENABLE_SYMBOLS MATCHES "YES")
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND NOT _INTEL_WINDOWS)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
|
||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fno-omit-frame-pointer")
|
||||
endif ()
|
||||
elseif (HDF5_ENABLE_SYMBOLS MATCHES "NO")
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND NOT _INTEL_WINDOWS)
|
||||
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 ()
|
||||
endif ()
|
||||
MARK_AS_ADVANCED (HDF5_ENABLE_SYMBOLS)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -427,3 +203,23 @@ if (HDF5_ENABLE_OPTIMIZATION)
|
||||
list (APPEND HDF5_CMAKE_C_FLAGS "${OPTIMIZE_CFLAGS}")
|
||||
endif ()
|
||||
MARK_AS_ADVANCED (HDF5_ENABLE_OPTIMIZATION)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# The build mode flags are not added to CMAKE_C_FLAGS, so create a separate
|
||||
# variable for them so they can be written out to libhdf5.settings and
|
||||
# H5build_settings.c
|
||||
#-----------------------------------------------------------------------------
|
||||
if ("${HDF_CFG_NAME}" STREQUAL "Debug")
|
||||
set (HDF5_BUILD_MODE_C_FLAGS "${CMAKE_C_FLAGS_DEBUG}")
|
||||
elseif ("${HDF_CFG_NAME}" STREQUAL "Developer")
|
||||
set (HDF5_BUILD_MODE_C_FLAGS "${CMAKE_C_FLAGS_DEVELOPER}")
|
||||
elseif ("${HDF_CFG_NAME}" STREQUAL "Release")
|
||||
set (HDF5_BUILD_MODE_C_FLAGS "${CMAKE_C_FLAGS_RELEASE}")
|
||||
elseif ("${HDF_CFG_NAME}" STREQUAL "MinSizeRel")
|
||||
set (HDF5_BUILD_MODE_C_FLAGS "${CMAKE_C_FLAGS_MINSIZEREL}")
|
||||
elseif ("${HDF_CFG_NAME}" STREQUAL "RelWithDebInfo")
|
||||
set (HDF5_BUILD_MODE_C_FLAGS "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
else ()
|
||||
set (HDF5_BUILD_MODE_C_FLAGS "")
|
||||
endif ()
|
||||
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
#
|
||||
# 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://www.hdfgroup.org/licenses.
|
||||
# If you do not have access to either file, you may request a copy from
|
||||
# help@hdfgroup.org.
|
||||
#
|
||||
|
||||
message (VERBOSE "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)
|
||||
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 ()
|
||||
|
||||
if (CMAKE_Fortran_COMPILER_ID MATCHES "NVHPC" )
|
||||
include (${HDF_RESOURCES_DIR}/HDFNvhpcFortranFlags.cmake)
|
||||
endif ()
|
||||
|
||||
if (CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
|
||||
include (${HDF_RESOURCES_DIR}/HDFGnuFortranFlags.cmake)
|
||||
endif ()
|
||||
|
||||
if (CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
|
||||
include (${HDF_RESOURCES_DIR}/HDFIntelFortranFlags.cmake)
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# HDF5 library compile options - to be made available to all targets
|
||||
#-----------------------------------------------------------------------------
|
||||
if (CMAKE_Fortran_COMPILER_ID STREQUAL "NAG")
|
||||
message (STATUS "... Select IEEE floating-point mode full")
|
||||
list (APPEND HDF5_CMAKE_Fortran_FLAGS "-ieee=full")
|
||||
endif ()
|
||||
|
||||
if (NOT MSVC AND NOT MINGW)
|
||||
# General flags
|
||||
if (CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")
|
||||
list (APPEND HDF5_CMAKE_Fortran_FLAGS "-Mfreeform" "-Mdclchk" "-Mstandard" "-Mallocatable=03")
|
||||
endif ()
|
||||
message (VERBOSE "HDF5_CMAKE_Fortran_FLAGS=${HDF5_CMAKE_Fortran_FLAGS}")
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# The build mode flags are not added to CMAKE_Fortran_FLAGS, so create a separate
|
||||
# variable for them so they can be written out to libhdf5.settings and
|
||||
# H5build_settings.c
|
||||
#-----------------------------------------------------------------------------
|
||||
if ("${HDF_CFG_NAME}" STREQUAL "Debug")
|
||||
set (HDF5_BUILD_MODE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_DEBUG}")
|
||||
elseif ("${HDF_CFG_NAME}" STREQUAL "Developer")
|
||||
set (HDF5_BUILD_MODE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_DEVELOPER}")
|
||||
elseif ("${HDF_CFG_NAME}" STREQUAL "Release")
|
||||
set (HDF5_BUILD_MODE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_RELEASE}")
|
||||
elseif ("${HDF_CFG_NAME}" STREQUAL "MinSizeRel")
|
||||
set (HDF5_BUILD_MODE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_MINSIZEREL}")
|
||||
elseif ("${HDF_CFG_NAME}" STREQUAL "RelWithDebInfo")
|
||||
set (HDF5_BUILD_MODE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_RELWITHDEBINFO}")
|
||||
else ()
|
||||
set (HDF5_BUILD_MODE_Fortran_FLAGS "")
|
||||
endif ()
|
||||
|
||||
@@ -1,158 +0,0 @@
|
||||
#
|
||||
# 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 LICENSE file, which can be found at the root of the source code
|
||||
# distribution tree, or in https://www.hdfgroup.org/licenses.
|
||||
# If you do not have access to either file, you may request a copy from
|
||||
# help@hdfgroup.org.
|
||||
#
|
||||
|
||||
message (VERBOSE "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")
|
||||
elseif (CMAKE_Fortran_COMPILER_ID MATCHES "IntelLLVM")
|
||||
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 - to be made available to all targets
|
||||
#-----------------------------------------------------------------------------
|
||||
if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 10.0)
|
||||
if (HDF5_ENABLE_BUILD_DIAGS)
|
||||
message (STATUS "... default color and URL extended diagnostic messages enabled")
|
||||
else ()
|
||||
message (STATUS "... disable color and URL extended diagnostic messages")
|
||||
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdiagnostics-urls=never -fno-diagnostics-color")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (CMAKE_Fortran_COMPILER_ID STREQUAL "NAG")
|
||||
message (STATUS "... Select IEEE floating-point mode full")
|
||||
list (APPEND HDF5_CMAKE_Fortran_FLAGS "-ieee=full")
|
||||
endif ()
|
||||
if (CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC")
|
||||
if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer")
|
||||
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mnoframe")
|
||||
if (NOT ${HDF_CFG_NAME} MATCHES "RelWithDebInfo")
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -s")
|
||||
endif ()
|
||||
else ()
|
||||
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mbounds -Mchkptr -Mdclchk -g")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT MSVC AND NOT MINGW)
|
||||
# General flags
|
||||
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/win-ifort-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/ifort-general")
|
||||
endif()
|
||||
list (APPEND HDF5_CMAKE_Fortran_FLAGS "-free")
|
||||
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-general")
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-developer-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-no-developer-general")
|
||||
endif ()
|
||||
list (APPEND HDF5_CMAKE_Fortran_FLAGS "-ffree-form" "-fimplicit-none")
|
||||
if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 8.0 AND NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.6)
|
||||
list (APPEND HDF5_CMAKE_Fortran_FLAGS "-std=f2008ts")
|
||||
else ()
|
||||
list (APPEND HDF5_CMAKE_Fortran_FLAGS "-std=f2008")
|
||||
endif ()
|
||||
elseif (CMAKE_Fortran_COMPILER_ID MATCHES "IntelLLVM")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/win-ifort-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/ifort-general")
|
||||
endif()
|
||||
list (APPEND HDF5_CMAKE_Fortran_FLAGS "-free")
|
||||
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")
|
||||
list (APPEND HDF5_CMAKE_Fortran_FLAGS "-Mfreeform" "-Mdclchk" "-Mstandard" "-Mallocatable=03")
|
||||
endif ()
|
||||
message (VERBOSE "HDF5_CMAKE_Fortran_FLAGS=${HDF5_CMAKE_Fortran_FLAGS}")
|
||||
|
||||
if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
|
||||
# Append more extra warning flags that only gcc 4.8+ knows about
|
||||
if (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")
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-developer-4.8")
|
||||
else ()
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-no-developer-4.8")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 4.9+ knows about
|
||||
#if (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.x+ knows about
|
||||
if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5.0)
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-developer-5")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 6.x+ knows about
|
||||
if (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+ knows about
|
||||
#if (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+ knows about
|
||||
if (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+ knows about
|
||||
#if (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 ()
|
||||
endif ()
|
||||
else ()
|
||||
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/win-ifort-general")
|
||||
list (APPEND HDF5_CMAKE_Fortran_FLAGS "/stand:f03" "/free")
|
||||
elseif (CMAKE_Fortran_COMPILER_ID MATCHES "IntelLLVM")
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/win-ifort-general")
|
||||
list (APPEND HDF5_CMAKE_Fortran_FLAGS "/stand:f03" "/free")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
#
|
||||
# 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://www.hdfgroup.org/licenses.
|
||||
# If you do not have access to either file, you may request a copy from
|
||||
# help@hdfgroup.org.
|
||||
#
|
||||
|
||||
###############################################################################
|
||||
# This file included from HDFCompilerFlags.cmake with
|
||||
# if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
###############################################################################
|
||||
#-----------------------------------------------------------------------------
|
||||
# Compiler specific flags
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}")
|
||||
if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer")
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ftrapv -fno-common")
|
||||
endif ()
|
||||
else ()
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstdarg-opt")
|
||||
endif ()
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
|
||||
if (HDF5_ENABLE_BUILD_DIAGS)
|
||||
message (STATUS "... default color and URL extended diagnostic messages enabled")
|
||||
else ()
|
||||
message (STATUS "... disable color and URL extended diagnostic messages")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-urls=never -fno-diagnostics-color")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# HDF5 library compile options - to be made available to all targets
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
||||
# 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_VERSION VERSION_GREATER_EQUAL 4.8)
|
||||
# add the general CXX flags for g++ compiler versions 4.8 and above.
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-general")
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-general")
|
||||
endif ()
|
||||
message (VERBOSE "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 CXX developer group warnings are enabled")
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general")
|
||||
else ()
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general")
|
||||
endif ()
|
||||
|
||||
# Technically, variable-length arrays are part of the C99 standard, but
|
||||
# we should approach them a bit cautiously... Only needed for gcc 4.X
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 4.8+ knows about
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-4.8")
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-developer-4.8")
|
||||
else ()
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-cxx-developer-4.8")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 4.9+ knows about
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-4.9")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 5.1+ knows about
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
|
||||
# autotools always add the C flags with the CXX flags
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-5")
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-5")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 6.x+ knows about
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/6")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 7.x+ knows about
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXxFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/7")
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7")
|
||||
#else ()
|
||||
# ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 8.x+ knows about
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/8")
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8")
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8")
|
||||
else ()
|
||||
# autotools always add the C flags with the CXX flags
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 9.x+ knows about
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-9")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 9.3+ knows about
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.3)
|
||||
# do not use C warnings, gnu-warnings 9.3, no cxx warnings
|
||||
# ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9.3")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 10.x+ knows about
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
# Use the C warnings as CXX warnings are the same
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-10")
|
||||
#else ()
|
||||
# ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-10")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to allow the user to enable all warnings
|
||||
#-----------------------------------------------------------------------------
|
||||
if (HDF5_ENABLE_ALL_WARNINGS)
|
||||
message (STATUS "....All CXX Warnings are enabled")
|
||||
if (MSVC)
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
list (APPEND HDF5_CMAKE_CXX_FLAGS "/Wall" "/wd4668")
|
||||
else ()
|
||||
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3" "/wd4100" "/wd4706" "/wd4127")
|
||||
endif ()
|
||||
else ()
|
||||
list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS})
|
||||
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.
|
||||
#-----------------------------------------------------------------------------
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option for --enable-symbols
|
||||
# This option will force/override the default setting for all configurations
|
||||
#-----------------------------------------------------------------------------
|
||||
if (HDF5_ENABLE_SYMBOLS MATCHES "YES")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
|
||||
elseif (HDF5_ENABLE_SYMBOLS MATCHES "NO")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s")
|
||||
endif ()
|
||||
@@ -0,0 +1,195 @@
|
||||
#
|
||||
# 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://www.hdfgroup.org/licenses.
|
||||
# If you do not have access to either file, you may request a copy from
|
||||
# help@hdfgroup.org.
|
||||
#
|
||||
|
||||
###############################################################################
|
||||
# This file included from HDFCompilerFlags.cmake with
|
||||
# if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
###############################################################################
|
||||
#-----------------------------------------------------------------------------
|
||||
# Compiler specific flags
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}")
|
||||
if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer")
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ftrapv -fno-common")
|
||||
endif ()
|
||||
else ()
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0 AND
|
||||
NOT CMAKE_C_CLANG_TIDY)
|
||||
# `clang-tidy` does not understand -fstdarg-opt
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstdarg-opt")
|
||||
endif ()
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 10.0)
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to allow the user to enable build extended diagnostics
|
||||
#
|
||||
# This should NOT be on by default as it can cause process issues.
|
||||
#-----------------------------------------------------------------------------
|
||||
option (HDF5_ENABLE_BUILD_DIAGS "Enable color and URL extended diagnostic messages" OFF)
|
||||
mark_as_advanced (HDF5_ENABLE_BUILD_DIAGS)
|
||||
if (HDF5_ENABLE_BUILD_DIAGS)
|
||||
message (STATUS "... default color and URL extended diagnostic messages enabled")
|
||||
else ()
|
||||
message (STATUS "... disable color and URL extended diagnostic messages")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-urls=never -fno-diagnostics-color")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# HDF5 library compile options - to be made available to all targets
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
||||
# 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.
|
||||
# Add general CFlags for GCC versions 4.8 and above
|
||||
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/general")
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general")
|
||||
endif ()
|
||||
# gcc automatically inlines based on the optimization level
|
||||
# this is just a failsafe
|
||||
list (APPEND H5_CFLAGS "-finline-functions")
|
||||
message (VERBOSE "CMAKE_C_FLAGS_GENERAL=${HDF5_CMAKE_C_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_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general")
|
||||
endif ()
|
||||
|
||||
# Turn on -Winline warnings now only for non-Debug and
|
||||
# non-Developer builds. For at least GNU compilers this
|
||||
# flag appears to conflict specifically with the -Og
|
||||
# optimization flag and will produce warnings about functions
|
||||
# not being considered for inlining
|
||||
if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer")
|
||||
list (APPEND H5_CFLAGS "-Winline")
|
||||
endif ()
|
||||
else ()
|
||||
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Technically, variable-length arrays are part of the C99 standard, but
|
||||
# we should approach them a bit cautiously... Only needed for gcc 4.X
|
||||
if (CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 4.8+ knows about
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8")
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8")
|
||||
else ()
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 4.9+ knows about
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 5.x+ knows about
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/5")
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 6.x+ knows about
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/6")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 7.x+ knows about
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/7")
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-7")
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7")
|
||||
#else ()
|
||||
# ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 8.x+ knows about
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/8")
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8")
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8")
|
||||
else ()
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 9.x+ knows about
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 9.3+ knows about
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.3)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9.3")
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 10.x+ knows about
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 10.0)
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-10")
|
||||
#else ()
|
||||
# ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-10")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 12.x+ knows about
|
||||
# or which should only be enabled for gcc 12.x+
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0)
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-12")
|
||||
#else ()
|
||||
# ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-12")
|
||||
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.
|
||||
#-----------------------------------------------------------------------------
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option for --enable-symbols
|
||||
# This option will force/override the default setting for all configurations
|
||||
#-----------------------------------------------------------------------------
|
||||
if (HDF5_ENABLE_SYMBOLS MATCHES "YES")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fno-omit-frame-pointer")
|
||||
elseif (HDF5_ENABLE_SYMBOLS MATCHES "NO")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s")
|
||||
endif ()
|
||||
@@ -0,0 +1,90 @@
|
||||
#
|
||||
# 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://www.hdfgroup.org/licenses.
|
||||
# If you do not have access to either file, you may request a copy from
|
||||
# help@hdfgroup.org.
|
||||
#
|
||||
|
||||
###############################################################################
|
||||
# This file included from HDFCompilerFortranFlags.cmake with
|
||||
# if (CMAKE_Fortran_COMPILER_ID MATCHES "GNU" )
|
||||
###############################################################################
|
||||
|
||||
message (VERBOSE "Warnings Configuration: default Fortran: ${CMAKE_Fortran_FLAGS}")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# HDF5 library compile options - to be made available to all targets
|
||||
#-----------------------------------------------------------------------------
|
||||
if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 10.0)
|
||||
if (HDF5_ENABLE_BUILD_DIAGS)
|
||||
message (STATUS "... default color and URL extended diagnostic messages enabled")
|
||||
else ()
|
||||
message (STATUS "... disable color and URL extended diagnostic messages")
|
||||
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdiagnostics-urls=never -fno-diagnostics-color")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT MSVC AND NOT MINGW)
|
||||
# General flags
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-general")
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-developer-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-no-developer-general")
|
||||
endif ()
|
||||
list (APPEND HDF5_CMAKE_Fortran_FLAGS "-ffree-form" "-fimplicit-none")
|
||||
if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 8.0 AND NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.6)
|
||||
list (APPEND HDF5_CMAKE_Fortran_FLAGS "-std=f2008ts")
|
||||
else ()
|
||||
list (APPEND HDF5_CMAKE_Fortran_FLAGS "-std=f2008")
|
||||
endif ()
|
||||
message (VERBOSE "HDF5_CMAKE_Fortran_FLAGS=${HDF5_CMAKE_Fortran_FLAGS}")
|
||||
|
||||
# Append more extra warning flags that only gcc 4.8+ knows about
|
||||
if (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")
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-developer-4.8")
|
||||
else ()
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-no-developer-4.8")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 4.9+ knows about
|
||||
#if (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.x+ knows about
|
||||
if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5.0)
|
||||
if (HDF5_ENABLE_DEV_WARNINGS)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-developer-5")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Append more extra warning flags that only gcc 6.x+ knows about
|
||||
if (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+ knows about
|
||||
#if (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+ knows about
|
||||
if (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+ knows about
|
||||
#if (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 ()
|
||||
endif ()
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
#
|
||||
# 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://www.hdfgroup.org/licenses.
|
||||
# If you do not have access to either file, you may request a copy from
|
||||
# help@hdfgroup.org.
|
||||
#
|
||||
|
||||
###############################################################################
|
||||
# This file included from HDFCompilerFlags.cmake with
|
||||
# if (CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
||||
###############################################################################
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Compiler specific flags
|
||||
#-----------------------------------------------------------------------------
|
||||
if (WIN32)
|
||||
set (_INTEL_WINDOWS 1)
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# HDF5 library compile options - to be made available to all targets
|
||||
#-----------------------------------------------------------------------------
|
||||
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
||||
# 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")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/win-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/general")
|
||||
endif()
|
||||
if (NOT _INTEL_WINDOWS)
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0)
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/15")
|
||||
endif ()
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0)
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/18")
|
||||
endif ()
|
||||
endif ()
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/win-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/general")
|
||||
endif ()
|
||||
endif ()
|
||||
message (VERBOSE "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 CXX developer group warnings are enabled")
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/win-developer-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/developer-general")
|
||||
endif ()
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/win-developer-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/developer-general")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option for --enable-symbols
|
||||
# This option will force/override the default setting for all configurations
|
||||
#-----------------------------------------------------------------------------
|
||||
if (NOT _INTEL_WINDOWS)
|
||||
if (HDF5_ENABLE_SYMBOLS MATCHES "YES")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
|
||||
elseif (HDF5_ENABLE_SYMBOLS MATCHES "NO")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-s")
|
||||
endif ()
|
||||
endif ()
|
||||
@@ -0,0 +1,106 @@
|
||||
#
|
||||
# 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://www.hdfgroup.org/licenses.
|
||||
# If you do not have access to either file, you may request a copy from
|
||||
# help@hdfgroup.org.
|
||||
#
|
||||
|
||||
###############################################################################
|
||||
# This file included from HDFCompilerFlags.cmake with
|
||||
# if (CMAKE_C_COMPILER_ID MATCHES "Intel")
|
||||
###############################################################################
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Compiler specific flags
|
||||
#-----------------------------------------------------------------------------
|
||||
if (WIN32)
|
||||
set (_INTEL_WINDOWS 1)
|
||||
endif ()
|
||||
|
||||
# Disable deprecation warnings for standard C functions.
|
||||
# really only needed for newer versions of VS, but should
|
||||
# not hurt other versions, and this will work into the
|
||||
# future
|
||||
if (MSVC OR _INTEL_WINDOWS)
|
||||
add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# HDF5 library compile options - to be made available to all targets
|
||||
#-----------------------------------------------------------------------------
|
||||
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
||||
# 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_C_COMPILER_ID STREQUAL "Intel")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/win-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/general")
|
||||
endif()
|
||||
if (NOT _INTEL_WINDOWS)
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/15")
|
||||
endif ()
|
||||
# this is just a failsafe
|
||||
list (APPEND H5_CFLAGS "-finline-functions")
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/18")
|
||||
endif ()
|
||||
endif ()
|
||||
elseif (CMAKE_C_COMPILER_ID MATCHES "IntelLLVM")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/win-general")
|
||||
else ()
|
||||
# this is just a failsafe
|
||||
list (APPEND H5_CFLAGS "-finline-functions")
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/general")
|
||||
endif ()
|
||||
endif ()
|
||||
message (VERBOSE "CMAKE_C_FLAGS_GENERAL=${HDF5_CMAKE_C_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_C_COMPILER_ID STREQUAL "Intel")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/win-developer-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/developer-general")
|
||||
endif ()
|
||||
elseif (CMAKE_C_COMPILER_ID MATCHES "IntelLLVM")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/win-developer-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/developer-general")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Turn on -Winline warnings now only for non-Debug and
|
||||
# non-Developer builds. For at least GNU compilers this
|
||||
# flag appears to conflict specifically with the -Og
|
||||
# optimization flag and will produce warnings about functions
|
||||
# not being considered for inlining
|
||||
if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer")
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND NOT _INTEL_WINDOWS)
|
||||
list (APPEND H5_CFLAGS "-Winline")
|
||||
elseif (CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" AND NOT _INTEL_WINDOWS)
|
||||
list (APPEND H5_CFLAGS "-Winline")
|
||||
endif ()
|
||||
endif ()
|
||||
@@ -0,0 +1,65 @@
|
||||
#
|
||||
# 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://www.hdfgroup.org/licenses.
|
||||
# If you do not have access to either file, you may request a copy from
|
||||
# help@hdfgroup.org.
|
||||
#
|
||||
|
||||
###############################################################################
|
||||
# This file included from HDFCompilerFortranFlags.cmake with
|
||||
# if (CMAKE_Fortran_COMPILER_ID MATCHES "Intel" )
|
||||
###############################################################################
|
||||
|
||||
message (VERBOSE "Warnings Configuration: default Fortran: ${CMAKE_Fortran_FLAGS}")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to allow the user to disable compiler warnings
|
||||
#-----------------------------------------------------------------------------
|
||||
if (HDF5_DISABLE_COMPILER_WARNINGS)
|
||||
# MSVC uses /w to suppress warnings. It also complains if another
|
||||
# warning level is given, so remove it.
|
||||
if (MSVC)
|
||||
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
|
||||
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} /warn:none")
|
||||
elseif (CMAKE_Fortran_COMPILER_ID MATCHES "IntelLLVM")
|
||||
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} /warn:none")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# HDF5 library compile options - to be made available to all targets
|
||||
#-----------------------------------------------------------------------------
|
||||
if (NOT MSVC AND NOT MINGW)
|
||||
# General flags
|
||||
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/win-ifort-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/ifort-general")
|
||||
endif()
|
||||
list (APPEND HDF5_CMAKE_Fortran_FLAGS "-free")
|
||||
elseif (CMAKE_Fortran_COMPILER_ID MATCHES "IntelLLVM")
|
||||
if (_INTEL_WINDOWS)
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/win-ifort-general")
|
||||
else ()
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/ifort-general")
|
||||
endif()
|
||||
list (APPEND HDF5_CMAKE_Fortran_FLAGS "-free")
|
||||
endif ()
|
||||
message (VERBOSE "HDF5_CMAKE_Fortran_FLAGS=${HDF5_CMAKE_Fortran_FLAGS}")
|
||||
else ()
|
||||
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/classic/win-ifort-general")
|
||||
list (APPEND HDF5_CMAKE_Fortran_FLAGS "/stand:f03" "/free")
|
||||
elseif (CMAKE_Fortran_COMPILER_ID MATCHES "IntelLLVM")
|
||||
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/oneapi/win-ifort-general")
|
||||
list (APPEND HDF5_CMAKE_Fortran_FLAGS "/stand:f03" "/free")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# 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://www.hdfgroup.org/licenses.
|
||||
# If you do not have access to either file, you may request a copy from
|
||||
# help@hdfgroup.org.
|
||||
#
|
||||
|
||||
###############################################################################
|
||||
# This file included from HDFCompilerFlags.cmake with
|
||||
# if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
###############################################################################
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Compiler specific flags
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# MSVC 14.28 enables C5105, but the Windows SDK 10.0.18362.0 triggers it.
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.28)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd5105")
|
||||
endif ()
|
||||
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# 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://www.hdfgroup.org/licenses.
|
||||
# If you do not have access to either file, you may request a copy from
|
||||
# help@hdfgroup.org.
|
||||
#
|
||||
|
||||
###############################################################################
|
||||
# This file included from HDFCompilerFlags.cmake with
|
||||
# if (CMAKE_C_COMPILER_ID MATCHES "MSVC")
|
||||
###############################################################################
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Compiler specific flags
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# MSVC 14.28 enables C5105, but the Windows SDK 10.0.18362.0 triggers it.
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 19.28)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -wd5105")
|
||||
endif ()
|
||||
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# 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://www.hdfgroup.org/licenses.
|
||||
# If you do not have access to either file, you may request a copy from
|
||||
# help@hdfgroup.org.
|
||||
#
|
||||
|
||||
###############################################################################
|
||||
# This file included from HDFCompilerFlags.cmake with
|
||||
# if (CMAKE_CXX_COMPILER_ID MATCHES "NVHPC" )
|
||||
###############################################################################
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Compiler specific flags
|
||||
#-----------------------------------------------------------------------------
|
||||
if (NOT DEFINED CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION)
|
||||
if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD EQUAL 11)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C11_STANDARD_COMPILE_OPTION}")
|
||||
endif ()
|
||||
endif ()
|
||||
if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Minform=warn")
|
||||
if (NOT ${HDF_CFG_NAME} MATCHES "RelWithDebInfo")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s")
|
||||
endif ()
|
||||
else ()
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Mbounds -gopt -g")
|
||||
endif ()
|
||||
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# 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://www.hdfgroup.org/licenses.
|
||||
# If you do not have access to either file, you may request a copy from
|
||||
# help@hdfgroup.org.
|
||||
#
|
||||
|
||||
###############################################################################
|
||||
# This file included from HDFCompilerFlags.cmake with
|
||||
# if (CMAKE_C_COMPILER_ID MATCHES "NVHPC" )
|
||||
###############################################################################
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Compiler specific flags
|
||||
#-----------------------------------------------------------------------------
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Minform=warn")
|
||||
if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer")
|
||||
if (NOT ${HDF_CFG_NAME} MATCHES "RelWithDebInfo")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s")
|
||||
endif ()
|
||||
else ()
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Mbounds -gopt")
|
||||
endif ()
|
||||
@@ -0,0 +1,38 @@
|
||||
#
|
||||
# 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://www.hdfgroup.org/licenses.
|
||||
# If you do not have access to either file, you may request a copy from
|
||||
# help@hdfgroup.org.
|
||||
#
|
||||
|
||||
###############################################################################
|
||||
# This file included from HDFCompilerFortranFlags.cmake with
|
||||
# if (CMAKE_Fortran_COMPILER_ID MATCHES "NVHPC" )
|
||||
###############################################################################
|
||||
|
||||
message (VERBOSE "Warnings Configuration: default Fortran: ${CMAKE_Fortran_FLAGS}")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# HDF5 library compile options - to be made available to all targets
|
||||
#-----------------------------------------------------------------------------
|
||||
if (CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC")
|
||||
if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer")
|
||||
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mnoframe")
|
||||
if (NOT ${HDF_CFG_NAME} MATCHES "RelWithDebInfo")
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -s")
|
||||
endif ()
|
||||
else ()
|
||||
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mbounds -Mchkptr -Mdclchk -g")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT MSVC AND NOT MINGW)
|
||||
# General flags
|
||||
message (VERBOSE "HDF5_CMAKE_Fortran_FLAGS=${HDF5_CMAKE_Fortran_FLAGS}")
|
||||
endif ()
|
||||
|
||||
@@ -47,6 +47,24 @@ New Features
|
||||
|
||||
Configuration:
|
||||
-------------
|
||||
- Added CMake build mode flags to the libhdf5.settings file
|
||||
|
||||
Flags from the CMake build mode (e.g., optimization) are not a part of
|
||||
CMAKE_<language>_FLAGS and were not exported to the libhdf5.settings file. This
|
||||
has been fixed and the C, Fortran, and C++ build mode flags are now exported to
|
||||
the file.
|
||||
|
||||
This also affects the text output of H5check_version() and the libhdf5.settings
|
||||
string stored in the library (for those who use strings(1), etc. to get
|
||||
build info from the binary).
|
||||
|
||||
- CMake: Split compiler specific flags into separate files
|
||||
|
||||
The compiler specific flags have been split into separate files to make
|
||||
it easier to maintain and add new compiler flags. The flags for NVHPC,
|
||||
Intel, GNU and Clang compilers are now in separate files included from
|
||||
the current compiler flags files; HDFCompiler<language>Flags.cmake.
|
||||
|
||||
- Added a configuration option for internal threading/concurrency support:
|
||||
|
||||
CMake: HDF5_ENABLE_THREADS (ON/OFF) (Default: ON)
|
||||
|
||||
@@ -56,7 +56,7 @@ const char H5build_settings[]=
|
||||
" CPPFLAGS: @CPPFLAGS@\n"
|
||||
" H5_CPPFLAGS: @H5_CPPFLAGS@\n"
|
||||
" AM_CPPFLAGS: @AM_CPPFLAGS@\n"
|
||||
" C Flags: @CMAKE_C_FLAGS@\n"
|
||||
" C Flags: @CMAKE_C_FLAGS@ @HDF5_BUILD_MODE_C_FLAGS@\n"
|
||||
" H5 C Flags: @HDF5_CMAKE_C_FLAGS@\n"
|
||||
" AM C Flags: @AM_CFLAGS@\n"
|
||||
" Shared C Library: @H5_ENABLE_SHARED_LIB@\n"
|
||||
@@ -65,7 +65,7 @@ const char H5build_settings[]=
|
||||
"\n"
|
||||
" Fortran: @HDF5_BUILD_FORTRAN@\n"
|
||||
" Fortran Compiler: @CMAKE_Fortran_COMPILER@ @CMAKE_Fortran_COMPILER_VERSION@\n"
|
||||
" Fortran Flags: @CMAKE_Fortran_FLAGS@\n"
|
||||
" Fortran Flags: @CMAKE_Fortran_FLAGS@ @HDF5_BUILD_MODE_Fortran_FLAGS@\n"
|
||||
" H5 Fortran Flags: @HDF5_CMAKE_Fortran_FLAGS@\n"
|
||||
" AM Fortran Flags: @AM_FCFLAGS@\n"
|
||||
" Shared Fortran Library: @H5_ENABLE_SHARED_LIB@\n"
|
||||
@@ -74,7 +74,7 @@ const char H5build_settings[]=
|
||||
"\n"
|
||||
" C++: @HDF5_BUILD_CPP_LIB@\n"
|
||||
" C++ Compiler: @CMAKE_CXX_COMPILER@ @CMAKE_CXX_COMPILER_VERSION@\n"
|
||||
" C++ Flags: @CMAKE_CXX_FLAGS@\n"
|
||||
" C++ Flags: @CMAKE_CXX_FLAGS@ @HDF5_BUILD_MODE_CXX_FLAGS@\n"
|
||||
" H5 C++ Flags: @HDF5_CMAKE_CXX_FLAGS@\n"
|
||||
" AM C++ Flags: @AM_CXXFLAGS@\n"
|
||||
" Shared C++ Library: @H5_ENABLE_SHARED_LIB@\n"
|
||||
|
||||
@@ -38,7 +38,7 @@ Languages:
|
||||
CPPFLAGS: @CPPFLAGS@
|
||||
H5_CPPFLAGS: @H5_CPPFLAGS@
|
||||
AM_CPPFLAGS: @AM_CPPFLAGS@
|
||||
CFLAGS: @CMAKE_C_FLAGS@
|
||||
CFLAGS: @CMAKE_C_FLAGS@ @HDF5_BUILD_MODE_C_FLAGS@
|
||||
H5_CFLAGS: @HDF5_CMAKE_C_FLAGS@
|
||||
AM_CFLAGS: @AM_CFLAGS@
|
||||
Shared C Library: @H5_ENABLE_SHARED_LIB@
|
||||
@@ -46,7 +46,7 @@ Languages:
|
||||
|
||||
Fortran: @HDF5_BUILD_FORTRAN@
|
||||
Fortran Compiler: @CMAKE_Fortran_COMPILER@ @CMAKE_Fortran_COMPILER_VERSION@
|
||||
Fortran Flags: @CMAKE_Fortran_FLAGS@
|
||||
Fortran Flags: @CMAKE_Fortran_FLAGS@ @HDF5_BUILD_MODE_Fortran_FLAGS@
|
||||
H5 Fortran Flags: @HDF5_CMAKE_Fortran_FLAGS@
|
||||
AM Fortran Flags: @AM_FCFLAGS@
|
||||
Shared Fortran Library: @H5_ENABLE_SHARED_LIB@
|
||||
@@ -55,7 +55,7 @@ Languages:
|
||||
|
||||
C++: @HDF5_BUILD_CPP_LIB@
|
||||
C++ Compiler: @CMAKE_CXX_COMPILER@ @CMAKE_CXX_COMPILER_VERSION@
|
||||
C++ Flags: @CMAKE_CXX_FLAGS@
|
||||
C++ Flags: @CMAKE_CXX_FLAGS@ @HDF5_BUILD_MODE_CXX_FLAGS@
|
||||
H5 C++ Flags: @HDF5_CMAKE_CXX_FLAGS@
|
||||
AM C++ Flags: @AM_CXXFLAGS@
|
||||
Shared C++ Library: @H5_ENABLE_SHARED_LIB@
|
||||
|
||||
Reference in New Issue
Block a user