Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export cmake file for catch2 #253

Merged
merged 2 commits into from
Nov 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions recipes/catch2/2.x.x/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import os

from conans import ConanFile, CMake, tools
Expand All @@ -12,20 +10,16 @@ class ConanRecipe(ConanFile):
homepage = "https://github.com/catchorg/Catch2"
url = "https://github.com/conan-io/conan-center-index"
license = "BSL-1.0"

settings = "os", "compiler", "build_type", "arch"

generators = "cmake"

_source_subfolder = "source_subfolder"
_build_subfolder = "build_subfolder"

def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_dir = "Catch2-" + self.version
os.rename(extracted_dir, self._source_subfolder)

_build_subfolder = "build_subfolder"

def _configure_cmake(self):
cmake = CMake(self)
cmake.definitions["BUILD_TESTING"] = "OFF"
Expand All @@ -42,14 +36,18 @@ def build(self):
cmake.build()

def package(self):
self.copy(pattern="LICENSE.txt", dst="licenses",
src=self._source_subfolder)

self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder)
cmake = self._configure_cmake()
cmake.install()

tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
tools.rmdir(os.path.join(self.package_folder, "share"))
for cmake_file in ["ParseAndAddCatchTests.cmake", "Catch.cmake"]:
self.copy(cmake_file,
src=os.path.join(self._source_subfolder, "contrib"),
dst=os.path.join("lib", "cmake", "Catch2"))

def package_id(self):
self.info.header_only()

def package_info(self):
self.cpp_info.builddirs = [os.path.join("lib", "cmake", "Catch2")]