-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make: use user variable to set CONAN_MAKE_PROGRAM when using 2 profil…
…e build
- Loading branch information
Showing
1 changed file
with
14 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"]) |