[Bug] Raising the minimum required CMake version to 3.16 breaks macro conan_set_vs_runtime
See original GitHub issueAfter some uninteresting bug chase, we found out the following behaviour:
With cmake_minimum_required(VERSION 3.16)
, CMake will override any runtime related flag (e.g. /MT
) that are explicitly set in the CMake scripts. This notably breaks the conan macro conan_set_vs_runtime
, which was doing exactly that.
This is likely due to the introduction of MSVC_RUNTIME_LIBRARY, which is a new way to control Windows runtime. Please see related issue conan-io/cmake-conan#174 , with a suggestion for CMake build helper to set this.
As a side note, we would be tempted to consider that a bug in CMake, since the doc states:
This property has effect only when policy CMP0091 is set to NEW
Yet, the situation is that simply raising a minimal version does break the behaviour as implemented by Conan.
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (8 by maintainers)
I think this might be an issue for Conan itself, not for cmake-conan only. Please @czoido have a look when possible.
The primary effect of cmake_minimum_required is to set policies known as of that version to
NEW
. If your script doesn’t even run with older CMake versions, then it was clearly written for (at least) that minimum version, and CMake policies emulating the behavior of older versions (that you have prohibited anyway) for backward-compatibility are not wanted. https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html#policy-settings.