(#3901) trompeloeil/39

* trompeloeil

* cleanup

* Update recipes/trompeloeil/all/conanfile.py

Co-authored-by: Michael Keck <git@cr0ydon.com>

* Update recipes/trompeloeil/all/conandata.yml

* Update recipes/trompeloeil/all/conanfile.py

Co-authored-by: Christoph Bachhuber <cbachhuber89@gmail.com>

* Update recipes/trompeloeil/config.yml

* Update recipes/trompeloeil/all/conanfile.py

Co-authored-by: Carlos Gomes Martinho <kmartinho8@gmail.com>

* CI fix

* test_package uses cmake_find_package generator

* enable c++14 again

Co-authored-by: Michael Keck <git@cr0ydon.com>
Co-authored-by: Christoph Bachhuber <cbachhuber89@gmail.com>
Co-authored-by: Carlos Gomes Martinho <kmartinho8@gmail.com>
This commit is contained in:
Florian Berchtold
2020-12-22 13:02:09 +01:00
committed by GitHub
parent f53c5aa3ad
commit f6356ecb07
6 changed files with 75 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
sources:
"39":
url: https://github.com/rollbear/trompeloeil/archive/v39.tar.gz
sha256: 10506E48ABD605740BC9ED43E34059F5068BC80AF14476BD129A3ED3B54D522F

View File

@@ -0,0 +1,32 @@
from conans import ConanFile, tools
import os
import glob
class TrompeloeilConan(ConanFile):
name = "trompeloeil"
description = "Header only C++14 mocking framework"
topics = ("conan", "trompeloeil", "header-only", "mocking")
homepage = "https://github.com/rollbear/trompeloeil"
url = "https://github.com/conan-io/conan-center-index"
license = "BSL-1.0"
settings = "os", "compiler", "build_type", "arch"
no_copy_source = True
@property
def _source_subfolder(self):
return "source_subfolder"
def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_dir = glob.glob(self.name + "-*/")[0]
os.rename(extracted_dir, self._source_subfolder)
def package(self):
include_folder = os.path.join(self._source_subfolder, "include")
self.copy(pattern="LICENSE*.txt", dst="licenses", src=self._source_subfolder)
self.copy(pattern="*.hpp", dst="include", src=include_folder)
def package_id(self):
self.info.header_only()

View File

@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(test_package CXX)
find_package(trompeloeil REQUIRED)
add_executable(test_package example.cpp)
target_link_libraries(test_package trompeloeil::trompeloeil)
set_property(TARGET test_package PROPERTY CXX_STANDARD 14)

View File

@@ -0,0 +1,16 @@
from conans import ConanFile, CMake, tools
import os
class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake_find_package"
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if not tools.cross_building(self.settings):
self.run("test_package", run_environment=True)

View File

@@ -0,0 +1,12 @@
#include <trompeloeil.hpp>
struct S
{
MAKE_MOCK1(func, void(int));
};
int main() {
S s;
REQUIRE_CALL(s, func(3));
s.func(3);
}

View File

@@ -0,0 +1,3 @@
versions:
"39":
folder: all