Skip to content

Commit

Permalink
modern-cpp-kafka: update the requirements & validate, fix the text
Browse files Browse the repository at this point in the history
  • Loading branch information
kenneth-jia committed Jul 20, 2022
1 parent 3fc9902 commit 6df4ae8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 7 additions & 0 deletions recipes/modern-cpp-kafka/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@ class ModernCppKafkaConan(ConanFile):
settings = "arch", "build_type", "compiler", "os"
no_copy_source = True

def requirements(self):
self.requires("librdkafka/1.8.2")

@property
def _source_subfolder(self):
return "source_subfolder"

def source(self):
tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder)

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
tools.check_min_cppstd(self, 17)

def package(self):
self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder)
self.copy(pattern="*.h", dst="include", src=os.path.join(self._source_subfolder, "include"))
Expand Down
3 changes: 1 addition & 2 deletions recipes/modern-cpp-kafka/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ conan_basic_setup()

set(CMAKE_CXX_STANDARD 17)

find_package(RdKafka REQUIRED CONFIG)
find_package(ModernCppKafka REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} RdKafka::rdkafka ModernCppKafka::ModernCppKafka)
target_link_libraries(${PROJECT_NAME} ModernCppKafka::ModernCppKafka)
5 changes: 1 addition & 4 deletions recipes/modern-cpp-kafka/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"

def requirements(self):
self.requires("librdkafka/1.8.2")

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self):
if not tools.cross_building(self.settings):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)

0 comments on commit 6df4ae8

Please sign in to comment.