diff --git a/CMakeLists.txt b/CMakeLists.txt index a5c5d113c..7060fe713 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,7 @@ option(HIGHFIVE_TEST_HALF_FLOAT "Enable half-precision floats" OFF) # TODO remove entirely. option(HIGHFIVE_HAS_CONCEPTS "Print readable compiler errors w/ C++20 concepts" OFF) +set(HIGHFIVE_MAX_ERROR 0 "Maximum number of compiler errors.") option(HIGHFIVE_HAS_WERROR "Convert warnings to errors." OFF) option(HIGHFIVE_GLIBCXX_ASSERTIONS "Enable bounds check for STL." OFF) # TODO these some magic to get a drop down menu in ccmake diff --git a/cmake/HighFiveWarnings.cmake b/cmake/HighFiveWarnings.cmake index 16896b648..dfd43c7f1 100644 --- a/cmake/HighFiveWarnings.cmake +++ b/cmake/HighFiveWarnings.cmake @@ -31,13 +31,20 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" -Wcast-align -Wdouble-promotion ) - endif() - if(HIGHFIVE_HAS_WERROR) - target_compile_options(HighFiveWarnings - INTERFACE - -Werror - -Wno-error=deprecated-declarations - ) + if(HIGHFIVE_MAX_ERRORS) + target_compile_options(HighFiveWarnings + INTERFACE + -fmax-errors=${HIGHFIVE_MAX_ERRORS} + ) + endif() + + if(HIGHFIVE_HAS_WERROR) + target_compile_options(HighFiveWarnings + INTERFACE + -Werror + -Wno-error=deprecated-declarations + ) + endif() endif() endif() diff --git a/doc/developer_guide.md b/doc/developer_guide.md index f129ecb1d..a5ed2767d 100644 --- a/doc/developer_guide.md +++ b/doc/developer_guide.md @@ -23,8 +23,13 @@ cmake --build build --parallel ctest --test-dir build ``` -You might want to turn Boost `-DHIGHFIVE_TEST_BOOST=On` or optional -dependencies on. +You might want to add: +* `-DHIGHFIVE_TEST_BOOST=On` or other optional dependencies on, +* `-DHIGHFIVE_MAX_ERROR=3` to only show the first three errors. + +Generic CMake reminders: +* `-DCMAKE_INSTALL_PREFIX` defines where HighFive will be installed, +* `-DCMAKE_PREFIX_PATH` defines where `*Config.cmake` files are found. ## Contributing There's numerous HDF5 features that haven't been wrapped yet. HighFive is a