-
Notifications
You must be signed in to change notification settings - Fork 990
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bugfix] msvc in legacy cmake generators (#10195)
* Fixing bug when msvc compiler is selected (legacy cmake generator) * Added one functional test
- Loading branch information
1 parent
7dd55c0
commit b8cbf28
Showing
3 changed files
with
68 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
import pytest | ||
|
||
from conans.client.build.cmake_flags import get_generator | ||
from conans.test.utils.mocks import ConanFileMock, MockSettings | ||
|
||
|
||
class TestGetGenerator(object): | ||
|
||
def test_vs_generator(self): | ||
settings = MockSettings({"os": "Windows", "arch": "x86_64", "compiler": "Visual Studio"}) | ||
conanfile = ConanFileMock() | ||
conanfile.settings = settings | ||
|
||
settings.values['compiler.version'] = '15' | ||
assert get_generator(conanfile) == 'Visual Studio 15 2017' | ||
@pytest.mark.parametrize("compiler,version,expected", [ | ||
("Visual Studio", "15", "Visual Studio 15 2017"), | ||
("Visual Studio", "15.9", "Visual Studio 15 2017"), | ||
("msvc", "193", "Visual Studio 17 2022"), | ||
("msvc", "192", "Visual Studio 16 2019") | ||
]) | ||
def test_vs_generator(compiler, version, expected): | ||
settings = MockSettings({"os": "Windows", "arch": "x86_64", "compiler": compiler}) | ||
conanfile = ConanFileMock() | ||
conanfile.settings = settings | ||
|
||
settings.values['compiler.version'] = '15.9' | ||
assert get_generator(conanfile) == 'Visual Studio 15 2017' | ||
settings.values['compiler.version'] = version | ||
assert get_generator(conanfile) == expected |