-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Visual Studio expands the __cplusplus macro to 199711L by default regardless of C++ std being used. #5
Comments
Hello @ttanguay , thanks for the feedback. On first glance, this should be possible to integrate into our CMakeLists, however I'm interested if you would be able to test it, as I have never used MSVC. |
Apparently this cannot be fixed using CMake without affecting the linked targets, I've created a solution that checks for MSVC and then uses |
I will check out your latest commit. |
I tested with latest commit and the PopOptional method of spsc::Queue is now available in Visual Studio without needing that target_compile_options in CMake. I am having some issues with the library when adding with CPMAddPackage. Everything works fine when I tested in main with a globally declared queue. But when I put the queue as a private member of a class I'm getting errors. Not sure if it's some conflict with another header I'm including or I just haven't linked the library in correctly. It works fine if I just include the header files for queue in the project directly. I'll try a few things. Do you have the proper cmake commands to add lockfree to a project using FetchContent... maybe i can use that instead and see if it's just a CPM issue. Thanks. |
Thanks for the review, I will merge the PR, please open another issue for the CPM problem and post the output you're getting. Please try the FetchContent with this code snippet: Include(FetchContent)
FetchContent_Declare(
lockfree
GIT_REPOSITORY https://github.com/DNedic/lockfree.git
GIT_TAG 2.0.2
)
FetchContent_MakeAvailable(lockfree) |
https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus?view=msvc-170
Using the /Zc:__cplusplus compiler option forces visual studio to set this macro properly.
NOTE: I was able to add lockfree to a project with C++17 support using CPMAddPackage with the following:
The text was updated successfully, but these errors were encountered: