Skip to content
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

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
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).

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           
---- 🚨 Try these New Features:

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