Skip to content

Commit 436a981

Browse files
t-bThomsonTan
andauthored
CMakeLists.txt: Enable CMAKE_MSVC_RUNTIME_LIBRARY support (#2652)
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]>
1 parent 1d8a7b5 commit 436a981

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12")
1313
cmake_policy(SET CMP0074 NEW)
1414
endif()
1515

16+
# Prefer CMAKE_MSVC_RUNTIME_LIBRARY if possible
17+
if(POLICY CMP0091)
18+
cmake_policy(SET CMP0091 NEW)
19+
endif()
20+
1621
project(opentelemetry-cpp)
1722

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

0 commit comments

Comments
 (0)