From e1514305518bd9a1c09a9ca46713d83782a6c560 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sun, 8 Aug 2021 00:05:04 +0200 Subject: [PATCH] make: use user variable to set CONAN_MAKE_PROGRAM when using 2 profile build --- recipes/make/all/test_package/conanfile.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/recipes/make/all/test_package/conanfile.py b/recipes/make/all/test_package/conanfile.py index 9139950e0ae29..40a73e6a128e7 100644 --- a/recipes/make/all/test_package/conanfile.py +++ b/recipes/make/all/test_package/conanfile.py @@ -1,11 +1,22 @@ from conans import ConanFile, AutoToolsBuildEnvironment, tools +import contextlib class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" + @contextlib.contextmanager + def _build_context(self): + if hasattr(self, "settings_build"): + # Environments are not inherited when cross building, so manually set the `CONANMAKE_PROGRAM' environment variable + with tools.environment_append({"CONAN_MAKE_PROGRAM": self.deps_user_info["make"].make}): + yield + else: + yield + def test(self): if not tools.cross_building(self): - with tools.chdir(self.source_folder), tools.remove_from_path("make"): - env_build = AutoToolsBuildEnvironment(self) - env_build.make(args=["love"]) + with tools.chdir(self.source_folder): + with self._build_context(): + env_build = AutoToolsBuildEnvironment(self) + env_build.make(args=["love"])