Skip to content

[BUILD] Visual Studio GMOCK_LIB issues and explicit c++17 #3158

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

Closed
wants to merge 2 commits into from

Conversation

bkuschel
Copy link

Changes

  • Copy over similar working code into cmake files dealing with GMOCK_LIB
  • Explicitly add c++17 support for MSVC

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@bkuschel bkuschel requested a review from a team as a code owner November 22, 2024 02:43
Copy link

netlify bot commented Nov 22, 2024

Deploy Preview for opentelemetry-cpp-api-docs canceled.

Name Link
🔨 Latest commit c280540
🔍 Latest deploy log https://app.netlify.com/sites/opentelemetry-cpp-api-docs/deploys/674062cdc77dfe0008d323f5

Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch.

This needs more investigations, to understand the root cause.


# Force C++17
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can not have that, this will break everybody.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to find an alternative

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcalff The only other way I can get it to compile with vs2022 is to add "-DWITH_STL=CXX14"
Other wise i get

warning STL4038: The contents of <string_view> are available only with C++17 or later.
C:\Users\Administrator\Git\opentelemetry-cpp\api\include\opentelemetry/std/string_view.h(18): error C2039: 'string_view': is not a member of 'std'

This is during stl build, nostd works without this (of course).

Copy link
Member

@owent owent Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use -DCMAKE_CXX_STANDARD=17 when running cmake command to use C++17 in your environment.

Copy link

codecov bot commented Nov 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.86%. Comparing base (fe68d51) to head (c280540).
Report is 39 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3158   +/-   ##
=======================================
  Coverage   87.86%   87.86%           
=======================================
  Files         195      195           
  Lines        6151     6151           
=======================================
  Hits         5404     5404           
  Misses        747      747           

@owent
Copy link
Member

owent commented Dec 20, 2024

This problem should already be fixed by #3203 , could you please try the main branch?

@marcalff
Copy link
Member

marcalff commented Jan 8, 2025

This problem should already be fixed by #3203 , could you please try the main branch?

As indicated earlier, the issues related to GMOCK_LIB have been resolved already.

Now closing this PR, since it is not needed.

If somehow the latest code in opentelemetry-cpp still does not work, please file an issue with the current findings.

@marcalff marcalff closed this Jan 8, 2025
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.

3 participants