From 97a39f5c7d24314442ac2a1d316c54d4f9e943f4 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 30 Sep 2024 19:43:11 +0300 Subject: [PATCH] Set compiler.runtime for ClangCL and other "cl-like" compilers --- conan_provider.cmake | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/conan_provider.cmake b/conan_provider.cmake index 0d2be00..e10f414 100644 --- a/conan_provider.cmake +++ b/conan_provider.cmake @@ -228,7 +228,22 @@ function(detect_compiler compiler compiler_version compiler_runtime compiler_run if(_compiler MATCHES MSVC) set(_compiler "msvc") string(SUBSTRING ${MSVC_VERSION} 0 3 _compiler_version) - # Configure compiler.runtime and compiler.runtime_type settings for MSVC + elseif(_compiler MATCHES AppleClang) + set(_compiler "apple-clang") + string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION}) + list(GET VERSION_LIST 0 _compiler_version) + elseif(_compiler MATCHES Clang) + set(_compiler "clang") + string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION}) + list(GET VERSION_LIST 0 _compiler_version) + elseif(_compiler MATCHES GNU) + set(_compiler "gcc") + string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION}) + list(GET VERSION_LIST 0 _compiler_version) + endif() + + if(MSVC) + # Configure compiler.runtime and compiler.runtime_type settings for MSVC (and ClangCL) if(CMAKE_MSVC_RUNTIME_LIBRARY) set(_msvc_runtime_library ${CMAKE_MSVC_RUNTIME_LIBRARY}) else() @@ -263,21 +278,6 @@ function(detect_compiler compiler compiler_version compiler_runtime compiler_run endif() message(STATUS "CMake-Conan: CMake compiler.runtime_type=${_compiler_runtime_type}") endif() - - unset(_KNOWN_MSVC_RUNTIME_VALUES) - - elseif(_compiler MATCHES AppleClang) - set(_compiler "apple-clang") - string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION}) - list(GET VERSION_LIST 0 _compiler_version) - elseif(_compiler MATCHES Clang) - set(_compiler "clang") - string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION}) - list(GET VERSION_LIST 0 _compiler_version) - elseif(_compiler MATCHES GNU) - set(_compiler "gcc") - string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION}) - list(GET VERSION_LIST 0 _compiler_version) endif() message(STATUS "CMake-Conan: [settings] compiler=${_compiler}")