Skip to content

Commit

Permalink
Merge pull request #253 from uilianries/hotfix/catch2-cmake
Browse files Browse the repository at this point in the history
Export cmake file for catch2
  • Loading branch information
danimtb authored Nov 4, 2019
2 parents c2f08ef + 91d9ed9 commit 8c7d82f
Showing 1 changed file with 9 additions and 11 deletions.
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")]

0 comments on commit 8c7d82f

Please sign in to comment.