conanfile: set compatibility_cppstd = False. #2860
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The Catch libraries have different API/ABI depending on the C++ standard they are compiled with. For example, StringMaker::convert(std::string_view) isn't in the binary when compiled with C++14, only with C++17 or later.
By default, Conan is allowed to serve Catch libraries compiled in C++14 to a project using C++17/20, potentially causing linker errors because of missing symbols (see #2605). This PR overrides this default using conan extension properties: the C++ standard used to build the Catch library will exactly match the one of the requiring project (building Catch from source if necessary).
This is probably much more constraining than necessary (I assume it will prevent conan from using a
c++17
catch2 binary into agnu17
project). But that's the only simple solution I have. And as a user, locally rebuilding Catch "just in case" is much better than getting linker errors.Note:
Right now for Windows, the conan-center catch2 package has only prebuilt binaries for C++14. So many Windows users are at risk of getting served C++14 Catch2 binaries in all their non-C++14 projects.
This can also happen on other platforms: if the first Catch2 binaries that ends up in your Conan cache were build in C++14, Conan will currently serve them in all your future C++17/20 projects.