@@ -103,6 +103,42 @@ def build(self):
103
103
client .run ("create . lib/1.0@ -s compiler='Visual Studio' -s compiler.toolset=v140" )
104
104
self .assertIn ("Conan: Skipping compiler check: Declared 'compiler.toolset'" , client .out )
105
105
106
+ @pytest .mark .slow
107
+ @pytest .mark .tool_visual_studio (version = "17" )
108
+ @pytest .mark .skipif (platform .system () != "Windows" , reason = "Requires Visual Studio" )
109
+ def test_check_msvc_compiler (self ):
110
+ """
111
+ Checking if MSVC 19.X compiler is being called via CMake
112
+ while using compiler=msvc in Conan profile.
113
+
114
+ Issue related: https://github.com/conan-io/conan/issues/10185
115
+ """
116
+ file_content = textwrap .dedent ("""
117
+ from conans import ConanFile, CMake
118
+
119
+ class ConanFileMSVCTest(ConanFile):
120
+ generators = "cmake"
121
+ exports_sources = "CMakeLists.txt"
122
+ settings = "os", "arch", "compiler"
123
+
124
+ def build(self):
125
+ cmake = CMake(self)
126
+ cmake.configure()
127
+ cmake.build()
128
+ """ )
129
+ client = TestClient ()
130
+ cmakelists = textwrap .dedent ("""
131
+ PROJECT(Hello)
132
+ cmake_minimum_required(VERSION 2.8)
133
+ include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
134
+ CONAN_BASIC_SETUP()
135
+ """ )
136
+ client .save ({"conanfile.py" : file_content ,
137
+ "CMakeLists.txt" : cmakelists })
138
+ client .run ("create . lib/1.0@ -s compiler=msvc -s compiler.version=193" )
139
+ self .assertIn ("-- The C compiler identification is MSVC 19.3" , client .out )
140
+ self .assertIn ("-- The CXX compiler identification is MSVC 19.3" , client .out )
141
+
106
142
@pytest .mark .slow
107
143
def test_no_output (self ):
108
144
client = TestClient ()
0 commit comments