Skip to content

Conversation

@davidhunter22
Copy link
Contributor

This gets the test cases and examples working when uing the standard library module.
All the tet currently pass, at least using MSVC.

The changes are the following

  1. Made a CMake function to enable use of the standard library modeul in a target. This will do whatever is necessary, which may differ for clang/gcc/MSVC going forward. It also allows checking of compiler/language versions
  2. There is an ugly workaround which I will compleltly understand if you don't want. The tests use catch2, version 2. This does not support using the standard library module. So to get things working I created a dummy catch.hpp. When not using the standard library module it just include the regular catch.hpp When using the standard module it defines all the macro preprocessor guards used by the standard library headers, so #define _VECTOR_. This means the headers don't get included and don't cause compiler errors. STL did suggest an alternative which is to create empty files like which would get included rather than the real ones.

Anyway even if you want to drop that fine but the reast I think looks OK

@davidhunter22
Copy link
Contributor Author

BTW I am pushing PR's to make catch2 usable when using the std library module but that is for Catch2 version 3 not version 2. Not sure if you have thought about upgrading

@foonathan
Copy link
Owner

Okay, I don't really like the workaround. Given that this only affects the internal infrastructure of the project and not end-users, and adds conditional compilation to every file, I don't think using the standard module for tests and examples is necessary at this point. If there is better support/transition in the future, I will reconsider.

Thank you for the work anyways.

@foonathan foonathan closed this Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants