Skip to content

Commit

Permalink
Set compiler.runtime for ClangCL and other "cl-like" compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Sep 30, 2024
1 parent c22bbf0 commit 97a39f5
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions conan_provider.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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}")
Expand Down

0 comments on commit 97a39f5

Please sign in to comment.