OlivierLDff / Qaterial

🧩 Collection of Material Components based on QtQuickControls2.
https://olivierldff.github.io/Qaterial/
MIT License
292 stars 54 forks source link

Allow setting CRT's ABI when compiling with MSVC #132

Closed ahmedyarub closed 2 years ago

ahmedyarub commented 2 years ago

Based on: https://cmake.org/cmake/help/git-stage/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html

OlivierLDff commented 2 years ago

I'm not using Qaterial as shared library but what does it fix? Isn't something the user should choose when doing cmake configure command? Is it still possible to overwrite CMAKE_MSVC_RUNTIME_LIBRARY with MultiThreadedDLL if needed?

ahmedyarub commented 2 years ago

I'm not using Qaterial as shared library but what does it fix? Isn't something the user should choose when doing cmake configure command? Is it still possible to overwrite CMAKE_MSVC_RUNTIME_LIBRARY with MultiThreadedDLL if needed?

I have an application that uses Qaterial along with other vcpkg libraries compiled using the triplet x64-windows-release. In that triplet a static CRT is used, which cannot be mixed with Qaterial's shared CRT. Setting CMAKE_MSVC_RUNTIME_LIBRARY is an option but for that we would still need to increase the minimum CMake version. Do you want me to just increase the CMake version without adding this logic?

OlivierLDff commented 2 years ago

Why do you need to increase the mnimum version? It doesn't work if you just use cmake v3.15?

OlivierLDff commented 2 years ago

For example Qaterial use precompiled headers, that are cmake 3.17 feature. It is only enabled if target_precompile_headers command is available. But if in your case it is not taken into account, then yes increase minimum version. Ubuntu 20 is shipped with cmake 3.16. So that's ok

ahmedyarub commented 2 years ago

Done

ahmedyarub commented 2 years ago

For example Qaterial use precompiled headers, that are cmake 3.17 feature. It is only enabled if target_precompile_headers command is available. In this case using a minimum version lower than 3.15 sets a policy that ignores default runtime flags.