Skip to content

Commit

Permalink
CMakeLists.txt: Enable CMAKE_MSVC_RUNTIME_LIBRARY support (#2652)
Browse files Browse the repository at this point in the history
The documentation for CMAKE_MSVC_RUNTIME_LIBRARY states [1]:

> This variable has effect only when policy CMP0091 is set to NEW prior to
> the first project() or enable_language() command that enables a language
> using a compiler targeting the MSVC ABI.

so the current usage of CMAKE_MSVC_RUNTIME_LIBRARY for vcpkg does not work
at all.

Let's fix that by setting policy 91 to new if present.

[1]: https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html

Co-authored-by: Tom Tan <[email protected]>
  • Loading branch information
t-b and ThomsonTan authored Jun 6, 2024
1 parent 1d8a7b5 commit 436a981
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12")
cmake_policy(SET CMP0074 NEW)
endif()

# Prefer CMAKE_MSVC_RUNTIME_LIBRARY if possible
if(POLICY CMP0091)
cmake_policy(SET CMP0091 NEW)
endif()

project(opentelemetry-cpp)

# Mark variables as used so cmake doesn't complain about them
Expand Down

2 comments on commit 436a981

@github-actions
Copy link

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp sdk Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 436a981 Previous: 1d8a7b5 Ratio
BM_MeasurementsTest 10029368.40057373 ns/iter 2820069.5514678955 ns/iter 3.56

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp api Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 436a981 Previous: 1d8a7b5 Ratio
BM_SpinLockThrashing/4/process_time/real_time 4.105503559112549 ms/iter 0.6907526495421461 ms/iter 5.94
BM_NaiveSpinLockThrashing/4/process_time/real_time 1.6993927955627441 ms/iter 0.6749223260318532 ms/iter 2.52
BM_ThreadYieldSpinLockThrashing/4/process_time/real_time 121.60563468933105 ms/iter 57.747721672058105 ms/iter 2.11

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.