From 7d50249b35029a03b34e123fbc0213c436159460 Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Wed, 12 May 2021 20:31:41 +0200 Subject: [PATCH 1/2] cmake: Add target for obtaining local covarage reports --- CMakeLists.txt | 1 + cmake/gcovr.cmake | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 cmake/gcovr.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index b1571b1a13..2c7627ef3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,7 @@ mark_as_advanced( option( BUILD_WITH_CCACHE "Use ccache to speed up compilations" OFF ) option( BUILD_WITH_COVERAGE "Add compiler flags to generate coverage stats" OFF ) +include(cmake/gcovr.cmake REQUIRED) set( PACKAGE_BUGREPORT "http://github.com/exiv2/exiv2" ) set( PACKAGE_URL "https://exiv2.org") diff --git a/cmake/gcovr.cmake b/cmake/gcovr.cmake new file mode 100644 index 0000000000..c787b88466 --- /dev/null +++ b/cmake/gcovr.cmake @@ -0,0 +1,20 @@ +# Intentd usage +# cmake -DBUILD_WITH_COVERAGE=yes ../ +# make -j +# make tests +# make coverage + +if(BUILD_WITH_COVERAGE) + find_program (GCOVR gcovr) + + if(GCOVR) + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/coverage_output ) + add_custom_command(OUTPUT _run_gcovr_parser + POST_BUILD + COMMAND ${GCOVR} --root ${CMAKE_SOURCE_DIR} --object-dir=${CMAKE_BINARY_DIR} --html --html-details -o coverage_output/coverage.html + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) + add_custom_target (coverage DEPENDS _run_gcovr_parser) + endif() + +endif(BUILD_WITH_COVERAGE) From f74316e60f03fafb1723f90ef1b58bb0d116678f Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Wed, 12 May 2021 20:31:54 +0200 Subject: [PATCH 2/2] doc: Update notes about c++11 --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 749989f812..93ef5a2577 100644 --- a/README.md +++ b/README.md @@ -745,20 +745,20 @@ You will find that 3 tests fail at the end of the test suite. It is safe to ign ### 2.17 Building with C++11 and other compilers -Exiv2 uses the default compiler for your system. Exiv2 v0.27 was written to the C++ 1998 standard and uses `auto_ptr`. The C++11 and C++14 compilers will issue deprecation warnings about auto\_ptr. As _auto\_ptr support has been removed from C++17, you cannot build Exiv2 v0.27 with C++17 or later compilers._ Exiv2 v1.0 and later do not use `auto_ptr` and will build with all modern C++ Standard Compilers. +Exiv2 uses the default compiler for your system. Exiv2 v0.27 was written to the C++ 1998 standard and uses `auto_ptr`. The C++11 and C++14 compilers will issue deprecation warnings about `auto_ptr`. As `auto_ptr` support has been removed from C++17, you cannot build Exiv2 v0.27 with C++17 or later compilers._ Exiv2 v1.0 and later do not use `auto_ptr` and will require a compiler compliant with the C++11 Standard. -To build with C++11: +To build Exiv2 v0.27.X with C++11: ```bash -$ cd -$ mkdir build ; cd build -$ cmake .. -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_FLAGS=-Wno-deprecated -$ make +cd +mkdir build ; cd build +cmake .. -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_FLAGS=-Wno-deprecated +make ``` -The option -DCMAKE\_CXX\_STANDARD=11 specifies the C++ Language Standard. Possible values are 98, 11 or 14. +The option -DCMAKE\_CXX\_STANDARD=11 specifies the C++ Language Standard. Possible values are 98, 11, 14, 17 or 20. -The option -DCMAKE\_CXX\_FLAGS=-Wno-deprecated suppresses warnings from C++11 concerning auto\_ptr. The compiler will issue deprecation warnings about video, eps and ssh code in Exiv2 v0.27. This is intentional. These features of Exiv2 will not be available in Exiv2 v1.0. +The option -DCMAKE\_CXX\_FLAGS=-Wno-deprecated suppresses warnings from C++11 concerning `auto_ptr`. The compiler will issue deprecation warnings about video, eps and ssh code in Exiv2 v0.27. This is intentional. These features of Exiv2 will not be available in Exiv2 v1.0. **Caution:** Visual Studio users should not use -DCMAKE\_CXX\_FLAGS=-Wno-deprecated.