Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not remove sh from path in the new CMake helper #8625

Merged
merged 13 commits into from Mar 23, 2021
10 changes: 4 additions & 6 deletions conan/tools/cmake/cmake.py
Expand Up @@ -79,17 +79,15 @@ def configure(self, source_folder=None):
self._conanfile.package_folder.replace("\\", "/"),
source)

if platform.system() == "Windows" and self._generator == "MinGW Makefiles":
arg_list += ' -DCMAKE_SH="CMAKE_SH-NOTFOUND"'

generator = '-G "{}" '.format(self._generator) if self._generator else ""
command = "%s %s%s" % (self._cmake_program, generator, arg_list)

is_windows_mingw = platform.system() == "Windows" and self._generator == "MinGW Makefiles"
self._conanfile.output.info("CMake command: %s" % command)
with chdir(build_folder):
if is_windows_mingw:
with tools.remove_from_path("sh"):
self._conanfile.run(command)
else:
self._conanfile.run(command)
self._conanfile.run(command)

def _build(self, build_type=None, target=None):
bf = self._conanfile.build_folder
Expand Down
2 changes: 2 additions & 0 deletions conans/test/functional/toolchains/cmake/test_cmake.py
Expand Up @@ -272,6 +272,7 @@ def _verify_out(marker=">>"):
@parameterized.expand([("Debug", "libstdc++", "4.9", "98", "x86_64", True),
("Release", "libstdc++", "4.9", "11", "x86_64", False)])
@pytest.mark.tool_mingw64
@pytest.mark.tool_cmake(version="3.15")
def test_toolchain_mingw_win(self, build_type, libcxx, version, cppstd, arch, shared):
# FIXME: The version and cppstd are wrong, toolchain doesn't enforce it
settings = {"compiler": "gcc",
Expand All @@ -287,6 +288,7 @@ def test_toolchain_mingw_win(self, build_type, libcxx, version, cppstd, arch, sh
self.assertIn("The C compiler identification is GNU", self.client.out)
self.assertIn('CMake command: cmake -G "MinGW Makefiles" '
'-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake"', self.client.out)
assert '-DCMAKE_SH="CMAKE_SH-NOTFOUND"' in self.client.out

def _verify_out(marker=">>"):
cmake_vars = {"CMAKE_GENERATOR_PLATFORM": "",
Expand Down