From 3ab6c8e34e33eac320a0249b8b1d15df2e76c71b Mon Sep 17 00:00:00 2001 From: silverqx Date: Fri, 5 Jul 2024 17:41:59 +0200 Subject: [PATCH] vcpkg bugfix /MT vs /MD --- CMakeLists.txt | 3 ++- cmake/Modules/TinyInitDefaultVariables.cmake | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 487fdf4b2..b14590ef5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,7 +126,8 @@ when the build type is equal" OFF feature_option_dependent(MSVC_RUNTIME_DYNAMIC "Use MSVC dynamic runtime library (-MD) instead of static (-MT), also considers \ a Debug configuration (-MTd, -MDd)" ON - "MSVC AND (NOT TINY_VCPKG OR NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)" + "MSVC AND NOT TINY_VCPKG AND NOT DEFINED VCPKG_CRT_LINKAGE AND \ +NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY" MSVC_RUNTIME_DYNAMIC-NOTFOUND ) diff --git a/cmake/Modules/TinyInitDefaultVariables.cmake b/cmake/Modules/TinyInitDefaultVariables.cmake index fa31d1ead..86a74eed3 100644 --- a/cmake/Modules/TinyInitDefaultVariables.cmake +++ b/cmake/Modules/TinyInitDefaultVariables.cmake @@ -46,7 +46,10 @@ DESTINATION is encountered.") # strictly needed as on vcpkg the MSVC_RUNTIME_DYNAMIC isn't defined/used but with # the TINY_VCPKG is clearly visible whats up. # Also see the comment for the MSVC_RUNTIME_DYNAMIC option. - if(MSVC AND (NOT TINY_VCPKG OR DEFINED MSVC_RUNTIME_DYNAMIC)) + if(MSVC AND NOT TINY_VCPKG AND NOT DEFINED VCPKG_CRT_LINKAGE AND + DEFINED MSVC_RUNTIME_DYNAMIC AND + NOT MSVC_RUNTIME_DYNAMIC STREQUAL "MSVC_RUNTIME_DYNAMIC-NOTFOUND" + ) if(MSVC_RUNTIME_DYNAMIC) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") else()