Skip to content

Commit

Permalink
(conan-io#8732) oniguruma: modernize
Browse files Browse the repository at this point in the history
* modernize

* keep .names[pkg_config]
  • Loading branch information
SpaceIm authored and miklelappo committed Feb 9, 2022
1 parent b90b748 commit 0e7b27d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions recipes/oniguruma/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from conans import ConanFile, CMake, tools
import os

required_conan_version = ">=1.33.0"
required_conan_version = ">=1.43.0"


class OnigurumaConan(ConanFile):
Expand Down Expand Up @@ -68,12 +68,17 @@ def package(self):
tools.rmdir(os.path.join(self.package_folder, "share"))

def package_info(self):
self.cpp_info.names["cmake_find_package"] = "oniguruma"
self.cpp_info.names["cmake_find_package_multi"] = "oniguruma"
self.cpp_info.names["pkg_config"] = "oniguruma"
self.cpp_info.components["onig"].names["cmake_find_package"] = "onig"
self.cpp_info.components["onig"].names["cmake_find_package_multi"] = "onig"
self.cpp_info.components["onig"].names["pkg_config"] = "oniguruma"
self.cpp_info.set_property("cmake_file_name", "oniguruma")
self.cpp_info.set_property("cmake_target_name", "oniguruma::onig")
self.cpp_info.set_property("pkg_config_name", "oniguruma")
# TODO: back to global scope after conan v2 once cmake_find_package_* removed
self.cpp_info.components["onig"].libs = ["onig"]
if not self.options.shared:
self.cpp_info.components["onig"].defines.append("ONIG_STATIC")

# TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed
self.cpp_info.components["onig"].set_property("cmake_target_name", "oniguruma::onig")
self.cpp_info.components["onig"].set_property("pkg_config_name", "oniguruma")
self.cpp_info.components["onig"].names["cmake_find_package"] = "onig"
self.cpp_info.components["onig"].names["cmake_find_package_multi"] = "onig"
self.cpp_info.components["onig"].names["pkg_config"] = "oniguruma"
2 changes: 1 addition & 1 deletion recipes/oniguruma/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ def build(self):
cmake.build()

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

0 comments on commit 0e7b27d

Please sign in to comment.