from conans import ConanFile, CMake, tools, RunEnvironment import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "cmake" def build(self): cmake = CMake(self) cmake.configure() cmake.build() def imports(self): self.copy("*paho*.dll", dst="bin", src="bin") self.copy("*paho*.dylib*", dst="bin", src="lib") def test(self): with tools.environment_append(RunEnvironment(self).vars): bin_path = os.path.join("bin", "test_package") if self.settings.os == "Windows": self.run(bin_path) elif self.settings.os == "Macos": self.run("DYLD_LIBRARY_PATH=%s %s" % (os.environ.get('DYLD_LIBRARY_PATH', ''), bin_path)) else: self.run("LD_LIBRARY_PATH=%s %s" % (os.environ.get('LD_LIBRARY_PATH', ''), bin_path))