When building with clang-cl and dynamic runtime, opencv is actually built with static runtime. BUILD_WITH_STATIC_CRT is on by default in opencv cmake (if MSVC). Clang-cl identifies as MSVC, which is why it's on by default.
The conan recipe makes the following check:
if is_msvc(self):
tc.variables["BUILD_WITH_STATIC_CRT"] = is_msvc_static_runtime(self)
But is_msvc evaluates to false, as it checks for the compiler actually being the visual studio MSVC.
BUILD_WITH_STATIC_CRT is not set in the resulting toolchain file from conan.
Description
When building with clang-cl and dynamic runtime, opencv is actually built with static runtime. BUILD_WITH_STATIC_CRT is on by default in opencv cmake (if MSVC). Clang-cl identifies as MSVC, which is why it's on by default. The conan recipe makes the following check:
But is_msvc evaluates to false, as it checks for the compiler actually being the visual studio MSVC. BUILD_WITH_STATIC_CRT is not set in the resulting toolchain file from conan.
Package and Environment Details
Conan profile
[settings] os=Windows arch=x86_64 compiler=clang compiler.version=16 compiler.cppstd=20 compiler.runtime=dynamic compiler.runtime_type=Release compiler.runtime_version=v143
[conf] tools.cmake.cmaketoolchain:generator=Visual Studio 17
Steps to reproduce
conan install opencv/4.9.0@ -r conancenter --build -pr:b dummy -pr:h dummy -s:h build_type=Release -o shared=False -o contrib=False -o contrib_freetype=False -o contrib_sfm=False -o parallel=False -o with_ipp=False -o with_ade=False -o with_jpeg2000=False -o with_openexr=False -o with_eigen=False -o with_webp=False -o with_quirc=False -o with_cuda=False -o with_cublas=False -o with_cufft=False -o with_cudnn=False -o with_ffmpeg=False -o with_imgcodec_hdr=False -o with_imgcodec_pfm=False -o with_imgcodec_pxm=False -o with_imgcodec_sunraster=False -o dnn=False -o dnn_cuda=False -o cuda_arch_bin=False -o cpu_baseline=None -o cpu_dispatch=None -o nonfree=False -o with_flatbuffers=False -o with_protobuf=False -o with_tesseract=False -o with_opencl=False -o with_jpeg=False -o with_png=False -o with_tiff=False -o dnn=False -o gapi=False -o highgui=False -o imgcodecs=False -o ml=False -o objdetect=False -o photo=False -o stitching=False -o video=False -o videoio=False -o flann=False -o calib3d=False -o features2d=False -o imgproc=True
Logs
conan_opencv.log