Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMakeToolchain: Honor vc runtime from profile even if cmake_minimum_required() < 3.15 in CMakeLists #10390

Merged
merged 3 commits into from Jan 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions conan/tools/cmake/toolchain.py
Expand Up @@ -99,6 +99,7 @@ class VSRuntimeBlock(Block):
{% set genexpr.str = genexpr.str +
'$<$<CONFIG:' + config + '>:' + value|string + '>' %}
{% endfor %}
set(CMAKE_POLICY_DEFAULT_CMP0091 NEW)
set(CMAKE_MSVC_RUNTIME_LIBRARY "{{ genexpr.str }}")
""")

Expand Down Expand Up @@ -798,6 +799,10 @@ class CMakeToolchain(object):
message("Using Conan toolchain: ${CMAKE_TOOLCHAIN_FILE}.")
endif()

if(${CMAKE_VERSION} VERSION_LESS "3.15")
message(FATAL_ERROR "The 'CMakeToolchain' generator only works with CMake >= 3.15")
endif()

{% for conan_block in conan_blocks %}
{{ conan_block }}
{% endfor %}
Expand Down