question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Raising the minimum required CMake version to 3.16 breaks macro conan_set_vs_runtime

See original GitHub issue

After 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:closed
  • Created 4 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
memshardedcommented, Mar 4, 2020

I think this might be an issue for Conan itself, not for cmake-conan only. Please @czoido have a look when possible.

1reaction
puetzkcommented, Mar 4, 2020

As a side note, we would be tempted to consider that a bug in CMake:

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found