exiv2
exiv2 copied to clipboard
Can we keep public headers C++11 compatible?
While we have moved to using C++17 internally, I think we should try to investigate how painful it would be to keep the public headers C++11 compatible.
Some recent MRs for example introduced std::string_view into basicio.hpp.
https://github.com/Exiv2/exiv2/blob/7ebf2a184e28bf638a39aa30ed3784c5035b668a/include/exiv2/basicio.hpp#L698
This is motivated by a report on the matrix channel by @aurelienpierre who stumbled over this when trying to compile darktable (C++11) with the latest master version of exiv2.
cc @piponazo @kevinbackhouse @kmilos @neheb @alexvanderberkel
I don't have a strong opinion on this.
Those string_views should just be auto. I'll write a PR.
Me neither, but have some questions:
Any particular reason for @aurelienpierre not using 0.27-maintenance branch?
Also, might be an idea to plan a 0.27.6 release?
@neheb before we change more, I'd suggest we create a test first that checks these headers compile with C++11 otherwise, changing something will just introduce more churn without any gain.
@kmilos that's the advice we gave on matrix.
But in general, eventually main will hopefully become a released version, so we should be happy that someone is trying to build with the main branch and test things.
Sounds good. I have no real way of testing my changes. Well, maybe building with darktable.
Hi guys. I think we should be able to test that the exiv2 target is only using C++11 features.
At the moment we are setting the C++ standard globally for our project with:
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
I do not recall if this is propagated to the consumers of Exiv2 via the CMake configuration files which are deployed during the installation step. However it should be possible to indicate that exiv2 needs at least c++11 by using this cmake code:
target_compile_features(exiv2lib PUBLIC cxx_std_11)
This information will appear in the Exiv2 CMake files we provide to customers.
Then a consumer project including Exiv2 and using a C++11 compiler should complain if =>C++14 features are included. I have this dummy project for test those things:
https://github.com/piponazo/exiv2Consumer .
Let me know if I can help with this topic. We could move #2257 to a branch in the main exiv2 repository so that few of us can work in the same branch.
I merged that PR. AFAIK, it should be fine now.
This can be closed I think