The previous conanfile.txt has been replaced by the conanfile.py.main
| import os | |||||
| from conans import ConanFile, CMake, tools | |||||
| class ScopeguardConan(ConanFile): | |||||
| name = "scope-guard" | |||||
| version = "0.3.5" | |||||
| license = "MIT" | |||||
| author = "offa <offa@github>" | |||||
| url = "https://github.com.offa/scope-guard" | |||||
| description = "Implementation of Scoped Guards and Unique Resource as proposed in P0052." | |||||
| homepage = "https://github.com/mrtazz/restclient-cpp" | |||||
| topics = ("cpp", "cpp17", "p0052", "scope-guard", | |||||
| "scope-exit", "scope-fail", "scope-success", "unique-resource", "cmake") | |||||
| no_copy_source = True | |||||
| _source_dir = "{}-{}".format(name, version) | |||||
| scm = { | |||||
| "type": "git", | |||||
| "subfolder": _source_dir, | |||||
| "url": "{}.git".format(homepage), | |||||
| "revision": version | |||||
| } | |||||
| requires = ( | |||||
| "Catch2/2.9.2@catchorg/stable", | |||||
| "trompeloeil/v34@rollbear/stable" | |||||
| ) | |||||
| def _configure_cmake(self): | |||||
| cmake = CMake(self) | |||||
| cmake.configure(source_folder=self._source_dir, build_folder="build") | |||||
| return cmake | |||||
| def package(self): | |||||
| cmake = self._configure_cmake() | |||||
| cmake.install() |
| [requires] | |||||
| Catch2/2.9.2@catchorg/stable | |||||
| trompeloeil/v34@rollbear/stable | |||||
| [generators] | |||||
| cmake_find_package | |||||
| cmake_paths | |||||
| cmake_minimum_required(VERSION 2.8.12) | |||||
| project(PackageTest CXX) | |||||
| include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | |||||
| conan_basic_setup() | |||||
| add_executable(example example.cpp) | |||||
| target_link_libraries(example ${CONAN_LIBS}) | |||||
| # CTest is a testing tool that can be used to test your project. | |||||
| # enable_testing() | |||||
| # add_test(NAME example | |||||
| # WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin | |||||
| # COMMAND example) |
| import os | |||||
| from conans import ConanFile, CMake, tools | |||||
| class ScopeguardTestConan(ConanFile): | |||||
| settings = "os", "compiler", "build_type", "arch" | |||||
| generators = "cmake" | |||||
| def build(self): | |||||
| cmake = CMake(self) | |||||
| # Current dir is "test_package/build/<build_id>" and CMakeLists.txt is | |||||
| # in "test_package" | |||||
| cmake.configure() | |||||
| cmake.build() | |||||
| def imports(self): | |||||
| self.copy("*.dll", dst="bin", src="bin") | |||||
| self.copy("*.dylib*", dst="bin", src="lib") | |||||
| self.copy('*.so*', dst='bin', src='lib') | |||||
| def test(self): | |||||
| if not tools.cross_building(self.settings): | |||||
| os.chdir("bin") | |||||
| self.run(".%sexample" % os.sep) |
| #include <iostream> | |||||
| #include "hello.h" | |||||
| int main() { | |||||
| hello(); | |||||
| } |